2009-02-16 09:32:19 +00:00
\input texinfo @c -*-texinfo-*-
2011-02-06 00:25:41 +00:00
2013-01-05 17:19:53 +01:00
@set VERSION 0.3
2014-06-09 22:20:31 -04:00
@setfilename ../../info/auth.info
2009-02-16 17:41:58 +00:00
@settitle Emacs auth-source Library @value{VERSION}
Fix single-quoting style in PDF manuals
The PDF versions of the GNU manuals used curved single quotes to
represent grave accent and apostrophe, which made it a pain to cut
and paste code examples from them. Fix the PDF versions to use
grave accent and apostrophe for Lisp source code, keystrokes, etc.
This change does not affect the info files, nor does it affect
ordinary uses of curved single quotes in PDF.
* doc/emacs/docstyle.texi: New file, which specifies treatment for
grave accent and apostrophe, as well as the document encoding.
* doc/emacs/emacs-xtra.texi, doc/emacs/emacs.texi:
* doc/lispintro/emacs-lisp-intro.texi:
* doc/lispref/back.texi, doc/lispref/book-spine.texi:
* doc/lispref/elisp.texi, doc/lispref/lay-flat.texi:
* doc/misc/ada-mode.texi, doc/misc/auth.texi:
* doc/misc/autotype.texi, doc/misc/bovine.texi, doc/misc/calc.texi:
* doc/misc/cc-mode.texi, doc/misc/cl.texi, doc/misc/dbus.texi:
* doc/misc/dired-x.texi, doc/misc/ebrowse.texi, doc/misc/ede.texi:
* doc/misc/ediff.texi, doc/misc/edt.texi, doc/misc/efaq-w32.texi:
* doc/misc/efaq.texi, doc/misc/eieio.texi, doc/misc/emacs-gnutls.texi:
* doc/misc/emacs-mime.texi, doc/misc/epa.texi, doc/misc/erc.texi:
* doc/misc/ert.texi, doc/misc/eshell.texi, doc/misc/eudc.texi:
* doc/misc/eww.texi, doc/misc/flymake.texi, doc/misc/forms.texi:
* doc/misc/gnus-coding.texi, doc/misc/gnus-faq.texi:
* doc/misc/gnus.texi, doc/misc/htmlfontify.texi:
* doc/misc/idlwave.texi, doc/misc/ido.texi, doc/misc/info.texi:
* doc/misc/mairix-el.texi, doc/misc/message.texi, doc/misc/mh-e.texi:
* doc/misc/newsticker.texi, doc/misc/nxml-mode.texi:
* doc/misc/octave-mode.texi, doc/misc/org.texi, doc/misc/pcl-cvs.texi:
* doc/misc/pgg.texi, doc/misc/rcirc.texi, doc/misc/reftex.texi:
* doc/misc/remember.texi, doc/misc/sasl.texi, doc/misc/sc.texi:
* doc/misc/semantic.texi, doc/misc/ses.texi, doc/misc/sieve.texi:
* doc/misc/smtpmail.texi, doc/misc/speedbar.texi:
* doc/misc/srecode.texi, doc/misc/todo-mode.texi, doc/misc/tramp.texi:
* doc/misc/url.texi, doc/misc/vhdl-mode.texi, doc/misc/vip.texi:
* doc/misc/viper.texi, doc/misc/widget.texi, doc/misc/wisent.texi:
* doc/misc/woman.texi:
Use it instead of '@documentencoding UTF-8', to lessen the need for
global changes like this in the future.
* doc/emacs/Makefile.in (EMACS_XTRA):
* doc/lispintro/Makefile.in (srcs):
* doc/lispref/Makefile.in (srcs):
Add dependency on docstyle.texi.
* doc/misc/Makefile.in (style): New macro.
(${buildinfodir}/%.info, %.dvi, %.pdf, %.html)
(${buildinfodir}/ccmode.info, ${buildinfodir}/efaq%.info, gnus_deps):
Use it.
2015-05-01 12:05:53 -07:00
@include docstyle.texi
2009-02-16 09:32:19 +00:00
@copying
This file describes the Emacs auth-source library.
2022-01-01 02:45:51 -05:00
Copyright @copyright{} 2008--2022 Free Software Foundation, Inc.
2009-02-16 09:32:19 +00:00
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
2014-05-07 13:34:53 -04:00
Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
2009-02-16 09:32:19 +00:00
and with the Back-Cover Texts as in (a) below. A copy of the license
2012-12-21 11:01:24 -08:00
is included in the section entitled ``GNU Free Documentation License''.
2009-02-16 09:32:19 +00:00
(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
2012-12-21 10:36:41 -08:00
modify this GNU manual.''
2009-02-16 09:32:19 +00:00
@end quotation
@end copying
2011-02-18 15:57:53 +02:00
@dircategory Emacs lisp libraries
2009-02-16 17:41:58 +00:00
@direntry
Minor doc/misc/*.texi direntry fixes.
* ada-mode.texi, auth.texi, autotype.texi, calc.texi, cc-mode.texi:
* dired-x.texi, ebrowse.texi, ede.texi, edt.texi, eieio.texi:
* emacs-mime.texi, epa.texi, erc.texi, eshell.texi, eudc.texi:
* flymake.texi, gnus.texi, info.texi, mairix-el.texi, message.texi:
* newsticker.texi, org.texi, pgg.texi, rcirc.texi, reftex.texi:
* remember.texi, sasl.texi, semantic.texi, ses.texi, smtpmail.texi:
* speedbar.texi, tramp.texi, url.texi, viper.texi, widget.texi:
* woman.texi:
Start direntry descriptions in column 32, per Texinfo convention.
Make them end with a period.
2010-06-24 00:10:51 -07:00
* Auth-source: (auth). The Emacs auth-source library.
2009-02-16 17:41:58 +00:00
@end direntry
2009-02-16 09:32:19 +00:00
@titlepage
2011-02-06 00:25:41 +00:00
@ifset WEBHACKDEVEL
@title Emacs auth-source Library (DEVELOPMENT VERSION)
@end ifset
@ifclear WEBHACKDEVEL
2009-02-16 09:32:19 +00:00
@title Emacs auth-source Library
2011-02-06 00:25:41 +00:00
@end ifclear
2009-02-16 09:32:19 +00:00
@author by Ted Zlatanov
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
2009-02-16 17:41:58 +00:00
@contents
2009-02-16 09:32:19 +00:00
2009-02-16 17:41:58 +00:00
@ifnottex
2009-02-16 09:32:19 +00:00
@node Top
@top Emacs auth-source
This manual describes the Emacs auth-source library.
It is a way for multiple applications to share a single configuration
(in Emacs and in files) for user convenience.
2009-02-16 17:41:58 +00:00
@insertcopying
2009-02-16 09:32:19 +00:00
@menu
* Overview:: Overview of the auth-source library.
2011-11-08 22:10:51 -08:00
* Help for users::
2015-02-05 11:50:17 +00:00
* Multiple GMail accounts with Gnus::
2011-11-08 22:10:51 -08:00
* Secret Service API::
2017-04-27 21:33:07 -07:00
* The Unix password store::
2011-11-08 22:10:51 -08:00
* Help for developers::
* GnuPG and EasyPG Assistant Configuration::
2012-12-21 11:01:24 -08:00
* GNU Free Documentation License:: The license for this documentation.
2011-11-08 22:10:51 -08:00
* Index::
* Function Index::
* Variable Index::
2009-02-16 09:32:19 +00:00
@end menu
2009-02-16 17:41:58 +00:00
@end ifnottex
2009-02-16 09:32:19 +00:00
@node Overview
@chapter Overview
2009-09-09 10:07:19 +00:00
The auth-source library is simply a way for Emacs and Gnus, among
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
others, to answer the old burning question ``What are my user name and
password?''
2009-08-29 00:27:12 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
(This is different from the old question about burning ``Where is the
fire extinguisher, please?''.)
The auth-source library supports more than just the user name or the
password (known as the secret).
Similarly, the auth-source library supports multiple storage backend,
currently either the classic ``netrc'' backend, examples of which you
2017-12-19 11:44:26 -05:00
can see later in this document, JSON files, the Secret Service API, and pass, the
2017-04-03 21:36:03 +02:00
standard unix password manager. This is done with EIEIO-based
backends and you can write your own if you want.
2009-02-16 09:32:19 +00:00
@node Help for users
@chapter Help for users
2009-08-29 00:27:12 +00:00
``Netrc'' files are a de facto standard. They look like this:
2019-11-18 10:48:29 +01:00
2009-08-29 00:27:12 +00:00
@example
2009-09-09 10:07:19 +00:00
machine @var{mymachine} login @var{myloginname} password @var{mypassword} port @var{myport}
2009-08-29 00:27:12 +00:00
@end example
2009-02-16 09:32:19 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
The @code{machine} is the server (either a DNS name or an IP address).
2019-07-10 01:18:39 +02:00
It's known as @var{:host} in @code{auth-source-search} queries.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
The @code{port} is the connection port or protocol. It's known as
2011-02-17 12:08:48 +00:00
@var{:port} in @code{auth-source-search} queries.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
The @code{user} is the user name. It's known as @var{:user} in
@code{auth-source-search} queries. You can also use @code{login} and
@code{account}.
2021-01-10 15:32:57 +01:00
Matching entries are usually used in the order they appear, so placing
the most specific entries first in the file is a good idea. For
instance:
@example
machine example.com login foobar password geheimnis port smtp
machine example.com login foobar password hemmelig
@end example
Here we're using one password for the @code{smtp} service, and a
different one for all the other services.
2019-01-24 11:34:34 +01:00
You can also use this file to specify client certificates to use when
setting up TLS connections. The format is:
2019-11-18 10:48:29 +01:00
2019-01-24 11:34:34 +01:00
@example
machine @var{mymachine} port @var{myport} key @var{key} cert @var{cert}
@end example
@var{key} and @var{cert} are filenames containing the key and
2019-11-18 10:48:29 +01:00
certificate to use respectively. In order to make network connections
use them automatically, either pass @code{:client-certificate t} to
@code{open-network-stream}, or customize
@code{network-stream-use-client-certificates} to @code{t}.
2019-01-24 11:34:34 +01:00
2014-11-03 22:21:25 +00:00
You can use spaces inside a password or other token by surrounding the
token with either single or double quotes.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
2015-04-11 07:47:25 -07:00
You can use apostrophes inside a password or other token by
2015-03-17 16:55:02 -07:00
surrounding it with double quotes, e.g., @code{"he'llo"}. Similarly you
2014-11-03 22:21:25 +00:00
can use double quotes inside a password or other token by surrounding
2015-04-11 07:47:25 -07:00
it with apostrophes, e.g., @code{'he"llo'}. You can't mix both (so a
password or other token can't have both apostrophes and double quotes).
2014-11-03 22:21:25 +00:00
All this is optional. You could just say (but we don't recommend it,
we're just showing that it's possible)
2009-09-09 10:07:19 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
@example
password @var{mypassword}
@end example
2009-09-09 10:07:19 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
to use the same password everywhere. Again, @emph{DO NOT DO THIS} or
you will be pwned as the kids say.
2009-09-09 10:07:19 +00:00
2012-04-04 16:44:56 -04:00
``Netrc'' files are usually called @file{.authinfo} or @file{.netrc};
nowadays @file{.authinfo} seems to be more popular and the auth-source
2011-02-23 13:35:35 +00:00
library encourages this confusion by accepting both, as you'll see
later.
2009-09-09 10:07:19 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
If you have problems with the search, set @code{auth-source-debug} to
2011-03-09 13:39:35 +00:00
@code{'trivia} and see what host, port, and user the library is
Use @file for buffers, per the Texinfo manual
* doc/misc/ada-mode.texi, doc/misc/auth.texi, doc/misc/calc.texi:
* doc/misc/ebrowse.texi, doc/misc/efaq.texi, doc/misc/emacs-gnutls.texi:
* doc/misc/epa.texi, doc/misc/ert.texi, doc/misc/eshell.texi:
* doc/misc/eww.texi, doc/misc/flymake.texi, doc/misc/gnus.texi:
* doc/misc/info.texi, doc/misc/message.texi, doc/misc/mh-e.texi:
* doc/misc/newsticker.texi, doc/misc/pcl-cvs.texi, doc/misc/rcirc.texi:
* doc/misc/sem-user.texi, doc/misc/smtpmail.texi, doc/misc/url.texi:
* doc/misc/viper.texi, doc/misc/wisent.texi, doc/misc/woman.texi:
Use @file for buffers, per the Texinfo manual.
2014-03-12 16:52:34 -04:00
checking in the @file{*Messages*} buffer. Ditto for any other
2011-03-09 13:39:35 +00:00
problems, your first step is always to see what's being checked. The
second step, of course, is to write a blog entry about it and wait for
the answer in the comments.
2009-09-09 10:07:19 +00:00
You can customize the variable @code{auth-sources}. The following may
2009-08-29 00:27:12 +00:00
be needed if you are using an older version of Emacs or if the
auth-source library is not loaded for some other reason.
2009-02-16 09:32:19 +00:00
@lisp
2009-08-29 00:27:12 +00:00
(require 'auth-source) ;; probably not necessary
2009-02-16 09:32:19 +00:00
(customize-variable 'auth-sources) ;; optional, do it once
@end lisp
@defvar auth-sources
2009-09-09 10:07:19 +00:00
The @code{auth-sources} variable tells the auth-source library where
2017-04-03 21:36:03 +02:00
your netrc files, Secret Service API collection items, or your
password store live for a particular host and protocol. While you can
get fancy, the default and simplest configuration is:
2009-02-16 09:32:19 +00:00
@lisp
2011-02-17 12:08:48 +00:00
;;; old default: required :host and :port, not needed anymore
(setq auth-sources '((:source "~/.authinfo.gpg" :host t :port t)))
2010-03-28 23:55:59 +00:00
;;; mostly equivalent (see below about fallbacks) but shorter:
(setq auth-sources '((:source "~/.authinfo.gpg")))
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
;;; even shorter and the @emph{default}:
2011-02-23 13:35:35 +00:00
(setq auth-sources '("~/.authinfo.gpg" "~/.authinfo" "~/.netrc"))
2012-12-22 13:12:07 -08:00
;;; use the Secrets API @var{Login} collection
;;; (@pxref{Secret Service API})
2011-02-15 11:24:37 +00:00
(setq auth-sources '("secrets:Login"))
2017-04-03 21:36:03 +02:00
;;; use pass (@file{~/.password-store})
2017-04-27 21:33:07 -07:00
;;; (@pxref{The Unix password store})
2022-04-17 12:39:41 +02:00
(auth-source-pass-enable)
2017-12-19 15:10:34 -05:00
;;; JSON data in format [@{ "machine": "SERVER",
;;; "login": "USER", "password": "PASSWORD" @}...]
2017-12-19 11:44:26 -05:00
(setq auth-sources '("~/.authinfo.json.gpg"))
2009-02-16 09:32:19 +00:00
@end lisp
2009-09-09 10:07:19 +00:00
By adding multiple entries to @code{auth-sources} with a particular
2009-08-29 00:27:12 +00:00
host or protocol, you can have specific netrc files for that host or
protocol. Usually this is unnecessary but may make sense if you have
shared netrc files or some other unusual setup (90% of Emacs users
have unusual setups and the remaining 10% are @emph{really} unusual).
2009-02-16 09:32:19 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
Here's a mixed example using two sources:
2010-03-28 23:55:59 +00:00
@lisp
2012-12-22 13:12:07 -08:00
(setq auth-sources '((:source (:secrets default)
:host "myserver" :user "joe")
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
"~/.authinfo.gpg"))
2010-03-28 23:55:59 +00:00
@end lisp
2009-08-29 00:27:12 +00:00
@end defvar
2009-02-16 09:32:19 +00:00
2009-09-09 10:07:19 +00:00
If you don't customize @code{auth-sources}, you'll have to live with
2012-05-01 22:28:14 +00:00
the defaults: the unencrypted netrc file @file{~/.authinfo} will be
used for any host and any port.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
2012-05-01 22:28:14 +00:00
If that fails, any host and any port are looked up in the netrc file
@file{~/.authinfo.gpg}, which is a GnuPG encrypted file (@pxref{GnuPG
and EasyPG Assistant Configuration}).
Finally, the unencrypted netrc file @file{~/.netrc} will be used for
any host and any port.
2009-02-16 09:32:19 +00:00
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
The typical netrc line example is without a port.
2009-08-29 00:27:12 +00:00
@example
machine YOURMACHINE login YOU password YOURPASSWORD
@end example
This will match any authentication port. Simple, right? But what if
there's a SMTP server on port 433 of that machine that needs a
different password from the IMAP server?
@example
machine YOURMACHINE login YOU password SMTPPASSWORD port 433
machine YOURMACHINE login YOU password GENERALPASSWORD
@end example
2020-09-01 15:59:43 +02:00
If you wish to specify a particular SMTP authentication method to use
with a machine, you can use the @code{smtp-auth} keyword.
@xref{Authentication,, Authentication, smtpmail, Emacs SMTP Library},
for available methods.
2009-02-16 09:32:19 +00:00
For url-auth authentication (HTTP/HTTPS), you need to put this in your
netrc file:
@example
machine yourmachine.com:80 port http login testuser password testpass
@end example
2009-08-29 00:27:12 +00:00
This will match any realm and authentication method (basic or digest)
2012-12-05 14:27:56 -08:00
over HTTP@. HTTPS is set up similarly. If you want finer controls,
2009-08-29 00:27:12 +00:00
explore the url-auth source code and variables.
2009-02-16 09:32:19 +00:00
For Tramp authentication, use:
@example
machine yourmachine.com port scp login testuser password testpass
@end example
Note that the port denotes the Tramp connection method. When you
don't use a port entry, you match any Tramp method, as explained
2009-08-29 00:27:12 +00:00
earlier. Since Tramp has about 88 connection methods, this may be
necessary if you have an unusual (see earlier comment on those) setup.
2009-02-16 09:32:19 +00:00
2017-12-19 11:44:26 -05:00
The netrc format is directly translated into JSON, if you are into
that sort of thing. Just point to a JSON file with entries like this:
@example
[
2017-12-19 15:10:34 -05:00
@{ "machine": "yourmachine.com", "port": "http",
"login": "testuser", "password": "testpass" @}
2017-12-19 11:44:26 -05:00
]
@end example
2015-02-05 11:50:17 +00:00
@node Multiple GMail accounts with Gnus
@chapter Multiple GMail accounts with Gnus
For multiple GMail accounts with Gnus, you have to make two nnimap
entries in your @code{gnus-secondary-select-methods} with distinct
names:
@example
(setq gnus-secondary-select-methods '((nnimap "gmail"
(nnimap-address "imap.gmail.com"))
(nnimap "gmail2"
(nnimap-address "imap.gmail.com"))))
@end example
Your netrc entries will then be:
@example
2015-02-21 20:00:16 -08:00
machine gmail login account@@gmail.com password "account password" port imap
machine gmail2 login account2@@gmail.com password "account2 password" port imap
2015-02-05 11:50:17 +00:00
@end example
2010-03-28 23:55:59 +00:00
@node Secret Service API
@chapter Secret Service API
2012-04-04 17:28:57 +02:00
The @dfn{Secret Service API} is a standard from
2019-09-22 23:53:39 -07:00
@uref{https://www.freedesktop.org/wiki/Specifications/secret-storage-spec/,,freedesktop.org}
2012-04-05 13:55:55 +00:00
to securely store passwords and other confidential information. This
API is implemented by system daemons such as the GNOME Keyring and the
KDE Wallet (these are GNOME and KDE packages respectively and should
2021-12-31 14:36:49 +01:00
be available on most modern GNU/Linux systems). It has been tested
also with KeePassXC.
2012-04-04 17:28:57 +02:00
2012-04-05 13:55:55 +00:00
The auth-source library uses the @file{secrets.el} library to connect
2012-12-05 14:27:56 -08:00
through the Secret Service API@. You can also use that library in
2012-04-05 13:55:55 +00:00
other packages, it's not exclusive to auth-source.
2012-04-04 17:28:57 +02:00
@defvar secrets-enabled
After loading @file{secrets.el}, a non-@code{nil} value of this
variable indicates the existence of a daemon providing the Secret
Service API.
@end defvar
@deffn Command secrets-show-secrets
2012-04-05 13:55:55 +00:00
This command shows all collections, items, and their attributes.
2012-04-04 17:28:57 +02:00
@end deffn
2012-04-05 13:55:55 +00:00
The atomic objects managed by the Secret Service API are @dfn{secret
items}, which contain things an application wishes to store securely,
like a password. Secret items have a label (a name), the @dfn{secret}
(which is the string we want, like a password), and a set of lookup
attributes. The attributes can be used to search and retrieve a
secret item at a later date.
2012-04-04 17:28:57 +02:00
Secret items are grouped in @dfn{collections}. A collection is
2012-04-05 13:55:55 +00:00
sometimes called a @samp{keyring} or @samp{wallet} in GNOME Keyring
and KDE Wallet but it's the same thing, a group of secrets.
Collections are personal and protected so only the owner can open them.
2012-04-04 17:28:57 +02:00
2012-04-06 01:56:38 +00:00
The most common collection is called @code{"login"}.
2012-04-05 13:55:55 +00:00
2012-04-06 01:56:38 +00:00
A collection can have an alias. The alias @code{"default"} is
2012-04-05 13:55:55 +00:00
commonly used so the clients don't have to know the specific name of
the collection they open. Other aliases are not supported yet.
2012-04-06 01:56:38 +00:00
Since aliases are globally accessible, set the @code{"default"} alias
2012-04-05 13:55:55 +00:00
only when you're sure it's appropriate.
2012-04-04 17:28:57 +02:00
@defun secrets-list-collections
2012-04-05 13:55:55 +00:00
This function returns all the collection names as a list.
2012-04-04 17:28:57 +02:00
@end defun
@defun secrets-set-alias collection alias
Set @var{alias} as alias of collection labeled @var{collection}.
2012-04-06 01:56:38 +00:00
Currently only the alias @code{"default"} is supported.
2012-04-04 17:28:57 +02:00
@end defun
@defun secrets-get-alias alias
Return the collection name @var{alias} is referencing to.
2012-04-06 01:56:38 +00:00
Currently only the alias @code{"default"} is supported.
2012-04-04 17:28:57 +02:00
@end defun
Collections can be created and deleted by the functions
@code{secrets-create-collection} and @code{secrets-delete-collection}.
2012-04-05 13:55:55 +00:00
Usually, this is not done from within Emacs. Do not delete standard
2012-04-06 01:56:38 +00:00
collections such as @code{"login"}.
2012-04-05 13:55:55 +00:00
2021-12-31 14:36:49 +01:00
With GNOME Keyring, there exists a special collection called
@code{"session"}, which has the lifetime of the user being logged in.
Its data are not stored on disk and go away when the user logs out.
Therefore, it can be used to store and retrieve secret items
temporarily. The @code{"session"} collection is better than a
persistent collection when the secret items should not live
permanently. The @code{"session"} collection can be addressed either
by the string @code{"session"}, or by @code{nil}, whenever a
collection parameter is needed.
However, other Secret Service provider don't create this temporary
@code{"session"} collection. You shall check first that this
collection exists, before you use it.
2021-12-27 19:53:00 +01:00
2012-04-04 17:28:57 +02:00
@defun secrets-list-items collection
2012-04-05 13:55:55 +00:00
Returns all the item labels of @var{collection} as a list.
2012-04-04 17:28:57 +02:00
@end defun
@defun secrets-create-item collection item password &rest attributes
This function creates a new item in @var{collection} with label
2018-09-11 11:46:32 +02:00
@var{item} and password @var{password}. The label @var{item} does not
have to be unique in @var{collection}. @var{attributes} are key-value
pairs set for the created item. The keys are keyword symbols,
2022-08-22 16:56:57 +02:00
starting with a colon; values are strings. Example:
2012-04-04 17:28:57 +02:00
@example
2021-12-27 19:53:00 +01:00
;;; The collection is "session", the label is "my item"
2018-09-11 11:46:32 +02:00
;;; and the secret (password) is "geheim".
2012-04-04 17:28:57 +02:00
(secrets-create-item "session" "my item" "geheim"
:method "sudo" :user "joe" :host "remote-host")
@end example
2018-09-11 11:46:32 +02:00
The key @code{:xdg:schema} determines the scope of the item to be
generated, i.e.@: for which applications the item is intended for.
This is just a string like "org.freedesktop.NetworkManager.Mobile" or
"org.gnome.OnlineAccounts", the other required keys are determined by
this. If no @code{:xdg:schema} is given,
"org.freedesktop.Secret.Generic" is used by default.
2012-04-04 17:28:57 +02:00
@end defun
@defun secrets-get-secret collection item
2018-09-11 11:46:32 +02:00
Return the secret of item labeled @var{item} in @var{collection}. If
there are several items labeled @var{item}, it is undefined which one
is returned. If there is no such item, return @code{nil}.
2012-04-04 17:28:57 +02:00
@end defun
@defun secrets-delete-item collection item
2018-09-11 11:46:32 +02:00
This function deletes item @var{item} in @var{collection}. If there
are several items labeled @var{item}, it is undefined which one is
deleted.
2012-04-04 17:28:57 +02:00
@end defun
The lookup attributes, which are specified during creation of a
secret item, must be a key-value pair. Keys are keyword symbols,
starting with a colon; values are strings. They can be retrieved
2012-04-05 13:55:55 +00:00
from a given secret item and they can be used for searching of items.
2012-04-04 17:28:57 +02:00
@defun secrets-get-attribute collection item attribute
Returns the value of key @var{attribute} of item labeled @var{item} in
2018-09-11 11:46:32 +02:00
@var{collection}. If there are several items labeled @var{item}, it
is undefined which one is returned. If there is no such item, or the
item doesn't own this key, the function returns @code{nil}.
2012-04-04 17:28:57 +02:00
@end defun
@defun secrets-get-attributes collection item
Return the lookup attributes of item labeled @var{item} in
2018-09-11 11:46:32 +02:00
@var{collection}. If there are several items labeled @var{item}, it
is undefined which one is returned. If there is no such item, or the
item has no attributes, it returns @code{nil}. Example:
2012-04-04 17:28:57 +02:00
@example
(secrets-get-attributes "session" "my item")
2018-09-11 11:46:32 +02:00
@result{} ((:user . "joe") (:host . "remote-host"))
2012-04-04 17:28:57 +02:00
@end example
@end defun
@defun secrets-search-items collection &rest attributes
2012-04-05 13:55:55 +00:00
Search for the items in @var{collection} with matching
@var{attributes}. The @var{attributes} are key-value pairs, as used
in @code{secrets-create-item}. Example:
2012-04-04 17:28:57 +02:00
@example
(secrets-search-items "session" :user "joe")
@result{} ("my item" "another item")
@end example
@end defun
2010-03-28 23:55:59 +00:00
2012-04-05 13:55:55 +00:00
The auth-source library uses the @file{secrets.el} library and thus
the Secret Service API when you specify a source matching
2012-04-06 01:56:38 +00:00
@code{"secrets:COLLECTION"}. For instance, you could use
@code{"secrets:session"} to use the @code{"session"} collection, open only
for the lifetime of Emacs. Or you could use @code{"secrets:Login"} to
open the @code{"Login"} collection. As a special case, you can use the
2012-04-05 13:55:55 +00:00
symbol @code{default} in @code{auth-sources} (not a string, but a
2012-04-06 01:56:38 +00:00
symbol) to specify the @code{"default"} alias. Here is a contrived
2012-04-05 13:55:55 +00:00
example that sets @code{auth-sources} to search three collections and
then fall back to @file{~/.authinfo.gpg}.
@example
(setq auth-sources '(default
"secrets:session"
"secrets:Login"
"~/.authinfo.gpg"))
@end example
2022-08-22 16:56:57 +02:00
Attribute values in the auth-source spec, which are not strings (like
port numbers), are stringified prior calling the @file{secrets.el}
functions.
2017-04-27 21:33:07 -07:00
@node The Unix password store
@chapter The Unix password store
2017-04-03 21:36:03 +02:00
2019-09-22 23:53:39 -07:00
@uref{https://www.passwordstore.org,,The standard unix password
2017-04-03 21:36:03 +02:00
manager} (or just @code{pass}) stores your passwords in
2019-06-13 21:54:21 +02:00
@code{gpg}-protected files following the Unix philosophy. The store
location (any directory) must be specified in the
@code{auth-source-pass-filename} variable which defaults to
@file{~/.password-store}.
2017-04-03 21:36:03 +02:00
2019-06-13 21:54:21 +02:00
Emacs integration of @code{pass} follows the approach suggested by the
pass project itself for data organization to find data. In
particular, to store a password for the user @code{rms} on the host
@code{gnu.org} and port @code{22}, you should use one of the following
filenames.
@table @file
@item gnu.org.gpg
No username or port in the filename means that any username and port
will match.
@item gnu.org/rms.gpg
The username to match can be expressed as filename inside a directory
whose name matches the host. This is useful if the store has
passwords for several users on the same host.
@item rms@@gnu.org.gpg
The username can also be expressed as a prefix, separated from the
host with an at-sign (@code{@@}).
@item gnu.org:22.gpg
The port (aka. service) to match can only be expressed after the host and separated with a colon (@code{:}). The separator can be changed through the @code{auth-source-pass-port-separator} variable.
@item gnu.org:22/rms.gpg
@item rms@@gnu.org:22.gpg
@item a/b/gnu.org.gpg
Entries can be stored in arbitrary directories.
@item a/b/gnu.org/rms.gpg
@item a/b/rms@@gnu.org.gpg
@item a/b/gnu.org:22.gpg
@item a/b/gnu.org:22/rms.gpg
@item a/b/rms@@gnu.org:22.gpg
@end table
If several entries match, the one matching the most items (where an
``item'' is one of username, port or host) is preferred. For example,
while searching for an entry matching the @code{rms} user on host
@code{gnu.org} and port @code{22}, then the entry
@file{gnu.org:22/rms.gpg} is preferred over @file{gnu.org.gpg}.
2017-04-03 21:36:03 +02:00
Users of @code{pass} may also be interested in functionality provided
2019-06-13 21:54:21 +02:00
by other Emacs packages:
2017-04-03 21:36:03 +02:00
@itemize
@item
@uref{https://git.zx2c4.com/password-store/tree/contrib/emacs/password-store.el,,password-store}: library wrapping @code{pass};
@item
@uref{https://github.com/NicolasPetton/pass,,pass}: major mode to manipulate the store and edit entries;
@item
@uref{https://github.com/jabranham/helm-pass,,helm-pass}: helm interface for pass.
@end itemize
2019-06-13 21:54:21 +02:00
@defvar auth-source-pass-filename
Set this variable to a string locating the password store on the disk.
Defaults to @file{~/.password-store}.
@end defvar
@defvar auth-source-pass-port-separator
Set this variable to a string that should separate an host name from a
port in an entry. Defaults to @samp{:}.
@end defvar
2009-02-16 09:32:19 +00:00
@node Help for developers
@chapter Help for developers
2011-03-09 13:39:35 +00:00
The auth-source library lets you control logging output easily.
@defvar auth-source-debug
2012-04-04 16:44:56 -04:00
Set this variable to @code{'trivia} to see lots of output in
Use @file for buffers, per the Texinfo manual
* doc/misc/ada-mode.texi, doc/misc/auth.texi, doc/misc/calc.texi:
* doc/misc/ebrowse.texi, doc/misc/efaq.texi, doc/misc/emacs-gnutls.texi:
* doc/misc/epa.texi, doc/misc/ert.texi, doc/misc/eshell.texi:
* doc/misc/eww.texi, doc/misc/flymake.texi, doc/misc/gnus.texi:
* doc/misc/info.texi, doc/misc/message.texi, doc/misc/mh-e.texi:
* doc/misc/newsticker.texi, doc/misc/pcl-cvs.texi, doc/misc/rcirc.texi:
* doc/misc/sem-user.texi, doc/misc/smtpmail.texi, doc/misc/url.texi:
* doc/misc/viper.texi, doc/misc/wisent.texi, doc/misc/woman.texi:
Use @file for buffers, per the Texinfo manual.
2014-03-12 16:52:34 -04:00
@file{*Messages*}, or set it to a function that behaves like
2012-04-04 16:44:56 -04:00
@code{message} to do your own logging.
2011-03-09 13:39:35 +00:00
@end defvar
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
The auth-source library only has a few functions for external use.
2009-02-16 09:32:19 +00:00
2012-04-04 16:36:33 -04:00
@defun auth-source-search &rest spec &key type max host user port secret require create delete &allow-other-keys
This function searches (or modifies) authentication backends according
to @var{spec}. See the function's doc-string for details.
@c TODO more details.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
@end defun
2009-02-16 09:32:19 +00:00
2011-03-09 13:39:35 +00:00
Let's take a look at an example of using @code{auth-source-search}
2012-04-04 16:36:33 -04:00
from Gnus's @code{nnimap.el}.
2011-03-09 13:39:35 +00:00
@example
(defun nnimap-credentials (address ports)
(let* ((auth-source-creation-prompts
'((user . "IMAP user at %h: ")
(secret . "IMAP password for %u@@%h: ")))
(found (nth 0 (auth-source-search :max 1
:host address
:port ports
:require '(:user :secret)
:create t))))
(if found
(list (plist-get found :user)
2022-01-09 17:36:38 -05:00
(auth-info-password found)
2011-03-09 14:37:30 +00:00
(plist-get found :save-function))
2011-03-09 13:39:35 +00:00
nil)))
@end example
This call requires the user and password (secret) to be in the
results. It also requests that an entry be created if it doesn't
exist already. While the created entry is being assembled, the shown
prompts will be used to interact with the user. The caller can also
pass data in @code{auth-source-creation-defaults} to supply defaults
for any of the prompts.
Note that the password needs to be evaluated if it's a function. It's
wrapped in a function to provide some security.
2011-12-21 01:58:39 -08:00
Later, after a successful login, @code{nnimap.el} calls the
2011-03-09 13:39:35 +00:00
@code{:save-function} like so:
@example
(when (functionp (nth 2 credentials))
2022-01-09 17:36:38 -05:00
(funcall (nth 2 credentials)))
2011-03-09 14:37:30 +00:00
@end example
2011-03-09 13:39:35 +00:00
2011-03-13 04:07:38 +00:00
This will work whether the @code{:save-function} was provided or not.
2011-03-09 13:39:35 +00:00
@code{:save-function} will be provided only when a new entry was
created, so this effectively says ``after a successful login, save the
authentication information we just used, if it was newly created.''
2011-03-13 04:07:38 +00:00
After the first time it's called, the @code{:save-function} will not
run again (but it will log something if you have set
@code{auth-source-debug} to @code{'trivia}). This is so it won't ask
the same question again, which is annoying. This is so it won't ask
the same question again, which is annoying. This is so it won't ask
the same question again, which is annoying.
So the responsibility of the API user that specified @code{:create t}
is to call the @code{:save-function} if it's provided.
2012-04-04 16:36:33 -04:00
@defun auth-source-delete &rest spec &key delete &allow-other-keys
This function deletes entries matching @var{spec} from the
authentication backends. It returns the entries that were deleted.
The backend may not actually delete the entries.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
@end defun
2010-03-28 23:55:59 +00:00
2012-04-04 16:36:33 -04:00
@defun auth-source-forget spec
This function forgets any cached data that exactly matches @var{spec}.
It returns @code{t} if it forget some data, and @code{nil} if no
matching data was found.
Merge changes made in Gnus trunk.
auth.texi (Overview, Help for users, Help for developers): Update docs.
(Help for users): Talk about spaces.
sieve-manage.el: Autoload `auth-source-search'.
(sieve-sasl-auth): Use it.
nnimap.el: Autoload `auth-source-forget+'.
(nnimap-open-connection-1): Use it if the connection fails.
auth-source.el: Require `password-cache'.
(auth-source-hide-passwords, auth-source-cache): Remove and mark obsolete.
(auth-source-magic): Marker for `password-cache' keys.
(auth-source-do-cache): Update docstring.
(auth-source-search): Use and check cache.
(auth-source-forget-all-cached, auth-source-remember)
(auth-source-recall, auth-source-forget, auth-source-forget+)
(auth-source-specmatchp): Caching support functions.
(auth-source-forget-user-or-password, auth-source-forget-all-cached): Remove and obsolete.
(auth-source-user-or-password): Remove caching to further discourage using it. Always hide passwords.
password-cache.el (password-cache-remove): Accept secrets that are not strings.
mail-source.el: Autoload `auth-source-search'.
(mail-source-keyword-map): Note order matters.
(mail-source-set-1): Get all the mail-source source values and defaults and search auth-source on those if needed. This can all probably be simplified.
nnimap.el: Autoload `auth-source-search'.
(nnimap-credentials): Use it.
(nnimap-open-connection-1): Ask for the virtual server and physical address in one shot.
nntp.el: Autoload `auth-source-search'.
(nntp-send-authinfo): Use it. Note TODO.
auth-source.el (auth-source-secrets-search, auth-source-user-or-password): Use `append' instead of `nconc'.
(auth-source-user-or-password): Build return list better and protect against nil :secret.
auth-source.el (top): Require 'eieio unconditionally. Autoload `secrets-get-attributes' instead of `secrets-get-attribute'.
(auth-source-secrets-search): Limit search when `max' is greater than number of results.
auth-source.el (auth-source-secrets-search): Add examples.
auth-source.el (auth-sources): Allow for simpler defaults for Secrets API with a string "secrets:collection-name" and with 'default.
(auth-source-backend-parse): Parse "secrets:collection-name" and 'default. Recurse on parses instead of repeating code. Use the Secrets API is the source is not nil and 'ignore otherwise. Emit a message when ignoring a source.
(auth-source-search): List ignored search keys at the top level.
(auth-source-netrc-create): Use `case' instead of `cond'.
(auth-source-secrets-search): Created with TODOs.
(auth-source-secrets-create): Created with TODOs.
(auth-source-retrieve, auth-source-create, auth-source-delete)
(auth-source-protocol-defaults, auth-source-user-or-password-imap)
(auth-source-user-or-password-pop3, auth-source-user-or-password-ssh)
(auth-source-user-or-password-sftp)
(auth-source-user-or-password-smtp): Removed.
(auth-source-user-or-password): Deprecated and modified to be a wrapper around `auth-source-search'. Not tested thoroughly.
auth-source.el: Bring in assoc and eioeio libraries.
(secrets-enabled): New variable to track the status of the Secrets API.
(auth-source-backend): New EIOEIO class to represent a backend.
(auth-source-creation-defaults): New variable to set prompt defaults during token creation (see the `auth-source-search' docstring for details).
(auth-sources): Simplify to allow a simple string as a netrc backend spec.
(auth-source-backend-parse): Parse a backend from an `auth-sources' spec.
(auth-source-backend-parse-parameters): Fill in the backend parameters.
(auth-source-search): Main auth-source API entry point.
(auth-source-delete): Wrapper around `auth-source-search' for deletion.
(auth-source-search-collection): Helper function for searching.
(auth-source-netrc-parse, auth-source-netrc-normalize)
(auth-source-netrc-search, auth-source-netrc-create): Netrc backend. Supports search, create, and delete.
(auth-source-secrets-search, auth-source-secrets-create): Secrets API backend stubs.
(auth-source-user-or-password): Call `auth-source-search' but it's not ready yet.
2011-02-13 00:25:29 +00:00
@end defun
2012-04-04 16:36:33 -04:00
@defun auth-source-forget+ &rest spec &allow-other-keys
This function forgets any cached data matching @var{spec}.
It returns the number of items forgotten.
2009-02-16 09:32:19 +00:00
@end defun
2022-01-09 17:36:38 -05:00
@defun auth-source-pick-first-password &rest spec
This function returns the password of the first record found by
applying @code{auth-source-search} to @var{spec}.
@end defun
@defun auth-info-password auth-info
This function extracts the password string from the @var{auth-info}
record.
@end defun
2010-10-08 23:55:33 +00:00
@node GnuPG and EasyPG Assistant Configuration
@appendix GnuPG and EasyPG Assistant Configuration
2014-02-07 21:07:55 -05:00
If the @code{auth-sources} variable contains @file{~/.authinfo.gpg}
before @file{~/.authinfo}, the auth-source library will try to
read the GnuPG encrypted @file{.gpg} file first, before
the unencrypted file.
2010-10-12 10:49:05 +09:00
2022-08-13 12:39:42 +02:00
There is an option @code{auto-encryption-mode} to automatically
decrypt @file{*.gpg} files. It is enabled by default.
2010-10-08 23:55:33 +00:00
2010-10-12 10:49:05 +09:00
If you want your GnuPG passwords to be cached, set up @code{gpg-agent}
2011-11-08 22:10:51 -08:00
or EasyPG Assistant
2010-10-15 12:21:03 +02:00
(@pxref{Caching Passphrases, , Caching Passphrases, epa}).
2010-10-08 23:55:33 +00:00
2010-10-12 10:49:05 +09:00
To quick start, here are some questions:
2010-10-08 23:55:33 +00:00
2017-04-03 21:36:03 +02:00
@itemize
2010-10-13 22:21:20 +00:00
@item
Do you use GnuPG version 2 instead of GnuPG version 1?
@item
Do you use symmetric encryption rather than public key encryption?
@item
Do you want to use gpg-agent?
2017-04-03 21:36:03 +02:00
@end itemize
2010-10-08 23:55:33 +00:00
Here are configurations depending on your answers:
@multitable {111} {222} {333} {configuration configuration configuration}
@item @b{1} @tab @b{2} @tab @b{3} @tab Configuration
2010-10-12 10:49:05 +09:00
@item Yes @tab Yes @tab Yes @tab Set up gpg-agent.
2010-10-08 23:55:33 +00:00
@item Yes @tab Yes @tab No @tab You can't, without gpg-agent.
2010-10-12 10:49:05 +09:00
@item Yes @tab No @tab Yes @tab Set up gpg-agent.
2010-10-08 23:55:33 +00:00
@item Yes @tab No @tab No @tab You can't, without gpg-agent.
@item No @tab Yes @tab Yes @tab Set up elisp passphrase cache.
@item No @tab Yes @tab No @tab Set up elisp passphrase cache.
2010-10-12 10:49:05 +09:00
@item No @tab No @tab Yes @tab Set up gpg-agent.
2010-10-08 23:55:33 +00:00
@item No @tab No @tab No @tab You can't, without gpg-agent.
@end multitable
2010-10-13 22:21:20 +00:00
To set up gpg-agent, follow the instruction in GnuPG manual
(@pxref{Invoking GPG-AGENT, , Invoking GPG-AGENT, gnupg}).
2010-10-08 23:55:33 +00:00
To set up elisp passphrase cache, set
@code{epa-file-cache-passphrase-for-symmetric-encryption}.
2012-12-21 11:01:24 -08:00
@node GNU Free Documentation License
@appendix GNU Free Documentation License
@include doclicense.texi
2009-02-16 09:32:19 +00:00
@node Index
2012-12-21 11:01:24 -08:00
@unnumbered Index
2009-02-16 09:32:19 +00:00
@printindex cp
@node Function Index
2012-12-21 11:01:24 -08:00
@unnumbered Function Index
2009-02-16 09:32:19 +00:00
@printindex fn
@node Variable Index
2012-12-21 11:01:24 -08:00
@unnumbered Variable Index
2009-02-16 09:32:19 +00:00
@printindex vr
@bye
@c End: