#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2016 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
"port|p=i",
"ssl:i",
"single|X",
+ "auth|A:s",
"modules=s",
# Set ssl port if they want it but didn't provide a number
$opt{ssl} = 4430 if defined $opt{ssl} and not $opt{ssl};
+# Default auth to on if they set $WebRemoteUserAuth
+$opt{auth} = '' if not exists $opt{auth} and parseconf( "WebRemoteUserAuth" );
+
+# Set an auth path if they want it but didn't pass a path
+if (defined $opt{auth} and not $opt{auth}) {
+ $opt{auth} = "$opt{root}/var/htpasswd";
+ unless (-f $opt{auth}) {
+ open(my $fh, ">", $opt{auth}) or die "Can't create default htpasswd: $!";
+ print $fh 'root:$apr1$TZA4Y0DL$DS5ZhDH8QrhB.uAtvNJmh.' . "\n";
+ close $fh or die "Can't create default htpasswd: $!";
+ }
+} elsif ($opt{auth} and not -f $opt{auth}) {
+ die "Can't read htpasswd file $opt{auth}!";
+}
+
# Parse out the WebPath
my $path = parseconf( "WebPath" ) || "";
$template =~ s!\$PATH/!$path/!g;
$template =~ s!\$PATH!$path || "/"!ge;
$template =~ s/\$SSL/$opt{ssl} || 0/ge;
+$template =~ s/\$AUTH/$opt{auth}/ge;
$template =~ s/\$RTHOME/$opt{root}/g;
$template =~ s/\$MODULES/$opt{modules}/g;
$template =~ s/\$TOOLS/$FindBin::Bin/g;
Determines the Apache module which is used. By default, the first one
of that list which exists will be used. See also L</--modules>.
-=item --port B<number>
+=item --port B<number>, -p
Choses the port to listen on. By default, this is parsed from the
F<RT_SiteConfig.pm>, and falling back to 8888.
certificate for C<localhost>. If the port number is not specified,
defaults to port 4430.
+=item --auth [F</path/to/htpasswd>], -A
+
+Turns on HTTP Basic Authentication; this is done automatically if
+C<$WebRemoteUserAuth> is set in the F<RT_SiteConfig.pm>. The provided
+path should be to a F<htpasswd> file; if not given, defaults to a file
+containing only user C<root> with password C<password>.
+
=item --single, -X
Run only one process or thread, for ease of debugging.
=cut
__DATA__
+Listen $PORT
+<IfDefine SSL>
+ Listen $SSL
+</IfDefine>
+
+ServerName localhost
+ServerRoot $RTHOME/var
+PidFile $RTHOME/var/apache2.pid
+<IfVersion < 2.4>
+ LockFile $RTHOME/var/apache2.lock
+</IfVersion>
+ServerAdmin root@localhost
+
+<IfVersion >= 2.4>
+ LoadModule mpm_prefork_module $MODULES/mod_mpm_prefork.so
+ LoadModule authz_core_module $MODULES/mod_authz_core.so
+</IfVersion>
+LoadModule authz_host_module $MODULES/mod_authz_host.so
+LoadModule env_module $MODULES/mod_env.so
+LoadModule alias_module $MODULES/mod_alias.so
+LoadModule mime_module $MODULES/mod_mime.so
+TypesConfig $TOOLS/mime.types
+
<IfDefine SINGLE>
<IfModule mpm_prefork_module>
StartServers 1
</IfModule>
</IfDefine>
-Listen $PORT
-<IfDefine SSL>
- Listen $SSL
-</IfDefine>
-
-ServerName localhost
-ServerRoot $RTHOME/var
-PidFile $RTHOME/var/apache2.pid
-LockFile $RTHOME/var/apache2.lock
-ServerAdmin root@localhost
-
-LoadModule authz_host_module $MODULES/mod_authz_host.so
-LoadModule env_module $MODULES/mod_env.so
-LoadModule alias_module $MODULES/mod_alias.so
-LoadModule mime_module $MODULES/mod_mime.so
-TypesConfig $TOOLS/mime.types
-
<IfDefine PERL>
LoadModule perl_module $MODULES/mod_perl.so
</IfDefine>
</IfDefine>
<IfDefine SSL>
LoadModule ssl_module $MODULES/mod_ssl.so
+ <IfVersion >= 2.4>
+ LoadModule socache_shmcb_module $MODULES/mod_socache_shmcb.so
+ </IfVersion>
</IfDefine>
<IfModule !log_config_module>
<IfDefine PERL>
PerlSetEnv RT_SITE_CONFIG $RTHOME/etc/RT_SiteConfig.pm
<Location $PATH>
- Order allow,deny
- Allow from all
SetHandler modperl
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app $RTHOME/sbin/rt-server
FastCgiServer $RTHOME/sbin/rt-server.fcgi -processes $PROCESSES -idle-timeout 300
ScriptAlias $PATH $RTHOME/sbin/rt-server.fcgi/
<Location $PATH>
- Order allow,deny
- Allow from all
Options +ExecCGI
AddHandler fastcgi-script fcgi
</Location>
FcgidMaxRequestLen 1073741824
ScriptAlias $PATH $RTHOME/sbin/rt-server.fcgi/
<Location $PATH>
- Order allow,deny
- Allow from all
Options +ExecCGI
AddHandler fcgid-script fcgi
</Location>
FastCgiServer $RTHOME/bin/mason_handler.fcgi -processes $PROCESSES -idle-timeout 300
ScriptAlias $PATH $RTHOME/bin/mason_handler.fcgi/
<Location $PATH>
- Order allow,deny
- Allow from all
- Options +ExecCGI
- AddHandler fastcgi-script fcgi
+ Options +ExecCGI
+ AddHandler fastcgi-script fcgi
</Location>
</IfDefine>
FcgidMaxRequestLen 1073741824
ScriptAlias $PATH $RTHOME/bin/mason_handler.fcgi/
<Location $PATH>
- Order allow,deny
- Allow from all
- Options +ExecCGI
- AddHandler fcgid-script fcgi
+ Options +ExecCGI
+ AddHandler fcgid-script fcgi
</Location>
</IfDefine>
</IfDefine>
SSLRandomSeed connect builtin
SSLRandomSeed connect file:/dev/urandom 512
SSLSessionCache shmcb:$RTHOME/var/ssl_scache(512000)
- SSLMutex file:$RTHOME/var/ssl_mutex
+ <IfVersion < 2.4>
+ SSLMutex file:$RTHOME/var/ssl_mutex
+ </IfVersion>
<VirtualHost *:$SSL>
SSLEngine on
- SSLCertificateFile $TOOLS/localhost.crt
- SSLCertificateKeyFile $TOOLS/localhost.key
+ SSLCertificateFile $TOOLS/localhost.crt
+ SSLCertificateKeyFile $TOOLS/localhost.key
</VirtualHost>
</IfDefine>