Commit Graph

123 Commits

Author SHA1 Message Date
Peter Müller
bb5ca28313 proxy.cgi: Implement proactive Fast Flux detection and detection for selectively announced destinations
This patch adds two new features to IPFire's web proxy:

(a) Proactive Fast Flux detection
    FQDNs are resolved to their IP addresses, which are then resolved to
    corresponding Autonomous System Numbers using IPFire's location
    database. Most destinations will scatter across a very low number of
    ASNs (not to be confused with IP addresses!). FQDNs hosted on Fast
    Flux setups have a significantly higher ASN diversity (5 is usually
    a good threshold), so they can be proactively detected.

(b) Detection for selectively announced destinations
    Especially in targeted operations, miscreants host FQDNs for
    exfiltrating data or malware distributions on ASNs not announced
    globally, but only to the intended victim or it's upstream ISPs.

    That way, security researchers located in other parts of the
    internet have no insights into these attacks, hence not being able
    to publish listings or send take down notices for the domains used.

    While RPKI made this attack harder, it can still be observed every
    now and then.

    This feature also protects against accessing FQDNs resolving to IP
    addresses not being globally routeable, hence providing a trivial
    mitigation for so-called "rebound attacks" - which we cannot filter
    at DNS level currently.

The second version of this patch consumes the user-defined whitelist for
the URL filter (if present and populated) for the ASNBL helper as well,
to make exceptions for funny destinations such as fedoraproject.org
possible. In addition, the ASNBL helper's sanity tests no longer include
publicly routable IP addresses, so failures on location01 cannot brick
IPFire installations in the field.

Thanks to Michael Tremer and Adolf Belka for these suggestions.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-10-13 12:13:30 +00:00
Michael Tremer
bc464ecd5c proxy.cgi: Use sane check for subnet
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-05 18:01:54 +00:00
Michael Tremer
ee4b5bbb2d proxy.cgi: Support running proxy without GREEN
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2021-09-05 18:01:36 +00:00
Peter Müller
e981b751d1 proxy.cgi: Suppress Squid version by default
While hiding version information does not come with any _actual_
security improvements, it is generally a good thing to do so by default:
Attackers will still be able to reasonably guess or enumerate the
software version running, but need to conduct additional effort to do
so, hence more likely raising alerts and drawing attention on their
operation.

In addition, we suppress version details somewhere else in IPFire 2.x by
default, too (e. g. Unbound and Apache), so we can justify this patch by
aiming to stay consistent, I guess. :-)

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-18 08:47:36 +00:00
Michael Tremer
46443100e0 Merge branch 'perl-system' into next 2021-06-17 20:11:47 +00:00
Peter Müller
6323e9086f proxy.cgi: drop options for faking Referer and User-Agent HTTP headers
While maintaining privacy when accessing web sites probably has never
been more important than it is today, faking Referer and User-Agent
headers is both obsolete and counterproductive:

(a) Most web sites require HTTPS, thwarting manipulation attempts to
    HTTP headers in transit. Given todays' internet landscape, faking
    these headers is unlikely to work for the vast majority of web
    sites.

(b) It is trivial to detect faked HTTP User-Agent headers by obtaining
    corresponding browser information via JavaScript. Any difference
    most likely indicates (trivial) header manipulation attempts, hence
    rendering this feature useless if browsers do not behave in the same
    manner, which we cannot control on IPFire.

(c) Especially static Referer headers make users stick out like a sore
    thumb, as nobody else in the world is likely to have the same
    Referer set _all the time_.

    Modern browsers attempt to strip sensitive information from Referer
    headers, or ditch them completely, particularly to 3rd party sites.

Given the state of the web ecosystem as we know it today, enforcing
privacy in a centralised manner does not even come close to being
sufficient. Without gaining control over users' browsers, their
settings, and their infrastructure (such as setting up terminal
environments for accessing the web, preventing hardware
fingerprinting), a centralised attempt will at best fail, if not making
things worse, as highlighted in (c).

Therefore, removing these features from the Squid GUI is the least worse
option we have. We should not give our users a false sense of privacy.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Reviewed-by: Bernhard Bitsch <bbitsch@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-17 20:06:26 +00:00
Michael Tremer
661918881f proxy.cgi: Use new perl system functions
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-06-10 14:41:24 +01:00
Stefan Schantl
875041991c proxy.cgi: Use new system methods
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2021-06-10 14:30:55 +01:00
Jonatan Schlag
8186b37230 Hardcode theme to ipfire
This disables the theme support and makes it impossible to use any other
themes than the ipfire default theme.

The only intention of this patch is to hardcode the theme to ipfire.
To change any cgi we have is an ugly way, but the only way to do this
fast. The colour handling needs certainly to be improved as well, but
this will and should be done in other patches.

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2021-04-08 10:11:34 +00:00
Steffen Klammer
badd010f86 modified proxy.cgi to make it possible that all subnets declared in "network access control" will be translated from cidr to subnet notation in proxy.pac
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2020-10-19 09:25:53 +00:00
Peter Müller
0f8251fe64 Revert "proxy: Remove AUTH_IPCACHE_TTL"
This reverts commit dc637f087f.

Rationale: "authenticate_ip_ttl" can be safely used as it does not
introduces an authentication bypass, but saves relationships between
successfully authenticated users and their IP addresses.

"max_user_ip" depends on such an authentication cache, so credential
sharing between several IPs (on purpose or by chance) can be detected
properly. This is useful in case of crompromised machines and/or
attackers in internal networks having stolen proxy authentication
credentials.

Quoted from squid.conf.documented or man 5 squid.conf:

>       acl aclname max_user_ip [-s] number
>         # This will be matched when the user attempts to log in from more
>         # than <number> different ip addresses. The authenticate_ip_ttl
>         # parameter controls the timeout on the ip entries. [fast]
>         # If -s is specified the limit is strict, denying browsing
>         # from any further IP addresses until the ttl has expired. Without
>         # -s Squid will just annoy the user by "randomly" denying requests.
>         # (the counter is reset each time the limit is reached and a
>         # request is denied)
>         # NOTE: in acceleration mode or where there is mesh of child proxies,
>         # clients may appear to come from multiple addresses if they are
>         # going through proxy farms, so a limit of 1 may cause user problems.

Fixes: #11994

Cc: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-07-01 12:08:10 +00:00
Peter Müller
abbec6069a proxy.cgi: remove old CVS licence clutter
Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-07-01 12:08:08 +00:00
Stefan Schantl
e698090e7f IDS: Dynamically generate and import the HTTP ports.
With this commit suricata reads the HTTP port declarations from a newly
introduced external file
(/var/ipfire/suricata/suricata-http-ports.yaml).

This file dynamically will be generated. HTTP ports always are the
default port "80" and "81" for update Accelerator and HTTP access to the
WUI. In case the Web-proxy is used, the configured proxy port and/or Transparent
Proxy port also will be declared as a HTTP port and written to that file.

In case one of the proxy ports will be changed, the HTTP port file will
be re-generated and suricate restarted if launched. Also if an old
backup with snort will be restored the convert script handles the
generation of the HTTP ports file.

Finally the suricata-generate-http-ports-file as a tiny script which
simply generates the http ports file and needs to be launched during the
installation of a core update. (The script will no be required
anymore, so it could be deleted afterwards.)

Fixes #12308.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-04-06 14:04:00 +00:00
Stefan Schantl
77ea7462bc proxy.cgi: Switch to MD5 hashed passwords for local user auth.
The former used default Crypt algorithmus only supports passwords up to
eight signs wheater MD5 does not have any limitation here.

Fixes 12290.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
2020-02-16 15:49:13 +00:00
Oliver Fuhrer
bf2a1c524b BUG 11696: VPN Subnets missing from wpad.dat
This patch fixes the behavior in 11696 and adds IPSEC and OpenVPN n2n subnets to wpad.dat so they don't pass through the proxy.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-05-20 10:38:17 +01:00
Alexander Koch
cdc82a993a squid / WPAD: Add Wiki-Link for required further adjustments to GUI
This patch adds a notice with a link to the Wiki-page https://wiki.ipfire.org/configuration/network/proxy/extend/wpad to the new WebGUI-Setion to make the user aware of the fact, that WPAD will only work correctly if he makes further adjustments:

- Add DHCP-Options for WPAD via DHCP
- Add HOST-Entries to DNS and Apache-vhost or haproxy-frontend/backend or firewall-redirect for WPAD via DNS

These additional options depend on the users environment and can not be shipped by default as they might break the users setups.

Note: The translations are only done for "en" and "de" yet!

Signed-off-by: Alexander Koch <ipfire@starkstromkonsument.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-20 14:16:00 +01:00
Alexander Koch
ce1c170b0c squid / WPAD: Add GUI for exception-files for generation of proxy.pac
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 <ipfire@starkstromkonsument.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-20 14:15:51 +01:00
Alexander Koch
ddc5602ac6 squid / WPAD: Add exception-files for generation of proxy.pac
This patch extends the script /srv/web/ipfire/cgi-bin/proxy.cgi by additional code for reading exceptions for URL's and IP's/Subnets from two new files:

- /var/ipfire/proxy/advanced/acls/dst_noproxy_url.acl
- /var/ipfire/proxy/advanced/acls/dst_noproxy_ip.acl

as described in: https://wiki.ipfire.org/configuration/network/proxy/extend/add_distri

These can be used to define additional URL's, IP's and Subnets that should be retrieved "DIRECT" and not via the proxy. The files have to be created by the user, as the WPAD-Feature is not enabled by default anyway. If the files are not present or their size is 0, nothing is done. I'll revise the wiki-page, after the patch is merged and the core update is released.

Signed-off-by: Alexander Koch <ipfire@starkstromkonsument.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-04-20 14:15:10 +01:00
Matthias Fischer
d50a78220d Bug 12008 - Typo in 'proxy.cgi' leads to wrong path for 'basic_ldap_auth'
Hi,

This should fix https://bugzilla.ipfire.org/show_bug.cgi?id=12008

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-03-02 14:13:17 +00:00
Michael Tremer
7ec83993e5 proxy: Show error messages in English by default
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-23 06:21:53 +00:00
Michael Tremer
ce1f04ee40 proxy: Allow selecting throttled bandwidth in MBit/s
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 16:10:59 +01:00
Michael Tremer
c2f1b8183c proxy: Suggest modern defaults for cache memory and disk
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 16:02:05 +01:00
Michael Tremer
cdd4cf4094 proxy: Drop support for throttling only certain mime types
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 16:00:05 +01:00
Michael Tremer
d68e150e86 proxy: Drop web browser check
This is neither reliable nor up to date and is therefore removed

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:54:56 +01:00
Michael Tremer
a1018d86ae proxy: Set authentication TTL for NTLM authentication also
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:49:18 +01:00
Michael Tremer
6df2d52887 proxy: Use correct authentication cache TTL for AD
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:48:32 +01:00
Michael Tremer
fa286b1330 proxy: Use entered setting for auth children for AD
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:46:20 +01:00
Michael Tremer
5c2a76f7b3 proxy: Use correct realm for AD authentication
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:44:19 +01:00
Michael Tremer
dc637f087f proxy: Remove AUTH_IPCACHE_TTL
This is potentially dangerous to set larger than zero.

Authentication is perfomed on basis of IP addresses which is
not a good idea at all.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:39:36 +01:00
Michael Tremer
ea72700a3b proxy: Drop NTLM authentication
This is the authentication againt NT 4.0 style domain controllers.

squid has dropped support for this in the 4.5 release and nobody
should be using these old domain controllers any more.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2019-01-08 15:28:46 +01:00
Michael Tremer
eedca6e36c squid: Run as many redirectors as we have CPU cores
This makes sure that we use the optimal ratio of memory and
CPU usage.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Tested-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Tested-by: Matthias Fischer <matthias.fischer@ipfire.org>
2019-01-08 03:33:37 +01:00
Daniel Weismüller
1a3323f2e6 BUG 11786 - squid: Remove setting for filter processes the number of Squid processes
I added a function to determine the number of cores.
Now the number of squid processes will be equal to the number of logical cores.
Further I removed the possibility of changing the number
of squid processes in the proxy.cgi

Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: root <root@ipfire.test>
2019-01-08 02:02:05 +01:00
Michael Tremer
a44eed2536 proxy.cgi: The group name cannot be in quotes
Squid interprets the quotes as part of the group name, too

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-07-01 12:38:48 +01:00
Daniel Weismüller via Development
53d6755451 squid: Add RAM-only Proxy functionality
As suggested by Oliver "giller" Fieker <oli@new-lan.de>
in bug 10592 I added the functionality to use the squid as ram-only cache.

Further it defines the maximum_object_size_in_memory
as 2% of the in the webif defined "Memory cache size".
The maximum_object_size_in_memory should have a useful
size of the defined memory cache and I don't want to
create another variable which muste be fulled in by the user.

Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Suggested-by: Oliver "giller" Fieker <oli@new-lan.de>
Suggested-by: Kim Wölfel <xaver4all@gmx.de>
Acked-by: Michael Tremer <michael.tremer@ipfire.org>
Cc: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-03-06 15:12:17 +00:00
Bernhard Held
a2b2ac7854 proxy.cgi: remove excessive newlines in generated proxy.pac
Remove excessive newlines in generated proxy.pac

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2018-02-14 22:22:49 +00:00
Matthias Fischer
c4b12981e2 proxy.cgi: Even more cosmetics
Another clickable link for 'proxy.cgi', this time for 'Cache Manager Interface' - this one opens in a new window.

And: This time - hopefully - with correct '_blank'-attribute (deleted the backslashes) - based on current 'next'.

Plus: Deleted some "blind" tabs - found by chance.

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-10-23 16:28:29 +01:00
Matthias Fischer
082771c1f4 proxy.cgi: Some cosmetics for the absolutely lazy ones (V2)
Added clickable links for 'URL filter' and 'Update accelerator' for faster access,
this time without the need to alter the language-files.

Best,
Matthias

Signed-off-by: Matthias Fischer <matthias.fischer@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2017-09-24 20:22:45 +01:00
Alf Høgemark
f00699e8bb Change case of the unit "bit" from "Bit" to "bit" in web UI
The correct case for "kilobit" is "kilobit", not "kiloBit".
And the same applies for Mbit, Gbit etc.
Reference is https://en.wikipedia.org/wiki/Kilobit

This commit changes the texts used in the web UI, so
that it correctly displays as "bit", "kbit", "Mbit" etc.

This fixes bugzilla item 10918.

Signed-off-by: Alf Høgemark <alf@i100.no>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-07-20 16:46:23 +01:00
Michael Tremer
0aff7b8196 {proxy,chpasswd}.cgi: Fix a remote code execution vulnerability
Handcrafted requests with shell commands could be sent to these
CGI files and gain shell access as unprivileged user.

References: #11087

Reported-by: Yann Cam <yann.cam@gmail.com>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2016-04-08 15:54:53 +01:00
Lars Schuhmacher
e3edceeb7a Mark required input fields with a star
Mark required input fields with a star as nowadays this is
the de-facto default. Before, it was the other way around and
optional fields were marked.

Signed-off-by: Lars Schumacher <larsen007@web.de>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
2015-09-21 16:40:41 +01:00
Michael Tremer
8fbcf730ae proxy.cgi: Move ACL definitions up
ACl definitions could not be used in some other directives
unless they are defined earlier.
2014-08-28 17:01:44 +02:00
Michael Tremer
2fc5124b7e proxy: Allow HTTP Basic authentication against Active Directory servers
Some clients may not support NTLMv2. Basic authentication can
now be activated. This is dangerous as it sends the credentials
in cleartext to the proxy server.
2014-08-11 11:49:56 +02:00
Michael Tremer
2deb75c0f3 Merge remote-tracking branch 'ms/squid-ad' into next 2014-07-27 12:01:50 +02:00
Michael Tremer
f0b7534f7f proxy.cgi: Move {minimum,maximum}_object_size before cache_dir.
The cache_dir directive ignores the object size directives
if those have not been set prior to cache_dir.

http://bugs.squid-cache.org/show_bug.cgi?id=3830
2014-07-10 14:04:05 +02:00
Michael Tremer
3ebc0da70f proxy.cgi: Allow safe/SSL ports to be empty.
Fixes a syntax error in the generated squid configuration
file.
2014-07-10 13:30:02 +02:00
Michael Tremer
b56746432b proxy: Add option to require a certain group for Internet access. 2014-06-12 11:29:18 +02:00
Michael Tremer
603248db53 squid: Add NTLM authentication against Windows Active Directory servers. 2014-06-10 20:15:58 +02:00
Michael Tremer
dd58c50c3e proxy.pac: Don't use proxy for direct domain access. 2014-05-12 13:21:24 +02:00
Bernhard Bitsch
7c1b7d3e22 proxy.pac: Only grant direct access for actual subnets.
Fixes #10324.
2014-05-12 13:16:43 +02:00
Alf Høgemark
153cf6406c cgi-bin: Use readonly="readonly" attribute on html input elements
The proper way to mark readonly is to use readonly="readonly", not
readonly="true", like it was done some places.
2014-02-18 18:48:57 +01:00