commit bc05648428d7c35f66a70717dd715925708e430d
parent 99cc10e900cf72d3865843ff5aaca1edd66c225d
Author: Anders Damsgaard <andersd@riseup.net>
Date: Mon, 25 Sep 2017 10:30:35 -0700
use password store instead of keyring
Diffstat:
4 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/.imapfilter/riseup.lua b/.imapfilter/riseup.lua
@@ -23,7 +23,8 @@ end
-- Accounts --
--------------
-status, pass = pipe_from("python ~/.mutt/offlineimap.py andersd mail.riseup.net")
+--status, pass = pipe_from("python ~/.mutt/offlineimap.py andersd mail.riseup.net")
+status, pass = pipe_from("python ~/.mutt/offlineimap-password-store.py andersd@riseup.net")
account = IMAP {
server = 'mail.riseup.net',
username = 'andersd',
diff --git a/.mutt/offlineimap-password-store.py b/.mutt/offlineimap-password-store.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python2
+from subprocess import check_output
+
+def get_pass(account):
+ return check_output("pass Email/" + account, shell=True).splitlines()[0]
+
+if __name__ == "__main__":
+ import sys
+ print(get_pass(sys.argv[1]))
diff --git a/.mutt/offlineimap.py b/.mutt/offlineimap.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python2
import re
import subprocess
import getpass
@@ -7,11 +7,9 @@ import sys
if sys.platform == 'linux2':
import gnomekeyring as gkey
-
user = getpass.getuser()
home = os.getenv('HOME')
-
def get_keychain_pass(account=None, server=None):
if sys.platform == 'darwin':
command = 'sudo -u ' + user + \
@@ -48,6 +46,9 @@ def set_keychain_pass(protocol, server, user, password):
name, attrs, password, True)
if __name__ == '__main__':
- account = sys.argv[1]
- server = sys.argv[2]
- print(get_keychain_pass(account=account, server=server))
+ if sys.argv[1] == 'create':
+ set_keychain_pass(sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])
+ else:
+ account = sys.argv[1]
+ server = sys.argv[2]
+ print(get_keychain_pass(account=account, server=server))
diff --git a/.offlineimaprc b/.offlineimaprc
@@ -12,7 +12,8 @@ accounts = riseup,geomail,gmail,princeton,noaa
#ui = quiet
ui = ttyui
#ui = blinkenlights
-pythonfile=~/.mutt/offlineimap.py
+#pythonfile=~/.mutt/offlineimap.py
+pythonfile=~/.mutt/offlineimap-password-store.py
# Controls how many accounts may be synced simultaneously
maxsyncaccounts = 10
@@ -54,7 +55,8 @@ localfolders = ~/Mail/riseup
type = IMAP
remotehost = mail.riseup.net
remoteuser = andersd
-remotepasseval = get_keychain_pass(account="andersd", server="mail.riseup.net")
+#remotepasseval = get_keychain_pass(account="andersd", server="mail.riseup.net")
+remotepasseval = get_pass("andersd@riseup.net")
ssl = yes
cert_fingerprint = 86a010ddba262196d7f6f1f47ae03032f9031c32
#folderfilter = lambda folder: folder not in ['Drafts']
@@ -98,7 +100,8 @@ localfolders = ~/Mail/geomail
type = IMAP
remotehost = imap.au.dk
remoteuser = au217756
-remotepasseval = get_keychain_pass(account="au217756", server="imap.au.dk")
+#remotepasseval = get_keychain_pass(account="au217756", server="imap.au.dk")
+remotepasseval = get_pass("anders.damsgaard@geo.au.dk")
ssl = yes
cert_fingerprint = ae2c89d80632be3ec8a149225199e3cdcc88311f
folderfilter = lambda folder: not re.search('NFIT-Import|geo07kej|Suggested Contacts|Noter|Opgaver|Journal|Slettet post|archive|Kalender|Kontaktpersoner|RSS Feeds', folder)
@@ -192,7 +195,8 @@ nametrans = lambda folder: {'drafts': '[Gmail]/Drafts',
# Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP.
type = Gmail
remoteuser = andersdc@gmail.com
-remotepasseval = get_keychain_pass(account="andersdc@gmail.com", server="imap.gmail.com")
+#remotepasseval = get_keychain_pass(account="andersdc@gmail.com", server="imap.gmail.com")
+remotepasseval = get_pass("andersdc@gmail.com")
auth_mechanisms = LOGIN
realdelete = no
nametrans = lambda folder: {'drafts': '[Gmail]/Drafts',
@@ -282,7 +286,7 @@ localfolders = ~/Mail/princeton
type = IMAP
remotehost = exchangeimap.princeton.edu
remoteuser = andersd
-remotepasseval = get_keychain_pass(account="andersd", server="exchangeimap.princeton.edu")
+remotepasseval = get_pass("andersd@princeton.edu")
ssl = yes
cert_fingerprint = 0855b2039ba7540c2f53f186bfc34fde80468fad
#folderfilter = lambda folder: folder not in ['Kalender','Kontaktpersoner','Slettet post','NFIT-Import-adc-2012-09-11-04:18']
@@ -330,7 +334,7 @@ nametrans = lambda folder: {'drafts': '[Gmail]/Drafts',
# Remote repos can be IMAP or Gmail, the latter being a preconfigured IMAP.
type = Gmail
remoteuser = anders.damsgaard@noaa.gov
-remotepasseval = get_keychain_pass(account="anders.damsgaard@noaa.gov", server="imap.gmail.com")
+remotepasseval = get_pass("anders.damsgaard@noaa.gov")
auth_mechanisms = LOGIN
realdelete = no
nametrans = lambda folder: {'drafts': '[Gmail]/Drafts',