From 102a8558132b61c919cda2bd9952cb5a1cacbf27 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 18 Jun 2009 17:26:00 -0400 Subject: Adding global site e-mail, global site name and global listen directives --- config/apache_mod_security/apache_mod_security.inc | 40 +++++++++++++++------- config/apache_mod_security/apache_mod_security.xml | 4 +++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/config/apache_mod_security/apache_mod_security.inc b/config/apache_mod_security/apache_mod_security.inc index 68f2e576..e6922689 100644 --- a/config/apache_mod_security/apache_mod_security.inc +++ b/config/apache_mod_security/apache_mod_security.inc @@ -15,20 +15,37 @@ function generate_apache_configuration() { // Generate mod_proxy specific configuration $mod_proxy = "ProxyRequests on\n"; foreach($config['installedpackages']['apache_mod_security']['config'] $ams) { - - $sitename = ""; - - $mod_proxy .= "ProxyPass /{$ams['sitename']}/ {$ams['siteurl']} \n"; - $mod_proxy .= "ProxyHTMLURLMap {$ams['siteurl']} /{$ams['sitename']} \n"; - $mod_proxy .= "\n"; + $sitename = str_replace(" ", "", $ams['sitename'])); + $mod_proxy .= "ProxyPass /{$sitename}/ {$sitename} \n"; + $mod_proxy .= "ProxyHTMLURLMap {$ams['siteurl']} /{$sitename} \n"; + $mod_proxy .= "\n"; $mod_proxy .= " ProxyPassReverse /\n"; $mod_proxy .= " SetOutputFilter proxy-html\n"; - $mod_proxy .= " ProxyHTMLURLMap / /{$ams['sitename']}/\n"; - $mod_proxy .= " ProxyHTMLURLMap /{$ams['sitename']} /{$ams['sitename']}\n"; + $mod_proxy .= " ProxyHTMLURLMap / /{$sitename}/\n"; + $mod_proxy .= " ProxyHTMLURLMap /{$ams['sitename']} /{$sitename}\n"; $mod_proxy .= " RequestHeader unset Accept-Encoding\n"; $mod_proxy .= "\n"; } + // Set global site e-mail + if($config['installedpackages']['apache_mod_security_settings']['config']['globalsiteadminemail']) { + $global_site_email = $config['installedpackages']['apache_mod_security_settings']['config']['globalsiteadminemail']; + } else { + $global_site_email = "admin@admin.comn"; + log_error("WARNING! Global site Administrator E-Mail address has not been set. Defaulting to bogus e-mail address."); + } + + // Set global site namne + if($config['installedpackages']['apache_mod_security_settings']['config']['globalbindtoipaddr']) { + $global_listen = "Listen " . $config['installedpackages']['apache_mod_security_settings']['config']['globalbindtoipaddr']; + if($config['installedpackages']['apache_mod_security_settings']['config']['globalbindtoport']) + $global_listen .= ":" . $config['installedpackages']['apache_mod_security_settings']['config']['globalbindtoport']; + else + $global_listen .= ":80"; + } else { + $global_listen = "Listen {$config['system']['hostname']}.{$config['system']['domain']}"; + } + $apache_config = <<http://www.pfsense.com/packages/config/apache_mod_security/apache_mod_security.inc + + Proxy Server Settings + /pkg.php?xml=apache_mod_security.xml&id=0 + Site Proxies /pkg.php?xml=apache_mod_security.xml -- cgit v1.2.3