all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to store SMTP credentials via Secret Service API?
@ 2013-06-12 23:47 John Steele Scott
  2013-06-13 10:39 ` Michael Albinus
  0 siblings, 1 reply; 3+ messages in thread
From: John Steele Scott @ 2013-06-12 23:47 UTC (permalink / raw)
  To: help-gnu-emacs

I'd like to store my SMTP authentication details using the Secret Service API, rather than keep them in the authinfo file. However, I'm having trouble creating the credential in the first place.

If I eval something like:

(secrets-create-item "Default" "toojays.net smtp" "my-secret-password"
 :host "my-mail-host" 
 :port "587"
 :user "toojays@toojays.net")

it errors like:

Secret Service session: /org/freedesktop/secrets/session/s287
byte-code: D-Bus error: "Method \"CreateItem\" with signature \"a{sv}(oayay)b\" on interface \"org.freedesktop.Secret.Collection\" doesn't exist

I found a similar error in a bug report for a different application <https://bugs.launchpad.net/ubuntu/+source/python-launchpadlib/+bug/745540> where it seems like a compatibility issue due to a different version of gnome-keyring. My system is running Ubuntu 12.04 and has gnome-keyring 3.2.2-2ubuntu4.1, and also mate-keyring 1.6.0-1+precise.

Is there a workaround for this?

For instance, if I could create the key some other way (e.g. via seahorse), will Emacs be able to retrieve it?

Have I even used the correct syntax to create the key?

Thanks,

John




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to store SMTP credentials via Secret Service API?
  2013-06-12 23:47 How to store SMTP credentials via Secret Service API? John Steele Scott
@ 2013-06-13 10:39 ` Michael Albinus
  2013-06-17  3:53   ` John Steele Scott
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Albinus @ 2013-06-13 10:39 UTC (permalink / raw)
  To: John Steele Scott; +Cc: help-gnu-emacs

John Steele Scott <toojays@toojays.net> writes:

Hi John,

> If I eval something like:
>
> (secrets-create-item "Default" "toojays.net smtp" "my-secret-password"
>  :host "my-mail-host" 
>  :port "587"
>  :user "toojays@toojays.net")
>
> it errors like:
>
> Secret Service session: /org/freedesktop/secrets/session/s287
> byte-code: D-Bus error: "Method \"CreateItem\" with signature
> \"a{sv}(oayay)b\" on interface \"org.freedesktop.Secret.Collection\"
> doesn't exist

Yep, there was an extension to the Secret Service API, which was not
implemented yet in secrets.el. (For the curious ones: a "secret" struct
has now an additional content_type entry. The signature is "(oayays)" )

> Is there a workaround for this?

I've changed secrets.el in Emacs' trunk accordingly. If you don't run
Emacs dev version, you could download the file from
<http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/net/secrets.el?h=trunk>

> For instance, if I could create the key some other way (e.g. via
> seahorse), will Emacs be able to retrieve it?

Likely yes. You could call "M-x secrets-show-secrets" and navigate
through the items. If Emacs shows you your password which you have
created via seahorse, chances are good that it works.

> Have I even used the correct syntax to create the key?

Yes. I have used it during debugging (with the exception, that I have
used "session" insted of "Default", 'cause I didn't want to add the key
permanently).

OTOH, IIRC one could instruct auth-sources to create a password if it
doesn't exist yet. Then you don't need to fiddle with secrets.el directly.

> Thanks,
>
> John

Best regards, Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to store SMTP credentials via Secret Service API?
  2013-06-13 10:39 ` Michael Albinus
@ 2013-06-17  3:53   ` John Steele Scott
  0 siblings, 0 replies; 3+ messages in thread
From: John Steele Scott @ 2013-06-17  3:53 UTC (permalink / raw)
  To: help-gnu-emacs

Thanks Michael for your reply.

On 13/06/13 20:09, Michael Albinus wrote:
> John Steele Scott <toojays@toojays.net> writes:
> 
> Hi John,
> 
>> If I eval something like:
>>
>> (secrets-create-item "Default" "toojays.net smtp" "my-secret-password"
>>  :host "my-mail-host" 
>>  :port "587"
>>  :user "toojays@toojays.net")
>>
>> it errors like:
>>
>> Secret Service session: /org/freedesktop/secrets/session/s287
>> byte-code: D-Bus error: "Method \"CreateItem\" with signature
>> \"a{sv}(oayay)b\" on interface \"org.freedesktop.Secret.Collection\"
>> doesn't exist
> 
> Yep, there was an extension to the Secret Service API, which was not
> implemented yet in secrets.el. (For the curious ones: a "secret" struct
> has now an additional content_type entry. The signature is "(oayays)" )
> 
>> Is there a workaround for this?
> 
> I've changed secrets.el in Emacs' trunk accordingly. If you don't run
> Emacs dev version, you could download the file from
> <http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/net/secrets.el?h=trunk>

I downloaded the new version, and used "load-file" to get it into my Emacs
24.3. I still had no success when trying to set the secret with
secrets-create-item though.

>> For instance, if I could create the key some other way (e.g. via
>> seahorse), will Emacs be able to retrieve it?
> 
> Likely yes. You could call "M-x secrets-show-secrets" and navigate
> through the items. If Emacs shows you your password which you have
> created via seahorse, chances are good that it works.

Okay, seahorse was no good, because at least with the version I had (3.2.2), I
couldn't see a way to set any properties such as host/port/username with the
secret. However, I found some python attached to this article
<http://www.clasohm.com/blog/one-entry?entry_id=90957> which shows how to
interface with gnome-keyring to set keys. I set the key that way, which seems to
work fine.

>> Have I even used the correct syntax to create the key?
> 
> Yes. I have used it during debugging (with the exception, that I have
> used "session" insted of "Default", 'cause I didn't want to add the key
> permanently).
> 
> OTOH, IIRC one could instruct auth-sources to create a password if it
> doesn't exist yet. Then you don't need to fiddle with secrets.el directly.

I did start there, but auth-sources complains that
"The Secrets API auth-source backend doesn't support creation yet"

Thanks again,

John




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-06-17  3:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 23:47 How to store SMTP credentials via Secret Service API? John Steele Scott
2013-06-13 10:39 ` Michael Albinus
2013-06-17  3:53   ` John Steele Scott

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.