aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-26 19:08:08 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-26 19:08:08 +0200
commit7ebe5d0978f0246f5170dc7e86ea1dd4ff5d1056 (patch)
tree005c831141ef1e090ec0423db87edd25ff83623e /config
parent70da583d75bc5a8456a67d0e5fd2cb9fb6b92242 (diff)
downloadpfsense-packages-7ebe5d0978f0246f5170dc7e86ea1dd4ff5d1056.tar.gz
pfsense-packages-7ebe5d0978f0246f5170dc7e86ea1dd4ff5d1056.tar.bz2
pfsense-packages-7ebe5d0978f0246f5170dc7e86ea1dd4ff5d1056.zip
Fix broken c-icap.conf handling, fix c-icap logs handling (Bug #4615)
Diffstat (limited to 'config')
-rwxr-xr-xconfig/squid3/34/squid.inc30
1 files changed, 21 insertions, 9 deletions
diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc
index b25efb7c..69cee12e 100755
--- a/config/squid3/34/squid.inc
+++ b/config/squid3/34/squid.inc
@@ -1438,17 +1438,29 @@ EOF;
}
}
// c-icap.conf
- if (!file_exists(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.sample")) {
- if (file_exists(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.default")) {
- $sample_file = file_get_contents(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.default");
- if (!preg_match("/squid_clamav/", $sample_file)) {
- $sample_file .= "\nService squid_clamav squidclamav.so\n";
- }
- $cicap_m[0] = "@Manager:Apassword\S+@";
- $cicap_r[0] = "";
- file_put_contents(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.sample", preg_replace($cicap_m, $cicap_r, $sample_file), LOCK_EX);
+ // make a backup of default c-icap.conf.sample first
+ // unlike with other config files, the file distributed in package is called c-icap.conf.sample, not c-icap.conf.default
+ if (!file_exists(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.default")) {
+ copy(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.sample", SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.default");
+ }
+ if (file_exists(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.default")) {
+ $sample_file = file_get_contents(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.default");
+ if (!preg_match("/squid_clamav/", $sample_file)) {
+ $sample_file .= "\nService squid_clamav squidclamav.so\n";
}
+ $cicap_m[0] = "@Manager:Apassword\S+@";
+ $cicap_r[0] = "";
+ // XXX: Bug #4615
+ $logdir = ($settings['log_dir'] ? $settings['log_dir'] : '/var/squid/logs');
+ $cicap_m[1] = "@DebugLevel\s1@";
+ $cicap_r[1] = "DebugLevel 0";
+ $cicap_m[2] = "@AccessLog /var/log/c-icap/access.log@";
+ $cicap_r[2] = "AccessLog $logdir/c-icap-access.log";
+ $cicap_m[3] = "@ServerLog /var/log/c-icap/server.log@";
+ $cicap_r[3] = "ServerLog $logdir/c-icap-server.log";
+ file_put_contents(SQUID_LOCALBASE . "/etc/c-icap/c-icap.conf.sample", preg_replace($cicap_m, $cicap_r, $sample_file), LOCK_EX);
}
+
// check squidclamav files until PBIs are gone (https://redmine.pfsense.org/issues/4197)
$ln_icap = array('bin/c-icap', 'bin/c-icap-client', 'c-icap-config', 'c-icap-libicapapi-config', 'c-icap-stretch', 'lib/c_icap', 'share/c_icap', 'etc/c-icap');
foreach ($ln_icap as $ln) {