Interner Proxy für VPN ohne public expose

Started by W0nderW0lf, June 19, 2024, 10:12:30 PM

Previous topic - Next topic
Hi @ll,

ich plage mich nun seit ein paar Jahren damit ab Nextcloud für mich / meine family selber _sicher_ zu hosten.

Nun habe ich mich dazu entschlossen das NGINX NAXSI Konstrukt für Nextcloud an den Nagel zu hängen, da das ohne experten Wissen und fachgerechte Hilfe für mich einfach zu kompliziert ist. Ich habe mich sehr bemüht eigene Rules zu erstellen und konnte zwar den Dienst immer erreichen und auch mit der Cloud arbeiten, aber dann kam es z.B. beim automatischen Upload von Daten immer probleme. Bot Protection hab ich deaktiviert, aber das schien keine Auswirkung zu haben.
Letztlich habe ich erkannt, dass gewisse Basic Rules für CSS und SQL Injections gewisse legitime Anfragen blockieren. Ich habe versucht mit höher gewichteten White Listings diese Rules zu ignorieren, aber das klappt leider nicht so ganz. Ich denke meine Profil Posts historie spricht da für sich...
Jedenfalls habe ich ein ungutes Gefühl mit Halbwissen Dinge zu whitelisten und öffentlich zu exposen. Ich bin durchaus in der Lage Nextcloud mit der Standard konfiguration und ohne NAXSI zur Verfügung zu stellen. Aber aus Erfahrung in der Vergangenheit kann ich sagen, dass das die Sicherheit nur von kurzer dauer ist. Ich habe schon diverse Angriffe an den eigenen Systemen erfahren und daraus immer konsequenzen gezogen. Ich bin einer der sehr gerne einen möglichst hohen Sicherheitsstandard hegt und bediene mich sämtlicher hardening guides die online zur Verfügung stehen. Meine Seiten sind alle immer mit A+ getestet, gültige certs, cloudflare, 2FA (in Nextcloud) usw.
Der letzte Angriff den ich bei mir vor ein paar Jahren erfahren habe, war ein MITM Proxy welcher meine Login maske von Nextcloud wiedergespiegelt hat, aber nach meiner 2FA Authentifizierung nicht auf das eigene Dashboard weitergeleitet hat. Ich dachte erst mein Proxy sei falsch konfiguriert, aber in Maltrail und ein paar Logs erhielt ich dann gewissheit, dass sich da jemand aus holland oder einem anderen Land eingeschaltet hat...
Keines meiner Dienste die ich public erreichbar habe, waren so vielen angriffen ausgesetzt wie Nextcloud.

Long story short...
Mittlerweile bin ich von meinem Raspberry Pi Cloud Setup auf Unraid umgestiegen und habe mir da ein paar Container bereit gestellt die ich auch nicht unbedingt exposen will. Bis auf einen, aber da hatte ich noch niiiee ein Problem.

Ich habe bei mir auf der OPNSense, Wireguard mit Unbound DNS + DoT, und Adguard mit laufender private DNS resolving eingerichtet. Ich komme überall hin und kann meine Hosts über den FQDN erreichen. Alles Top.

Jetzt bin aber an einem Punkt wo ich nicht weiß was mehr Sinn machen würde. Damit Nextcloud im Docker ordentlich läuft, will ich das ganze möglichst komfortabel mit HTTPS und einem proxy lösen. Ich möchte auf IPv4 und selfsigned Zertifikate verzichten. Ich habe die chance den NPM (NGINX Proxy Manager) in Unraid bereit zu stellen, aber das reicht nicht um die URL aufrufen zu können. Da nur der OPNsense NGINX den Servernamen kennt, der aber auf die Außenwelt eingestellt ist, würde jede Anfrage weiterhin aus dem Internet kommen. Ich weiß jetzt nicht, ob es sinn macht, die Konfiguration aus dem OPNsense NGINX zu entfernen und auf HAProxy umzustellen der nach innen zielt. Oder könnte ich die HTTPS Lauschadresse im NGINX auf 2 Subnetze beschränken? Anschließend könnte man NAXSI deaktivieren, da man für interne Anfragen aus einem vertrauenswürdigen Netz keine zusätzliche WAF braucht (obwohl's auch ein nice to have wäre.  ;D )
Viele Wege führen nach Rom...
Die Alternative wäre eben der Forward Proxy auf der OPNsense und der NPM ausm Unraid.

Habt ihr bessere Vorschläge? Bin für jede Hilfe dankbar!  8)

Viele Grüße

Das os-caddy Plugin macht eigentlich alles automatisch. Ich habe das als extern erreichbaren Proxy vor meiner Nextcloud und die Kommunikation zw. Caddy und Nextcloud läuft unverschlüsselt über plain HTTP. Das ist in einem geswitchten Netz eigentlich auch kein Problem.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Wildcard SSL Zertifikat + Reverse Proxy der per default eine statische Seite ausliefert.
99,99999% dieser "Angriffe" machen Requests auf die IP Adresse und schlagen fehl, weil dort nur die statische Seite ausgeliefert wird.
Alle Subdomains sind dann "privat", d.h. man erreicht den Dienst nur wenn man die Subdomain kennt.

Caddy würde jeden Request ohne den korrekten SNI-Namen sowieso ablehnen.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Hi, erstmal danke für den Vorschlag.

Caddy war mir neu. Habs mir mal angesehen und bin gerade dabei mich durch die Doc's zu wühlen. Dabei ist mir aber auch wieder folgendes aufgefallen.

QuoteThere is no TCP/UDP stream and WAF (Web Application Firewall) support in this plugin. For a business grade Reverse Proxy with WAF functionality, use os-OPNWAF. For TCP/UDP streaming, use either os-nginx or os-haproxy.

os-OPNWAF ist vermutlich ein Enterprise Plugin für Kunden, oder?
Und weiter..

QuoteAs an alternative to a WAF, it is simple to integrate Caddy with CrowdSec. Check the tutorial section for guidance

Das heißt dann also, ich hätte eine sehr abgespeckte funktionalität, da ich kein Premium bzw. Business Plan habe. Durch die Limitierung der Blocklisten im free plan, besteht ein höheres Risiko angegriffen zu werden. Richtig?
Alternativ kann man hier auch den Zugriff über Internal IPs beschränken wie ich hier gerade lese.

QuoteThey can be used to restrict access per domain. In this example, they are used to restrict access to only internal IPv4 networks, refusing connections from the internet.

os-OPNWAF ist keine Erweiterung von os-caddy, sondern ein eigener Reverse Proxy mit WAF basierend auf Apache2 in der OPNsense Business Edition.

Und zum allgemeinen Angriffsrisiko, wenn man nicht angegriffen werden will trennt man sich einfach vom Internet. Dann müssen die bösen Buben schon ins Haus einbrechen um an die leckeren Daten auf dem Storage zu kommen.

Und am besten WLAN aus.
Hardware:
DEC740

June 21, 2024, 05:21:03 PM #6 Last Edit: June 21, 2024, 05:32:20 PM by W0nderW0lf
Quote from: Monviech on June 20, 2024, 07:18:01 PM
os-OPNWAF ist keine Erweiterung von os-caddy, sondern ein eigener Reverse Proxy mit WAF basierend auf Apache2 in der OPNsense Business Edition.
Das war mir schon klar. Ich wollte nur die Bestätigung, dass das nichts für normalsterbliche ist. ^^

Ich hab's jetzt auch soweit mehr oder weniger fertig. Nextcloud wäre jetzt theorethisch aufrufbar. Allerdings kommt meine Anfrage nicht am Server an, weil ich die Access Listen hinzugefügt habe. Im Prinzip habe ich den Zugriff auf interne Subnetze limitiert. Jedoch wird meine Anfrage erst ins internet geleitet, wo es dann wieder zurück zu Caddy kommt, anstatt den direkten Weg zu gehen. Ich sehe aber nirgends dokumentiert wie du genau diesen Fall verhinderst.
Im Prinzip bräuchte ich eine Regel die Anfragen auf https://<nextcloud.domain>/  automatisch an Caddy weiterleitet, statt ins Internet.
Ne Ahnung wie ich das am besten anstelle? Ein Alias ruft nur Adressen ab. Welche alternativen hätte ich also hier?

Die Anfragen werden nicht ins internet geleitet. Caddy hört auf der öffentlichen IP Adresse deiner Firewall und antwortet direkt. Es ist also egal wenn die Anfrage aus deinem Internen Netz zur öffentlichen IP geht, die OPNsense hat die ja auf dem Interface.

Du kannst mit tcpdump überprüfen was mit dem Traffic passiert.

Der Fall dass es über das Internet geht kann nur passieren, wenn du 2 WAN Anschlüsse hättest, und durch eine reply-to Regel der Traffic zum Standardgateway des Providers geroutet wird, von wo aus er auf dem zweiten WAN Anschluss zurückkommt.
Hardware:
DEC740

June 22, 2024, 11:20:25 AM #8 Last Edit: June 22, 2024, 11:23:52 AM by W0nderW0lf
Ich habe nur einen WAN Anschluss.

Beim TCPDump habe ich nun folgendes rauslesen können:

Mein LAN Client sendet einen query request an meinen DNS Server und erhält die Adresse von meiner OPNsense.
Kurze Zeit darauf erhalte ich "Destination Unreachable"
Der Dienst ist natürlich erreichbar, aber dadurch das Caddy die Abfrage abwimmelt, ist es das eben nicht.

Unter Remote IP Stand meine Public IP.
"info","ts":"2024-06-22T09:01:52Z","logger":"http.log.access.37fc6c8b-42c2-41e0-baba-c38516660295","msg":"NOP","request":{"remote_ip":"X.X.X.X","remote_port":"6102","client_ip":"X.X.X.X","proto":"HTTP/2.0","method":"GET","host":"ncloud.example.com","uri":"/login","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Dnt":["1"],"Te":["trailers"],"Accept-Language":["de,en-US;q=0.7,en;q=0.3"],"Sec-Fetch-Site":["none"],"Sec-Gpc":["1"],"Priority":["u=1"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-User":["?1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:127.0) Gecko/20100101 Firefox/127.0"],"Accept-Encoding":["gzip, deflate, br, zstd"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Dest":["document"]},"tls":{"resumed":true,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"ncloud.example.com"}},"bytes_read":0,"user_id":"","duration":0.000012932,"size":0,"status":0,"resp_headers":{"Server":["Caddy"],"Alt-Svc":["h3=\":443\"; ma=2592000"]}}

Im Caddy Log sehe ich nur solche Meldungen. Vielleicht übersehe ich auch was...




Ich verstehe hier leider nicht ganz was passiert.

Wenn die Anfrage z.B aus dem LAN kommt mit der öffentlichen IP Adresse der OPNsense als Ziel, und es auf dem LAN interface die Firewall Regeln gibt, dass "This Firewall" auf Port 80 und 443 erreicht werden darf, sollte Caddy richtig funktionieren.

Vielleicht gibt es noch alte Port Forward oder Outbound NAT Regeln die die Quell IP oder Ziel IP des Pakets ändern.
Hardware:
DEC740

Ich kann es mir auch nicht erklären.

Hier meine Rules:


June 22, 2024, 04:13:41 PM #11 Last Edit: June 22, 2024, 04:16:06 PM by Monviech
Wenn die interne IP Adresse deines Clients mit der öffentlichen IP Adresse der OPNsense ersetzt wird, ist hier irgend ein Source NAT.

Dafür müsste ich alle Netzwerke kennen und alle Regeln von "/ui/diagnostics/firewall/statistics#rules".

Hier jetzt Troubleshooting zu betreiben ist asynchron recht schwer.

Ich empfehle die automatischen NAT Reflection Regeln auszuschalten. Alle Port Forward Regeln aus. Bei Outbound auf Manuell gehen (achtung dadurch wird das Internet nicht mehr funktionieren, hier muss dann manuelle Outbound Masquerading Regeln angelegt werden.)

Dann nochmal mit dem internen Client die Webseite aufrufen. Dann sollte eigendlich kein NAT mehr irgendwelche Adressen verändern.

Ist aber alles nur Vermutung gerade, die Firewall Regeln als xml ohne Zusammenhang der Infrastruktur helfen mir gerade nicht. Da es aber sehr viele Leute richtig hinbekommen Caddy in Betrieb zu nehmen, ist hier sehr wahrscheinlich ein Konfigurationsfehler der OPNsense die Ursache.
Hardware:
DEC740

Aber das merkwürdige ist, ich habe keine custom NAT rules.

Allgemein habe ich nicht sehr viele Regeln, außer es handelt sich um meine Server bzw. Unraid Netze.
LAN und VPN sind recht "offen" also mit erlaube any to any.



igc0 = WAN, igc1=LAN und wg0=wireguard

rules

    filter rules
        @0 scrub in on wireguard all max-mss 1360 fragment reassemble
        @1 scrub in all fragment reassemble
        @0 block drop in log on ! igc1 inet from 192.168.1.0/24 to any
        @1 block drop in log inet from <__automatic_73dcf8_0:6> to any
        @2 block drop in log on ! igc2 inet from 192.168.100.0/25 to any
        @3 block drop in log on ! igc3 inet from 192.168.200.0/25 to any
        @4 block drop in log on ! wg0 inet from 100.65.0.0/24 to any
        @5 block drop in log on ! igc0 inet from 192.168.178.0/24 to any
        @6 block drop in log on ! igc4 inet from 192.168.99.0/26 to any
        @7 block drop in log on igc1 inet6 from fe80::e63a:6eff:fe5d:9b3c to any
        @8 block drop in log on igc2 inet6 from fe80::e63a:6eff:fe5d:9b3d to any
        @9 block drop in log on igc3 inet6 from fe80::e63a:6eff:fe5d:9b3e to any
        @10 block drop in log on igc0 inet6 from fe80::e63a:6eff:fe5d:9b3b to any
        @11 block drop in log on igc4 inet6 from fe80::e63a:6eff:fe5d:9b3f to any
        @12 block drop in log inet all label "02f4bab031b57d1e30553ce08e0ec131"
        @13 block drop in log inet6 all label "02f4bab031b57d1e30553ce08e0ec131"
        @14 pass in log quick inet6 proto ipv6-icmp all icmp6-type unreach keep state label "1d245529367b2e34eeaff16086aeafe9"
        @15 pass in log quick inet6 proto ipv6-icmp all icmp6-type toobig keep state label "1d245529367b2e34eeaff16086aeafe9"
        @16 pass in log quick inet6 proto ipv6-icmp all icmp6-type neighbrsol keep state label "1d245529367b2e34eeaff16086aeafe9"
        @17 pass in log quick inet6 proto ipv6-icmp all icmp6-type neighbradv keep state label "1d245529367b2e34eeaff16086aeafe9"
        @18 pass out log quick inet6 proto ipv6-icmp from (self:7) to fe80::/10 icmp6-type echoreq keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @19 pass out log quick inet6 proto ipv6-icmp from (self:7) to ff02::/16 icmp6-type echoreq keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @20 pass out log quick inet6 proto ipv6-icmp from (self:7) to fe80::/10 icmp6-type echorep keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @21 pass out log quick inet6 proto ipv6-icmp from (self:7) to ff02::/16 icmp6-type echorep keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @22 pass out log quick inet6 proto ipv6-icmp from (self:7) to fe80::/10 icmp6-type routersol keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @23 pass out log quick inet6 proto ipv6-icmp from (self:7) to ff02::/16 icmp6-type routersol keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @24 pass out log quick inet6 proto ipv6-icmp from (self:7) to fe80::/10 icmp6-type routeradv keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @25 pass out log quick inet6 proto ipv6-icmp from (self:7) to ff02::/16 icmp6-type routeradv keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @26 pass out log quick inet6 proto ipv6-icmp from (self:7) to fe80::/10 icmp6-type neighbrsol keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @27 pass out log quick inet6 proto ipv6-icmp from (self:7) to ff02::/16 icmp6-type neighbrsol keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @28 pass out log quick inet6 proto ipv6-icmp from (self:7) to fe80::/10 icmp6-type neighbradv keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @29 pass out log quick inet6 proto ipv6-icmp from (self:7) to ff02::/16 icmp6-type neighbradv keep state label "acdbb900b50d8fb4ae21ddfdc609ecf8"
        @30 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type echoreq keep state label "42e9d787749713a849d8e92432efdfaa"
        @31 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type echoreq keep state label "42e9d787749713a849d8e92432efdfaa"
        @32 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type routersol keep state label "42e9d787749713a849d8e92432efdfaa"
        @33 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type routersol keep state label "42e9d787749713a849d8e92432efdfaa"
        @34 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type routeradv keep state label "42e9d787749713a849d8e92432efdfaa"
        @35 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type routeradv keep state label "42e9d787749713a849d8e92432efdfaa"
        @36 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type neighbrsol keep state label "42e9d787749713a849d8e92432efdfaa"
        @37 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type neighbrsol keep state label "42e9d787749713a849d8e92432efdfaa"
        @38 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to fe80::/10 icmp6-type neighbradv keep state label "42e9d787749713a849d8e92432efdfaa"
        @39 pass in log quick inet6 proto ipv6-icmp from fe80::/10 to ff02::/16 icmp6-type neighbradv keep state label "42e9d787749713a849d8e92432efdfaa"
        @40 pass in log quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type echoreq keep state label "8752fca75c6be992847ea984161bd3f1"
        @41 pass in log quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type routersol keep state label "8752fca75c6be992847ea984161bd3f1"
        @42 pass in log quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type routeradv keep state label "8752fca75c6be992847ea984161bd3f1"
        @43 pass in log quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type neighbrsol keep state label "8752fca75c6be992847ea984161bd3f1"
        @44 pass in log quick inet6 proto ipv6-icmp from ff02::/16 to fe80::/10 icmp6-type neighbradv keep state label "8752fca75c6be992847ea984161bd3f1"
        @45 pass in log quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type echoreq keep state label "71dd196398b3f1da265dbd9dcad00e70"
        @46 pass in log quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type routersol keep state label "71dd196398b3f1da265dbd9dcad00e70"
        @47 pass in log quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type routeradv keep state label "71dd196398b3f1da265dbd9dcad00e70"
        @48 pass in log quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type neighbrsol keep state label "71dd196398b3f1da265dbd9dcad00e70"
        @49 pass in log quick inet6 proto ipv6-icmp from :: to ff02::/16 icmp6-type neighbradv keep state label "71dd196398b3f1da265dbd9dcad00e70"
        @50 block drop in log quick inet proto tcp from any port = 0 to any label "7b5bdc64d7ae74be1932f6764a591da5"
        @51 block drop in log quick inet proto udp from any port = 0 to any label "7b5bdc64d7ae74be1932f6764a591da5"
        @52 block drop in log quick inet6 proto tcp from any port = 0 to any label "7b5bdc64d7ae74be1932f6764a591da5"
        @53 block drop in log quick inet6 proto udp from any port = 0 to any label "7b5bdc64d7ae74be1932f6764a591da5"
        @54 block drop in log quick inet proto tcp from any to any port = 0 label "ae69f581dc429e3484a65f8ecd63baa5"
        @55 block drop in log quick inet proto udp from any to any port = 0 label "ae69f581dc429e3484a65f8ecd63baa5"
        @56 block drop in log quick inet6 proto tcp from any to any port = 0 label "ae69f581dc429e3484a65f8ecd63baa5"
        @57 block drop in log quick inet6 proto udp from any to any port = 0 label "ae69f581dc429e3484a65f8ecd63baa5"
        @58 pass log quick inet6 proto carp from any to ff02::12 keep state label "cf439d72ef4d245e8ad4a1405df1f665"
        @59 pass log quick inet proto carp from any to 224.0.0.18 keep state label "2ffa978d51f7b3fbc9000c2895106ee7"
        @60 block drop in log quick proto tcp from <sshlockout:0> to (self:14) port = 8908 label "db8f7226d24fe8390da89c8bfcab11d4"
        @61 block drop in log quick proto tcp from <sshlockout:0> to (self:14) port = 8443 label "8a7589316cc5c5cb69c0eb81112fb366"
        @62 block drop in log quick from <virusprot:0> to any label "8e367e2f9944d93137ae56d788c5d5e1"
        @63 pass in log quick on igc1 inet proto udp from any port = bootpc to 255.255.255.255 port = bootps keep state label "5168be2cca1e130b1ef2ac18161356a8"
        @64 pass in log quick on igc1 proto udp from any port = bootpc to (self:14) port = bootps keep state label "0b032d1bab91fc97e4a7faf03a7f17c3"
        @65 pass out log quick on igc1 proto udp from (self:14) port = bootps to any port = bootpc keep state label "5039e43005a9aa50eb032af274cc9aad"
        @66 pass in log quick on igc1 inet6 proto udp from fe80::/10 to fe80::/10 port = dhcpv6-client keep state label "fef3d333d96a8d3558956de1fffc61cc"
        @67 pass in log quick on igc1 inet6 proto udp from fe80::/10 to ff02::/16 port = dhcpv6-client keep state label "fef3d333d96a8d3558956de1fffc61cc"
        @68 pass in log quick on igc1 inet6 proto udp from fe80::/10 to ff02::/16 port = dhcpv6-server keep state label "d2bd536587a9f5680c1f850b2d346839"
        @69 pass in log quick on igc1 inet6 proto udp from ff02::/16 to fe80::/10 port = dhcpv6-server keep state label "3420206ced96c01ef73fbc4ac9deb745"
        @70 pass in log quick on igc1 inet6 proto udp from fe80::/10 to (self:7) port = dhcpv6-client keep state label "0fd202708c326aebbe44ab710b6d3652"
        @71 pass out log quick on igc1 inet6 proto udp from (self:7) port = dhcpv6-server to fe80::/10 keep state label "83f6c28de8efae9b444094e4a5bf898c"
        @72 pass in log quick on igc2 inet proto udp from any port = bootpc to 255.255.255.255 port = bootps keep state label "07daf606e4baa82915478774a40f014d"
        @73 pass in log quick on igc2 proto udp from any port = bootpc to (self:14) port = bootps keep state label "1e13125d68d267924569eadb69fa1ad1"
        @74 pass out log quick on igc2 proto udp from (self:14) port = bootps to any port = bootpc keep state label "4eb553ee95bcbf5299054b24b13f5528"
        @75 pass in log quick on igc3 inet proto udp from any port = bootpc to 255.255.255.255 port = bootps keep state label "102fc1c757023ef7f945d512ed212862"
        @76 pass in log quick on igc3 proto udp from any port = bootpc to (self:14) port = bootps keep state label "09ef23f01c5890e379d587e8e2d3dea0"
        @77 pass out log quick on igc3 proto udp from (self:14) port = bootps to any port = bootpc keep state label "4d95e0fbab26f616dedb0dda7c7581c3"
        @78 pass in log quick on igc0 proto udp from any port = bootps to any port = bootpc keep state label "f994f615e00b8be0042263f86c79913f"
        @79 pass out log quick on igc0 proto udp from any port = bootpc to any port = bootps keep state label "5cf7ab808da1fcbca1ddb9ba9b46b669"
        @80 pass in log quick on igc4 inet proto udp from any port = bootpc to 255.255.255.255 port = bootps keep state label "5abb7d88958c4e6df293f4bdf4663c7b"
        @81 pass in log quick on igc4 proto udp from any port = bootpc to (self:14) port = bootps keep state label "033633dc5b7d01a4ed8a7ee32de9e4f6"
        @82 pass out log quick on igc4 proto udp from (self:14) port = bootps to any port = bootpc keep state label "d0acc14b6054e272353f9b9147abb923"
        @83 block drop in quick inet from <crowdsec_blacklists:38091> to any label "3dece8d37a64bb42cdb4de03f79519e7"
        @84 block drop in quick inet6 from <crowdsec6_blacklists:29> to any label "2fe2f572b74d29f8a46214fc4c95b151"
        @85 block drop in log quick on igc0 inet from <bogons:853> to any label "b7cd97a164650b538506fb551a0369e7"
        @86 block drop in log quick on igc0 inet6 from <bogonsv6:144340> to any label "f140a48ddade668b9d6f5259669a1d5c"
        @87 block drop in log quick on igc0 inet from 10.0.0.0/8 to any label "1eb94a38e58994641aff378c21d5984f"
        @88 block drop in log quick on igc0 inet from 127.0.0.0/8 to any label "1eb94a38e58994641aff378c21d5984f"
        @89 block drop in log quick on igc0 inet from 100.64.0.0/10 to any label "1eb94a38e58994641aff378c21d5984f"
        @90 block drop in log quick on igc0 inet from 172.16.0.0/12 to any label "1eb94a38e58994641aff378c21d5984f"
        @91 block drop in log quick on igc0 inet from 192.168.0.0/16 to any label "1eb94a38e58994641aff378c21d5984f"
        @92 block drop in log quick on igc0 inet6 from fc00::/7 to any label "45afd72424c84d011c07957569151480"
        @93 pass in quick on lo0 all no state label "7535c94082e72e2207679aadb26afd92"
        @94 pass out log all flags S/SA keep state allow-opts label "fae559338f65e11c53669fc3642c93c2"
        @95 pass in log quick on igc1 proto tcp from any to (self:14) port = 8443 flags S/SA keep state label "b3d0aa308cae0f22daa73b5ebfdd6380"
        @96 pass in log quick on igc1 proto tcp from any to (self:14) port = 8908 flags S/SA keep state label "b3d0aa308cae0f22daa73b5ebfdd6380"
        @97 pass out log route-to (igc0 192.168.178.1) inet from (igc0:1) to ! (igc0:network:1) flags S/SA keep state allow-opts label "43ddc4e7182143cfd0e584aa8c76e779"
        @98 pass log quick on igc1 inet proto tcp from any to <GIT_IP_Whitelist:2> port = https flags S/SA keep state label "5fe609e54818e435919c8acdc9ae5fc8"
        @99 pass log quick on igc2 inet proto tcp from any to <GIT_IP_Whitelist:2> port = https flags S/SA keep state label "5fe609e54818e435919c8acdc9ae5fc8"
        @100 pass log quick on igc3 inet proto tcp from any to <GIT_IP_Whitelist:2> port = https flags S/SA keep state label "5fe609e54818e435919c8acdc9ae5fc8"
        @101 pass log quick on wg0 inet proto tcp from any to <GIT_IP_Whitelist:2> port = https flags S/SA keep state label "5fe609e54818e435919c8acdc9ae5fc8"
        @102 pass log quick on igc0 inet proto tcp from any to <GIT_IP_Whitelist:2> port = https flags S/SA keep state label "5fe609e54818e435919c8acdc9ae5fc8"
        @103 pass log quick on igc1 inet proto tcp from any to 140.82.121.4 port = ssh flags S/SA keep state label "f4ba95622bae15933a258d80d7ce1e8c"
        @104 pass log quick on igc2 inet proto tcp from any to 140.82.121.4 port = ssh flags S/SA keep state label "f4ba95622bae15933a258d80d7ce1e8c"
        @105 pass log quick on igc3 inet proto tcp from any to 140.82.121.4 port = ssh flags S/SA keep state label "f4ba95622bae15933a258d80d7ce1e8c"
        @106 pass log quick on wg0 inet proto tcp from any to 140.82.121.4 port = ssh flags S/SA keep state label "f4ba95622bae15933a258d80d7ce1e8c"
        @107 pass log quick on igc0 inet proto tcp from any to 140.82.121.4 port = ssh flags S/SA keep state label "f4ba95622bae15933a258d80d7ce1e8c"
        @108 pass in quick inet proto tcp from any to ! <GIT_IP_Whitelist:2> flags S/SA keep state label "d3591b10e43743e30a709ce7663b59fa"
        @109 pass in quick inet proto udp from any to ! <GIT_IP_Whitelist:2> keep state label "d3591b10e43743e30a709ce7663b59fa"
        @110 block drop log quick on igc1 inet from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @111 block drop log quick on igc1 inet6 from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @112 block drop log quick on igc2 inet from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @113 block drop log quick on igc2 inet6 from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @114 block drop log quick on igc3 inet from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @115 block drop log quick on igc3 inet6 from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @116 block drop log quick on wg0 inet from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @117 block drop log quick on wg0 inet6 from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @118 block drop log quick on igc0 inet from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @119 block drop log quick on igc0 inet6 from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @120 block drop log quick on igc4 inet from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @121 block drop log quick on igc4 inet6 from <Malicious_IPs:18916> to any label "676a9f50666a42c84301e677e1372c22"
        @122 block drop log quick on igc1 inet from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @123 block drop log quick on igc1 inet6 from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @124 block drop log quick on igc2 inet from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @125 block drop log quick on igc2 inet6 from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @126 block drop log quick on igc3 inet from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @127 block drop log quick on igc3 inet6 from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @128 block drop log quick on wg0 inet from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @129 block drop log quick on wg0 inet6 from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @130 block drop log quick on igc0 inet from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @131 block drop log quick on igc0 inet6 from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @132 block drop log quick on igc4 inet from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @133 block drop log quick on igc4 inet6 from any to <Malicious_IPs:18916> label "be5085ce30e680463235dc3d9e4c436d"
        @134 block drop in log quick inet from any to <Malicious_IPs:18916> label "15d4b08e375bd5b4a1bfe3b8dd0e8eaf"
        @135 block drop in log quick inet6 from any to <Malicious_IPs:18916> label "15d4b08e375bd5b4a1bfe3b8dd0e8eaf"
        @136 block drop in log quick on igc1 inet from any to <crowdsec_blacklists:38091> label "33d9f0f6541d0b4f4e3d0cff2c201978"
        @137 block drop in log quick on igc2 inet from any to <crowdsec_blacklists:38091> label "33d9f0f6541d0b4f4e3d0cff2c201978"
        @138 block drop in log quick on igc3 inet from any to <crowdsec_blacklists:38091> label "33d9f0f6541d0b4f4e3d0cff2c201978"
        @139 block drop in log quick on wg0 inet from any to <crowdsec_blacklists:38091> label "33d9f0f6541d0b4f4e3d0cff2c201978"
        @140 block drop in log quick on igc0 reply-to (igc0 192.168.178.1) inet from any to <crowdsec_blacklists:38091> label "33d9f0f6541d0b4f4e3d0cff2c201978"
        @141 block drop in log quick on wireguard inet from any to <crowdsec_blacklists:38091> label "33d9f0f6541d0b4f4e3d0cff2c201978"
        @142 block drop in log quick on igc1 inet from any to <crowdsec6_blacklists:29> label "257e8fa5902cc9c5e1428aad8d1b5953"
        @143 block drop in log quick on igc2 inet from any to <crowdsec6_blacklists:29> label "257e8fa5902cc9c5e1428aad8d1b5953"
        @144 block drop in log quick on igc3 inet from any to <crowdsec6_blacklists:29> label "257e8fa5902cc9c5e1428aad8d1b5953"
        @145 block drop in log quick on wg0 inet from any to <crowdsec6_blacklists:29> label "257e8fa5902cc9c5e1428aad8d1b5953"
        @146 block drop in log quick on igc0 reply-to (igc0 192.168.178.1) inet from any to <crowdsec6_blacklists:29> label "257e8fa5902cc9c5e1428aad8d1b5953"
        @147 block drop in log quick on wireguard inet from any to <crowdsec6_blacklists:29> label "257e8fa5902cc9c5e1428aad8d1b5953"
        @148 pass in log quick on igc0 reply-to (igc0 192.168.178.1) inet proto udp from any to (igc0:1) port = 51820 keep state label "d1a7879fa18dc8ea0aa7df5c99b10957"
        @149 pass in quick on igc0 reply-to (igc0 192.168.178.1) inet proto tcp from any to (igc0:1) port = http flags S/SA keep state label "e1c879a2f139a936f547b953d96c3ea8"
        @150 pass in quick on igc0 reply-to (igc0 192.168.178.1) inet proto tcp from any to (igc0:1) port = https flags S/SA keep state label "e1c879a2f139a936f547b953d96c3ea8"
        @151 pass in quick on igc0 reply-to (igc0 192.168.178.1) inet proto tcp from any to (self:7) port = http flags S/SA keep state label "da8e692e0c200ca488800341b823ad5f"
        @152 pass in quick on igc0 inet6 proto tcp from any to (self:7) port = http flags S/SA keep state label "da8e692e0c200ca488800341b823ad5f"
        @153 pass in quick on igc0 reply-to (igc0 192.168.178.1) inet proto tcp from any to (self:7) port = https flags S/SA keep state label "c79619348261fdc4b0204ec4a93888bf"
        @154 pass in quick on igc0 inet6 proto tcp from any to (self:7) port = https flags S/SA keep state label "c79619348261fdc4b0204ec4a93888bf"
        @155 pass in quick on igc1 inet from (igc1:network:1) to any flags S/SA keep state label "7ec30a775f5761dbf17c1d22463d22f8"
        @156 pass in quick on igc1 inet proto tcp from any to (self:7) port = http flags S/SA keep state label "5a3af4610c82e86b6113ec6de17d01e6"
        @157 pass in quick on igc1 inet proto tcp from any to (self:7) port = https flags S/SA keep state label "f2db1a9c60f4c9b97b664231fc82661f"
        @158 pass in log quick on igc2 inet proto tcp from any to any port = http flags S/SA keep state label "e1547fc82abbc47d6ef7b9440d85e82b"
        @159 pass in log quick on igc2 inet6 proto tcp from any to any port = http flags S/SA keep state label "e1547fc82abbc47d6ef7b9440d85e82b"
        @160 pass in log quick on igc2 inet proto tcp from any to any port = https flags S/SA keep state label "f95e87d88701fc2304c8e349665351ff"
        @161 pass in log quick on igc2 inet6 proto tcp from any to any port = https flags S/SA keep state label "f95e87d88701fc2304c8e349665351ff"
        @162 block drop in log quick on igc2 inet all label "7197d9fcb10047f871039c7c234b4dbf"
        @163 block drop in log quick on igc2 inet6 all label "7197d9fcb10047f871039c7c234b4dbf"
        @164 pass in quick on wg0 inet from (wg0:network:1) to any flags S/SA keep state label "2e8c745ab1902678c973687535685c2b"
        @165 pass in quick on wg0 inet6 from (wg0:network:*) to any flags S/SA keep state label "2e8c745ab1902678c973687535685c2b"
        @166 pass in quick on wg0 inet6 from fe80::/10 to any flags S/SA keep state label "2e8c745ab1902678c973687535685c2b"
        @167 block drop in quick on wg0 inet all label "40581bc9034fd36869d4ab7e5becf3f8"
        @168 block drop in quick on wg0 inet6 all label "40581bc9034fd36869d4ab7e5becf3f8"
        @169 pass in quick on igc3 inet proto tcp from any to any port = http flags S/SA keep state label "1ee9e2a05608bfdb51125289d53f8f0f"
        @170 pass in quick on igc3 inet6 proto tcp from any to any port = http flags S/SA keep state label "1ee9e2a05608bfdb51125289d53f8f0f"
        @171 pass in quick on igc3 inet proto tcp from any to any port = https flags S/SA keep state label "a38d8e0ca66004679bc5382f1f5cfb46"
        @172 pass in quick on igc3 inet6 proto tcp from any to any port = https flags S/SA keep state label "a38d8e0ca66004679bc5382f1f5cfb46"
        @173 block drop in log quick on igc3 inet all label "74bd3df10ff01798ced3ef3c799b8204"
        @174 block drop in log quick on igc3 inet6 all label "74bd3df10ff01798ced3ef3c799b8204"
        @175 pass in log quick on igc4 inet proto tcp from any to any port = https flags S/SA keep state label "eb48731bc83c94b53075159c2f99a83e"
        @176 pass in log quick on igc4 inet6 proto tcp from any to any port = https flags S/SA keep state label "eb48731bc83c94b53075159c2f99a83e"
        @177 pass in log quick on igc4 inet proto tcp from any to any port = http flags S/SA keep state label "f373f203f7e75e24591ab4035e1e4b65"
        @178 pass in log quick on igc4 inet6 proto tcp from any to any port = http flags S/SA keep state label "f373f203f7e75e24591ab4035e1e4b65"
        @179 block drop in log quick on igc4 inet all label "bb19ae9f9b0fc5379daa88758052b390"
        @180 block drop in log quick on igc4 inet6 all label "bb19ae9f9b0fc5379daa88758052b390"
        @181 pass in quick on wireguard inet from (wireguard:network:1) to any flags S/SA keep state label "2be27c99ad49942931537e63da8b9c23"
        @182 block drop in log quick on wireguard inet from (wireguard:network:1) to any label "53ceaf9f9d50ae2042c06b1322219941"
        @183 anchor "acme-client/*" all
        @184 anchor "iperf" all
    nat rules
        @0 no nat proto carp all
        @1 nat on igc0 inet from (igc1:network:1) to any port = isakmp -> (igc0:0) static-port
        @2 nat on igc0 inet from (lo0:network:1) to any port = isakmp -> (igc0:0) static-port
        @3 nat on igc0 inet from (igc2:network:1) to any port = isakmp -> (igc0:0) static-port
        @4 nat on igc0 inet from (igc3:network:1) to any port = isakmp -> (igc0:0) static-port
        @5 nat on igc0 inet from (wg0:network:1) to any port = isakmp -> (igc0:0) static-port
        @6 nat on igc0 inet from (igc4:network:1) to any port = isakmp -> (igc0:0) static-port
        @7 nat on igc0 inet from 127.0.0.0/8 to any port = isakmp -> (igc0:0) static-port
        @8 nat on igc0 inet from (igc1:network:1) to any -> (igc0:0) port 1024:65535
        @9 nat on igc0 inet from (lo0:network:1) to any -> (igc0:0) port 1024:65535
        @10 nat on igc0 inet from (igc2:network:1) to any -> (igc0:0) port 1024:65535
        @11 nat on igc0 inet from (igc3:network:1) to any -> (igc0:0) port 1024:65535
        @12 nat on igc0 inet from (wg0:network:1) to any -> (igc0:0) port 1024:65535
        @13 nat on igc0 inet from (igc4:network:1) to any -> (igc0:0) port 1024:65535
        @14 nat on igc0 inet from 127.0.0.0/8 to any -> (igc0:0) port 1024:65535
        @15 nat-anchor "acme-client/*" all
        @0 no rdr proto carp all
        @1 no rdr on igc1 proto tcp from any to (igc1:2) port = 8443
        @2 no rdr on igc1 proto tcp from any to (igc1:2) port = 8908
        @3 rdr-anchor "acme-client/*" all


Ich werde zum Test mal deinen Vorschlag umsetzen _und_ mal die Local Access List im Caddy entfernen. Wenn ich von draußen rein komme, müsste die Config soweit stimmen und mich rein lassen.

Nochmal ein kurzes Update.
Ich habe die Acces Liste entfernt und es geht. Also von außen habe ich keine Probleme und die Config scheint soweit auch zu passen.

Ich habe mir nochmal den tcpdump angesehen.. hatte vorher meinen filter falsch. Aber ich sehe doch die Antwort und mein DNS Server gibt mir folgendes zurück:

Flags: 0x8182 Standard query response, Server failure
    1... .... .... .... = Response: Message is a response
    .000 0... .... .... = Opcode: Standard query (0)
    .... .0.. .... .... = Authoritative: Server is not an authority for domain
    .... ..0. .... .... = Truncated: Message is not truncated
    .... ...1 .... .... = Recursion desired: Do query recursively
    .... .... 1... .... = Recursion available: Server can do recursive queries
    .... .... .0.. .... = Z: reserved (0)
    .... .... ..0. .... = Answer authenticated: Answer/authority portion was not authenticated by the server
    .... .... ...0 .... = Non-authenticated data: Unacceptable
    .... .... .... 0010 = Reply code: Server failure (2)



June 22, 2024, 08:48:38 PM #14 Last Edit: June 22, 2024, 08:51:45 PM by Monviech
Wer ist denn DNS Server in deinem Netz? Unbound mit standardkonfig auf der OPNsense? Oder etwas spezielles?

Du hast Recht, bei deinen Regeln sehe ich keine speziellen NAT oder RDR Regeln.

Hier ist ein DNS Problem im Gang.

Ich hatte bei Unbound auf der OPNsense ein paar Domains die nicht aufgelöst werden konnten (rekursiv). Hier half es Weiterleitungen für einzelne Domains so konfigurieren, die z.B. auf 1.1.1.1 zeigen. Dann wird für die einzelne Domain nicht der rekursive Weg sondern eine Weiterleitung genommen um das Ergebnis der Auflösung von 1.1.1.1 zu bekommen.
Hardware:
DEC740