diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-04-22 04:11:38 +0000 |
---|---|---|
committer | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-04-22 04:11:38 +0000 |
commit | c7b1432ce5e49d061a182df0b09db5de36d787f5 (patch) | |
tree | 87f552c880943bc9e5668a795f63aff36029eb3e /config/squid-reverse/squid.inc | |
parent | b5779ad7a8932bfef434f2a8bec0cdc8cb7c2105 (diff) | |
download | pfsense-packages-c7b1432ce5e49d061a182df0b09db5de36d787f5.tar.gz pfsense-packages-c7b1432ce5e49d061a182df0b09db5de36d787f5.tar.bz2 pfsense-packages-c7b1432ce5e49d061a182df0b09db5de36d787f5.zip |
squid3 - version 2.0.5 with transparent proxy fix and integration with captive portal for non transparent use.
Diffstat (limited to 'config/squid-reverse/squid.inc')
-rw-r--r-- | config/squid-reverse/squid.inc | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc index db3aafca..70127510 100644 --- a/config/squid-reverse/squid.inc +++ b/config/squid-reverse/squid.inc @@ -1525,7 +1525,42 @@ function squid_generate_rules($type) { global $config; $squid_conf = $config['installedpackages']['squid']['config'][0]; - + + //check captive portal option + $cp_file='/etc/inc/captiveportal.inc'; + $pfsense_version=preg_replace("/\s/","",file_get_contents("/etc/version")); + $port = ($settings['proxy_port'] ? $settings['proxy_port'] : 3128); + $cp_inc = file($cp_file); + $new_cp_inc=""; + $found_rule=0; + foreach ($cp_inc as $line){ + $new_line=$line; + //remove applied squid patch + if (preg_match('/} set 1 skipto 65314/',$line)){ + $found_rule++; + $new_line =""; + } + //add squid patch option based on current config + if (preg_match('/set 1 pass ip from any to/',$line) && $squid_conf['patch_cp']){ + $found_rule++; + $new_line = "\t".'$cprules .= "add {$rulenum} set 1 skipto 65314 ip from any to {$ips} '.$port.' in\n";'."\n"; + $new_line .= $line; + } + if (preg_match('/set 1 pass ip from {/',$line) && $squid_conf['patch_cp']){ + $found_rule++; + $new_line = "\t".'$cprules .= "add {$rulenum} set 1 skipto 65314 ip from {$ips} '.$port.' to any out\n";'."\n"; + $new_line .= $line; + } + $new_cp_inc .= $new_line; + } + if (!file_exists('/root/'.$pfsense_version.'.captiveportal.inc.backup')) { + copy ($cp_file,'/root/'.$pfsense_version.'.captiveportal.inc.backup'); + } + if($found_rule > 0){ + file_put_contents($cp_file,$new_cp_inc, LOCK_EX); + } + + //normal squid rule check if (($squid_conf['transparent_proxy'] != 'on') || ($squid_conf['allow_interface'] != 'on')) { return; } |