srchub-install

srchub-install Commit Details


Date:2017-05-01 21:27:23 (7 years 7 months ago)
Author:Natalie Adams
Branch:master
Commit:de4a3cdfc6bda3249c9297e59599083069250232
Parents: b66e41f60abfe0ca7116658b59cd777b8a57bb95
Message:Adding conf files

Changes:

File differences

AuthBasic.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* File::Passwd::Authbasic
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.0 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_0.txt. If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category FileFormats
* @package File_Passwd
* @author Michael Wallner <mike@php.net>
* @copyright 2003-2005 Michael Wallner
* @license http://www.php.net/license/3_0.txt PHP License 3.0
* @version CVS: $Id: Authbasic.php,v 1.17 2005/03/30 18:33:33 mike Exp $
* @link http://pear.php.net/package/File_Passwd
*/
/**
* Requires File::Passwd::Common
*/
require_once 'File/Passwd/Common.php';
/**
* Manipulate AuthUserFiles as used for HTTP Basic Authentication.
*
* <kbd><u>
* Usage Example:
* </u></kbd>
* <code>
* $htp = &File_Passwd::factory('AuthBasic');
* $htp->setMode('sha');
* $htp->setFile('/www/mike/auth/.htpasswd');
* $htp->load();
* $htp->addUser('mike', 'secret');
* $htp->save();
* </code>
*
* <kbd><u>
* Output of listUser()
* </u></kbd>
* <pre>
* array
* + user => crypted_passwd
* + user => crypted_passwd
* </pre>
*
* @author Michael Wallner <mike@php.net>
* @package File_Passwd
* @version $Revision: 1.17 $
* @access public
*/
class File_Passwd_Authbasic extends File_Passwd_Common
{
/**
* Path to AuthUserFile
*
* @var string
* @access private
*/
var $_file = '.htpasswd';
/**
* Actual encryption mode
*
* @var string
* @access private
*/
var $_mode = 'sha';
/**
* Supported encryption modes
*
* @var array
* @access private
*/
var $_modes = array('plain' => 'p', 'md5' => 'm', 'des' => 'd', 'sha' => 's');
/**
* Constructor
*
* @access public
* @param string $file path to AuthUserFile
*/
function File_Passwd_Authbasic($file = '.htpasswd')
{
File_Passwd_Authbasic::__construct($file);
}
/**
* Constructor (ZE2)
*
* Rewritten because DES encryption is not
* supportet by the Win32 httpd.
*
* @access protected
* @param string $file path to AuthUserFile
*/
function __construct($file = '.htpasswd')
{
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
unset($this->_modes['des']);
}
$this->setFile($file);
}
/**
* Fast authentication of a certain user
*
* Returns a PEAR_Error if:
* o file doesn't exist
* o file couldn't be opened in read mode
* o file couldn't be locked exclusively
* o file couldn't be unlocked (only if auth fails)
* o file couldn't be closed (only if auth fails)
*
* @static call this method statically for a reasonable fast authentication
*
* @throws PEAR_Error
* @access public
* @return mixed true if authenticated, false if not or PEAR_Error
* @param string $file path to passwd file
* @param string $user user to authenticate
* @param string $pass plaintext password
* @param string $mode des, sha or md5
*/
function staticAuth($file, $user, $pass, $mode)
{
$line = File_Passwd_Common::_auth($file, $user);
if (!$line || PEAR::isError($line)) {
return $line;
}
list(,$real) = explode(':', $line);
$crypted = File_Passwd_Authbasic::_genPass($pass, $real, $mode);
if (PEAR::isError($crypted)) {
return $crypted;
}
return ($real === $crypted);
}
/**
* Apply changes and rewrite AuthUserFile
*
* Returns a PEAR_Error if:
* o directory in which the file should reside couldn't be created
* o file couldn't be opened in write mode
* o file couldn't be locked exclusively
* o file couldn't be unlocked
* o file couldn't be closed
*
* @throws PEAR_Error
* @access public
* @return mixed true on success or PEAR_Error
*/
function save()
{
$content = '';
foreach ($this->_users as $user => $pass) {
$content .= $user . ':' . $pass . "\n";
}
return $this->_save($content);
}
/**
* Add an user
*
* The username must start with an alphabetical character and must NOT
* contain any other characters than alphanumerics, the underline and dash.
*
* Returns a PEAR_Error if:
* o user already exists
* o user contains illegal characters
*
* @throws PEAR_Error
* @access public
* @return mixed true on success or PEAR_Error
* @param string $user
* @param string $pass
*/
function addUser($user, $pass)
{
if ($this->userExists($user)) {
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_EXISTS_ALREADY_STR, 'User ', $user),
FILE_PASSWD_E_EXISTS_ALREADY
);
}
if (!preg_match($this->_pcre, $user)) {
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_INVALID_CHARS_STR, 'User ', $user),
FILE_PASSWD_E_INVALID_CHARS
);
}
$this->_users[$user] = $this->_genPass($pass);
return true;
}
/**
* Change the password of a certain user
*
* Returns a PEAR_Error if user doesn't exist.
*
* @throws PEAR_Error
* @access public
* @return mixed true on success or a PEAR_Error
* @param string $user the user whose password should be changed
* @param string $pass the new plaintext password
*/
function changePasswd($user, $pass)
{
if (!$this->userExists($user)) {
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_EXISTS_NOT_STR, 'User ', $user),
FILE_PASSWD_E_EXISTS_NOT
);
}
$this->_users[$user] = $this->_genPass($pass);
return true;
}
/**
* Verify password
*
* Returns a PEAR_Error if:
* o user doesn't exist
* o an invalid encryption mode was supplied
*
* @throws PEAR_Error
* @access public
* @return mixed true if passwords equal, false if they don't, or PEAR_Error
* @param string $user the user whose password should be verified
* @param string $pass the plaintext password to verify
*/
function verifyPasswd($user, $pass)
{
if (!$this->userExists($user)) {
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_EXISTS_NOT_STR, 'User ', $user),
FILE_PASSWD_E_EXISTS_NOT
);
}
$real = $this->_users[$user];
return ($real === $this->_genPass($pass, $real));
}
/**
* Get actual encryption mode
*
* @access public
* @return string
*/
function getMode()
{
return $this->_mode;
}
/**
* Get supported encryption modes
*
* <pre>
* array
* + md5
* + sha
* + des
* </pre>
*
* ATTN: DES encryption not available on Win32!
*
* @access public
* @return array
*/
function listModes()
{
return array_keys($this->_modes);
}
/**
* Set the encryption mode
*
* You can choose one of md5, sha or des.
*
* ATTN: DES encryption not available on Win32!
*
* Returns a PEAR_Error if a specific encryption mode is not supported.
*
* @throws PEAR_Error
* @access public
* @return mixed true on succes or PEAR_Error
* @param string $mode
*/
function setMode($mode)
{
$mode = strToLower($mode);
if (!isset($this->_modes[$mode])) {
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $this->_mode),
FILE_PASSWD_E_INVALID_ENC_MODE
);
}
$this->_mode = $mode;
return true;
}
/**
* Generate password with htpasswd executable
*
* @access private
* @return string the crypted password
* @param string $pass the plaintext password
* @param string $salt the salt to use
* @param string $mode encyption mode, usually determined from
* <var>$this->_mode</var>
*/
function _genPass($pass, $salt = null, $mode = null)
{
$mode = is_null($mode) ? strToLower($this->_mode) : strToLower($mode);
if ($mode == 'md5') {
return File_Passwd::crypt_apr_md5($pass, $salt);
} elseif ($mode == 'des') {
return File_Passwd::crypt_des($pass, $salt);
} elseif ($mode == 'sha') {
return File_Passwd::crypt_sha($pass, $salt);
} else if ($mode == 'plain') {
return $pass;
}
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $mode),
FILE_PASSWD_E_INVALID_ENC_MODE
);
}
/**
* Parse the AuthUserFile
*
* Returns a PEAR_Error if AuthUserFile has invalid format.
*
* @throws PEAR_Error
* @access public
* @return mixed true on success or PEAR_error
*/
function parse()
{
$this->_users = array();
foreach ($this->_contents as $line) {
$user = explode(':', $line);
if (count($user) != 2) {
return PEAR::raiseError(
FILE_PASSWD_E_INVALID_FORMAT_STR,
FILE_PASSWD_E_INVALID_FORMAT
);
}
$this->_users[$user[0]] = trim($user[1]);
}
$this->_contents = array();
return true;
}
/**
* Generate Password
*
* Returns PEAR_Error FILE_PASSD_E_INVALID_ENC_MODE if the supplied
* encryption mode is not supported.
*
* @static
* @access public
* @return mixed The crypted password on success or PEAR_Error on failure.
* @param string $pass The plaintext password.
* @param string $mode The encryption mode to use (des|md5|sha).
* @param string $salt The salt to use.
*/
function generatePasswd($pass, $mode = FILE_PASSWD_DES, $salt = null)
{
if (!in_array(strToLower($mode), array('des', 'md5', 'sha'))) {
return PEAR::raiseError(
sprintf(FILE_PASSWD_E_INVALID_ENC_MODE_STR, $this->_mode),
FILE_PASSWD_E_INVALID_ENC_MODE
);
}
return File_Passwd_Authbasic::_genPass($pass, $salt, $mode);
}
/**
* @ignore
* @deprecated
*/
function generatePassword($pass, $mode = FILE_PASSWD_DES, $salt = null)
{
return File_Passwd_Authbasic::generatePasswd($pass, $mode, $salt);
}
}
git.run
1
2
3
4
5
#!/bin/sh
exec 2>&1
echo 'git-daemon starting.'
exec chpst -ugit:git \
"$(git --exec-path)"/git-daemon --verbose --base-path=/home/git/repositories /home/git/repositories
indefero.base.conf
1
Include /home/www/indefero/scripts/private_indefero.conf
indefero.cron
1
2
3
4
*/5 * * * * /bin/sh /home/www/indefero/scripts/SyncMercurial.sh
15 * * * * /usr/bin/php5 /home/www/indefero/scripts/calculateforgecron.php
0 1 * * * /usr/bin/php5 /home/www/indefero/scripts/activitycron.php
*/5 * * * * /usr/bin/php5 /home/www/indefero/scripts/queuecron.php
indefero.hg.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ScriptAliasMatch ^/hg(.*) /home/www/indefero/scripts/hgweb.cgi$1
<Location /hg>
Options +ExecCGI
AuthName "Restricted"
AuthType Basic
AuthUserFile /home/mercurial/.htpasswd
<Limit PUT POST>
Require valid-user
</Limit>
</Location>
<Directory /home/indefero/scripts>
Options +ExecCGI
AuthName "Restricted"
AuthType Basic
AuthUserFile /home/mercurial/.htpasswd
<Limit PUT POST>
Require valid-user
</Limit>
</Directory>
indefero.svn.conf
1
2
3
4
5
6
7
8
9
10
<Location /svn>
DAV svn
SVNParentPath /home/svn/repositories
AuthzSVNAccessFile /home/svn/dav_svn.authz
Satisfy Any
Require valid-user
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /home/svn/dav_svn.passwd
</Location>

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.07483s using 14 queries.