initial commit of file from CVS for smeserver-shellinabox on Sat Sep 7 16:41:40 AEST 2024

This commit is contained in:
Trevor Batley
2024-09-07 16:41:40 +10:00
parent 097d60d1a9
commit 9fcd6b9cda
51 changed files with 1068 additions and 2 deletions

View File

@@ -0,0 +1,57 @@
{
my $status = $shellinaboxd{'status'} || "disabled";
return " # shellinabox is disabled in this VirtualHost"
unless $status eq 'enabled';
{
$OUT .= "###########################################################\n";
$OUT .= "######## shellinabox reverse proxy ##########\n";
$OUT .= "###########################################################\n";
{
if ( $port ne "443" ) {
$OUT .= "# Redirect shellinabox Address to Secure Address\n";
$OUT .= " RewriteEngine On\n";
$OUT .= " RewriteCond %{HTTPS} off\n";
$OUT .= " RewriteRule \/$shellinaboxd{'Name'} https:\/\/%{HTTP_HOST}:443\/$shellinaboxd{'Name'}\n";
$OUT .= "## End Of Redirect\n";
}
$OUT .= "##########\n";
$OUT .= " AddExternalAuth pwauth /usr/bin/pwauth\n";
$OUT .= " SetExternalAuthMethod pwauth pipe\n";
$OUT .= "#########\n";
$OUT .= "\n";
$OUT .= "#########\n";
$OUT .= "\<Location \/$shellinaboxd{'Name'}\>\n";
$OUT .= " ProxyPass http://localhost:$shellinaboxd{'TcpPort'}/" . "\n";
$OUT .= " Require all denied\n";
$OUT .= " SSLRequireSSL\n";
if ( $shellinaboxd{'PublicAccess'} eq 'local' ) {
$OUT .= " Require ip $localAccess\n";
}
elsif ( $shellinaboxd{'PublicAccess'} eq 'global' ) {
$OUT .= " Require all granted\n";
}
elsif ( $shellinaboxd{'PublicAccess'} eq 'IP' ) {
my $fixedip = $shellinaboxd{'FixedIP'} || "";
$OUT .= " Require ip $fixedip\n";
}
elsif ( ( $shellinaboxd{'PublicAccess'} ne 'global' ) && ( $shellinaboxd{'PublicAccess'} ne 'local' ) ) {
$OUT .= " Require all denied\n";
}
$OUT .= " AuthName \"$shellinaboxd{'Name'}\"\n";
$OUT .= " AuthBasicProvider external\n";
$OUT .= " AuthType Basic\n";
$OUT .= " AuthExternal pwauth\n";
if ( ( $shellinaboxd{'PublicAccess'} ne 'local' ) || ( $shellinaboxd{'WebAuth'} eq 'enabled' ) ) {
my @users = split( ",", ( $shellinaboxd{ShellUsers} || "" ) );
$OUT .= " Require valid-user admin @users\n";
}
$OUT .= "\<\/Location\>\n";
$OUT .= "#########\n";
}
}
}

View File

@@ -0,0 +1,28 @@
# Shell in a box daemon configuration
# For details see shellinaboxd man page
# Basic options
USER=shellinabox
GROUP=shellinabox
CERTDIR=/var/lib/shellinabox
{
return "PORT=${'shellinaboxd'}{'TcpPort'}";
}
#OPTS="--disable-ssl-menu -s /:LOGIN"
#for root login
{
my $port = ${'sshd'}{'TCPPort'};
$OUT .= "OPTS=\"--no-beep --localhost-only --disable-ssl --service=\/:SSH\:localhost\:$port\" ";
}
# Additional examples with custom options:
# Fancy configuration with right-click menu choice for black-on-white:
# OPTS="--user-css Normal:+black-on-white.css,Reverse:-white-on-black.css --disable-ssl-menu -s /:LOGIN"
# Simple configuration for running it as an SSH console with SSL disabled:
# OPTS="-t -s /:SSH:host.example.com"

View File

@@ -0,0 +1,2 @@
[Install]
WantedBy=sme-server.target