mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
Added recent proxy modifications to core27
Ability to change filedescriptors up to 16000 Ability to use cachemanager website to monitor squid Ability to reconfigure squid wihtout restart
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
etc/init.d/squid
|
||||
etc/sysctl.conf
|
||||
etc/squid/errors
|
||||
usr/bin/squidclient
|
||||
@@ -17,6 +18,7 @@ usr/lib/squid/smb_auth.pl
|
||||
usr/lib/squid/smb_auth.sh
|
||||
usr/lib/squid/squid_ldap_auth
|
||||
usr/lib/squid/unlinkd
|
||||
usr/local/bin/squidctrl
|
||||
usr/sbin/squid
|
||||
var/ipfire/updatexlrator/bin/checkdeaddl
|
||||
var/ipfire/updatexlrator/bin/checkup
|
||||
@@ -25,6 +27,7 @@ var/ipfire/updatexlrator/bin/download
|
||||
var/ipfire/updatexlrator/bin/lscache
|
||||
var/ipfire/updatexlrator/updxlrator-lib.pl
|
||||
srv/web/ipfire/cgi-bin/proxy.cgi
|
||||
srv/web/ipfire/cgi-bin/cachemgr.cgi
|
||||
srv/web/ipfire/cgi-bin/updatexlrator.cgi
|
||||
var/ipfire/langs
|
||||
lib/modules/2.6.25.19-ipfire/kernel/drivers/net/imq.ko
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
#!/bin/bash
|
||||
. /opt/pakfire/lib/functions.sh
|
||||
/usr/local/bin/backupctrl exclude >/dev/null 2>&1
|
||||
/etc/init.d/squid stop
|
||||
extract_files
|
||||
[ -e /var/ipfire/qos/enable ] && qosctrl stop
|
||||
qosctrl generate
|
||||
[ -e /var/ipfire/qos/enable ] && qosctrl start
|
||||
perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"
|
||||
sysctl -p
|
||||
/etc/init.d/squid restart
|
||||
mv /etc/squid/cachemgr.conf /var/ipfire/proxy/cachemgr.conf
|
||||
ln -sf /var/ipfire/proxy/cachemgr.conf /etc/squid/cachemgr.conf
|
||||
chown nobody.nobody /var/ipfire/proxy/cachemgr.conf
|
||||
/etc/init.d/squid start
|
||||
@@ -192,6 +192,7 @@ $proxysettings{'TRANSPARENT_BLUE'} = 'off';
|
||||
$proxysettings{'PROXY_PORT'} = '800';
|
||||
$proxysettings{'VISIBLE_HOSTNAME'} = '';
|
||||
$proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
|
||||
$proxysettings{'ADMIN_PASSWORD'} = '';
|
||||
$proxysettings{'ERR_LANGUAGE'} = 'German';
|
||||
$proxysettings{'ERR_DESIGN'} = 'ipfire';
|
||||
$proxysettings{'SUPPRESS_VERSION'} = 'off';
|
||||
@@ -203,8 +204,10 @@ $proxysettings{'UPSTREAM_PROXY'} = '';
|
||||
$proxysettings{'UPSTREAM_USER'} = '';
|
||||
$proxysettings{'UPSTREAM_PASSWORD'} = '';
|
||||
$proxysettings{'LOGGING'} = 'off';
|
||||
$proxysettings{'CACHEMGR'} = 'off';
|
||||
$proxysettings{'LOGQUERY'} = 'off';
|
||||
$proxysettings{'LOGUSERAGENT'} = 'off';
|
||||
$proxysettings{'FILEDESCRIPTORS'} = '4096';
|
||||
$proxysettings{'CACHE_MEM'} = '2';
|
||||
$proxysettings{'CACHE_SIZE'} = '50';
|
||||
$proxysettings{'MAX_SIZE'} = '4096';
|
||||
@@ -331,7 +334,7 @@ if ($proxysettings{'ACTION'} eq $Lang::tr{'edit'})
|
||||
$proxysettings{'NCSA_PASS_CONFIRM'} = $proxysettings{'NCSA_PASS'};
|
||||
}
|
||||
|
||||
if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}))
|
||||
if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) || ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'}))
|
||||
{
|
||||
if ($proxysettings{'ENABLE'} !~ /^(on|off)$/ ||
|
||||
$proxysettings{'TRANSPARENT'} !~ /^(on|off)$/ ||
|
||||
@@ -354,6 +357,12 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'}
|
||||
goto ERROR;
|
||||
}
|
||||
}
|
||||
if (!($proxysettings{'FILEDESCRIPTORS'} =~ /^\d+/) ||
|
||||
($proxysettings{'FILEDESCRIPTORS'} < 1) || ($proxysettings{'FILEDESCRIPTORS'} > 16384))
|
||||
{
|
||||
$errormessage = $Lang::tr{'proxy errmsg filedescriptors'};
|
||||
goto ERROR;
|
||||
}
|
||||
if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/) ||
|
||||
($proxysettings{'CACHE_MEM'} < 1))
|
||||
{
|
||||
@@ -625,6 +634,8 @@ ERROR:
|
||||
&writeconfig;
|
||||
&writepacfile;
|
||||
|
||||
if ($proxysettings{'CACHEMGR'} eq 'on'){&writecachemgr;}
|
||||
|
||||
system ('/usr/local/bin/squidctrl', 'disable');
|
||||
unlink "${General::swroot}/proxy/enable";
|
||||
unlink "${General::swroot}/proxy/transparent";
|
||||
@@ -643,7 +654,8 @@ ERROR:
|
||||
system ('/usr/bin/touch', "${General::swroot}/proxy/transparent_blue"); }
|
||||
|
||||
if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy save and restart'}) { system('/usr/local/bin/squidctrl restart >/dev/null 2>&1'); }
|
||||
}
|
||||
if ($proxysettings{'ACTION'} eq $Lang::tr{'proxy reconfigure'}) { system('/usr/local/bin/squidctrl reconfigure >/dev/null 2>&1'); }
|
||||
}
|
||||
}
|
||||
|
||||
if ($proxysettings{'ACTION'} eq $Lang::tr{'advproxy clear cache'})
|
||||
@@ -704,6 +716,9 @@ $checked{'OFFLINE_MODE'}{$proxysettings{'OFFLINE_MODE'}} = "checked='checked'";
|
||||
$checked{'LOGGING'}{'off'} = '';
|
||||
$checked{'LOGGING'}{'on'} = '';
|
||||
$checked{'LOGGING'}{$proxysettings{'LOGGING'}} = "checked='checked'";
|
||||
$checked{'CACHEMGR'}{'off'} = '';
|
||||
$checked{'CACHEMGR'}{'on'} = '';
|
||||
$checked{'CACHEMGR'}{$proxysettings{'CACHEMGR'}} = "checked='checked'";
|
||||
$checked{'LOGQUERY'}{'off'} = '';
|
||||
$checked{'LOGQUERY'}{'on'} = '';
|
||||
$checked{'LOGQUERY'}{$proxysettings{'LOGQUERY'}} = "checked='checked'";
|
||||
@@ -915,8 +930,7 @@ if ($netsettings{'BLUE_DEV'}) {
|
||||
print "<td colspan='2'> </td>";
|
||||
}
|
||||
print <<END
|
||||
<td class='base'>$Lang::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
|
||||
<td><input type='text' name='ADMIN_MAIL_ADDRESS' value='$proxysettings{'ADMIN_MAIL_ADDRESS'}' /></td>
|
||||
<td colspan='2'> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
END
|
||||
@@ -1038,6 +1052,18 @@ print <<END
|
||||
<tr>
|
||||
<td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'>$Lang::tr{'proxy cachemgr'}:</td>
|
||||
<td><input type='checkbox' name='CACHEMGR' $checked{'CACHEMGR'}{'on'} /></td>
|
||||
<td class='base'>$Lang::tr{'advproxy admin mail'}: <img src='/blob.gif' alt='*' /></td>
|
||||
<td><input type='text' name='ADMIN_MAIL_ADDRESS' value='$proxysettings{'ADMIN_MAIL_ADDRESS'}' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base'>$Lang::tr{'proxy filedescriptors'}:</td>
|
||||
<td><input type='text' name='FILEDESCRIPTORS' value='$proxysettings{'FILEDESCRIPTORS'}' size='5' /></td>
|
||||
<td class='base'>$Lang::tr{'proxy admin password'}: <img src='/blob.gif' alt='*' /></td>
|
||||
<td><input type='text' name='ADMIN_PASSWORD' value='$proxysettings{'ADMIN_PASSWORD'}' /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width='25%'></td> <td width='20%'> </td><td width='25%'> </td><td width='30%'></td>
|
||||
</tr>
|
||||
@@ -2111,6 +2137,7 @@ print <<END
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
|
||||
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'proxy reconfigure'}' /></td>
|
||||
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy save and restart'}' /></td>
|
||||
<td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'advproxy clear cache'}' /></td>
|
||||
<td> </td>
|
||||
@@ -3856,7 +3883,11 @@ END
|
||||
print FILE " $proxysettings{'VISIBLE_HOSTNAME'}\n\n";
|
||||
}
|
||||
|
||||
if (!($proxysettings{'ADMIN_MAIL_ADDRESS'} eq '')) { print FILE "cache_mgr $proxysettings{'ADMIN_MAIL_ADDRESS'}\n\n"; }
|
||||
if (!($proxysettings{'ADMIN_MAIL_ADDRESS'} eq '')) { print FILE "cache_mgr $proxysettings{'ADMIN_MAIL_ADDRESS'}\n"; }
|
||||
if (!($proxysettings{'ADMIN_PASSWORD'} eq '')) { print FILE "cachemgr_passwd $proxysettings{'ADMIN_PASSWORD'} all\n"; }
|
||||
print FILE "\n";
|
||||
|
||||
print FILE "max_filedescriptors $proxysettings{'FILEDESCRIPTORS'}\n\n";
|
||||
|
||||
# Write the parent proxy info, if needed.
|
||||
if ($remotehost ne '')
|
||||
@@ -3954,3 +3985,14 @@ sub deluser
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
sub writecachemgr
|
||||
{
|
||||
open(FILE, ">${General::swroot}/proxy/cachemgr.conf");
|
||||
flock(FILE, 2);
|
||||
print FILE "$netsettings{'GREEN_ADDRESS'}:$proxysettings{'PROXY_PORT'}\n";
|
||||
print FILE "localhost";
|
||||
return;
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
@@ -2006,6 +2006,11 @@
|
||||
'you can only define one roadwarrior connection when using pre-shared key authentication' => 'Sie können nur eine Roadwarrior Verbindung definieren, wenn die Pre-shared Schlüsselauthentifizierung verwendet wird.<br/>Entweder haben Sie bereits eine Roadwarrior Verbindung mit Pre-shared Schlüsselauthentifizierung, oder Sie versuchen gerade eine hinzuzufügen.',
|
||||
'your department' => 'Ihre Abteilung',
|
||||
'your e-mail' => 'Ihre E-mail Adresse',
|
||||
'proxy errmsg filedescriptors' => 'Ungültiger Anzahl Filedescriptoren',
|
||||
'proxy filedescriptors' => 'Anzahl Fildescriptoren',
|
||||
'proxy admin password' => 'Cache Administrator Passwort',
|
||||
'proxy cachemgr' => 'Cachemanager aktivieren',
|
||||
'proxy reconfigure' => 'Speichern und Laden',
|
||||
);
|
||||
|
||||
#EOF
|
||||
|
||||
@@ -2039,6 +2039,11 @@
|
||||
'you can only define one roadwarrior connection when using pre-shared key authentication' => 'You can only define one Roadwarrior connection when using pre-shared key authentication.<br />Either you already have a Roadwarrior connection with pre-shared key authentication, or you\'re trying to add one now.',
|
||||
'your department' => 'Your Department',
|
||||
'your e-mail' => 'Your E-mail Address',
|
||||
'proxy errmsg filedescriptors' => 'Wrong amount of filedescriptors',
|
||||
'proxy filedescriptors' => 'Amount of fildescriptors',
|
||||
'proxy admin password' => 'Cache administrator password',
|
||||
'proxy cachemgr' => 'Activate cachemanager',
|
||||
'proxy reconfigure' => 'Save and Reload',
|
||||
);
|
||||
|
||||
#EOF
|
||||
|
||||
10
lfs/squid
10
lfs/squid
@@ -86,14 +86,17 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
--enable-ntlm-auth-helpers="SMB" \
|
||||
--enable-useragent-log \
|
||||
--enable-referer-log \
|
||||
--enable-snmp \
|
||||
--with-pthreads --with-dl
|
||||
--enable-snmp \
|
||||
--with-pthreads --with-dl \
|
||||
--with-maxfd="16384"
|
||||
|
||||
cd $(DIR_APP) && make $(MAKETUNING)
|
||||
cd $(DIR_APP) && make install
|
||||
|
||||
rm -f /etc/squid/squid.conf
|
||||
ln -sf /var/ipfire/proxy/squid.conf /etc/squid/squid.conf
|
||||
rm -f /etc/squid/cachemgr.conf
|
||||
ln -sf /var/ipfire/proxy/cachemgr.conf /etc/squid/cachemgr.conf
|
||||
rm -f /etc/squid/errors
|
||||
ln -sf /usr/lib/squid/errors/English /etc/squid/errors
|
||||
|
||||
@@ -101,6 +104,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
touch /var/log/squid/access.log
|
||||
chown -R squid:squid /var/log/squid /var/log/cache /var/log/updatexlrator
|
||||
|
||||
cp /usr/lib/squid/cachemgr.cgi /srv/web/ipfire/cgi-bin/cachemgr.cgi
|
||||
chown nobody.nobody /srv/web/ipfire/cgi-bin/cachemgr.cgi
|
||||
|
||||
cp -f $(DIR_SRC)/config/updxlrator/updxlrator /usr/sbin/updxlrator
|
||||
cp -f $(DIR_SRC)/config/updxlrator/checkup /var/ipfire/updatexlrator/bin/checkup
|
||||
cp -f $(DIR_SRC)/config/updxlrator/download /var/ipfire/updatexlrator/bin/download
|
||||
|
||||
@@ -90,6 +90,10 @@ case "$1" in
|
||||
$0 start
|
||||
;;
|
||||
|
||||
reconfigure)
|
||||
/usr/sbin/squid -k reconfigure
|
||||
;;
|
||||
|
||||
status)
|
||||
statusproc /usr/sbin/squid
|
||||
statusproc /usr/lib/squid/unlinkd
|
||||
|
||||
@@ -19,7 +19,7 @@ int main(int argc, char *argv[]) {
|
||||
exit(1);
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "\nNo argument given.\n\nsquidctrl (start|stop|restart|flush)\n\n");
|
||||
fprintf(stderr, "\nNo argument given.\n\nsquidctrl (start|stop|restart|flush|reconfigure)\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ int main(int argc, char *argv[]) {
|
||||
safe_system("/etc/rc.d/init.d/squid stop");
|
||||
} else if (strcmp(argv[1], "restart") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/squid restart");
|
||||
} else if (strcmp(argv[1], "reconfigure") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/squid reconfigure");
|
||||
} else if (strcmp(argv[1], "flush") == 0) {
|
||||
safe_system("/etc/rc.d/init.d/squid flush");
|
||||
} else if (strcmp(argv[1], "enable") == 0) {
|
||||
@@ -37,7 +39,7 @@ int main(int argc, char *argv[]) {
|
||||
} else if (strcmp(argv[1], "disable") == 0) {
|
||||
safe_system("rm -f /etc/rc.d/rc*.d/*squid >/dev/null 2>&1");
|
||||
} else {
|
||||
fprintf(stderr, "\nBad argument given.\n\nsquidctrl (start|stop|restart|flush)\n\n");
|
||||
fprintf(stderr, "\nBad argument given.\n\nsquidctrl (start|stop|restart|flush|reconfigure)\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user