41
41
This specification also proposes a way to describe credentials so that several
42
42
remote branches can use the same definition. This is particularily important
43
for users handling a lot of passwords who need to update them on a regular
43
for users handling a lot of passwords and who need to update them on a regular
61
61
This specification describes a way to provide user and passwords to bzr while
62
62
storing them in a relatively safe way.
64
Note that ssh servers can be configured to use keys instead of (``user``,
64
Note that SSH servers can be configured to use keys instead of (``user``,
65
65
``password``) and, when used with appropriate agents, provide the same kind of
66
comfort this specification aims to provide for all other schemes. These
67
specification do not try to cover these configurations by providing
68
pass-phrases, but the mechanisms presented *can* be used to provide users.
66
comfort this specification aims to provide for all other schemes. Since SSH
67
agents provide a safer way to secure the passwords, this specification is
68
restricted to providing ``user`` but does not provide ``password`` when used
70
71
Authentication definitions
71
72
--------------------------
76
77
1. user and password
78
79
``FTP`` and ``SFTP`` needs a (``user``, ``password``) to authenticate against a
79
``host`` (SFTP can use ssh keys too, but we don't talk about that in this
80
specification as ssh agents provide a better solution).
80
``host`` (SFTP can use SSH keys too, but we don't talk about that in this
81
specification as SSH agents provide a better solution).
82
83
2. user, realm and password
87
88
really needed is (``user``, ``password``, ``host``, ``path``). The ``realm``
88
89
can be ignored [#ignored_realm]_ as long as it is still presented to the user
89
90
when prompting for the password (unless someone found a way to declare two
90
different realms for the same path).
91
different realms for the same path).
92
``HTTP proxy`` can be handled as ``HTTP`` (or ``HTTPS``) by explicitely
93
``HTTP proxy`` can be handled as ``HTTP`` (or ``HTTPS``) by explicitly
93
94
specifying the appropriate port.
95
96
.. [#ignored_realm] The true purpose of realms is to allow the same credentials
112
113
same scheme), only numerical values are allowed, this should be used only
113
114
when the server uses a port different than the scheme standard port,
115
* ``path``: can be empty (FTP or SFTP will never user it),
116
* ``path``: can be empty (FTP or SFTP will never use it),
117
* ``user``: can be empty (``bzr`` will defaults to python's
118
``getpass.get_user()`` and attempt another matching(see below)),
118
* ``user``: can be empty (``bzr`` will defaults to Python's
119
``getpass.get_user()`` for FTP, SFTP and SSH),
120
121
* ``password``: can be empty (for security reasons, a user may use the
121
122
definitions without storing the passwords but want to be prompted ; or the
122
123
password will be provided by an external plugin via the
123
``password_encoding`` mechanism decribed below).
124
``password_encoding`` mechanism decribed below). Must be left empty for
125
127
* ``password_encoding``: can be empty (default is ``plaintext``).
127
129
Also note that an optional ``verify_certificates=no`` field will allow the
128
130
connection to ``HTTPS`` hosts that provides a self certified certificate (the
129
default should be to refuse the connection and inform the user).
131
default should be to refuse the connection and inform the user). (Not
131
134
Multiple definitions can be provided and, for a given URL, bzr will select a
132
135
(``user`` [, ``password``]) based on the following rules :
157
160
accidental reading (if an administrator have to look into the file, he will not
158
161
see the passwords in clear).
160
This specification intend to ease the authentication providing, not to secure
163
This specification intends to ease the authentication providing, not to secure
161
164
it in the best possible way.
166
Plugins can provide additional password encodings. The provided
167
``netrc_credential_store`` plugin can be used as an example implementation.
163
169
Future versions of this specification may provide additional
164
170
encodings [#password_encoding]_.
167
173
that will rely on external means to store the password which, in these
168
174
cases, will not appear anymore in the definition. It is assumed that
169
175
additional password encodings will provide a storage outside of the file
170
described here. An encoding named ``netrc`` for example will provide
171
passwords by retrieving them in the ``.netrc`` file.
176
described here. The ``netrc`` encoding, for example, provides passwords by
177
retrieving them from the ``.netrc`` file.
186
192
generally servers. The same authentification definition can even be used
187
193
for several schemes for servers providing those schemes.
189
``~/.bazaar/authentication.conf`` will use the same file format than
195
``~/.bazaar/authentication.conf`` will use the same file format as
190
196
``~/.bazaar/bazaar.conf``.
192
198
Each section describes an authentication definition.
205
211
* ``port``: the port the server is listening,
207
213
* ``verify_certificates``: to control certificate verification (useful
208
for self certified hosts). This applies to HTTP[S] only. Accepted values
214
for self certified hosts). This applies to HTTPS only. Accepted values
209
215
are yes and no, default to yes.
211
217
* ``path``: the branch location,
256
262
password=obvious1234
269
# Obtain the base64 encoded password by running 'echo -n "secret-pass" | base64'
263
270
password='c2VjcmV0LXBhc3M='
264
271
password_encoding=base64
265
272
verify_certificates=no # Still searching a free certificate provider
268
275
# Our local user is barbaz, on all remote sites we're known as foobar
271
278
* an HTTP server and a proxy::
273
280
# development branches on dev server
297
304
* source hosting provider declaring sub-domains for each project::
300
# we use sftp, but ssh is the scheme used for authentication
307
# we use SFTP, but SSH is the scheme used for authentication
302
309
# The leading '.' ensures that 'sf.net' alone doesn't match
323
330
3. No ``user`` given in the URL (and no ``password``).
325
332
Get a user from ``~/.bazaar/authentication.conf`` or prompt for one if none is
326
found. Continue as 2.
333
found. Continue as 2. (Not implemented yet)
328
335
Note: A user will be queried only if the server requires it for ``HTTP`` or
329
336
``HTTPS``, other protocols always require a user.
341
348
* No assumptions should be made about the clients of this service
342
349
(i.e. Transport is the primary target but plugins must be able to use it as
343
350
well, the definitions used: (``scheme, host, [port,] path``) are general
344
enough to described credentials for ``svn`` servers or LaunchPad xmlrpc
351
enough to described credentials for ``svn`` servers or LaunchPad XML-RPC
347
354
* Policies regarding default users may be taken into account by the
357
364
* As this specification proposes a matching between some credentials
358
definitions and real urls, the implementation should provide an optional UI
359
feedback about which credential definition is used. That will allow the user
360
to validate his definitions.
365
definitions and real URLs, the implementation provides an optional UI
366
feedback about which credential definition is used. Using ``-Dauth`` will
367
output some traces in the ``.bzr.log`` file metionning the sections
368
used. This allows the user to validate his definitions.
362
370
Questions and Answers
363
371
---------------------
372
380
* What if a ``.netrc`` file exists ?
374
* It will be honored if the definition specifies
375
``password_encoding=netrc`` once the appropriate plugin have been
382
* It is honored if the definition specifies
383
``password_encoding=netrc``.
378
385
* What mode should the authentication file use ?
380
387
* 600 read/write for owner only by default, if another mode (more
381
388
permissive) is used, a warning will be issued to inform the users of the
389
potential risks.(Not implemented yet)
384
391
* What about using ``seahorse`` on Ubuntu or ``KeyChain Access`` on Mac OS X ?
386
393
* plugins can be written and registered to handle the associated
387
394
``password_encoding``.
389
* Could it be possible to encode the whole authentication file with a ssh key
396
* Could it be possible to encode the whole authentication file with an SSH key
392
399
* yes and if the user configure a ssh-agent it will not be queried for
393
pass-phrase every time we want to query the file for a password. But that
394
seems a bit extreme for a first version.
400
pass-phrase every time we want to query the file for a password. But
401
that seems a bit extreme for a first version.(Not implemented yet and
396
404
* Why can't bzr update the authentication file when it queried the user for a