From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Koch To: development@lists.ipfire.org Subject: [PATCH 1/2] squid / WPAD: Add GUI for exception-files for generation of proxy.pac Date: Thu, 18 Apr 2019 01:54:17 +0200 Message-ID: <1555545258-20523-1-git-send-email-ipfire@starkstromkonsument.de> In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6508221741458808957==" List-Id: --===============6508221741458808957== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This patch adds the missing Web-GUI for the WPAD-Exceptions to proxy.cgi Note: The translations are only done for "en" and "de" yet! Signed-off-by: Alexander Koch --- html/cgi-bin/proxy.cgi | 110 +++++++++++++++++++++++++++++++++++++++++++++++= -- langs/de/cgi-bin/de.pl | 7 ++++ langs/en/cgi-bin/en.pl | 7 ++++ langs/es/cgi-bin/es.pl | 7 ++++ langs/fr/cgi-bin/fr.pl | 7 ++++ langs/it/cgi-bin/it.pl | 7 ++++ langs/nl/cgi-bin/nl.pl | 7 ++++ langs/pl/cgi-bin/pl.pl | 7 ++++ langs/ru/cgi-bin/ru.pl | 7 ++++ langs/tr/cgi-bin/tr.pl | 7 ++++ 10 files changed, 169 insertions(+), 4 deletions(-) diff --git a/html/cgi-bin/proxy.cgi b/html/cgi-bin/proxy.cgi index 369a5cb..46908d2 100644 --- a/html/cgi-bin/proxy.cgi +++ b/html/cgi-bin/proxy.cgi @@ -559,6 +559,8 @@ ERROR: delete $proxysettings{'SRC_UNRESTRICTED_MAC'}; delete $proxysettings{'DST_NOCACHE'}; delete $proxysettings{'DST_NOAUTH'}; + delete $proxysettings{'DST_NOPROXY_IP'}; + delete $proxysettings{'DST_NOPROXY_URL'}; delete $proxysettings{'PORTS_SAFE'}; delete $proxysettings{'PORTS_SSL'}; delete $proxysettings{'MIME_TYPES'}; @@ -1318,6 +1320,58 @@ END ; } =20 +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +# WPAD settings +# =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +print < + + $Lang::tr{'advproxy wpad title'} + + + + + + $Lang::tr{'advproxy wpad label dst_noproxy= _ip'}: + $Lang::tr{'advproxy wpad label dst_noproxy= _url'}: + + + + + + + + $Lang::tr{'advproxy wpad example dst_nopro= xy_ip'} + $Lang::tr{'advproxy wpad example dst_nopro= xy_url'} + + +   + + + $Lang::tr{'advproxy wpad view pac'}: http://$ENV{SERVER_ADDR}:81/wp= ad.dat + + + +
+ +END +; + # ------------------------------------------------------------------- =20 print <) { $proxysettings{'DST_NOAUTH'} .=3D $_ }; close(FILE); } + if (-e "$acl_dst_noproxy_ip") { + open(FILE,"$acl_dst_noproxy_ip"); + delete $proxysettings{'DST_NOPROXY_IP'}; + while () { $proxysettings{'DST_NOPROXY_IP'} .=3D $_ }; + close(FILE); + } + if (-e "$acl_dst_noproxy_url") { + open(FILE,"$acl_dst_noproxy_url"); + delete $proxysettings{'DST_NOPROXY_URL'}; + while () { $proxysettings{'DST_NOPROXY_URL'} .=3D $_ }; + close(FILE); + } if (-e "$acl_ports_safe") { open(FILE,"$acl_ports_safe"); delete $proxysettings{'PORTS_SAFE'}; @@ -2446,6 +2512,31 @@ sub check_acls } } =20 + @temp =3D split(/\n/,$proxysettings{'DST_NOPROXY_IP'}); + undef $proxysettings{'DST_NOPROXY_IP'}; + foreach (@temp) + { + s/^\s+//g; s/\s+$//g; + if ($_) + { + unless (&General::validipormask($_)) { $errormessage =3D $Lang::tr{'adv= proxy errmsg wpad invalid ip or mask'}; } + $proxysettings{'DST_NOPROXY_IP'} .=3D $_."\n"; + } + } + + @temp =3D split(/\n/,$proxysettings{'DST_NOPROXY_URL'}); + undef $proxysettings{'DST_NOPROXY_URL'}; + foreach (@temp) + { + s/^\s+//g; + unless (/^#/) { s/\s+//g; } + if ($_) + { + if (/^\./) { $_ =3D '*'.$_; } + $proxysettings{'DST_NOPROXY_URL'} .=3D $_."\n"; + } + } + if (($proxysettings{'NTLM_ENABLE_ACL'} eq 'on') && ($proxysettings{'NTLM_US= ER_ACL'} eq 'positive')) { @temp =3D split(/\n/,$proxysettings{'NTLM_ALLOW_USERS'}); @@ -2584,6 +2675,16 @@ sub write_acls print FILE $proxysettings{'DST_NOAUTH'}; close(FILE); =20 + open(FILE, ">$acl_dst_noproxy_ip"); + flock(FILE, 2); + print FILE $proxysettings{'DST_NOPROXY_IP'}; + close(FILE); + + open(FILE, ">$acl_dst_noproxy_url"); + flock(FILE, 2); + print FILE $proxysettings{'DST_NOPROXY_URL'}; + close(FILE); + open(FILE, ">$acl_dst_noauth_net"); close(FILE); open(FILE, ">$acl_dst_noauth_dom"); @@ -2769,7 +2870,7 @@ END # Additional exceptions for URLs # The file has to be created by the user and should contain one entry per l= ine # Line-Format: - # e.g. *ipfire.org* + # e.g. *.ipfire.org* if (-s "$acl_dst_noproxy_url") { undef @templist; =20 @@ -2786,8 +2887,8 @@ END =20 # Additional exceptions for Subnets # The file has to be created by the user and should contain one entry per l= ine - # Line-Format: "", "" - # e.g. "192.168.0.0", "255.255.255.0" + # Line-Format: / + # e.g. 192.168.0.0/255.255.255.0 if (-s "$acl_dst_noproxy_ip") { undef @templist; =20 @@ -2798,7 +2899,8 @@ END =20 foreach (@templist) { - print FILE " (isInNet(host, $_)) ||\n"; + @temp =3D split(/\//); + print FILE " (isInNet(host, \"$temp[0]\", \"$temp[1]\")) ||\n"; } } =20 diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index d63ebe6..764ea60 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -396,6 +396,13 @@ 'advproxy visible hostname' =3D> 'Sichtbarer Hostname', 'advproxy web browser' =3D> 'Web-Browser', 'advproxy wednesday' =3D> 'Mi', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Ausgenommene URL\'s (eine pro Ze= ile)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Ausgenommene IP-Subnetze (eins pr= o Zeile)', +'advproxy wpad example dst_noproxy_url' =3D> 'z.B. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'z.B. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Ungültige IP oder= Subnetz für ausgenommenes IP-Subnetz', +'advproxy wpad view pac' =3D> 'PAC-Datei aufrufen', 'again' =3D> 'Wiederholung:', 'age second' =3D> 'Sekunde', 'age seconds' =3D> 'Sekunden', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index a709604..c66914d 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -397,6 +397,13 @@ 'advproxy visible hostname' =3D> 'Visible hostname', 'advproxy web browser' =3D> 'Web browser', 'advproxy wednesday' =3D> 'Wed', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'Again:', 'age second' =3D> 'second', 'age seconds' =3D> 'seconds', diff --git a/langs/es/cgi-bin/es.pl b/langs/es/cgi-bin/es.pl index 23bc207..f960461 100644 --- a/langs/es/cgi-bin/es.pl +++ b/langs/es/cgi-bin/es.pl @@ -316,6 +316,13 @@ 'advproxy visible hostname' =3D> 'Nombre de host visible', 'advproxy web browser' =3D> 'Navegador Web', 'advproxy wednesday' =3D> 'Mie', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'De nuevo:', 'aktiv' =3D> 'Activo', 'album' =3D> 'Album', diff --git a/langs/fr/cgi-bin/fr.pl b/langs/fr/cgi-bin/fr.pl index b4ecf32..f5d3e51 100644 --- a/langs/fr/cgi-bin/fr.pl +++ b/langs/fr/cgi-bin/fr.pl @@ -394,6 +394,13 @@ 'advproxy visible hostname' =3D> 'Nom d\'h=C3=B4te visible ', 'advproxy web browser' =3D> 'Navigateur web', 'advproxy wednesday' =3D> 'Mer', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'De nouveau :', 'age second' =3D> 'seconde', 'age seconds' =3D> 'secondes', diff --git a/langs/it/cgi-bin/it.pl b/langs/it/cgi-bin/it.pl index 6c9137c..2b819ff 100644 --- a/langs/it/cgi-bin/it.pl +++ b/langs/it/cgi-bin/it.pl @@ -331,6 +331,13 @@ 'advproxy visible hostname' =3D> 'Hostname Visible', 'advproxy web browser' =3D> 'Web browser', 'advproxy wednesday' =3D> 'Mer', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'Again:', 'age second' =3D> 'Secondi', 'age seconds' =3D> 'Secondi', diff --git a/langs/nl/cgi-bin/nl.pl b/langs/nl/cgi-bin/nl.pl index 5fa89b1..a2b4633 100644 --- a/langs/nl/cgi-bin/nl.pl +++ b/langs/nl/cgi-bin/nl.pl @@ -330,6 +330,13 @@ 'advproxy visible hostname' =3D> 'Zichtbare hostnaam', 'advproxy web browser' =3D> 'Webbrowser', 'advproxy wednesday' =3D> 'Woe', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'Nogmaals:', 'age second' =3D> 'seconde', 'age seconds' =3D> 'seconden', diff --git a/langs/pl/cgi-bin/pl.pl b/langs/pl/cgi-bin/pl.pl index 521381a..ab2ef42 100644 --- a/langs/pl/cgi-bin/pl.pl +++ b/langs/pl/cgi-bin/pl.pl @@ -318,6 +318,13 @@ 'advproxy visible hostname' =3D> 'Widoczna nazwa hosta', 'advproxy web browser' =3D> 'Przegl=C4=85darka WWW', 'advproxy wednesday' =3D> '=C5=9Ar', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'Ponownie:', 'aktiv' =3D> 'Aktywny', 'album' =3D> 'Album', diff --git a/langs/ru/cgi-bin/ru.pl b/langs/ru/cgi-bin/ru.pl index 9ac46d4..1963468 100644 --- a/langs/ru/cgi-bin/ru.pl +++ b/langs/ru/cgi-bin/ru.pl @@ -316,6 +316,13 @@ 'advproxy visible hostname' =3D> '=D0=92=D0=B8=D0=B4=D0=B8=D0=BC=D0=BE=D0=B5= =D0=B8=D0=BC=D1=8F =D1=85=D0=BE=D1=81=D1=82=D0=B0', 'advproxy web browser' =3D> '=D0=92=D0=B5=D0=B1 =D0=91=D1=80=D0=B0=D1=83=D0= =B7=D0=B5=D1=80: ', 'advproxy wednesday' =3D> '=D0=A1=D1=80', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> '=D0=95=D1=89=D1=91 =D1=80=D0=B0=D0=B7:', 'aktiv' =3D> '=D0=90=D0=BA=D1=82=D0=B8=D0=B2=D0=B5=D0=BD', 'album' =3D> '=D0=90=D0=BB=D1=8C=D0=B1=D0=BE=D0=BC', diff --git a/langs/tr/cgi-bin/tr.pl b/langs/tr/cgi-bin/tr.pl index 1917b82..d23616d 100644 --- a/langs/tr/cgi-bin/tr.pl +++ b/langs/tr/cgi-bin/tr.pl @@ -394,6 +394,13 @@ 'advproxy visible hostname' =3D> 'Ana bilgisayar ad=C4=B1n=C4=B1 g=C3=B6ster= ', 'advproxy web browser' =3D> '=C4=B0nternet taray=C4=B1c=C4=B1s=C4=B1', 'advproxy wednesday' =3D> '=C3=87ar', +'advproxy wpad title' =3D> 'Web Proxy Auto-Discovery Protocol (WPAD) / Proxy= Auto-Config (PAC)', +'advproxy wpad label dst_noproxy_url' =3D> 'Excluded URL\'s (one per line)', +'advproxy wpad label dst_noproxy_ip' =3D> 'Excluded IP-Subnets (one per line= )', +'advproxy wpad example dst_noproxy_url' =3D> 'e.g. *.ipfire.org*', +'advproxy wpad example dst_noproxy_ip' =3D> 'e.g. 192.168.2.0/255.255.255.0', +'advproxy errmsg wpad invalid ip or mask' =3D> 'WPAD: Invalid IP or subnet f= or excluded IP-subnet', +'advproxy wpad view pac' =3D> 'Open PAC-File', 'again' =3D> 'Tekrar:', 'age second' =3D> 'saniye', 'age seconds' =3D> 'saniye', --=20 2.7.4 --===============6508221741458808957==--