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 | |
| 73 | The 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 | |
| 79 | where: |
| 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 | |
| 89 | Examples: |
| 90 | |
| 91 | {{{ |
| 92 | $ tracd -p 8080 \ |
| 93 | --auth="project1,/path/to/passwordfile,mycompany.com" /path/to/project1 |
| 94 | }}} |
| 95 | |
| 96 | Of 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 | |
| 104 | Another 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 === |
| 112 | This section describes how to use `tracd` with Apache .htpasswd files. |
| 113 | |
| 114 | To create a .htpasswd file use Apache's `htpasswd` command (see [#GeneratingPasswordsWithoutApache below] for a method to create these files without using Apache): |
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 | |
| 124 | Then to start `tracd` run something like this: |
| 125 | |
| 126 | {{{ |
| 127 | $ tracd -p 8080 --basic-auth="projectdirname,/fullpath/environmentname/.htpasswd,realmname" /fullpath/environmentname |
| 128 | }}} |
| 129 | |
| 130 | For 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 === |