X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fdevel%2Ftools%2Frt-apache;h=23290a01e5d85ba9055bc965483aad347927c91d;hb=9aee669886202be7035e6c6049fc71bc99dd3013;hp=f9942edc14b11bb082d153fc34260cedcf527342;hpb=73a6a80a9ca5edbd43d139b7cb25bfee4abfd35e;p=freeside.git diff --git a/rt/devel/tools/rt-apache b/rt/devel/tools/rt-apache index f9942edc1..23290a01e 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. Determines the Apache module which is used. By default, the first one of that list which exists will be used. See also L. -=item --port B +=item --port B, -p Choses the port to listen on. By default, this is parsed from the F, and falling back to 8888. @@ -238,6 +255,13 @@ Also listens on the provided port with HTTPS, using a self-signed certificate for C. If the port number is not specified, defaults to port 4430. +=item --auth [F], -A + +Turns on HTTP Basic Authentication; this is done automatically if +C<$WebRemoteUserAuth> is set in the F. The provided +path should be to a F file; if not given, defaults to a file +containing only user C with password C. + =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/ - Order allow,deny - Allow from all - Options +ExecCGI - AddHandler fastcgi-script fcgi + Order allow,deny + Allow from all + Options +ExecCGI + AddHandler fastcgi-script fcgi @@ -416,10 +440,10 @@ Alias $PATH/NoAuth/images/ $RTHOME/share/html/NoAuth/images/ FcgidMaxRequestLen 1073741824 ScriptAlias $PATH $RTHOME/bin/mason_handler.fcgi/ - Order allow,deny - Allow from all - Options +ExecCGI - AddHandler fcgid-script fcgi + Order allow,deny + Allow from all + Options +ExecCGI + AddHandler fcgid-script fcgi @@ -433,7 +457,7 @@ Alias $PATH/NoAuth/images/ $RTHOME/share/html/NoAuth/images/ SSLMutex file:$RTHOME/var/ssl_mutex SSLEngine on - SSLCertificateFile $TOOLS/localhost.crt - SSLCertificateKeyFile $TOOLS/localhost.key + SSLCertificateFile $TOOLS/localhost.crt + SSLCertificateKeyFile $TOOLS/localhost.key