summaryrefslogtreecommitdiffstats
path: root/proxy_wizard/Squid.pm
diff options
context:
space:
mode:
Diffstat (limited to 'proxy_wizard/Squid.pm')
-rwxr-xr-xproxy_wizard/Squid.pm24
1 files changed, 11 insertions, 13 deletions
diff --git a/proxy_wizard/Squid.pm b/proxy_wizard/Squid.pm
index 001cabf5..cba09f44 100755
--- a/proxy_wizard/Squid.pm
+++ b/proxy_wizard/Squid.pm
@@ -23,6 +23,7 @@ package MDK::Wizard::Squid;
use strict;
use common;
+use services;
require MDK::Wizard::Wizcommon;
my $wiz = new MDK::Wizard::Wizcommon;
@@ -47,14 +48,14 @@ my $o = {
wiz_squid_mem => '',
wiz_squid_port => '',
wiz_squid_mynetw => '',
- wiz_squid_defdir => '',
+ wiz_squid_defdir => '/var/spool/squid',
wiz_squid_cachepeer => '',
wiz_squid_peerport => '',
wiz_squid_menupeer => '',
wiz_squid_disk => ''
},
needed_rpm => [ 'squid' ],
- defaultimage => "$ENV{__WIZARD_HOME__}proxy_wizard/images/proxy.png"
+ defaultimage => "$ENV{__WIZ_HOME__}proxy_wizard/images/proxy.png"
};
$o->{pages} = {
@@ -115,17 +116,17 @@ $o->{pages} = {
next => 'cachepeer'
},
shownet => {
- name => N('Grant access on local network') . "\n\n" . N('Access will be allowed for hosts on the network. Here is the information found about your current local network, you can modify it if needed.') . "\n\n" . N('You can use either a numeric format like \q192.168.1.0/255.255.255.0\q or a text format like \q.domain.net\q'),
+ name => N('Grant access on local network') . "\n\n" . N('Access will be allowed for hosts on the network. Here is the information found about your current local network, you can modify it if needed.') . "\n\n" . N('You can use either a numeric format like "192.168.1.0/255.255.255.0" or a text format like ".domain.net"'),
pre => sub {
$o->{var}{wiz_squid_mynetw} ||= network_mask()
},
data => [
- { label => 'Authorized network:', val => \$o->{var}{wiz_squid_mynetw}, help => N('Use numeric format like \q192.168.1.0/255.255.255.0\q or a text format like \q.domain.net\q') },
+ { label => 'Authorized network:', val => \$o->{var}{wiz_squid_mynetw}, help => N('Use numeric format like "192.168.1.0/255.255.255.0" or a text format like ".domain.net"') },
],
next => 'cachepeer'
},
cachepeer => {
- name => N('Cache hierarchy') . "\n\n" . N('As an option, Squid can be configured in proxy cascading. You can add a new upper level proxy by specifying its hostname and port.') . "\n\n" . N('You can safely select \qNo upper level proxy\q if you don\'t need this feature.'),
+ name => N('Cache hierarchy') . "\n\n" . N('As an option, Squid can be configured in proxy cascading. You can add a new upper level proxy by specifying its hostname and port.') . "\n\n" . N('You can safely select "No upper level proxy" if you don\'t need this feature.'),
pre => sub {
$o->{var}{wiz_squid_menupeer} ||= 1
},
@@ -138,7 +139,7 @@ $o->{pages} = {
next => 'summary_2'
},
valcachepeer => {
- name => N('Cache hierarchy') . "\n\n" . N('Enter the qualified hostname (like \qcache.domain.net\q) and the port of the proxy to use.'),
+ name => N('Cache hierarchy') . "\n\n" . N('Enter the qualified hostname (like "cache.domain.net") and the port of the proxy to use.'),
data => [
{ label => 'Upper level proxy hostname:', val => \$o->{var}{wiz_squid_cachepeer} },
{ label => 'Upper level proxy port:', val => \$o->{var}{wiz_squid_peerport} },
@@ -185,7 +186,6 @@ sub new {
}
sub network_mask {
- my $o = IFCFG->new();
my $wiz_ip_server = $wiz->{net}->itf_get("IPADDR");
my $mask = $wiz->{net}->itf_get("NETMASK");
"$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
@@ -220,13 +220,11 @@ sub do_it {
-f $file and MDK::Common::cp_af($file, $file.".orig");
MDK::Common::cp_af("__WIZ_HOME__/proxy_wizard/scripts/squid.conf.default", $file);
substInFile {
- s|^\s*\#?\s*(cache_dir.*$o->{var}{wiz_squid_defdir}\s*)\d*(.*)|$1$o->{var}{wiz_squid_disk}$2|;
- s|^\s*\#?\s*(acl\s*mynetwork\s*src\s*).*$|$1$o->{var}{wiz_squid_mynetw}\n|;
- s|^\s*\#?\s*(cache_mem\s*)\d*(\s*MB.*)|$1$o->{var}{wiz_squid_mem}$2|;
- s|^\s*\#?\s*(http_port\s*)\d*(.*)|$1$o->{var}{wiz_squid_port}$2|;
+ 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*acl\s*mynetwork\s*src.*|acl mynetwork src $o->{var}{wiz_squid_mynetw}|;
+ s|^\s*\#?\s*(cache_mem\s*)\d+(\s*MB.*)|$1$o->{var}{wiz_squid_mem} MB|;
+ s|^\s*\#?\s*(http_port\s*)\d+(.*)|$1$o->{var}{wiz_squid_port}|;
} $file;
- print "LEVEL $o->{var}{'wiz_squid_level'}\n\n";
- exit;
standalone::explanations("$file: cache_dir = $o->{var}{wiz_squid_defdir} $o->{var}{wiz_squid_disk}
mynetw = $o->{var}{wiz_squid_mynetw} cache_mem = $o->{var}{wiz_squid_mem} http_port = $o->{var}{wiz_squid_port}
level = $o->{var}{wiz_squid_level}");