From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/80850 Path: news.gmane.org!not-for-mail From: Richard Riley Newsgroups: gmane.emacs.gnus.general Subject: Re: smtpmail authentication again Date: Tue, 10 Jan 2012 03:34:43 +0100 Organization: aich tea tea pea dicky riley dot net Message-ID: References: <87d3awtgda.fsf@lifelogs.com> <878vlktfy6.fsf@lifelogs.com> <874nw7slnv.fsf@lifelogs.com> <87fwfqouk3.fsf@lifelogs.com> Reply-To: ding@gnus.org NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1326162939 996 80.91.229.12 (10 Jan 2012 02:35:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 10 Jan 2012 02:35:39 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M29132@lists.math.uh.edu Tue Jan 10 03:35:35 2012 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RkRYl-0003Wk-9u for ding-account@gmane.org; Tue, 10 Jan 2012 03:35:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1RkRYF-0002yp-UZ; Mon, 09 Jan 2012 20:35:03 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1RkRYD-0002yf-C9 for ding@lists.math.uh.edu; Mon, 09 Jan 2012 20:35:01 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1RkRYB-0003Yo-OG for ding@lists.math.uh.edu; Mon, 09 Jan 2012 20:35:00 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1RkRY8-0002Jr-UK for ding@gnus.org; Tue, 10 Jan 2012 03:34:56 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RkRY8-0003F9-9V for ding@gnus.org; Tue, 10 Jan 2012 03:34:56 +0100 Original-Received: from 85.183.18.158 ([85.183.18.158]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Jan 2012 03:34:56 +0100 Original-Received: from rileyrg by 85.183.18.158 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 10 Jan 2012 03:34:56 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 71 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 85.183.18.158 Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) Cancel-Lock: sha1:oBWqDXS0HFHWjklLAW7+t3uk3Wc= X-Spam-Score: -2.8 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:80850 Archived-At: Ted Zlatanov writes: > On Sat, 07 Jan 2012 15:45:54 +0100 Richard Riley wrote: > > RR> Ted Zlatanov writes: >>> On Sat, 07 Jan 2012 06:33:11 +0100 Richard Riley wrote: >>> > RR> So long as the passwords are encrypted in the authinfo.gpg.... >>> >>> .gpg files are always encrypted if EPA/EPG is enabled, so yes. >>> >>> You can also encrypt individual passwords in an otherwise unencrypted >>> netrc/authinfo file with `auth-source-netrc-use-gpg-tokens'. But they >>> are not usable with other tools then. > > RR> ,---- > RR> | Documentation: > RR> | Set this to tell auth-source when to create GPG password > RR> | tokens in netrc files. It's either an alist or `never'. > RR> | Note that if EPA/EPG is not available, this should NOT be used. > RR> `---- > > RR> I dont understand the docstring. How does auth-source create passwords? > > `auth-source-search' can, in some cases, create a whole entry, including > a password. If this is created in an unencrypted file, you can choose > to encrypt just the password. Also there's a "plstore" auth-source > backend (in addition to the "netrc" default backend) which stores > passwords and other secrets safely in an otherwise unencrypted file. > > RR> While on the subject, whats the best elisp example/snippet to get a > RR> password from the authinfo based on only machine name or machine name > RR> and user id so I can use this in other elisp apps (e.g use authinfo to > RR> get my irc password from .authinfo.gpg). > > Which IRC client? I had a ERC patch a while ago but Deniz Dogan (the > maintainer then IIRC) didn't have the time to work on it. In any case, > I'd rather submit a patch to the IRC client so you don't have to do this > yourself. > > To answer your question about how to search, and assuming you don't want > to auto-create entries: > > (let* ((auth-info (car > (auth-source-search > :host "yourhost.com" > :user "yourusername" > :max 1 > :require '(:user :secret) > :create nil))) > (user (plist-get auth-info :user)) > (password (plist-get auth-info :secret))) > (when (functionp password) > (setq password (funcall password))) > (list user password auth-info)) > > If this returns nil, you can repeat the search without the :user query, > so you'll get any "yourhost.com" entries. Thanks ted. I'll try to use this then to store my erc credentials in gpg file. Strikes me as the srt of thing that would greatly benefit from little wrappers for the commone usage as simple as getUserForHost("host"); getPassForHost("host"); regards r.