Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac OS X and keychain access #244

Closed
5c0tt opened this issue Sep 19, 2015 · 6 comments
Closed

Mac OS X and keychain access #244

5c0tt opened this issue Sep 19, 2015 · 6 comments
Labels

Comments

@5c0tt
Copy link

5c0tt commented Sep 19, 2015

I have been trying to get offlineimap up and running on OS X. Reading, I am not sure if the photon file of offlineimap.py is part of offlineimap or not, but perhaps someone can point me in the right direction.

The file has a call in it to:
sudo -u sjl %(security)s -v %(command)s -g -a %(account)s -s %(server)s %(keychain)s" % params

This command does not work on Mac OS X 10.10.5 Yosemite. I played with it in the command line, using hard coded parameters, and still get a null return, not the "Password:" that the script ends up looking for and parsing out.

Dropping the reference to that file, offlineimap asks for my gmail password, and I think works, I ended up deleted it all as it seemed like I made a mess.

@nicolas33
Copy link
Member

photon? I don't know it.

@johnmastro
Copy link

@5c0tt, I'm not familiar with photon either but I may be able to help with one other aspect.

The -u sjl part of that command assumes that your user name on the computer is sjl. If it's not, you should change it appropriately. (I suspect the command was copied from Steve Losh's The Homely Mutt, a nice article indeed).

Likewise, if the file has something like the below, you'll need to change the 'keychain' value to point at your actual login.keychain file. That probably just means replacing the sjl part again.

params = {
    'security': '/usr/bin/security',
    'command': 'find-internet-password',
    'account': account,
    'server': server,
    'keychain': '/Users/sjl/Library/Keychains/login.keychain',  # <-- Here
}

@chris001
Copy link
Member

I hear there's 6.5.7 adapted to work on Mac OS X, available through
MacPorts.
https://trac.macports.org/browser/trunk/dports/mail/offlineimap/Portfile
Give it a try and post back your results!

On 9/18/2015 11:05 PM, Scott wrote:

I have been trying to get offlineimap up and running on OS X. Reading,
I am not sure if the photon file of offlineimap.py is part of
offlineimap or not, but perhaps someone can point me in the right
direction.

The file has a call in it to:
sudo -u sjl %(security)s -v %(command)s -g -a %(account)s -s
%(server)s %(keychain)s" % params

This command does not work on Mac OS X 10.10.5 Yosemite. I played with
it in the command line, using hard coded parameters, and still get a
null return, not the "Password:" that the script ends up looking for
and parsing out.

Dropping the reference to that file, offlineimap asks for my gmail
password, and I think works, I ended up deleted it all as it seemed
like I made a mess.


Reply to this email directly or view it on GitHub
#244.

@OI-mailinglist
Copy link

Chris Coleman notifications@github.com writes:

I hear there's 6.5.7 adapted to work on Mac OS X, available through
MacPorts.
https://trac.macports.org/browser/trunk/dports/mail/offlineimap/Portfile
Give it a try and post back your results!

I installed it using homebrew and it works nicely, but this has nothing
to do with the question (unless MacPorts adds this file, which I do not
know).

I use the following to get my password from the keychain:

a file named .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 my .offlineimaprc (the relevant bits):

--8<---------------cut here---------------start------------->8---
pythonfile = ~/.offlineimap.py ## to specify the python file with the comand

remoteuser = MyUsername

to get the password:

remotepasseval = get_keychain_pass(account="RMKrugGmailOfflineimap")
--8<---------------cut here---------------end--------------->8---

I don't remember where I got this from, but I found it womewhere.

Cheers,

Rainer

On 9/18/2015 11:05 PM, Scott wrote:

I have been trying to get offlineimap up and running on OS X. Reading,
I am not sure if the photon file of offlineimap.py is part of
offlineimap or not, but perhaps someone can point me in the right
direction.

The file has a call in it to:
sudo -u sjl %(security)s -v %(command)s -g -a %(account)s -s
%(server)s %(keychain)s" % params

This command does not work on Mac OS X 10.10.5 Yosemite. I played with
it in the command line, using hard coded parameters, and still get a
null return, not the "Password:" that the script ends up looking for
and parsing out.

Dropping the reference to that file, offlineimap asks for my gmail
password, and I think works, I ended up deleted it all as it seemed
like I made a mess.


Reply to this email directly or view it on GitHub
#244.


Reply to this email directly or view it on GitHub:
#244 (comment)


OfflineIMAP-project mailing list: OfflineIMAP-project@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project

OfflineIMAP homepages:

Rainer M. Krug
email: Rainerkrugsde
PGP: 0x0F52F982

@5c0tt
Copy link
Author

5c0tt commented Sep 23, 2015

photon, I think I mean python ;)
I did change the username, I acutely changed it to a hard coded user, and
$USER, the path to the keychain was updated, everything I could test, I
did, but I kept getting errors when running offlineimap on the command line.

I just ran a test on the shell and was able to get security to return to
me a correct value, so I think I am going better.

I just want to confirm, if i go through all this, set up offlienimap, and
tie it all in with mutt, I will be able to edit a subject and headers, and
they will sync back? I know that IMAP is not meant to be edited, so you
are essentially tossing out the original and replacing it in with a new
one, but in order for me to keep things organized, I need to edit my
messages, having a backup if the fist priority though.

Thank you.

On Sat, Sep 19, 2015 at 5:46 PM, John Mastro notifications@github.com
wrote:

@5c0tt https://github.com/5c0tt, I'm not familiar with photon either
but I may be able to help with one other aspect.

The -u sjl part of that command assumes that your user name on the
computer is sjl. If it's not, you should change it appropriately. (I
suspect the command was copied from Steve Losh's The Homely Mutt
http://stevelosh.com/blog/2012/10/the-homely-mutt/, a nice article
indeed).

Likewise, if the file has something like the below, you'll need to change
the 'keychain' value to point at your actual login.keychain file. That
probably just means replacing the sjl part again.

params = {
'security': '/usr/bin/security',
'command': 'find-internet-password',
'account': account,
'server': server,
'keychain': '/Users/sjl/Library/Keychains/login.keychain', # <-- Here

Scott

@nicolas33
Copy link
Member

As long as the editor removes the old mail and creates a new one in the maildir on changes, offlineimap will do the right thing and sync back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants