<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Authentication Settings — Bazaar v2.2.4 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '2.2.4', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/bzr.ico"/> <link rel="top" title="Bazaar v2.2.4 documentation" href="../index.html" /> <link rel="up" title="Bazaar User Reference" href="index.html" /> <link rel="next" title="Bug Tracker Settings" href="bugs-help.html" /> <link rel="prev" title="Working Trees" href="working-trees-help.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="bugs-help.html" title="Bug Tracker Settings" accesskey="N">next</a></li> <li class="right" > <a href="working-trees-help.html" title="Working Trees" accesskey="P">previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.2.4)</a> »</li> <li><a href="index.html" accesskey="U">Bazaar User Reference</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="authentication-settings"> <h1>Authentication Settings<a class="headerlink" href="#authentication-settings" title="Permalink to this headline">¶</a></h1> <div class="section" id="intent"> <h2>Intent<a class="headerlink" href="#intent" title="Permalink to this headline">¶</a></h2> <p>Many different authentication policies can be described in the <tt class="docutils literal"><span class="pre">authentication.conf</span></tt> file but a particular user should need only a few definitions to cover his needs without having to specify a user and a password for every branch he uses.</p> <p>The definitions found in this file are used to find the credentials to use for a given url. The same credentials can generally be used for as many branches as possible by grouping their declaration around the remote servers that need them. It’s even possible to declare credentials that will be used by different servers.</p> <p>The intent is to make this file as small as possible to minimize maintenance.</p> <p>Once the relevant credentials are declared in this file you may use branch urls without embedding passwords (security hazard) or even users (enabling sharing of your urls with others).</p> <p>Instead of using:</p> <div class="highlight-python"><pre>bzr branch ftp://joe:secret@host.com/path/to/my/branch</pre> </div> <p>you simply use:</p> <div class="highlight-python"><pre>bzr branch ftp://host.com/path/to/my/branch</pre> </div> <p>provided you have created the following <tt class="docutils literal"><span class="pre">authentication.conf</span></tt> file:</p> <div class="highlight-python"><div class="highlight"><pre><span class="p">[</span><span class="n">myprojects</span><span class="p">]</span> <span class="n">scheme</span><span class="o">=</span><span class="n">ftp</span> <span class="n">host</span><span class="o">=</span><span class="n">host</span><span class="o">.</span><span class="n">com</span> <span class="n">user</span><span class="o">=</span><span class="n">joe</span> <span class="n">password</span><span class="o">=</span><span class="n">secret</span> </pre></div> </div> </div> <div class="section" id="authentication-definitions"> <h2>Authentication definitions<a class="headerlink" href="#authentication-definitions" title="Permalink to this headline">¶</a></h2> <p>There are two kinds of authentication used by the various schemes supported by bzr:</p> <ol class="arabic simple"> <li>user and password</li> </ol> <p><tt class="docutils literal"><span class="pre">FTP</span></tt> needs a (<tt class="docutils literal"><span class="pre">user</span></tt>, <tt class="docutils literal"><span class="pre">password</span></tt>) to authenticate against a <tt class="docutils literal"><span class="pre">host</span></tt> <tt class="docutils literal"><span class="pre">SFTP</span></tt> can use either a password or a host key to authenticate. However, ssh agents are a better, more secure solution. So we have chosen to not provide our own less secure method.</p> <ol class="arabic simple" start="2"> <li>user, realm and password</li> </ol> <p><tt class="docutils literal"><span class="pre">HTTP</span></tt> and <tt class="docutils literal"><span class="pre">HTTPS</span></tt> needs a (<tt class="docutils literal"><span class="pre">user,</span> <span class="pre">realm,</span> <span class="pre">password</span></tt>) to authenticate against a host. But, by using <tt class="docutils literal"><span class="pre">.htaccess</span></tt> files, for example, it is possible to define several (<tt class="docutils literal"><span class="pre">user,</span> <span class="pre">realm,</span> <span class="pre">password</span></tt>) for a given <tt class="docutils literal"><span class="pre">host</span></tt>. So what is really needed is (<tt class="docutils literal"><span class="pre">user</span></tt>, <tt class="docutils literal"><span class="pre">password</span></tt>, <tt class="docutils literal"><span class="pre">host</span></tt>, <tt class="docutils literal"><span class="pre">path</span></tt>). The <tt class="docutils literal"><span class="pre">realm</span></tt> is not taken into account in the definitions, but will displayed if bzr prompts you for a password.</p> <p><tt class="docutils literal"><span class="pre">HTTP</span> <span class="pre">proxy</span></tt> can be handled as <tt class="docutils literal"><span class="pre">HTTP</span></tt> (or <tt class="docutils literal"><span class="pre">HTTPS</span></tt>) by explicitly specifying the appropriate port.</p> <p>To take all schemes into account, the password will be deduced from a set of authentication definitions (<tt class="docutils literal"><span class="pre">scheme</span></tt>, <tt class="docutils literal"><span class="pre">host</span></tt>, <tt class="docutils literal"><span class="pre">port</span></tt>, <tt class="docutils literal"><span class="pre">path</span></tt>, <tt class="docutils literal"><span class="pre">user</span></tt>, <tt class="docutils literal"><span class="pre">password</span></tt>).</p> <blockquote> <div><ul class="simple"> <li><tt class="docutils literal"><span class="pre">scheme</span></tt>: can be empty (meaning the rest of the definition can be used for any scheme), <tt class="docutils literal"><span class="pre">SFTP</span></tt> and <tt class="docutils literal"><span class="pre">bzr+ssh</span></tt> should not be used here, <tt class="docutils literal"><span class="pre">ssh</span></tt> should be used instead since this is the real scheme regarding authentication,</li> <li><tt class="docutils literal"><span class="pre">host</span></tt>: can be empty (to act as a default for any host),</li> <li><tt class="docutils literal"><span class="pre">port</span></tt> can be empty (useful when an host provides several servers for the same scheme), only numerical values are allowed, this should be used only when the server uses a port different than the scheme standard port,</li> <li><tt class="docutils literal"><span class="pre">path</span></tt>: can be empty (FTP or SFTP will never user it),</li> <li><tt class="docutils literal"><span class="pre">user</span></tt>: can be empty (<tt class="docutils literal"><span class="pre">bzr</span></tt> will defaults to python’s <tt class="docutils literal"><span class="pre">getpass.get_user()</span></tt>),</li> <li><tt class="docutils literal"><span class="pre">password</span></tt>: can be empty if you prefer to always be prompted for your password.</li> </ul> </div></blockquote> <p>Multiple definitions can be provided and, for a given URL, bzr will select a (<tt class="docutils literal"><span class="pre">user</span></tt> [, <tt class="docutils literal"><span class="pre">password</span></tt>]) based on the following rules :</p> <blockquote> <div><ol class="arabic simple"> <li>the first match wins,</li> <li>empty fields match everything,</li> <li><tt class="docutils literal"><span class="pre">scheme</span></tt> matches even if decorators are used in the requested URL,</li> <li><tt class="docutils literal"><span class="pre">host</span></tt> matches exactly or act as a domain if it starts with ‘.’ (<tt class="docutils literal"><span class="pre">project.bzr.sf.net</span></tt> will match <tt class="docutils literal"><span class="pre">.bzr.sf.net</span></tt> but <tt class="docutils literal"><span class="pre">projectbzr.sf.net</span></tt> will not match <tt class="docutils literal"><span class="pre">bzr.sf.net</span></tt>).</li> <li><tt class="docutils literal"><span class="pre">port</span></tt> matches if included in the requested URL (exact matches only)</li> <li><tt class="docutils literal"><span class="pre">path</span></tt> matches if included in the requested URL (and by rule #2 above, empty paths will match any provided path).</li> </ol> </div></blockquote> </div> <div class="section" id="file-format"> <h2>File format<a class="headerlink" href="#file-format" title="Permalink to this headline">¶</a></h2> <p>The general rules for <a class="reference internal" href="configuration-help.html"><em>configuration files</em></a> apply except for the variable policies.</p> <p>Each section describes an authentication definition.</p> <p>The section name is an arbitrary string, only the <tt class="docutils literal"><span class="pre">DEFAULT</span></tt> value is reserved and should appear as the <em>last</em> section.</p> <p>Each section should define:</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">user</span></tt>: the login to be used,</li> </ul> <p>Each section could define:</p> <ul class="simple"> <li><tt class="docutils literal"><span class="pre">host</span></tt>: the remote server,</li> <li><tt class="docutils literal"><span class="pre">port</span></tt>: the port the server is listening,</li> <li><tt class="docutils literal"><span class="pre">path</span></tt>: the branch location,</li> <li><tt class="docutils literal"><span class="pre">password</span></tt>: the password.</li> </ul> </div> <div class="section" id="examples"> <h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2> <div class="section" id="personal-projects-hosted-outside"> <h3>Personal projects hosted outside<a class="headerlink" href="#personal-projects-hosted-outside" title="Permalink to this headline">¶</a></h3> <p>All connections are done with the same <tt class="docutils literal"><span class="pre">user</span></tt> (the remote one for which the default bzr one is not appropriate) and the password is always prompted with some exceptions:</p> <div class="highlight-python"><pre># Pet projects on hobby.net [hobby] host=r.hobby.net user=jim password=obvious1234 # Home server [home] scheme=https host=home.net user=joe password=1essobV10us [DEFAULT] # Our local user is barbaz, on all remote sites we're known as foobar user=foobar</pre> </div> </div> <div class="section" id="source-hosting-provider"> <h3>Source hosting provider<a class="headerlink" href="#source-hosting-provider" title="Permalink to this headline">¶</a></h3> <p>In the shp.net (fictitious) domain, each project has its own site:</p> <div class="highlight-python"><pre>[shpnet domain] # we use sftp, but ssh is the scheme used for authentication scheme=ssh # The leading '.' ensures that 'shp.net' alone doesn't match host=.shp.net user=joe # bzr don't support supplying a password for sftp, # consider using an ssh agent if you don't want to supply # a password interactively. (pageant, ssh-agent, etc)</pre> </div> </div> <div class="section" id="https-sftp-servers-and-their-proxy"> <h3>HTTPS, SFTP servers and their proxy<a class="headerlink" href="#https-sftp-servers-and-their-proxy" title="Permalink to this headline">¶</a></h3> <p>At company.com, the server hosting release and integration branches is behind a proxy, and the two branches use different authentication policies:</p> <div class="highlight-python"><pre>[reference code] scheme=https host=dev.company.com path=/dev user=user1 password=pass1 # development branches on dev server [dev] scheme=ssh # bzr+ssh and sftp are available here host=dev.company.com path=/dev/integration user=user2 # proxy [proxy] scheme=http host=proxy.company.com port=3128 user=proxyuser1 password=proxypass1</pre> </div> </div> </div> <div class="section" id="planned-enhancements"> <h2>Planned enhancements<a class="headerlink" href="#planned-enhancements" title="Permalink to this headline">¶</a></h2> <p>The following are not yet implemented but planned as parts of a work in progress:</p> <ul class="simple"> <li>add a <tt class="docutils literal"><span class="pre">password_encoding</span></tt> field allowing:<ul> <li>storing the passwords in various obfuscating encodings (base64 for one),</li> <li>delegate password storage to plugins (.netrc for example).</li> </ul> </li> <li>update the credentials when the user is prompted for user or password,</li> <li>add a <tt class="docutils literal"><span class="pre">verify_certificates</span></tt> field for <tt class="docutils literal"><span class="pre">HTTPS</span></tt>.</li> </ul> <p>The <tt class="docutils literal"><span class="pre">password_encoding</span></tt> and <tt class="docutils literal"><span class="pre">verify_certificates</span></tt> fields are recognized but ignored in the actual implementation.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Authentication Settings</a><ul> <li><a class="reference internal" href="#intent">Intent</a></li> <li><a class="reference internal" href="#authentication-definitions">Authentication definitions</a></li> <li><a class="reference internal" href="#file-format">File format</a></li> <li><a class="reference internal" href="#examples">Examples</a><ul> <li><a class="reference internal" href="#personal-projects-hosted-outside">Personal projects hosted outside</a></li> <li><a class="reference internal" href="#source-hosting-provider">Source hosting provider</a></li> <li><a class="reference internal" href="#https-sftp-servers-and-their-proxy">HTTPS, SFTP servers and their proxy</a></li> </ul> </li> <li><a class="reference internal" href="#planned-enhancements">Planned enhancements</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="working-trees-help.html" title="previous chapter">Working Trees</a></p> <h4>Next topic</h4> <p class="topless"><a href="bugs-help.html" title="next chapter">Bug Tracker Settings</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/user-reference/authentication-help.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="bugs-help.html" title="Bug Tracker Settings" >next</a></li> <li class="right" > <a href="working-trees-help.html" title="Working Trees" >previous</a> |</li> <li><a href="http://bazaar.canonical.com/"> <img src="../_static/bzr icon 16.png" /> Home</a> | </li> <a href="http://doc.bazaar.canonical.com/en/">Documentation</a> | </li> <li><a href="../index.html">Table of Contents (2.2.4)</a> »</li> <li><a href="index.html" >Bazaar User Reference</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009, Canonical Ltd. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7. </div> </body> </html>