Use a keyring to store some credentials

This commit is contained in:
Tom Willemse 2014-09-22 22:56:54 +02:00
parent 9ccb99ee15
commit 931979b5c6
4 changed files with 11 additions and 16 deletions

View file

@ -13,8 +13,7 @@
(require 'esh-proc) (require 'esh-proc)
(require 'fill-column-indicator) (require 'fill-column-indicator)
(require 'magit) (require 'magit)
(require 'yasnippet) (require 'yasnippet))
(require 'noflet))
(load (concat user-emacs-directory "init2")) (load (concat user-emacs-directory "init2"))
@ -658,7 +657,8 @@ For `python-mode' I prefer `python-imenu-create-flat-index'."
(if (daemonp) (if (daemonp)
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
(lambda (frame) (lambda (frame)
(noflet ((display-graphic-p (&optional display) t)) (cl-letf (((symbol-function 'display-graphic-p)
(lambda () t)))
(oni:set-theme frame)))) (oni:set-theme frame))))
(oni:eval-after-init (oni:set-theme nil))) (oni:eval-after-init (oni:set-theme nil)))

View file

@ -1,4 +1,5 @@
from offlineimap import imaputil from offlineimap import imaputil
import keyring
def lld_flagsimap2maildir(flagstring): def lld_flagsimap2maildir(flagstring):
@ -39,13 +40,5 @@ imaputil.flagsmaildir2imap = lld_flagsmaildir2imap
imaputil.flagsimap2maildir = lld_flagsimap2maildir imaputil.flagsimap2maildir = lld_flagsimap2maildir
def getuser(host):
import netrc
mynet = netrc.netrc()
return mynet.authenticators(host)[0]
def getpassword(host): def getpassword(host):
import netrc return keyring.get_password('offlineimap', host)
mynet = netrc.netrc()
return mynet.authenticators(host)[2]

View file

@ -18,8 +18,8 @@ nametrans = lambda folder: re.sub('^Inbox$', 'INBOX', folder.capitalize())
[Repository ryuslash.org-remote] [Repository ryuslash.org-remote]
type = IMAP type = IMAP
remotehost = imap.alwaysdata.com remotehost = imap.alwaysdata.com
remoteusereval = getuser("imap.alwaysdata.com") remoteuser = 'tom@ryuslash.org'
remotepasseval = getpassword("imap.alwaysdata.com") remotepasseval = getpassword("ryuslash")
nametrans = lambda folder: folder.lower() nametrans = lambda folder: folder.lower()
[Account picturefix] [Account picturefix]
@ -71,8 +71,8 @@ nametrans = lambda folder: re.sub('^inbox$', 'INBOX', re.sub('^drafts$', '[Gm
[Repository gmail-remote] [Repository gmail-remote]
type = Gmail type = Gmail
remoteusereval = getuser("imap.google.com") remoteuser = "ryuslash@gmail.com"
remotepasseval = getpassword("imap.google.com") remotepasseval = getpassword("gmail")
realdelete = no realdelete = no
cert_fingerprint = 687687a7f2dc166baf58221ff7a42f1683d0d164 cert_fingerprint = 687687a7f2dc166baf58221ff7a42f1683d0d164
folderfilter = lambda folder: folder in ['INBOX', '[Gmail]/Drafts', '[Gmail]/Sent Mail', '[Gmail]/Trash'] folderfilter = lambda folder: folder in ['INBOX', '[Gmail]/Drafts', '[Gmail]/Sent Mail', '[Gmail]/Trash']

View file

@ -31,6 +31,8 @@ case $_hostname in
# exec i3 # exec i3
;; ;;
phoenix) phoenix)
eval $(/usr/bin/gnome-keyring-daemon --start --components=secrets)
export GPG_AGENT_INFO SSH_AUTH_SOCK
exec awesome exec awesome
;; ;;
esac esac