unless (-e $browserdb) { system("touch $browserdb"); }
unless (-e $mimetypes) { system("touch $mimetypes"); }
+my $HAVE_NTLM_AUTH = (-e "/usr/bin/ntlm_auth");
+
open FILE, $browserdb;
@useragentlist = sort { reverse(substr(reverse(substr($a,index($a,',')+1)),index(reverse(substr($a,index($a,','))),',')+1)) cmp reverse(substr(reverse(substr($b,index($b,',')+1)),index(reverse(substr($b,index($b,','))),',')+1))} grep !/(^$)|(^\s*#)/,<FILE>;
close(FILE);
&General::readhash("${General::swroot}/main/settings", \%mainsettings);
my $green_cidr = &General::ipcidr("$netsettings{'GREEN_NETADDRESS'}\/$netsettings{'GREEN_NETMASK'}");
-my $blue_cidr = "# Blue not defined";
-if ($netsettings{'BLUE_DEV'}) {
+my $blue_cidr = "";
+if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) {
$blue_cidr = &General::ipcidr("$netsettings{'BLUE_NETADDRESS'}\/$netsettings{'BLUE_NETMASK'}");
}
$proxysettings{'TRANSPARENT'} = 'off';
$proxysettings{'TRANSPARENT_BLUE'} = 'off';
$proxysettings{'PROXY_PORT'} = '800';
+$proxysettings{'TRANSPARENT_PORT'} = '3128';
$proxysettings{'VISIBLE_HOSTNAME'} = '';
$proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
$proxysettings{'ADMIN_PASSWORD'} = '';
$proxysettings{'CACHEMGR'} = 'off';
$proxysettings{'LOGQUERY'} = 'off';
$proxysettings{'LOGUSERAGENT'} = 'off';
-$proxysettings{'FILEDESCRIPTORS'} = '4096';
+$proxysettings{'FILEDESCRIPTORS'} = '16384';
$proxysettings{'CACHE_MEM'} = '2';
$proxysettings{'CACHE_SIZE'} = '50';
$proxysettings{'MAX_SIZE'} = '4096';
$proxysettings{'CACHE_POLICY'} = 'LRU';
$proxysettings{'L1_DIRS'} = '16';
$proxysettings{'OFFLINE_MODE'} = 'off';
+$proxysettings{'CACHE_DIGESTS'} = 'off';
$proxysettings{'CLASSROOM_EXT'} = 'off';
$proxysettings{'SUPERVISOR_PASSWORD'} = '';
$proxysettings{'NO_PROXY_LOCAL'} = 'off';
$proxysettings{'LDAP_BINDDN_USER'} = '';
$proxysettings{'LDAP_BINDDN_PASS'} = '';
$proxysettings{'LDAP_GROUP'} = '';
+$proxysettings{'NTLM_AUTH_GROUP'} = '';
+$proxysettings{'NTLM_AUTH_BASIC'} = 'off';
$proxysettings{'NTLM_DOMAIN'} = '';
$proxysettings{'NTLM_PDC'} = '';
$proxysettings{'NTLM_BDC'} = '';
$errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
goto ERROR;
}
+ if (!(&General::validport($proxysettings{'TRANSPARENT_PORT'})))
+ {
+ $errormessage = $Lang::tr{'advproxy errmsg invalid proxy port'};
+ goto ERROR;
+ }
+ if ($proxysettings{'PROXY_PORT'} eq $proxysettings{'TRANSPARENT_PORT'}) {
+ $errormessage = $Lang::tr{'advproxy errmsg proxy ports equal'};
+ goto ERROR;
+ }
if (!($proxysettings{'UPSTREAM_PROXY'} eq ''))
{
my @temp = split(/:/,$proxysettings{'UPSTREAM_PROXY'});
}
}
if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) ||
- ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 16384))
+ ($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 1048576))
{
$errormessage = $Lang::tr{'proxy errmsg filedescriptors'};
goto ERROR;
&read_acls;
}
+# ------------------------------------------------------------------
+
+# Hook to regenerate the configuration files, if cgi got called from command line.
+if ($ENV{"REMOTE_ADDR"} eq "") {
+ writeconfig();
+ exit(0);
+}
+
+# -------------------------------------------------------------------
+
$checked{'ENABLE'}{'off'} = '';
$checked{'ENABLE'}{'on'} = '';
$checked{'ENABLE'}{$proxysettings{'ENABLE'}} = "checked='checked'";
$checked{'OFFLINE_MODE'}{'off'} = '';
$checked{'OFFLINE_MODE'}{'on'} = '';
$checked{'OFFLINE_MODE'}{$proxysettings{'OFFLINE_MODE'}} = "checked='checked'";
+$checked{'CACHE_DIGESTS'}{'off'} = '';
+$checked{'CACHE_DIGESTS'}{'on'} = '';
+$checked{'CACHE_DIGESTS'}{$proxysettings{'CACHE_DIGESTS'}} = "checked='checked'";
$checked{'LOGGING'}{'off'} = '';
$checked{'LOGGING'}{'on'} = '';
$checked{'AUTH_METHOD'}{'ident'} = '';
$checked{'AUTH_METHOD'}{'ldap'} = '';
$checked{'AUTH_METHOD'}{'ntlm'} = '';
+$checked{'AUTH_METHOD'}{'ntlm-auth'} = '';
$checked{'AUTH_METHOD'}{'radius'} = '';
$checked{'AUTH_METHOD'}{$proxysettings{'AUTH_METHOD'}} = "checked='checked'";
$checked{'NTLM_USER_ACL'}{'negative'} = '';
$checked{'NTLM_USER_ACL'}{$proxysettings{'NTLM_USER_ACL'}} = "checked='checked'";
+$checked{'NTLM_AUTH_BASIC'}{'on'} = '';
+$checked{'NTLM_AUTH_BASIC'}{'off'} = '';
+$checked{'NTLM_AUTH_BASIC'}{$proxysettings{'NTLM_AUTH_BASIC'}} = "checked='checked'";
+
$checked{'RADIUS_ENABLE_ACL'}{'off'} = '';
$checked{'RADIUS_ENABLE_ACL'}{'on'} = '';
$checked{'RADIUS_ENABLE_ACL'}{$proxysettings{'RADIUS_ENABLE_ACL'}} = "checked='checked'";
<tr>
<td class='base'>$Lang::tr{'advproxy transparent on'} <font color="$Header::colourgreen">Green</font>:</td>
<td><input type='checkbox' name='TRANSPARENT' $checked{'TRANSPARENT'}{'on'} /></td>
- <td class='base'>$Lang::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
- <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td>
+ <td width='25%' class='base'>$Lang::tr{'advproxy proxy port transparent'}:</td>
+ <td width='30%'><input type='text' name='TRANSPARENT_PORT' value='$proxysettings{'TRANSPARENT_PORT'}' size='5' /></td>
</tr>
<tr>
END
print "<td colspan='2'> </td>";
}
print <<END
- <td colspan='2'> </td>
+ <td class='base'>$Lang::tr{'advproxy visible hostname'}: <img src='/blob.gif' alt='*' /></td>
+ <td><input type='text' name='VISIBLE_HOSTNAME' value='$proxysettings{'VISIBLE_HOSTNAME'}' /></td>
</tr>
<tr>
END
<td class='base'>$Lang::tr{'advproxy offline mode'}:</td>
<td><input type='checkbox' name='OFFLINE_MODE' $checked{'OFFLINE_MODE'}{'on'} /></td>
</tr>
+<tr>
+ <td class='base'>$Lang::tr{'advproxy cache-digest'}:</td>
+ <td><input type='checkbox' name='CACHE_DIGESTS' $checked{'CACHE_DIGESTS'}{'on'} /></td>
+</tr>
</table>
<hr size='1'>
<table width='100%'>
<td colspan='4'><b>$Lang::tr{'advproxy destination ports'}</b></td>
</tr>
<tr>
- <td width='25%' align=center></td> <td width='20%' align=center></td><td width='25%' align=center></td><td width='30%' align=center></td>
+ <td width='25%' align='center'></td> <td width='20%' align='center'></td><td width='25%' align='center'></td><td width='30%' align='center'></td>
</tr>
<tr>
<td colspan='2' class='base'>$Lang::tr{'advproxy standard ports'}:</td>
<td class='base'>$Lang::tr{'advproxy fake referer'}: <img src='/blob.gif' alt='*' /></td>
</tr>
<tr>
- <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='56' /></td>
- <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='56' /></td>
+ <td><input type='text' name='FAKE_USERAGENT' value='$proxysettings{'FAKE_USERAGENT'}' size='40%' /></td>
+ <td><input type='text' name='FAKE_REFERER' value='$proxysettings{'FAKE_REFERER'}' size='40%' /></td>
</tr>
</table>
<hr size='1'>
END
;
-print <<END
+my $auth_columns = 5;
+if ($HAVE_NTLM_AUTH) {
+ $auth_columns++;
+}
+my $auth_column_width = 100 / $auth_columns;
+
+print <<END;
<table width='100%'>
<tr>
- <td colspan='5'><b>$Lang::tr{'advproxy AUTH method'}</b></td>
+ <td colspan='$auth_columns'><b>$Lang::tr{'advproxy AUTH method'}</b></td>
</tr>
<tr>
- <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked{'AUTH_METHOD'}{'none'} />$Lang::tr{'advproxy AUTH method none'}</td>
- <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked{'AUTH_METHOD'}{'ncsa'} />$Lang::tr{'advproxy AUTH method ncsa'}</td>
- <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked{'AUTH_METHOD'}{'ident'} />$Lang::tr{'advproxy AUTH method ident'}</td>
- <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked{'AUTH_METHOD'}{'ldap'} />$Lang::tr{'advproxy AUTH method ldap'}</td>
- <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked{'AUTH_METHOD'}{'ntlm'} />$Lang::tr{'advproxy AUTH method ntlm'}</td>
- <td width='16%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked{'AUTH_METHOD'}{'radius'} />$Lang::tr{'advproxy AUTH method radius'}</td>
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='none' $checked{'AUTH_METHOD'}{'none'} />$Lang::tr{'advproxy AUTH method none'}</td>
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ncsa' $checked{'AUTH_METHOD'}{'ncsa'} />$Lang::tr{'advproxy AUTH method ncsa'}</td>
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ident' $checked{'AUTH_METHOD'}{'ident'} />$Lang::tr{'advproxy AUTH method ident'}</td>
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ldap' $checked{'AUTH_METHOD'}{'ldap'} />$Lang::tr{'advproxy AUTH method ldap'}</td>
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm' $checked{'AUTH_METHOD'}{'ntlm'} />$Lang::tr{'advproxy AUTH method ntlm'}</td>
+END
+
+if ($HAVE_NTLM_AUTH) {
+ print <<END;
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='ntlm-auth' $checked{'AUTH_METHOD'}{'ntlm-auth'} />$Lang::tr{'advproxy AUTH method ntlm auth'}</td>
+END
+}
+
+print <<END
+ <td width='$auth_column_width%' class='base'><input type='radio' name='AUTH_METHOD' value='radius' $checked{'AUTH_METHOD'}{'radius'} />$Lang::tr{'advproxy AUTH method radius'}</td>
</tr>
</table>
END
END
; }
+# ===================================================================
+# NTLM-AUTH settings
+# ===================================================================
+
+if ($proxysettings{'AUTH_METHOD'} eq 'ntlm-auth') {
+ print <<END;
+ <hr size ='1'>
+ <table width='100%'>
+ <td width='20%' class='base'>$Lang::tr{'advproxy basic authentication'}:</td>
+ <td width='40%'><input type='checkbox' name='NTLM_AUTH_BASIC' $checked{'NTLM_AUTH_BASIC'}{'on'} /></td>
+ <td colspan='2'> </td>
+ </table>
+
+ <hr size='1' />
+
+ <table width='100%'>
+ <tr>
+ <td colspan='4'><b>$Lang::tr{'advproxy group access control'}</b></td>
+ </tr>
+ <tr>
+ <td width='20%' class='base'>$Lang::tr{'advproxy group required'}: <img src='/blob.gif' alt='*' /></td>
+ <td width='40%'><input type='text' name='NTLM_AUTH_GROUP' value='$proxysettings{'NTLM_AUTH_GROUP'}' size='37' /></td>
+ <td> </td>
+ <td> </td>
+ </tr>
+ </table>
+END
+}
+
# ===================================================================
# LDAP auth settings
# ===================================================================
<td width='25%'><input type='text' name='NCSA_USERNAME' value='$proxysettings{'NCSA_USERNAME'}' size='12'
END
;
- if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly "; }
+ if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'}) { print " readonly='readonly' "; }
print <<END
/></td>
<td width='25%' class='base'>$Lang::tr{'advproxy NCSA group'}:</td>
print FILE <<END
if (
(isPlainHostName(host)) ||
- (dnsDomainIs(host, ".$mainsettings{'DOMAINNAME'}")) ||
(isInNet(host, "127.0.0.1", "255.0.0.0")) ||
- (isInNet(host, "10.0.0.0", "255.0.0.0")) ||
- (isInNet(host, "172.16.0.0", "255.240.0.0")) ||
- (isInNet(host, "192.168.0.0", "255.255.0.0")) ||
+END
+;
+
+ if ($netsettings{'GREEN_DEV'}) {
+ print FILE " (isInNet(host, \"$netsettings{'GREEN_NETADDRESS'}\", \"$netsettings{'GREEN_NETMASK'}\")) ||\n";
+ }
+
+ if (&Header::blue_used() && $netsettings{'BLUE_DEV'}) {
+ print FILE " (isInNet(host, \"$netsettings{'BLUE_NETADDRESS'}\", \"$netsettings{'BLUE_NETMASK'}\")) ||\n";
+ }
+
+ if (&Header::orange_used() && $netsettings{'ORANGE_DEV'}) {
+ print FILE " (isInNet(host, \"$netsettings{'ORANGE_NETADDRESS'}\", \"$netsettings{'ORANGE_NETMASK'}\")) ||\n";
+ }
+
+ print FILE <<END
(isInNet(host, "169.254.0.0", "255.255.0.0"))
)
return "DIRECT";
END
;
+
+ # Include file with user defined settings.
+ if (-e "/etc/squid/squid.conf.pre.local") {
+ print FILE "include /etc/squid/squid.conf.pre.local\n\n";
+ }
+
print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
- if ($proxysettings{'TRANSPARENT'} eq 'on') { print FILE " transparent" }
if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
print FILE "\n";
+ if ($proxysettings{'TRANSPARENT'} eq 'on') {
+ print FILE "http_port $netsettings{'GREEN_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept";
+ if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
+ print FILE "\n";
+ }
+
if ($netsettings{'BLUE_DEV'} && $proxysettings{'ENABLE_BLUE'} eq 'on') {
print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'PROXY_PORT'}";
- if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') { print FILE " transparent" }
if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
print FILE "\n";
+
+ if ($proxysettings{'TRANSPARENT_BLUE'} eq 'on') {
+ print FILE "http_port $netsettings{'BLUE_ADDRESS'}:$proxysettings{'TRANSPARENT_PORT'} intercept";
+ if ($proxysettings{'NO_CONNECTION_AUTH'} eq 'on') { print FILE " no-connection-auth" }
+ print FILE "\n";
+ }
}
if ($proxysettings{'CACHE_SIZE'} > 0)
print FILE <<END
cache_effective_user squid
-cache_effective_group squid
umask 022
pid_filename /var/run/squid.pid
print FILE "error_directory $errordir/$proxysettings{'ERR_LANGUAGE'}\n\n";
if ($proxysettings{'OFFLINE_MODE'} eq 'on') { print FILE "offline_mode on\n\n"; }
-
+ if ($proxysettings{'CACHE_DIGESTS'} eq 'on') { print FILE "digest_generation on\n\n"; } else { print FILE "digest_generation off\n\n"; }
+
if ((!($proxysettings{'MEM_POLICY'} eq 'LRU')) || (!($proxysettings{'CACHE_POLICY'} eq 'LRU')))
{
if (!($proxysettings{'MEM_POLICY'} eq 'LRU'))
print FILE "\n";
}
- if ($proxysettings{'CACHE_SIZE'} ne '0')
+ if ($proxysettings{'CACHE_SIZE'} > 0) {
+ print FILE <<END
+maximum_object_size $proxysettings{'MAX_SIZE'} KB
+minimum_object_size $proxysettings{'MIN_SIZE'} KB
+
+cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256
+END
+ ;
+ } else {
+ print FILE "cache deny all\n\n";
+ }
+
+ print FILE <<END
+request_body_max_size $proxysettings{'MAX_OUTGOING_SIZE'} KB
+END
+ ;
+
+ if ($proxysettings{'MAX_INCOMING_SIZE'} > 0) {
+ if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size none IPFire_unrestricted_ips\n"; }
+ if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size none IPFire_unrestricted_mac\n"; }
+ if ($proxysettings{'AUTH_METHOD'} eq 'ncsa')
+ {
+ if (!-z $extgrp) { print FILE "reply_body_max_size none for_extended_users\n"; }
+ }
+ }
+
+ if ( $proxysettings{'MAX_INCOMING_SIZE'} != '0' )
{
- print FILE "cache_dir aufs /var/log/cache $proxysettings{'CACHE_SIZE'} $proxysettings{'L1_DIRS'} 256\n\n";
+ print FILE "reply_body_max_size $proxysettings{'MAX_INCOMING_SIZE'} KB all\n\n";
}
if ($proxysettings{'LOGGING'} eq 'on')
{
print FILE <<END
-access_log /var/log/squid/access.log
+access_log stdio:/var/log/squid/access.log
cache_log /var/log/squid/cache.log
cache_store_log none
END
;
- if ($proxysettings{'LOGUSERAGENT'} eq 'on') { print FILE "useragent_log \/var\/log\/squid\/user_agent.log\n"; }
+ if ($proxysettings{'LOGUSERAGENT'} eq 'on') { print FILE "access_log stdio:\/var\/log\/squid\/user_agent.log useragent\n"; }
if ($proxysettings{'LOGQUERY'} eq 'on') { print FILE "\nstrip_query_terms off\n"; }
} else {
print FILE <<END
{
if ($proxysettings{'AUTH_METHOD'} eq 'ncsa')
{
- print FILE "auth_param basic program $authdir/ncsa_auth $userdb\n";
+ print FILE "auth_param basic program $authdir/basic_ncsa_auth $userdb\n";
print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
print FILE "auth_param basic realm $authrealm\n";
print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n";
if ($proxysettings{'AUTH_METHOD'} eq 'ldap')
{
print FILE "auth_param basic utf8 on\n";
- print FILE "auth_param basic program $authdir/squid_ldap_auth -b \"$proxysettings{'LDAP_BASEDN'}\"";
+ print FILE "auth_param basic program $authdir/basic_ldap_auth -b \"$proxysettings{'LDAP_BASEDN'}\"";
if (!($proxysettings{'LDAP_BINDDN_USER'} eq '')) { print FILE " -D \"$proxysettings{'LDAP_BINDDN_USER'}\""; }
if (!($proxysettings{'LDAP_BINDDN_PASS'} eq '')) { print FILE " -w $proxysettings{'LDAP_BINDDN_PASS'}"; }
if ($proxysettings{'LDAP_TYPE'} eq 'ADS')
print FILE "auth_param ntlm children $proxysettings{'AUTH_CHILDREN'}\n";
if (!($proxysettings{'AUTH_IPCACHE_TTL'} eq '0')) { print FILE "\nauthenticate_ip_ttl $proxysettings{'AUTH_IPCACHE_TTL'} minutes\n"; }
} else {
- print FILE "auth_param basic program $authdir/msnt_auth\n";
+ print FILE "auth_param basic program $authdir/basic_msnt_auth\n";
print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
print FILE "auth_param basic realm $authrealm\n";
print FILE "auth_param basic credentialsttl $proxysettings{'AUTH_CACHE_TTL'} minutes\n";
}
}
+ if ($proxysettings{'AUTH_METHOD'} eq 'ntlm-auth')
+ {
+ print FILE "auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp";
+ if ($proxysettings{'NTLM_AUTH_GROUP'}) {
+ my $ntlm_auth_group = $proxysettings{'NTLM_AUTH_GROUP'};
+ $ntlm_auth_group =~ s/\\/\+/;
+
+ print FILE " --require-membership-of=\"$ntlm_auth_group\"";
+ }
+ print FILE "\n";
+
+ print FILE "auth_param ntlm children $proxysettings{'AUTH_CHILDREN'}\n\n";
+
+ # BASIC authentication
+ if ($proxysettings{'NTLM_AUTH_BASIC'} eq "on") {
+ print FILE "auth_param basic program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-basic";
+ if ($proxysettings{'NTLM_AUTH_GROUP'}) {
+ my $ntlm_auth_group = $proxysettings{'NTLM_AUTH_GROUP'};
+ $ntlm_auth_group =~ s/\\/\+/;
+
+ print FILE " --require-membership-of=\"$ntlm_auth_group\"";
+ }
+ print FILE "\n";
+ print FILE "auth_param basic children 10\n";
+ print FILE "auth_param basic realm IPFire Web Proxy Server\n";
+ print FILE "auth_param basic credentialsttl 2 hours\n\n";
+ }
+ }
+
if ($proxysettings{'AUTH_METHOD'} eq 'radius')
{
- print FILE "auth_param basic program $authdir/squid_radius_auth -h $proxysettings{'RADIUS_SERVER'} -p $proxysettings{'RADIUS_PORT'} ";
+ print FILE "auth_param basic program $authdir/basic_radius_auth -h $proxysettings{'RADIUS_SERVER'} -p $proxysettings{'RADIUS_PORT'} ";
if (!($proxysettings{'RADIUS_IDENTIFIER'} eq '')) { print FILE "-i $proxysettings{'RADIUS_IDENTIFIER'} "; }
print FILE "-w $proxysettings{'RADIUS_SECRET'}\n";
print FILE "auth_param basic children $proxysettings{'AUTH_CHILDREN'}\n";
print FILE "acl blocked_mimetypes rep_mime_type \"$mimetypes\"\n\n";
}
- print FILE <<END
-#acl all src all
-acl localhost src 127.0.0.1/32
-END
-;
open (PORTS,"$acl_ports_ssl");
-@temp = <PORTS>;
+my @ssl_ports = <PORTS>;
close PORTS;
-if (@temp)
-{
- foreach (@temp) { print FILE "acl SSL_ports port $_"; }
+
+if (@ssl_ports) {
+ foreach (@ssl_ports) {
+ print FILE "acl SSL_ports port $_";
+ }
}
+
open (PORTS,"$acl_ports_safe");
-@temp = <PORTS>;
+my @safe_ports = <PORTS>;
close PORTS;
-if (@temp)
-{
- foreach (@temp) { print FILE "acl Safe_ports port $_"; }
+
+if (@safe_ports) {
+ foreach (@safe_ports) {
+ print FILE "acl Safe_ports port $_";
+ }
}
+
print FILE <<END
acl IPFire_http port $http_port
close (ACL);
}
if ((!-z $extgrp) && ($proxysettings{'AUTH_METHOD'} eq 'ncsa') && ($proxysettings{'NCSA_BYPASS_REDIR'} eq 'on')) { print FILE "\nredirector_access deny for_extended_users\n"; }
- print FILE <<END
+
+ # Check if squidclamav is enabled.
+ if ($proxysettings{'ENABLE_CLAMAV'} eq 'on') {
+ print FILE "\n#Settings for squidclamav:\n";
+ print FILE "http_port 127.0.0.1:$proxysettings{'PROXY_PORT'}\n";
+ print FILE "acl purge method PURGE\n";
+ print FILE "http_access deny to_localhost\n";
+ print FILE "http_access allow localhost\n";
+ print FILE "http_access allow purge localhost\n";
+ print FILE "http_access deny purge\n";
+ print FILE "url_rewrite_access deny localhost\n";
+ }
+ print FILE <<END;
#Access to squid:
#local machine, no restriction
http_access allow CONNECT IPFire_ips IPFire_networks IPFire_https
#Deny not web services
-http_access deny !Safe_ports
-http_access deny CONNECT !SSL_ports
-
END
- ;
+
+if (@safe_ports) {
+ print FILE "http_access deny !Safe_ports\n";
+}
+
+if (@ssl_ports) {
+ print FILE "http_access deny CONNECT !SSL_ports\n";
+}
if ($proxysettings{'AUTH_METHOD'} eq 'ident')
{
print FILE "http_reply_access allow all\n\n";
}
- if ($proxysettings{'CACHE_SIZE'} > 0)
- {
- print FILE <<END
-maximum_object_size $proxysettings{'MAX_SIZE'} KB
-minimum_object_size $proxysettings{'MIN_SIZE'} KB
-
-END
- ;
- } else { print FILE "cache deny all\n\n"; }
-
- print FILE <<END
-request_body_max_size $proxysettings{'MAX_OUTGOING_SIZE'} KB
-END
- ;
- if ($proxysettings{'MAX_INCOMING_SIZE'} > 0) {
- if (!-z $acl_src_unrestricted_ip) { print FILE "reply_body_max_size none IPFire_unrestricted_ips\n"; }
- if (!-z $acl_src_unrestricted_mac) { print FILE "reply_body_max_size none IPFire_unrestricted_mac\n"; }
- if ($proxysettings{'AUTH_METHOD'} eq 'ncsa')
- {
- if (!-z $extgrp) { print FILE "reply_body_max_size none for_extended_users\n"; }
- }
- }
-
- if ( $proxysettings{'MAX_INCOMING_SIZE'} != '0' )
- {
- print FILE "reply_body_max_size $proxysettings{'MAX_INCOMING_SIZE'} KB all\n\n";
- }
-
print FILE "visible_hostname";
if ($proxysettings{'VISIBLE_HOSTNAME'} eq '')
{
print FILE "include /etc/squid/squid.conf.local\n";
}
close FILE;
+
+ # Proxy settings for squidclamav - if installed.
+ #
+ # Check if squidclamav is enabled.
+ if ($proxysettings{'ENABLE_CLAMAV'} eq 'on') {
+
+ my $configfile='/etc/squidclamav.conf';
+
+ my $data = &General::read_file_utf8($configfile);
+ $data =~ s/squid_port [0-9]+/squid_port $proxysettings{'PROXY_PORT'}/g;
+ &General::write_file_utf8($configfile, $data);
+ }
}
# -------------------------------------------------------------------