232 |
my $w = $in->wait_message(N("Squid proxy"), N("Configuring your system as a Proxy server...")); |
my $w = $in->wait_message(N("Squid proxy"), N("Configuring your system as a Proxy server...")); |
233 |
my $file="/etc/squid/squid.conf"; |
my $file="/etc/squid/squid.conf"; |
234 |
-f $file and MDK::Common::cp_af($file, $file . ".orig"); |
-f $file and MDK::Common::cp_af($file, $file . ".orig"); |
235 |
MDK::Common::cp_af("__WIZ_HOME__/proxy_wizard/scripts/squid.conf.default", $file); |
MDK::Common::cp_af("$::Wiz_dir/proxy_wizard/scripts/squid.conf.default", $file); |
236 |
substInFile { |
substInFile { |
237 |
s|^\s*#?\s*cache_dir ufs /var/spool/squid 100 16 256.*|cache_dir ufs $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} 16 256|; |
s|^\s*#?\s*cache_dir ufs /var/spool/squid 100 16 256.*|cache_dir ufs $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk} 16 256|; |
238 |
s|^\s*#?\s*acl\s*mynetwork\s*src.*|acl mynetwork src $o->{var}{wiz_squid_mynetw}|; |
s|^\s*#?\s*acl\s*localnet\s*src.*|acl localnet src $o->{var}{wiz_squid_mynetw}|; |
239 |
s|^\s*#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|; |
s|^\s*#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|; |
240 |
s|^\s*#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|; |
s|^\s*#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|; |
241 |
} $file; |
} $file; |
249 |
} elsif ($o->{var}{wiz_squid_level} == 2) { |
} elsif ($o->{var}{wiz_squid_level} == 2) { |
250 |
substInFile { |
substInFile { |
251 |
s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|; |
s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|; |
252 |
s|^\s*#?\s*(http_access\s*allow\s*)localhost|#$&\n$1mynetwork|; |
s|^\s*#?\s*(http_access\s*allow\s*)localhost|#$&\n$1localnet|; |
253 |
} $file; |
} $file; |
254 |
} elsif ($o->{var}{wiz_squid_level} == 3) { |
} elsif ($o->{var}{wiz_squid_level} == 3) { |
255 |
substInFile { |
substInFile { |
256 |
s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|; |
s|^\s*#?\s*(http_access\s*)allow(\s*all.*)|#$&\n$1deny$2|; |
257 |
s|^\s*#?\s*(http_access\s*allow\s*)mynetwork|#$&\n$1localhost|; |
s|^\s*#?\s*(http_access\s*allow\s*)localnet|#$&\n$1localhost|; |
258 |
} $file; |
} $file; |
259 |
} else { # should not happen |
} else { # should not happen |
260 |
die "wiz_squid_level error"; |
die "wiz_squid_level error"; |
278 |
} $file; |
} $file; |
279 |
|
|
280 |
system("/sbin/chkconfig --level 345 squid on"); |
system("/sbin/chkconfig --level 345 squid on"); |
281 |
services::restart_or_start('squid'); |
reload_or_restart('squid'); |
282 |
undef $w; |
undef $w; |
283 |
check_started('squid'); |
check_started('squid'); |
284 |
} |
} |