OPNsense Forum

International Forums => German - Deutsch => Topic started by: p1n0ck10 on November 28, 2018, 01:57:54 AM

Title: Web Proxy + IPv6
Post by: p1n0ck10 on November 28, 2018, 01:57:54 AM
Hallo Zusammen,

ich möchte gerne den Web Proxy Transparent in meinem Netzwerk verwenden um Funktionen wie Webfilter, Blacklists und Virusscanner zu verwenden. Dies am besten für IPv4 + IPv6.
ich hab zwar schon die Suchfunktion betätigt und die Doku unter
https://wiki.opnsense.org/manual/how-tos/proxytransparent.html
aber nichts wirkliches zu dem Thema mit IPv6 gefunden deswegen wär ich froh hier ein paar Hinweise zu bekommen... ::)

Zu meiner OPNsense Konfiguration:
ich hab ein DualStack-Anschluss mit IPv4 + IPv6 von Vodafone. OPNsense für IPv6 konfiguriert. Läuft soweit alles. Meine Clients bekommen eine IPv6-Adresse vom Provider. Getestet unter
http://ipv6-test.com (siehe Anhang: Ergebniss_ipv6-test.com.jpg) und
http://test-ipv6.com (ergibt 10/10 Punkten)
Web Proxy Transparent konfiguriert mit Port-Forwarding der HTTP und HTTPS Ports auf die lokale IPv4 127.0.0.1 und IPv6 ::1 der OPNsense sodass der Web Proxy auf Port 3128 und 3129 verwendet wird. Sobald ich die NAT-Regeln dazu aktiv schalte komme ich aber nicht mehr mit einer IPv6 Adresse ins Internet siehe
http://wieistmeineip.de oder eine reine IPv6 Seite wie z.B. https://ipv6.google.com kann nicht mehr angesurft werden.

Wisst ihr ob und wie der Web Proxy mit IPv6 funktioniert?

Vielen Dank schonmal im Voraus  ;)
Title: Re: Web Proxy + IPv6
Post by: fabian on November 28, 2018, 06:03:15 PM
Das letzte mal als ich das getestet hatte, war es glaub ich ein problem mit NAT. Müsste es aber selber wieder mal testen.
Title: Re: Web Proxy + IPv6
Post by: p1n0ck10 on November 29, 2018, 12:20:30 AM
Hallo @fabian,

wäre super wenn du das auch nochmal testen könntest. Nachdem ich nicht weiter kam hab ich noch ein bischen was bei squid nachgelesen... https://wiki.squid-cache.org/Features/IPv6 und meinen Post nochmal erweitert und sortiert.

In der Squid-Doku unter Troubleshooting steht...
>>
Your squid may be configured to only listen for IPv4.

The UDP port listening addresses in squid.conf (udp_incoming_address, snmp_incoming_address) can be either IPv4 or IPv6. The default is to accept traffic on any IP address to the relevant UDP port. If you configure this to a specific IP address of either type it will not accept traffic of the other type.

/!\ Note that configuring UDP incoming address to 0.0.0.0 as some old Squid-2 configurations did. Explicitly makes the incoming port IPv4-only, which can break responses to UDP packets sent out using default IPv6-enabled outgoing UDP ports.

Each of the TCP port lines in squid.conf (http_port, https_port, ftp_port) can take either a port, hostname:port, or ip:port combo.

When these lines contain an IPv4 address or a hostname with only IPv4 addresses Squid will only open on those IPv4 you configured. You can add new port lines for IPv6 using [ipv6]:port, add AAAA records to the hostname in DNS, or use only a port.
<<

ACL's sollten laut Squid so aussehen...

acl localhost src 127.0.0.1 ::1



Hier mal meine Konfiguration...

Forward Proxy / Generell Forward Settings
===========================
Proxy interfaces:      LAN, WIFI
Proxy port:         3128
Enable Transparent HTTP proxy:   yes   
Enable SSL inspection:      yes
Log SNI information only:   yes
SSL Proxy port:         3129
CA to use:         MY CA
SSL no bump sites:      .google.de .google.com .googleapis.com .googlestatic.com .1e100.net
SSL cache size:         4
SSL cert workers:      5
Allow interface:      yes

Forward Proxy / Access Control List
=======================
Allowed Subnets:      192.168.1.0/24 (LAN Beispiel-IP), 192.168.2.0/24, 1201:8213:843:6900::/64 (WIFI Beispiel-IP IPv4+IPv6)

NAT / Port Forward
=============
aktiv <->   LAN   TCP   LAN net      *   *   80 (HTTP)   IPv4_localhost     3128   redirect HTTP to Web Proxy
aktiv <->   LAN   TCP   LAN net      *   *   443 (HTTPS)   IPv4_localhost     3129   redirect HTTPS to Web Proxy
aktiv <->   WIFI   TCP   WIFI net   *   *   80 (HTTP)   IPv4_localhost     3128   redirect HTTP to Web Proxy
aktiv <->   WIFI   TCP   WIFI net   *   *   443 (HTTPS)   IPv4_localhost     3129   redirect HTTPS to Web Proxy
inaktiv <->   WIFI   TCP   WIFI net   *   *   80 (HTTP)   IPv6_localhost     3128   redirect HTTP to Web Proxy
inaktiv <->   WIFI   TCP   WIFI net   *   *   443 (HTTPS)   IPv6_localhost     3129   redirect HTTPS to Web Proxy


In meiner squid.conf unter /usr/local/etc/squid steht folgendes... (mal das Relevante raus kopiert)

#
# Automatic generated configuration for Squid.
# Do not edit this file manually.
#

# Setup transparent mode listeners on loopback interfaces
http_port 127.0.0.1:3128 intercept ssl-bump cert=/var/squid/ssl/ca.pem dynamic_cert_mem_cache_size=10MB generate-host-certificates=on
http_port [::1]:3128 intercept ssl-bump cert=/var/squid/ssl/ca.pem dynamic_cert_mem_cache_size=10MB generate-host-certificates=on
https_port 127.0.0.1:3129 intercept ssl-bump cert=/var/squid/ssl/ca.pem dynamic_cert_mem_cache_size=10MB generate-host-certificates=on
https_port [::1]:3129 intercept ssl-bump cert=/var/squid/ssl/ca.pem dynamic_cert_mem_cache_size=10MB generate-host-certificates=on

# Setup regular listeners configuration
http_port 192.168.1.1:3128  ssl-bump cert=/var/squid/ssl/ca.pem dynamic_cert_mem_cache_size=10MB generate-host-certificates=on
http_port 192.168.2.1:3128  ssl-bump cert=/var/squid/ssl/ca.pem dynamic_cert_mem_cache_size=10MB generate-host-certificates=on


# ACL lists

# ACL - Allow Subnets - User defined (subnets)
acl subnets src 192.168.1.0/24 #(LAN Beispiel-IP)
acl subnets src 192.168.2.0/24 #(WIFI Beispiel-IP IPv4)
acl subnets src 1201:8213:843:6900::/64 #(WIFI Beispiel-IP IPv6)

# ACL - Remote fetched Blacklist (remoteblacklist)
acl remoteblacklist_ShallasBlacklist dstdomain "/usr/local/etc/squid/acl/ShallasBlacklist"
acl remoteblacklist_UT1 dstdomain "/usr/local/etc/squid/acl/UT1"

# ACL - Block browser/user-agent - User defined (browser)

# ACL - SSL ports, default are configured in config.xml
# Configured SSL ports (if defaults are not listed, then they have been removed from the configuration!):
acl SSL_ports port 443 # https

# Default Safe ports are now defined in config.xml
# Configured Safe ports (if defaults are not listed, then they have been removed from the configuration!):
# ACL - Safe_ports
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT



Hab mal unter den Sockets nachgeschaut auf was der alles lauscht:
COMMAND   PROTO   LOCAL         FOREIGN
IPv4
=====
squid   udp46   *:7402            *:*
squid   udp4      *:6744            *:*
squid   tcp4      127.0.0.1:3128      *:*
squid   tcp4      192.168.1.1:3128   *:*   (LAN Beispiel-IP)
squid   tcp4      192.168.2.1:3128   *:*   (WIFI Beispiel-IP)
squid   tcp4      127.0.0.1:3129      *:*

IPv6
=====
squid   udp46   *:7402            *:*
squid   tcp6      ::1:3128            *:*
squid   tcp6      ::1:3129            *:*


IPv4 funktioniert. Nur IPv6 nicht.
Fragen:
Könnt es sein das man zwingend eine statische IPv6-Adresse beim WIFI-Interface konfiguriert haben muss?
  >> Ich bring bei mir IPv6 nur zum laufen wenn dies auf "Track from WAN" steht.
Squid schreibt das man keine IPv4 Adresse in den Listener schreiben soll da er sonst nicht auf IPv6 hört oder man fügt eine IPv6 Adresse hinzu. Sieht mir in meiner Config anderst aus.
Wird Port Forwarding für IPv6 von OPNsense überhaupt unterstützt? Da gibt es NAT64 und NAT66 für IPv6. Laut Doku wird NAT64 noch nicht unterstützt https://wiki.opnsense.org/manual/ipv6.html
Wie sieht es mit NAT66 aus? Hab dazu diesen Artikel gefunden https://github.com/opnsense/core/issues/667

Ich leg das erstmal auf Eis, Urlaub is rumm :o. Anscheinend gibt es da noch weitere Leidensgenossen:
https://forum.opnsense.org/index.php?topic=4399.msg16557#msg16557

Falls das jemand schon mal zum laufen gebracht hat wär ich über Hinweise sehr dankbar  ;D

Viele Grüße