This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DNAT and Firewall Rule Question

So I wanted to block some malicious IPs and I placed a block rule at the top of my firewall rule list.  Then I discovered to my surprise that the traffic wasn't being blocked.  This is because I am using DNAT with Automatic Firewall Rule checked.  Therefore, the traffic was being allowed before my block rule ever applied.

So upon perusing the forum, I see that there are two ways around this:

1) Add a blackhole NAT rule as the first DNAT
2) Stop using automatic firewall rules and add separate firewall rules for each NAT entry.


So my question is, are there any pros/cons to each approach?  I have about 40 DNAT rules setup, so that is a lot of firewall rules I'd have to add. But if that is a better way of doing things, I'll change it.  Any thoughts/advice?  Thanks.

Matt

P.S. Where does Country Blocking fall in w/r to DNAT?


This thread was automatically locked due to age.
  • #1 is going to be the simplest to implement.  Dispensing with automatic firewall rules in lieu of manually created ones (as much as possible) will give you maximum visibility to the traffic, through the firewall logs, and granularity of control.

    Country blocking rules are the first to be processed.  A potential pitfall with this is that more and more, content is being served from distributed providers, such as Akamai.  These have servers all over the world, so some of the content of a site for a US company might be coming from China or Malaysia.
    __________________
    ACE v8/SCA v9.3

    ...still have a v5 install disk in a box somewhere.

    http://xkcd.com
    http://www.tedgoff.com/mb
    http://www.projectcartoon.com/cartoon/1
  • Yeah, that is why I was kinda shying away from using Country Blocking.  So Country Blocking happens even before the DNAT?


    I know the black hole DNAT would be easiest, just didn't know if it would cause other problems/issues.  I just want to do it the best/proper way and if best practice would be to not use the automatic firewall rules, I'll bite the bullet and change it.  Would be nice to have both before and after rule sets maybe.


    Matt
  • So Country Blocking happens even before the DNAT
      Correct, both inbound and outbound.

    if best practice would be to not use the automatic firewall rules, I'll bite the bullet and change it
      The vast majority use automatic firewall rule quite successfully and are happy with not having to manage rules manually.  If they are working for you to this point, there's no need to change.

    Would be nice to have both before and after rule sets maybe
      Astaro Security Gateway Feature Requests: Hot (953 ideas)  [:)]
    __________________
    ACE v8/SCA v9.3

    ...still have a v5 install disk in a box somewhere.

    http://xkcd.com
    http://www.tedgoff.com/mb
    http://www.projectcartoon.com/cartoon/1
  • So how exactly do I make the black hole DNAT rule?

    I created a Block Group of IPs and networks.  I set the traffic service to Any and the traffic dest. to Any.  I set NAT mode to DNAT.  I set destination to a dead end IP (10.9.9.9) and dest. service to Any.  When I try and save that, it says it cannot create a NAT rule mapping all services into one.  What's the best way to setup a black hole rule?

    Thanks.

    Matt
  • Just leave the 'Destination Service' field empty.

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • Just leave the 'Destination Service' field empty.

    Cheers - Bob



    Thanks! That worked.  

    The only thing I don't like about using this method is that you see the traffic in the log just as "Connection Using NAT" so you can't really tell what is "good" traffic vs. "bad" traffic.  It doesn't show up as a drop which is obvious to see since it is red.  

    Matt
  • In fact, it isn't dropped, Matt, the bits just go off to electronic Heaven. [:)]

    I prefer to kill such traffic with the DNAT method but it is possible to create a Firewall rule that actually drops the traffic:

    {Network/Group to be blocked} -> Any -> {group of all "(Address)" objects on WAN interfaces} : Drop


    You can turn on logging if you want the satisfaction of seeing the drops.  Note that the 'Destination' in the traffic selector is a group containing the "(Address)" objects created by WebAdmin when you define a new interface or an Additional Address - a regular Network definition won't work.*

    Cheers - Bob
    * But, an "irregular" one will. [;)] I always recommend that people never bind a definition to an interface - that all Host/Network definition have 'Interface: >'.  In this case, if you own the subnet 61.62.63.64/27, you could in either the DNAT or the Firewall rule, use a Network definition with your public subnet and 'Interface: External'.
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA
  • In fact, it isn't dropped, Matt, the bits just go off to electronic Heaven. [[:)]]


    Right, I understand, it's not really being blocked, it's just being NAT'd to nowhere.


    I prefer to kill such traffic with the DNAT method but it is possible to create a Firewall rule that actually drops the traffic:

    {Network/Group to be blocked} -> Any -> {group of all "(Address)" objects on WAN interfaces} : Drop




    This is what I originally did and then I discovered nothing was being blocked because I had Automatic Firewall rules on all my DNAT rules.  So the traffic was being allowed before it ever got to my block rule at the top of my firewall list.  I think I had the source being my block group on any interface with a destination of Any/Any.


    You can turn on logging if you want the satisfaction of seeing the drops.  Note that the 'Destination' in the traffic selector is a group containing the "(Address)" objects created by WebAdmin when you define a new interface or an Additional Address - a regular Network definition won't work.*

    Cheers - Bob
    * But, an "irregular" one will. [;)] I always recommend that people never bind a definition to an interface - that all Host/Network definition have 'Interface: >'.  In this case, if you own the subnet 61.62.63.64/27, you could in either the DNAT or the Firewall rule, use a Network definition with your public subnet and 'Interface: External'.


    I kinda did want the satisfaction at first of seeing the drops, but now after thinking about it, I don't want to create 40 or so firewall rules.  So I think I'll stick with the NAT to nowhere! [[:)]]  

    Why do you recommend never binding a definition to an interface?  I was binding the address/network ranges in my block list to the External interface.  Is that not a good idea?

    Thanks.

    Matt
  • Hello,
    just inserting the blackhole NAT on top (position 1) of the NAT-rules doesn't help, because the according firewall rules are in order of their first entry, and are not reordered together with the DNAT rules. If the blackhole rule has been entered last, it will remain last on the hidden firewall rules list.

    If you want to tie this up, you have to switch off all other DNAT rules, look into the hidden portion of firewall configuration list to see if the blackhole NAT rule is on top after this step, and afterwards switch the rest of the DNAT rules back on, so they get positions starting from 2 ->...

    Additionally you have to insert a DNAT target, "any" does not work anymore with newer UTM versions. I hope "External (WAN) (Address)" is the correct choice.

    Best regards,
    SA
  • SA, "External (WAN) (Address)" is correct.  Take a look at https://community.sophos.com/products/unified-threat-management/astaroorg/f/54/t/40646

    Cheers - Bob
     
    Sophos UTM Community Moderator
    Sophos Certified Architect - UTM
    Sophos Certified Engineer - XG
    Gold Solution Partner since 2005
    MediaSoft, Inc. USA