Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - BenKenobi

#1
and the rules -
#2
not possible to show all the rules NAT first
#3
I've been doing that - it was adding another brute force source that showed me the IP was already blocked, I was also still receiving 'spam' from blocklisted IP's and ranges which I should not be. This has stopped since I introduced the !source into the NAT rule so far. Far too many IP's to list here but the aliases do contain what I expect.

Sources in Japan are being particularly problematic as are a few via some proxies that seek to bypass GEOIP, takes time to identify them. I'd post some server logs but I keep them pretty clean to make reviewing easier. I guess I could drop the !source and demonstrate that bad actors are able to bypass the firewall block rules.
#4
On the addresses I block I use 'any' I don't care what port they're from or going to.

#5
Don't know how you want that shared - I can't post images here and I'm not setting them up in an external repository, I suppose I could extract the XML from a backup.

    <rule uuid="e3035897-2778-4205-ae56-aeb7ef3203a5">
      <sequence>1000</sequence>
      <disabled>0</disabled>
      <nordr>0</nordr>
      <interface>wan</interface>
      <ipprotocol>inet</ipprotocol>
      <protocol>tcp</protocol>
      <source>
        <network>BlockBeforeNAT</network>
        <port/>
        <not>1</not>
      </source>
      <destination>
        <network>82.68.34.122</network>
        <port>143</port>
        <not>0</not>
      </destination>
      <target>ATAMailServer</target>
      <local-port>143</local-port>
      <poolopts/>
      <log>0</log>
      <category/>
      <descr/>
      <tag/>
      <tagged/>
      <nosync>0</nosync>
      <natreflection/>
      <pass/>
      <audit>eyJjcmVhdGVkIjp7InVzZXJuYW1lIjoicm9vdCIsInRpbWUiOiIxNzgzNTg4NzIwLjkxIiwiZGVzY3JpcHRpb24iOiJcL2FwaVwvYXBpLnBocCBtYWRlIGNoYW5nZXMifSwidXBkYXRlZCI6eyJ1c2VybmFtZSI6InJvb3RAMTAuMTAwLjAuMTMiLCJ0aW1lIjoiMTc5MjQ0NjcxMC43MiIsImRlc2NyaXB0aW9uIjoiXC9hcGlcL2FwaS5waHAgbWFkZSBjaGFuZ2VzIn0sInVzZXJkYXRhIjp7Im5vdGUiOiIifX0=</audit>
      <associated-rule-id/>
    </rule>

This is the rule - note that it contains specific rules designed to block anyone that triggers a security issue on the internal servers - without the 'not' rule in the source the IP addresses that are blocked continue to trigger alerts so they are bypassing the rule below.

          <rule uuid="10814b62-534c-46a2-9b02-32e5f624bc4c">
            <enabled>1</enabled>
            <statetype>keep</statetype>
            <state-policy/>
            <sequence>51</sequence>
            <action>block</action>
            <quick>1</quick>
            <interfacenot>0</interfacenot>
            <interface>wan</interface>
            <received-on-not>0</received-on-not>
            <received-on/>
            <direction>in</direction>
            <ipprotocol>inet</ipprotocol>
            <protocol>any</protocol>
            <icmptype/>
            <icmp6type/>
            <source_net>Censys,EMailRangePerm,InetCens,InetCens2,Shodan,Shadow,VariousScumbags,BlacklistedSources,BlacklistJSON,TalosV4,GeoIP,range_bans</source_net>
            <source_not>0</source_not>
            <source_port/>
            <destination_net>any</destination_net>
            <destination_not>0</destination_not>
            <destination_port/>
            <divert-to/>
            <gateway/>
            <replyto/>
            <disablereplyto>0</disablereplyto>
            <log>0</log>
            <allowopts>0</allowopts>
            <nosync>0</nosync>
            <nopfsync>0</nopfsync>
            <statetimeout/>
            <udp-first/>
            <udp-multiple/>
            <udp-single/>
            <max-src-nodes/>
            <max-src-states/>
            <max-src-conn/>
            <max/>
            <max-src-conn-rate/>
            <max-src-conn-rates/>
            <max-pkt-rate-number/>
            <max-pkt-rate-seconds/>
            <overload/>
            <adaptivestart/>
            <adaptiveend/>
            <prio/>
            <set-prio/>
            <set-prio-low/>
            <tag/>
            <tagged/>
            <tcpflags1/>
            <tcpflags2/>
            <tcpflags_any>0</tcpflags_any>
            <categories/>
            <sched/>
            <tos/>
            <shaper1/>
            <shaper2/>
            <description>Scumbags</description>
            <audit>eyJjcmVhdGVkIjp7InVzZXJuYW1lIjoicm9vdEAxMC4xMDAuMC4xMyIsInRpbWUiOiIxNzg5NTYxODkyLjU3IiwiZGVzY3JpcHRpb24iOiJcL2FwaVwvYXBpLnBocCBtYWRlIGNoYW5nZXMifSwidXBkYXRlZCI6eyJ1c2VybmFtZSI6InJvb3RAMTAuMTAwLjAuMTMiLCJ0aW1lIjoiMTc4OTU2MTg5Mi41NyIsImRlc2NyaXB0aW9uIjoiXC9hcGlcL2FwaS5waHAgbWFkZSBjaGFuZ2VzIn0sInVzZXJkYXRhIjp7Im5vdGUiOiIifX0=</audit>
          </rule>

Some of the triggers on the mail server in particular are brute force attempts, these are caught by fail2ban, invalid <CR> characters and injection attempts, I regularly check the logs on the servers. When I added a new IP address I found that I had already blocked it, so I dug deeper ...
#6
Well I have evidence that it does from logs on the servers so we will leave it at that, IP's that are specifically and deliberately blocked are still appearing.

Not debating it any more
#7
You can't NAT from certain sources if you don't know what they are - and to web servers and mail servers they can not be known in advance.

Which part of NAT bypasses firewall rules isn't being understood, I don't think the misunderstanding here is mine.

Any firewall 'blocks' should be evaluated BEFORE any packets are offered up for NAT, as it stands those rules are completely ignored, if the firewall executes a destination NAT the firewall rules are not enforced so anything set in them is irrelevant.

I only managed to make this work by tricking the NAT - by stating that the 'source' must not be in any of these lists using a network group i.e. a network group rule inverted as the NAT source.
#8
The problem is one of precedence - NAT should NOT be executed before any blocks I set up - this defeats rules specifically configured to protect internal servers from known bad actors whether they be government sponsored or otherwise. The firewall rules are NOT evaluated after NAT - they're completely ignored.

By not enforcing rules that I set up the firewall is in effect providing an open door via any port I have open for legitimate means.

The solution I found seems to work but configuring the firewall to process block rules before NAT would be a much better option.
#9
Well despite the responses - I mean NAT without a 'pass' is pretty pointless -

I take issue with "Firewall rules are allowing traffic" no they aren't - the NAT bypasses firewall rules completely.

I found the solution here, it is still wrong IMHO that firewall rules are not enforced before NAT - should only be presented for NAT if it does not violate any block list which is exactly what the thread linked below does.

https://forum.opnsense.org/index.php?topic=46122.0
#10
Really need an option to force firewall rules before NAT - I need to keep scumbags and scammers out but OpnSense lets them through - as I have found here NAT is applied before Firewall rules - I want an option not to - if I block a country I expect it blocked even from NAT traversal or I need to put a firewall on every internal box - this isn't efficient.

If I have missed something and there is a setting could somebody expose it please.
#11
QuoteI can assure you there is at least one setup mistake at play here

Sorry that doesn't offer many clues - if you suspect a configuration error then perhaps the documentation should make such configurations clearer.

Even so I'm not so sure - simply because the config works in pFSense, of course pFSense could be broken but if so I'm glad it is. To add even further insult the OPNsense insists on using the default gateway even when a 1:1 NAT explicitly says not to. The 'default' gateway is taking priority over everything, even if a specific gateway is stated in the Firewall rules for LAN outgoing traffic it is ignored and traffic exits on the 'default' gateway. Load shaping etc flat out doesn't work

How do I know - because my mail servers are supposed to use one gateway only, no exceptions, 1:1 in place and LAN rules. They don't as confirmed by RFC headers on a receiver which messes up my SPF and DMARC.

I'll do what I can to report but I'll be going back to pFSense unfortunately, I'd rather not because I don't care a lot for the direction Netgate are taking things, but I don't have time to mess with this. I will leave the system set up so that I can play but once I collect everything required for the report I'll be taking OPNsense down.
#12
The default gateway which is one of the WAN interfaces never changes and it uses that exclusively despite both WAN and OPT1 being part of a tier 1 group - each WAN has its own gateway and is a distinct ISP account. The tier 1 group comprising WAN and OPT1 (both are set as tier 1) is set up as the default route for all outgoing LAN traffic.

No matter how much traffic transits the group it all passes out on the default WAN.

In pFSense it just works, same kind of configuration, I'd like to move away from pFSense but I keep hitting barriers like this.
#13
How many load balancing features does OPNsense posess ? - dual WAN

#14
22.1 Legacy Series / Loadbalancing - still broken
June 19, 2022, 09:50:46 PM
Thought I'd give OPNSense another shot but loadbalancing still won't work - PFSense load balancing works out of the box and is a breeze to configure compared to OPNsense. Even if configured to the letter OPNsense makes no attempt whatsoever to balance load - yes even with the appropriate gateway set in the 'all LAN traffic' rule all traffic is pushed on the default regardless.

All the guides I have read to make loadbalancing work in OPNsense require the use of unbound - don't use it, no intention of doing so - I run my own internal DNS / DHCP systems.

There's a lot to like about OPNsense but this is a showstopper for me.

Is there a solution to make load balancing work without unbound OR any kind of gateway monitoring.
#15
I need a server behind the firewall to use a specific gateway but no longer seem able to.

Just rebuilt the firewall on new hardware but now I can't add a rule to force a specific internal IP to leave by a specific gateway - firewall says outgoing connections cannot use policy based routing - what kind of ridiculous nonsense is this ??

Is there any solution or is it time to put my Cisco 1900 back in service ?