diff options
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | 0001-Added-passwordeval-option-and-documentation.patch | 308 | ||||
-rw-r--r-- | PKGBUILD | 43 |
3 files changed, 369 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7e708488e027 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,18 @@ +pkgbase = getmail-passwordeval + pkgdesc = A POP3 mail retriever with reliable Maildir and command delivery (with passwordeval patch). + pkgver = 4.53.0 + pkgrel = 1 + url = http://pyropus.ca/software/getmail + arch = any + license = GPL + depends = python2 + optdepends = python2-gnomekeyring: for storing passwords in gnome-keyring + provides = getmail + conflicts = getmail + source = http://pyropus.ca/software/getmail/old-versions/getmail-4.53.0.tar.gz + source = 0001-Added-passwordeval-option-and-documentation.patch + sha256sums = 282596fe33b5a24b3aefe5b268f57efbcdd5b980478901418045b481636f92ab + sha256sums = 0bdaaa3f2ada33b32b5861eef71a5290d478a67b7cda90e2aadc598876dda7ad + +pkgname = getmail-passwordeval + diff --git a/0001-Added-passwordeval-option-and-documentation.patch b/0001-Added-passwordeval-option-and-documentation.patch new file mode 100644 index 000000000000..6080dbde5552 --- /dev/null +++ b/0001-Added-passwordeval-option-and-documentation.patch @@ -0,0 +1,308 @@ +From e81910097884e05a58da38e277b581ea3a073da9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Esa=20M=C3=A4=C3=A4tt=C3=A4?= <esa.maatta_at_iki.fi> +Date: Mon, 7 May 2012 20:02:23 +0300 +Subject: [PATCH 1/1] Added passwordeval option and documentation. + +Removes need for plain text password in the getmailrc file. Instead of "password" +option "passwordeval" option can be used. + +For example: + +passwordeval = gpg -d gmail.gpg + +The value of the "passwordeval" option is run and the output is used as the +password. If password cannot be found from the output, then password is prompted +from the user. +--- + docs/configuration.html | 22 ++++++++++++++++++++-- + docs/getmailrc-examples | 34 ++++++++++++++++++++++++---------- + getmailcore/retrievers.py | 11 +++++++++++ + getmailcore/utilities.py | 24 +++++++++++++++++++++++- + 4 files changed, 78 insertions(+), 13 deletions(-) + +diff --git a/docs/configuration.html b/docs/configuration.html +index 0508ddf..f48ab27 100644 +--- a/docs/configuration.html ++++ b/docs/configuration.html +@@ -548,8 +548,9 @@ type = <span class="meta">typename</span> + password + (<a href="#parameter-string">string</a>) + — password to use when logging in to the mail server. If not +- using Kerberos authentication -- see below -- getmail gets the password +- credential for the POP/IMAP server in one of the following ways: ++ using Kerberos authentication or passwordeval option -- see below -- ++ getmail gets the password credential for the POP/IMAP server in one of ++ the following ways: + <ol> + <li>from the <span class="file">password</span> configuration item in the getmailrc file</li> + <li>on Mac OS X only, from the OS X keychain</li> +@@ -569,6 +570,12 @@ type = <span class="meta">typename</span> + via the keychain. See <a href="http://article.gmane.org/gmane.mail.getmail.user/5120">this + posting to the getmail users' mailing list by Alan Schmitt</a> for details. + </li> ++ <li> ++ passwordeval ++ (<a href="#parameter-string">string</a>) ++ — command which output is used as the password. This can be used ++ instead of the password option. ++ </li> + </ul> + <p> + All IMAP retriever types also take the following optional parameters: +@@ -1248,6 +1255,17 @@ password = my_mail_password + </pre> + + <p> ++ A typical POP3 mail account with password in gpg encrypted file. ++</p> ++<pre class="example"> ++[retriever] ++type = SimplePOP3Retriever ++server = popmail.isp.example.net ++username = account_name ++passwordeval = gpg -d ~/.popmail.isp.example.net.gpg ++</pre> ++ ++<p> + If your ISP provides POP3 access on a non-standard port number, you would + need to include the port parameter: + </p> +diff --git a/docs/getmailrc-examples b/docs/getmailrc-examples +index dc8da2d..3d98ce8 100644 +--- a/docs/getmailrc-examples ++++ b/docs/getmailrc-examples +@@ -22,8 +22,22 @@ password = mailpassword + type = Maildir + path = ~jeffp/Maildir/ + ++# Example 2: same as (1), but evaluate password using external command. In this ++# case gpg. + # +-# Example 2: same as (1), but operate quietly, delete messages from ++ ++[retriever] ++type = SimplePOP3Retriever ++server = pop.example.net ++username = jeff.plotzky ++passwordeval = gpg -d ~/.pop.example.net.gpg ++ ++[destination] ++type = Maildir ++path = ~jeffp/Maildir/ ++ ++# ++# Example 3: same as (1), but operate quietly, delete messages from + # the server after retrieving them, and log getmail's actions (in detail) + # to a file. + # +@@ -45,7 +59,7 @@ type = Maildir + path = ~jeffp/Maildir/ + + # +-# Example 3: same as (1), but the mail account is accessed via IMAP4 instead ++# Example 4: same as (1), but the mail account is accessed via IMAP4 instead + # of POP3. + # + +@@ -60,7 +74,7 @@ type = Maildir + path = ~jeffp/Maildir/ + + # +-# Example 4: same as (3), but retrieve mail from the INBOX, INBOX.spam, and ++# Example 5: same as (4), but retrieve mail from the INBOX, INBOX.spam, and + # mailing-lists.getmail-users mail folders. + # + +@@ -76,7 +90,7 @@ type = Maildir + path = ~jeffp/Maildir/ + + # +-# Example 5: same as (3), but move messages to the mail folder "sent-mail" ++# Example 6: same as (4), but move messages to the mail folder "sent-mail" + # after retrieving them. Note that you do this by setting delete and + # move_on_delete options. + # +@@ -96,7 +110,7 @@ type = Maildir + path = ~jeffp/Maildir/ + + # +-# Example 6: same as (1), but deliver the messages to an mboxrd-format mbox ++# Example 7: same as (1), but deliver the messages to an mboxrd-format mbox + # file as user "jeffp". + # + +@@ -112,7 +126,7 @@ path = ~jeffp/Mail/inbox + user = jeffp + + # +-# Example 7: same as (1), but deliver the messages through an external MDA ++# Example 8: same as (1), but deliver the messages through an external MDA + # which takes several arguments. + # + +@@ -129,7 +143,7 @@ arguments = ("--message-from-stdin", "--scan-message", "--to-maildir", + "~jeffp/Maildir/") + + # +-# Example 8: retrieve mail from a corporate POP3-SSL domain mailbox, ++# Example 9: retrieve mail from a corporate POP3-SSL domain mailbox, + # sort messages for several local users and deliver to maildirs in their + # home directories (except Sam, who likes mbox files, and Christina, who + # uses procmail for further sorting), and deliver all other mail to +@@ -187,7 +201,7 @@ arguments = ("-f", "%(sender)", "-m", "/home/christina/.procmailrc") + user = christina + + # +-# Example 9: same as (3), but use SpamAssassin to filter out spam, ++# Example 10: same as (4), but use SpamAssassin to filter out spam, + # and ClamAV to filter out MS worms. + # + +@@ -213,7 +227,7 @@ type = Maildir + path = ~jeffp/Maildir/ + + # +-# Example 10: same as (3), but deliver all mail to two different local ++# Example 11: same as (4), but deliver all mail to two different local + # mailboxes. + # + +@@ -231,7 +245,7 @@ destinations = ( + ) + + # +-# Example 11: retrieve mail from a simple (non-multidrop) POP3 mailbox. ++# Example 12: retrieve mail from a simple (non-multidrop) POP3 mailbox. + # Then extract addresses from the message header (see documentation for which + # fields are examined), and deliver mail containing the address + # <list1@domain.example.net> to ~/Mail/lists/list1/, mail containing the +diff --git a/getmailcore/retrievers.py b/getmailcore/retrievers.py +index 6e82df7..351dade 100755 +--- a/getmailcore/retrievers.py ++++ b/getmailcore/retrievers.py +@@ -62,6 +62,7 @@ class SimplePOP3Retriever(POP3RetrieverBase, POP3initMixIn): + ConfInt(name='port', required=False, default=110), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfBool(name='use_apop', required=False, default=False), + ConfBool(name='delete_dup_msgids', required=False, default=False), + ) +@@ -95,6 +96,7 @@ class SimplePOP3SSLRetriever(POP3RetrieverBase, POP3SSLinitMixIn): + ConfInt(name='port', required=False, default=POP3_ssl_port), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfBool(name='use_apop', required=False, default=False), + ConfBool(name='delete_dup_msgids', required=False, default=False), + ConfFile(name='keyfile', required=False, default=None), +@@ -171,6 +173,7 @@ class BrokenUIDLPOP3Retriever(BrokenUIDLPOP3RetrieverBase, POP3initMixIn): + ConfInt(name='port', required=False, default=110), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfBool(name='use_apop', required=False, default=False), + ) + received_with = 'POP3' +@@ -201,6 +204,7 @@ class BrokenUIDLPOP3SSLRetriever(BrokenUIDLPOP3RetrieverBase, POP3SSLinitMixIn): + ConfInt(name='port', required=False, default=POP3_ssl_port), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfBool(name='use_apop', required=False, default=False), + ConfFile(name='keyfile', required=False, default=None), + ConfFile(name='certfile', required=False, default=None), +@@ -237,6 +241,7 @@ class MultidropPOP3Retriever(MultidropPOP3RetrieverBase, POP3initMixIn): + ConfInt(name='port', required=False, default=110), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfBool(name='use_apop', required=False, default=False), + ConfString(name='envelope_recipient'), + ) +@@ -270,6 +275,7 @@ class MultidropPOP3SSLRetriever(MultidropPOP3RetrieverBase, POP3SSLinitMixIn): + ConfInt(name='port', required=False, default=POP3_ssl_port), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfBool(name='use_apop', required=False, default=False), + ConfString(name='envelope_recipient'), + ConfFile(name='keyfile', required=False, default=None), +@@ -316,6 +322,7 @@ class MultidropSDPSRetriever(SimplePOP3Retriever, POP3initMixIn): + ConfInt(name='port', required=False, default=110), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + # Demon apparently doesn't support APOP + ConfBool(name='use_apop', required=False, default=False), + ) +@@ -368,6 +375,7 @@ class SimpleIMAPRetriever(IMAPRetrieverBase, IMAPinitMixIn): + ConfInt(name='port', required=False, default=imaplib.IMAP4_PORT), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfTupleOfUnicode(name='mailboxes', required=False, + default="('INBOX', )", allow_specials=('ALL',)), + ConfBool(name='use_peek', required=False, default=True), +@@ -409,6 +417,7 @@ class SimpleIMAPSSLRetriever(IMAPRetrieverBase, IMAPSSLinitMixIn): + ConfInt(name='port', required=False, default=imaplib.IMAP4_SSL_PORT), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfTupleOfUnicode(name='mailboxes', required=False, + default="('INBOX', )", allow_specials=('ALL',)), + ConfBool(name='use_peek', required=False, default=True), +@@ -454,6 +463,7 @@ class MultidropIMAPRetriever(MultidropIMAPRetrieverBase, IMAPinitMixIn): + ConfInt(name='port', required=False, default=imaplib.IMAP4_PORT), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfTupleOfUnicode(name='mailboxes', required=False, + default="('INBOX', )", allow_specials=('ALL',)), + ConfBool(name='use_peek', required=False, default=True), +@@ -496,6 +506,7 @@ class MultidropIMAPSSLRetriever(MultidropIMAPRetrieverBase, IMAPSSLinitMixIn): + ConfInt(name='port', required=False, default=imaplib.IMAP4_SSL_PORT), + ConfString(name='username'), + ConfPassword(name='password', required=False, default=None), ++ ConfString(name='passwordeval', required=False, default=None), + ConfTupleOfUnicode(name='mailboxes', required=False, + default="('INBOX', )", allow_specials=('ALL',)), + ConfBool(name='use_peek', required=False, default=True), +diff --git a/getmailcore/utilities.py b/getmailcore/utilities.py +index 9ed6643..572be61 100755 +--- a/getmailcore/utilities.py ++++ b/getmailcore/utilities.py +@@ -688,7 +688,29 @@ if keychain_password is None: + + ####################################### + def get_password(label, user, server, protocol, logger): +- # try keychain/keyrings first, where available ++ # try passwordeval first ++ if label.conf['passwordeval']: ++ cmd = label.conf['passwordeval'] ++ (status, output) = commands.getstatusoutput(cmd) ++ password = None ++ if status != os.EX_OK or not output: ++ emsg = 'passwordeval command "{}" failed: {} {}'.format( ++ cmd, status, output) ++ # Add line separator if missing so that prompting for password is ++ # clearer ++ if emsg[-1] != os.linesep: ++ emsg += os.linesep ++ logger.error(emsg) ++ else: ++ # select last line as password from the output and remove any line ++ # separators from the end. ++ password = output.rstrip(os.linesep).rpartition(os.linesep)[2] ++ # if could not be evaluated, prompt in the usual way ++ if not password: ++ password = getpass.getpass('Enter password for %s: ' % label) ++ return password ++ ++ # try keychain/keyrings second, where available + password = keychain_password(user, server, protocol, logger) + if password: + logger.debug('using password from keychain/keyring') +-- +2.11.0 + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..6c23b0e31f51 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,43 @@ +# Maintainer: awe00 < awe00 AT hotmail DOT fr> +# Contributor: Andreas Radke <andyrtr@archlinux.org> +# Contributor: Manolis Tzanidakis <manolis@archlinux.org> +# Contributor: Esa Määttä <esa.maatta_at_iki.fi> + +pkgname=getmail-passwordeval +pkgver=4.53.0 +pkgrel=1 +pkgdesc="A POP3 mail retriever with reliable Maildir and command delivery (with passwordeval patch)." +arch=(any) +url="http://pyropus.ca/software/getmail" +license=("GPL") +depends=('python2') +provides=('getmail') +conflicts=('getmail') +optdepends=('python2-gnomekeyring: for storing passwords in gnome-keyring') +# no signature, no https +source=("http://pyropus.ca/software/getmail/old-versions/getmail-$pkgver.tar.gz" + "0001-Added-passwordeval-option-and-documentation.patch") +sha256sums=('282596fe33b5a24b3aefe5b268f57efbcdd5b980478901418045b481636f92ab' + '0bdaaa3f2ada33b32b5861eef71a5290d478a67b7cda90e2aadc598876dda7ad') + +prepare() { + cd getmail-${pkgver} + # fix broken shebang calls + sed -i -e "s|#![ ]*/usr/bin/env python|#!/usr/bin/env python2|" getmailcore/__init__.py + sed -i -e "s|#![ ]*/usr/bin/env python2.3|#!/usr/bin/env python2|" $(find . -name '*.py') + # recheck + head -1 $(find . -name '*.py') + + patch -Np1 -i "${srcdir}/0001-Added-passwordeval-option-and-documentation.patch" +} + +build() { + cd getmail-${pkgver} + python2 setup.py build +} + +package() { + cd getmail-${pkgver} + python2 setup.py install --root=${pkgdir} +} + |