Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Firewall rules - just a stupid question.

    Firewalling
    3
    8
    1.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • panzP
      panz
      last edited by

      Standard rules (WAN, LAN, for example), as far as I understand, are all quick rules and processed top to bottom. The first match wins. Traffic is evaluated ENTERING the interface. I understand this for WAN and LAN rules, but for OpenVPN interface how does this work?

      So, traffic with destination OpenVPN enters WAN and then where is it going to go? IN(to) OpenVPN interface or OUT OpenVPN interface to ovpn subnet? Is this traffic filtered by deny/drop WAN rules or I have to build firewall rules for the OpenVPN interface?

      pfSense 2.3.2-RELEASE-p1 (amd64)
      motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

      1 Reply Last reply Reply Quote 0
      • GruensFroeschliG
        GruensFroeschli
        last edited by

        The VPN traffic entering from the WAN can be treated as if the traffic is coming from a a real physical interface called OpenVPN.
        Rules you place on the OpenVPN tab are no different than rules on any other interface.

        With the rules on the OpenVPN interface you filter only traffic of your remote sites / roadwarriors.
        To control traffic exiting the OpenVPN interface, you put rules on the LAN/OPT/etc. interface.

        We do what we must, because we can.

        Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

        1 Reply Last reply Reply Quote 0
        • panzP
          panz
          last edited by

          If I understand correctly, If I have pfsense setup as an OpenVPN client to some vpn provider (for example StrongVPN) have I to set a deny (incoming) policy on the OpenVPN interface equal to that (default) that's set on the WAN?

          pfSense 2.3.2-RELEASE-p1 (amd64)
          motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

          1 Reply Last reply Reply Quote 0
          • GruensFroeschliG
            GruensFroeschli
            last edited by

            If you don't create any rules, then anything will be blocked by default.
            Only if you start creating your own rules which allow something, traffic is able to "enter" on this interface.

            The block rules which are on the WAN interface by default (block private and block bogon) can be enabled by setting the respective checkboxes on the config-page of the interface itself (interfaces–>OPTx).

            If you don't have any rules these two rules aren't really needed, but they provide a "safe" start for a WAN.
            --> The help prevent someone shooting in their own foot.

            We do what we must, because we can.

            Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

            1 Reply Last reply Reply Quote 0
            • K
              kejianshi
              last edited by

              I wouldn't set any deny rules in openvpn until its working perfectly - You can add rules later if you want, but this way, if the rule you add breaks openvpn, you will immediately know what the problem is.

              1 Reply Last reply Reply Quote 0
              • panzP
                panz
                last edited by

                I would like to set a default deny policy for all incoming traffic on the OpenVPN client connection (similar to that on the WAN), then allow only the traffic that's a reply to LAN requests. I thought this was enabled by default, with automatically created rules for OpenVPN, but in release 2.1 seems that the auto-created rule is "all all".

                I think that OpenVPN connection to a VPN provider IS INTERNET, so I'd like to protect my network (I know that VPN provider should do this, but…)  ;D

                pfSense 2.3.2-RELEASE-p1 (amd64)
                motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

                1 Reply Last reply Reply Quote 0
                • K
                  kejianshi
                  last edited by

                  Nothing gets allowed automatically.

                  By default, everything - Absolutely everything is denied.

                  So, rather than concentrating on deny rules, concentrate on allow rules.

                  1 Reply Last reply Reply Quote 0
                  • panzP
                    panz
                    last edited by

                    The OpenVPN setup (client) created a rule:

                    pass in quick on openvpn all flags S/SA keep state

                    that scares me a bit  ::)

                    I had to create a floating rule on the WAN (em0) to stop clients of the LAN to connect to Internet if VPN is down:

                    block drop log on em0 inet proto tcp all flags S/SA

                    and a second quick rule (on WAN) to allow client-only VPN handshaking:

                    block drop log quick on em0 inet proto udp from any to ! <my_dns_addresses>port = domain

                    where <my_dns_addresses>is an alias that points to my favorite DNS servers (like OpenNIC's).

                    Now I want to create some rules to protect the OpenVPN interface from connections coming from Internet (-> just in case my VPN provider would allow something to come through).</my_dns_addresses></my_dns_addresses>

                    pfSense 2.3.2-RELEASE-p1 (amd64)
                    motherboard: MSI C847MS-E33 Micro ATX (with Intel Celeron CPU 847 @ 1.10 GHz) ~ PSU: Corsair VS350 ~ RAM: Kingston KVR1333D3E9S 4096 MB 240-pin DIMM DDR3 SDRAM 1.5 volt ~ NIC: Intel EXPI9301CTBLK (LAN) ~ NIC: D-Link DFE-528TX (CAM) ~ Hard Disk: Western Digital WD10JFCX Red ~ Case: Cooler Master HAF XB ~ power consumption: 21 Watts.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.