Edgewall Software

Changes between Version 77 and Version 78 of TracStandalone


Ignore:
Timestamp:
Mar 19, 2010, 12:21:16 PM (14 years ago)
Author:
Sebastian Krysmanski <sebastian@…>
Comment:

Restructured information and remove not about skipping the "=" on Windows as this doesn't have particular benefit (and a some places was simply wrong)

Legend:

Unmodified
Added
Removed
Modified
  • TracStandalone

    v77 v78  
    6767
    6868== Using Authentication ==
    69 
    70 Using tracd with Apache .htpasswd files:
    71 
    72 To create a .htpasswd file using htpasswd:
     69`tracd` provides support for both Basic and Digest authentication. The default is to use Digest.
     70
     71  ''Support for Basic authentication was added in version 0.9.''
     72
     73The general format for using authentication is (replace `--auth` with `--basic-auth` if you want to use Basic auth):
     74
     75{{{
     76 $ tracd -p port --auth="base_project_dir,password_file_path,realm" project_path
     77}}}
     78
     79where:
     80
     81 * '''base_project_dir''': the base directory of the project specified as follows:
     82   * when serving multiple projects: ''relative'' to the `project_bath`
     83   * when serving only a single project (`-s`): the name of the project directory
     84 Don't use an absolute path here as this won't work. ''Note:'' This parameter is case-sensitive even for environments on Windows.
     85 * '''password_file_path''': path to the password file
     86 * '''realm''': the realm name (can be anything)
     87 * '''project_path''': path of the project
     88
     89Examples:
     90
     91{{{
     92 $ tracd -p 8080 \
     93   --auth="project1,/path/to/passwordfile,mycompany.com" /path/to/project1
     94}}}
     95
     96Of course, the password file can be be shared so that it is used for more than one project:
     97{{{
     98 $ tracd -p 8080 \
     99   --auth="project1,/path/to/passwordfile,mycompany.com" \
     100   --auth="project2,/path/to/passwordfile,mycompany.com" \
     101   /path/to/project1 /path/to/project2
     102}}}
     103
     104Another way to share the password file is to specify "*" for the project name:
     105{{{
     106 $ tracd -p 8080 \
     107   --auth="*,/path/to/users.htdigest,mycompany.com" \
     108   /path/to/project1 /path/to/project2
     109}}}
     110
     111=== Using a htpasswd password file ===
     112This section describes how to use `tracd` with Apache .htpasswd files.
     113
     114To create a .htpasswd file use Apache's `htpasswd` command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache):
    73115
    74116{{{
     
    79121 $ sudo htpasswd /path/to/env/.htpasswd username2
    80122}}}
    81 then for starting the tracd:
    82 
    83 {{{
    84  $ tracd -p 8080 --basic-auth=environmentname,/fullpath/environmentname/.htpasswd,/fullpath/environmentname /fullpath/environmentname
    85 }}}
    86 
    87 someone reported, '=' can be skipped under Windows environment, as my tested, (under Windows 7), quotation mark is required, otherwise you will get an error:tracd-script.py: error: Incorrect number of parameters for --basic-auth
    88 {{{
    89  $ tracd -p 8080 --basic-auth='environmentname,/fullpath/environmentname/.htpasswd,/fullpath/environmentname' /fullpath/environmentname
    90 }}}
    91 
    92 Note: You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD).
    93 
    94 Tracd provides support for both Basic and Digest authentication. The default is to use Digest; to use Basic authentication, replace `--auth` with `--basic-auth` in the examples below. (You must still specify a dialogic "realm", which can be an empty string by trailing the BASICAUTH with a comma.)
    95 
    96   ''Support for Basic authentication was added in version 0.9.''
    97 
    98 The general format for using authentication is (on windows skip the "=" after --auth):
    99 
    100 {{{
    101  $ tracd -p port --auth=base_project_dir,password_file_path,realm project_path
    102 }}}
    103 
    104 where:
    105 
    106  * '''base_project_dir''' is the base directory of the project; note: this doesn't refer to the project name, and it is case-sensitive even for windows environments
    107  * '''password_file_path''' path of the password file
    108  * '''realm''' realm
    109  * '''project_path''' path of the project
    110 
    111 Example (on windows skip the "=" after --auth):
    112 
    113 {{{
    114  $ tracd -p 8080 \
    115    --auth=project1,/path/to/users.htdigest,mycompany.com /path/to/project1
    116 }}}
    117 Of course, the digest file can be be shared so that it is used for more than one project:
    118 {{{
    119  $ tracd -p 8080 \
    120    --auth=project1,/path/to/users.htdigest,mycompany.com \
    121    --auth=project2,/path/to/users.htdigest,mycompany.com \
    122    /path/to/project1 /path/to/project2
    123 }}}
    124 
    125 Another way to share the digest file is to specify "*"
    126 for the project name:
    127 {{{
    128  $ tracd -p 8080 \
    129    --auth="*",/path/to/users.htdigest,mycompany.com \
    130    /path/to/project1 /path/to/project2
    131 }}}
    132 If using the `-s` parameter for serving a Trac environment from the root of a domain, one must use `*` for the project name
    133 
    134 == How to set up an htdigest password file ==
     123
     124Then to start `tracd` run something like this:
     125
     126{{{
     127 $ tracd -p 8080 --basic-auth="projectdirname,/fullpath/environmentname/.htpasswd,realmname" /fullpath/environmentname
     128}}}
     129
     130For example:
     131
     132{{{
     133 $ tracd -p 8080 --basic-auth="testenv,/srv/tracenv/testenv/.htpasswd,My Test Env" /srv/tracenv/testenv
     134}}}
     135
     136''Note:'' You might need to pass "-m" as a parameter to htpasswd on some platforms (OpenBSD).
     137
     138=== Using a htdigest password file ===
    135139
    136140If you have Apache available, you can use the htdigest command to generate the password file. Type 'htdigest' to get some usage instructions, or read [http://httpd.apache.org/docs/2.0/programs/htdigest.html this page] from the Apache manual to get precise instructions.  You'll be prompted for a password to enter for each user that you create.  For the name of the password file, you can use whatever you like, but if you use something like `users.htdigest` it will remind you what the file contains. As a suggestion, put it in your <projectname>/conf folder along with the [TracIni trac.ini] file.
     
    138142Note that you can start tracd without the --auth argument, but if you click on the ''Login'' link you will get an error.
    139143
    140 == Generating Passwords Without Apache ==
     144=== Generating Passwords Without Apache ===
    141145
    142146If you don't have Apache available, you can use this simple Python script to generate your passwords: