Jeżeli w pass skrzynki email masz zapisane w strukturze: mail/<domain>/<user> to dla john.doe@bogus.corp będzie wyglądać to tak:
$ pass mail/bogus.corp/john.doe
ElevenBenevolentElephants
login: jdoe
host: mail.bogus.corp
Do pobierania danych z pass utwórz skrypt helpera, np. ~/.config/offlineimap/helpers.py:
#! /usr/bin/env python
# helpers.py: using pass for offlineimap secrets
from subprocess import check_output
def get_host(account):
return check_output(
"pass mail/" + account.split('@')[1] + "/" + account.split('@')[0],
shell=True).splitlines()[2][6:]
def get_login(account):
return check_output(
"pass mail/" + account.split('@')[1] + "/" + account.split('@')[0],
shell=True).splitlines()[1][7:]
def get_pass(account):
return check_output(
"pass mail/" + account.split('@')[1] + "/" + account.split('@')[0],
shell=True).splitlines()[0]
Skonfiguruj OfflineIMAP dodając ścieżkę do pliku i odpowiednie wywołania w konfiguracjach kont:
$ grep -A2 general ~/.config/offlineimap/config
[general]
pythonfile = ~/.config/offlineimap/helpers.py
$ grep 'Repository john.doe.bogus.corp-remote' -A4 ~/.config/offlineimap/config
[Repository john.doe.bogus.corp-remote]
type = IMAP
remotehosteval = get_host("john.doe@bogus.corp")
remoteusereval = get_login("john.doe@bogus.corp")
remotepasseval = get_pass("john.doe@bogus.corp")