Using keyring to store password.
Rainer M Krug
Rainer at krugs.de
Wed Feb 25 10:29:45 GMT 2015
Stephen Eglen <sje30 at cam.ac.uk> writes:
> Hi,
> I have the following in my .offlineimaprc
>
> [general]
> pythonfile = ~/offlineimap.py
> maxconnections = 3
>
> [Repository MyMailRemote]
> type = IMAP
> remotehost = imap.damtp.cam.ac.uk
> remoteuser = "sje30"
> remotepasseval = keyring.get_password('imap-damtp', 'personal')
> ssl = yes
> cert_fingerprint=6f602609295492a040f18a7f55d9e12a1d5a0ecd
>
> and "import keyring" is in my offlineimap.py file. Is this a good way to
> store the password, or is there a better way?
>
> When I run offlineimap I then get the following error:
> PLAIN authentication failed: [AUTHENTICATIONFAILED] Authentication failed.
>
> but then the mail is copied across (presumably using another method).
>
> How do I prevent it trying the PLAIN auth method?
I can't comment on this, but I have the following and it works (OS X):
in .offlineimap.py:
--8<---------------cut here---------------start------------->8---
import re, commands
def get_keychain_pass(account=None):
params = {
'security': '/usr/bin/security',
'command': 'find-generic-password',
'account': account,
}
command = "%(security)s %(command)s -g -a %(account)s " % params
outtext = commands.getoutput(command)
return re.match(r'password: "(.*)"', outtext).group(1)
--8<---------------cut here---------------end--------------->8---
in .offlineimaprc (among other stuff):
--8<---------------cut here---------------start------------->8---
[general]
pythonfile = ~/.offlineimap.py
[Repository RemoteRMKrugGMAIL]
type = Gmail
sslcacertfile = ~/certs/Certificates.cer
remoteuser = MyGmailAddress
remotepasseval = get_keychain_pass(account="RMKrugGmailOfflineimap")
--8<---------------cut here---------------end--------------->8---
I found this somewhere, but unfoertunately can't remember where.
Cheers,
Rainer
>
> Thanks, Stephen
>
>
> _______________________________________________
> OfflineIMAP-project mailing list: OfflineIMAP-project at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
>
> OfflineIMAP homepages:
> - https://github.com/OfflineIMAP
> - http://offlineimap.org
>
--
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 494 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20150225/4b4cb643/attachment-0003.sig>
More information about the OfflineIMAP-project
mailing list