From fc4860b825cc420bb2a877a902209259cb1eac75 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 23 Jun 2009 20:18:58 -0400 Subject: Add mem_cache and disk_cache backend code. Add rc start script, etc. --- config/apache_mod_security/apache_mod_security.inc | 111 +++++++++++++++++---- 1 file changed, 93 insertions(+), 18 deletions(-) (limited to 'config/apache_mod_security') diff --git a/config/apache_mod_security/apache_mod_security.inc b/config/apache_mod_security/apache_mod_security.inc index 2f533b0d..0a323701 100644 --- a/config/apache_mod_security/apache_mod_security.inc +++ b/config/apache_mod_security/apache_mod_security.inc @@ -1,27 +1,97 @@ + ENDPHP\n"; + + $stop = "php -q -d auto_prepend_file=config.inc < + ENDPHP\n"; + + write_rcfile(array( + "file" => $filename, + "start" => $start, + "stop" => $stop + ) + ); + } function apache_mod_security_deinstall() { global $config, $g; - exec("rm -rf /usr/local/apachemodsecurity"); + exec("/bin/rm -rf /usr/local/apachemodsecurity"); + exec("/bin/rm -f /usr/local/etc/rc.d/apache_mod_security.sh"); } +// Regenerate apache configuration and handle server restart function apache_mod_security_resync() { global $config, $g; generate_apache_configuration(); + apache_mod_security_restart(); } // Generate mod_proxy specific configuration function generate_apache_configuration() { global $config, $g; + $mod_proxy = ""; // Set global site e-mail if($config['installedpackages']['apachemodsecuritysettings']['config'][0]['globalsiteadminemail']) { @@ -53,29 +123,30 @@ function generate_apache_configuration() { $global_listen .= ":80"; } + // Setup mem_cache + if($config['installedpackages']['apachemodsecuritysettings']['config'][0]['mod_mem_cache']) { + if($config['installedpackages']['apachemodsecuritysettings']['config'][0]['mod_mem_cache_size']) + $mcachesize = $config['installedpackages']['apachemodsecuritysettings']['config'][0]['mod_mem_cache_size']; + else + $mcachesize = "100"; + $mem_cache = "MCacheSize $mcachesize\n"; + } - - // XXX The maximum amount of memory used by the cache in KBytes - //MCacheSize 700000 // CacheRoot Directive - // CacheRoot /var/apache_mod_security_cache - // htcacheclean can be used to maintain the cache size at a maximum level. - // XXX - - - - // Syntax:ProxyPreserveHost On|Off ? - $mod_proxy = "ProxyRequests on\n"; - - $mod_proxy = << Order deny,allow Allow from all - - + EOF; @@ -186,6 +257,8 @@ EOF; SecRequestBodyInMemoryLimit 131072 SecRequestBodyLimit 10485760 + {$mod_security_custom} + SecResponseBodyMimeTypesClear SecResponseBodyMimeType (null) text/plain text/html text/css text/xml @@ -294,8 +367,6 @@ EOF; #phpMyAdmin path vln SecFilterSelective REQUEST_URI "/css/phpmyadmin\.css\.php\?GLOBALS\[cfg\]\[ThemePath\]=/etc" - {$mod_security_custom} - EOF; @@ -774,6 +845,10 @@ SSLRandomSeed startup builtin SSLRandomSeed connect builtin +# Cache settings +{$mem_cache} +{$cache_root} + # Mod security {$mod_security} -- cgit v1.2.3