From 28981fac68e0c86dbdb2faf0bde1fd3d538fb50f Mon Sep 17 00:00:00 2001 From: Stefan Schantl Date: Sat, 17 Jan 2015 10:15:12 +0100 Subject: [PATCH] guardian.cgi: Add configure options for owncloud. The related options only will be displayed when the owncloud addon has been installed. Signed-off-by: Stefan Schantl --- html/cgi-bin/guardian.cgi | 30 +++++++++++++++++++++++++++++- langs/en/cgi-bin/en.pl | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/guardian.cgi b/html/cgi-bin/guardian.cgi index 5547ee4517..49c5b57050 100644 --- a/html/cgi-bin/guardian.cgi +++ b/html/cgi-bin/guardian.cgi @@ -51,8 +51,14 @@ our %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +# Pakfire meta file for owncloud. +# (File exists when the addon is installed.) +my $owncloud_meta = "/opt/pakfire/db/meta/meta-owncloud"; + our %settings = (); +$settings{'ACTION'} = ''; + $settings{'GUARDIAN_ENABLED'} = 'off'; $settings{'GUARDIAN_ENABLE_SNORT'} = 'on'; $settings{'GUARDIAN_ENABLE_SSH'} = 'on'; @@ -64,7 +70,10 @@ $settings{'GUARDIAN_LOGFILE'} = '/var/log/guardian/guardian.log'; $settings{'GUARDIAN_SNORT_ALERTFILE'} = '/var/log/snort/alert'; $settings{'GUARDIAN_PRIORITY_LEVEL'} = '3'; -$settings{'ACTION'} = ''; +# Default settings for owncloud if installed. +if ( -e "$owncloud_meta") { + $settings{'GUARDIAN_ENABLE_OWNCLOUD'} = 'off'; +} my $errormessage = ''; @@ -280,6 +289,9 @@ sub showMainBox() { $checked{'GUARDIAN_ENABLE_HTTPD'}{'off'} = ''; $checked{'GUARDIAN_ENABLE_HTTPD'}{'on'} = ''; $checked{'GUARDIAN_ENABLE_HTTPD'}{$settings{'GUARDIAN_ENABLE_HTTPD'}} = "checked='checked'"; + $checked{'GUARDIAN_ENABLE_OWNCLOUD'}{'off'} = ''; + $checked{'GUARDIAN_ENABLE_OWNCLOUD'}{'on'} = ''; + $checked{'GUARDIAN_ENABLE_OWNCLOUD'}{$settings{'GUARDIAN_ENABLE_OWNCLOUD'}} = "checked='checked'"; $selected{'GUARDIAN_LOGLEVEL'}{$settings{'GUARDIAN_LOGLEVEL'}} = 'selected'; $selected{'GUARDIAN_PRIORITY_LEVEL'}{$settings{'GUARDIAN_PRIORITY_LEVEL'}} = 'selected'; @@ -374,6 +386,16 @@ END on / off +END + # Display owncloud checkbox when the addon is installed. + if ( -e "$owncloud_meta" ) { + print"\n"; + print"$Lang::tr{'guardian block owncloud brute-force'}\n"; + print"on /\n"; + print" off\n"; + print"\n"; + } + print <
@@ -662,6 +684,12 @@ sub BuildConfiguration() { print FILE "EnableSnortMonitoring\t\t$settings{'GUARDIAN_ENABLE_SNORT'}\n"; print FILE "EnableSSHMonitoring\t\t$settings{'GUARDIAN_ENABLE_SSH'}\n"; print FILE "EnableHTTPDMonitoring\t\t$settings{'GUARDIAN_ENABLE_HTTPD'}\n"; + + # Check if owncloud settings should be written. + if (exists $settings{'GUARDIAN_ENABLE_OWNCLOUD'}) { + print FILE "EnableOwncloudMonitoring\t$settings{'GUARDIAN_ENABLE_OWNCLOUD'}\n"; + } + print FILE "LogLevel\t\t\t$settings{'GUARDIAN_LOGLEVEL'}\n"; print FILE "BlockCount\t\t\t$settings{'GUARDIAN_BLOCKCOUNT'}\n"; print FILE "HostGatewayByte\t\t\t$HostGatewayByte\n"; diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 70f73fec19..048966f8f2 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -1267,6 +1267,7 @@ 'guardian watch snort alertfile' => 'Monitor Snort alertfile', 'guardian block ssh brute-force' => 'SSH Brute-force detection', 'guardian block httpd brute-force' => 'HTTPD Brute-force detection', +'guardian block owncloud brute-force' => 'Owncloud Brute-force detection', 'guest ok' => 'allow guests to access', 'gui settings' => 'GUI Settings', 'gz with key' => 'Only an encrypted archive can be restored on this machine.', -- 2.39.5