summaryrefslogtreecommitdiff
path: root/rt/devel/tools/rt-apache
diff options
context:
space:
mode:
Diffstat (limited to 'rt/devel/tools/rt-apache')
-rw-r--r--rt/devel/tools/rt-apache46
1 files changed, 35 insertions, 11 deletions
diff --git a/rt/devel/tools/rt-apache b/rt/devel/tools/rt-apache
index f9942ed..23290a0 100644
--- a/rt/devel/tools/rt-apache
+++ b/rt/devel/tools/rt-apache
@@ -77,6 +77,7 @@ GetOptions( \%opt,
"port|p=i",
"ssl:i",
"single|X",
+ "auth|A:s",
"modules=s",
@@ -125,6 +126,21 @@ unless ($opt{port}) {
# 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" ) || "";
@@ -133,6 +149,7 @@ $template =~ s/\$PORT/$opt{port}/g;
$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;
@@ -227,7 +244,7 @@ environment variable, or C</opt/rt4>.
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.
@@ -238,6 +255,13 @@ Also listens on the provided port with HTTPS, using a self-signed
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.
@@ -402,10 +426,10 @@ Alias $PATH/NoAuth/images/ $RTHOME/share/html/NoAuth/images/
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
+ Order allow,deny
+ Allow from all
+ Options +ExecCGI
+ AddHandler fastcgi-script fcgi
</Location>
</IfDefine>
@@ -416,10 +440,10 @@ Alias $PATH/NoAuth/images/ $RTHOME/share/html/NoAuth/images/
FcgidMaxRequestLen 1073741824
ScriptAlias $PATH $RTHOME/bin/mason_handler.fcgi/
<Location $PATH>
- Order allow,deny
- Allow from all
- Options +ExecCGI
- AddHandler fcgid-script fcgi
+ Order allow,deny
+ Allow from all
+ Options +ExecCGI
+ AddHandler fcgid-script fcgi
</Location>
</IfDefine>
</IfDefine>
@@ -433,7 +457,7 @@ Alias $PATH/NoAuth/images/ $RTHOME/share/html/NoAuth/images/
SSLMutex file:$RTHOME/var/ssl_mutex
<VirtualHost *:$SSL>
SSLEngine on
- SSLCertificateFile $TOOLS/localhost.crt
- SSLCertificateKeyFile $TOOLS/localhost.key
+ SSLCertificateFile $TOOLS/localhost.crt
+ SSLCertificateKeyFile $TOOLS/localhost.key
</VirtualHost>
</IfDefine>