]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Added recent proxy modifications to core27
authormaniacikarus <maniacikarus@ipfire.org>
Tue, 17 Feb 2009 18:31:14 +0000 (19:31 +0100)
committermaniacikarus <maniacikarus@ipfire.org>
Tue, 17 Feb 2009 18:31:14 +0000 (19:31 +0100)
Ability to change filedescriptors up to 16000
Ability to use cachemanager website to monitor squid
Ability to reconfigure squid wihtout restart

config/rootfiles/core/27/files
config/rootfiles/core/27/update.sh
html/cgi-bin/proxy.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl
lfs/squid
src/initscripts/init.d/squid
src/misc-progs/squidctrl.c

index 6c1e603dc82bd07d17880820acc612302553ad2e..6b3bbbc55257503aa10040b3dd423f877d464d63 100644 (file)
@@ -1,3 +1,4 @@
+etc/init.d/squid
 etc/sysctl.conf
 etc/squid/errors
 usr/bin/squidclient
 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/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
 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
 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
 srv/web/ipfire/cgi-bin/updatexlrator.cgi
 var/ipfire/langs
 lib/modules/2.6.25.19-ipfire/kernel/drivers/net/imq.ko
index c8e847c3c4daa5e7942d54048666ed86ededa517..d28e9dc8cb94f0da58a06a82636002109ee3c01f 100644 (file)
@@ -1,10 +1,14 @@
 #!/bin/bash
 . /opt/pakfire/lib/functions.sh
 /usr/local/bin/backupctrl exclude >/dev/null 2>&1
 #!/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
 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
\ No newline at end of file
index 7aba37a00f43de83e5a0002457825dc56e79c4b8..780fe5b92f116e849039c97c3c3c643dc45bb52d 100644 (file)
@@ -192,6 +192,7 @@ $proxysettings{'TRANSPARENT_BLUE'} = 'off';
 $proxysettings{'PROXY_PORT'} = '800';
 $proxysettings{'VISIBLE_HOSTNAME'} = '';
 $proxysettings{'ADMIN_MAIL_ADDRESS'} = '';
 $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';
 $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{'UPSTREAM_USER'} = '';
 $proxysettings{'UPSTREAM_PASSWORD'} = '';
 $proxysettings{'LOGGING'} = 'off';
+$proxysettings{'CACHEMGR'} = 'off';
 $proxysettings{'LOGQUERY'} = 'off';
 $proxysettings{'LOGUSERAGENT'} = 'off';
 $proxysettings{'LOGQUERY'} = 'off';
 $proxysettings{'LOGUSERAGENT'} = 'off';
+$proxysettings{'FILEDESCRIPTORS'} = '4096';
 $proxysettings{'CACHE_MEM'} = '2';
 $proxysettings{'CACHE_SIZE'} = '50';
 $proxysettings{'MAX_SIZE'} = '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'};
 }
 
        $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)$/ ||
 {
        if ($proxysettings{'ENABLE'} !~ /^(on|off)$/ ||
            $proxysettings{'TRANSPARENT'} !~ /^(on|off)$/ ||
@@ -354,6 +357,12 @@ if (($proxysettings{'ACTION'} eq $Lang::tr{'save'}) || ($proxysettings{'ACTION'}
                        goto ERROR;
                }
        }
                        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))
        {
        if (!($proxysettings{'CACHE_MEM'} =~ /^\d+/) ||
                ($proxysettings{'CACHE_MEM'} < 1))
        {
@@ -625,6 +634,8 @@ ERROR:
                &writeconfig;
                &writepacfile;
 
                &writeconfig;
                &writepacfile;
 
+               if ($proxysettings{'CACHEMGR'} eq 'on'){&writecachemgr;}
+
                system ('/usr/local/bin/squidctrl', 'disable');
                unlink "${General::swroot}/proxy/enable";
                unlink "${General::swroot}/proxy/transparent";
                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'); }
                        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'})
 }
 
 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{'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'";
 $checked{'LOGQUERY'}{'off'} = '';
 $checked{'LOGQUERY'}{'on'} = '';
 $checked{'LOGQUERY'}{$proxysettings{'LOGQUERY'}} = "checked='checked'";
@@ -915,8 +930,7 @@ if ($netsettings{'BLUE_DEV'}) {
        print "<td colspan='2'>&nbsp;</td>";
 }
 print <<END
        print "<td colspan='2'>&nbsp;</td>";
 }
 print <<END
-       <td class='base'>$Lang::tr{'advproxy admin mail'}:&nbsp;<img src='/blob.gif' alt='*' /></td>
-       <td><input type='text' name='ADMIN_MAIL_ADDRESS' value='$proxysettings{'ADMIN_MAIL_ADDRESS'}' /></td>
+       <td colspan='2'>&nbsp;</td>
 </tr>
 <tr>
 END
 </tr>
 <tr>
 END
@@ -1038,6 +1052,18 @@ print <<END
 <tr>
        <td colspan='4'><b>$Lang::tr{'advproxy cache management'}</b></td>
 </tr>
 <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'}:&nbsp;<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'}:&nbsp;<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>
 <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>&nbsp;</td>
        <td align='center'><input type='submit' name='ACTION' value='$Lang::tr{'save'}' /></td>
 <tr>
        <td>&nbsp;</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>&nbsp;</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>&nbsp;</td>
@@ -3856,7 +3883,11 @@ END
                print FILE " $proxysettings{'VISIBLE_HOSTNAME'}\n\n";
        }
 
                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 '')
 
        # 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;
+}
+
+# -------------------------------------------------------------------
\ No newline at end of file
index efaf8f0fa2373dbf4f80e82c42d459bf00097f71..06dae3b8eb2c3043aca8ca68cee1a8a483129cdc 100644 (file)
 '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',
 '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
 );
 
 #EOF
index 230e47fa38cda65f27b95d7510ddc521a5c8950d..51780964ca47df17870c8584b4e599a5447d9626 100644 (file)
 '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',
 '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
 );
 
 #EOF
index f4bc5f00c27860f93dbd8cf8fa5dbb2f78c36783..b91faa13c79e39a6b22a8ef963dfc0d4fbb380ed 100644 (file)
--- a/lfs/squid
+++ b/lfs/squid
@@ -86,14 +86,17 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
           --enable-ntlm-auth-helpers="SMB" \
           --enable-useragent-log \
           --enable-referer-log \
           --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
 
        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
 
        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
 
        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
        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
index 25fcac0c4eff2f77e286ecf03177a9532bdcb77f..85c1a4311f611a6389710ad064c690a0617f3b39 100644 (file)
@@ -90,6 +90,10 @@ case "$1" in
                $0 start
                ;;
 
                $0 start
                ;;
 
+       reconfigure)
+       /usr/sbin/squid -k reconfigure
+               ;;
+
        status)
                statusproc /usr/sbin/squid
                statusproc /usr/lib/squid/unlinkd
        status)
                statusproc /usr/sbin/squid
                statusproc /usr/lib/squid/unlinkd
index 11966203099efbcd621534c483102c7d21521203..9f3ba5dd9a3a9acc83e3a727174bd5cc7f356913 100644 (file)
@@ -19,7 +19,7 @@ int main(int argc, char *argv[]) {
                exit(1);
 
        if (argc < 2) {
                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);
        }
 
                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");
                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) {
        } 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 {
        } 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);
        }
 
                exit(1);
        }