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

    How do I whitelist a few countries only?

    Scheduled Pinned Locked Moved Firewalling
    17 Posts 3 Posters 1.6k Views
    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.
    • P
      paul2019
      last edited by paul2019

      I'm currently using a blacklist approach to deny inbound from the world, except 4 countries, and my unit is running out of memory

      I would like to change that to whitelist the inbound from those 4 countries and block inbound from all others.

      I went on to permit inbound on the geo ip lists and check only the countries that I need, but it warned about the advanced inbound being set to deny and how I would have to set it to allow all inbound before doing a geo ip permit rule.

      I went on the advanced settings and didn't find any option to set the inbound WAN to be allowed by default, I only found block and reject..

      What's the correct way of doing this, whitelist inbound from a couple countries only?

      Thanks

      johnpozJ 1 Reply Last reply Reply Quote 0
      • NogBadTheBadN
        NogBadTheBad
        last edited by NogBadTheBad

        Use pfBlocker to create an Alias permit and use it on an inbound firewall rule:-

        Screenshot 2020-10-31 at 13.39.19.png

        I use the above rule to allow sftp inbound from the UK.

        By default everything is blocked by the default WAN rule.

        Andy

        1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

        P 2 Replies Last reply Reply Quote 0
        • P
          paul2019 @NogBadTheBad
          last edited by

          @NogBadTheBad said in How do I whitelist a few countries only?:

          Use pfBlocker to create an Alias permit and use it on an inbound firewall rule:-

          I use the above rule to allow sftp inbound from the UK.

          By default everything is blocked by the default WAN rule.

          Hi Andy, so I've created an alias and added the geo ips that I require to it, then went on firewall rules and added the alias just like you did, to pass.

          How do I get rid of those pfsense geo block lists I have there? I set them to Disabled but the rule still stays there in the firewall rules (eg: pfB_Topv4, etc). Do they remain there when we set it to Disabled? Just wanted to make sure the memory won't be allocated to process that list anymore since there is now a single rule with the allowed alias doing the trick and everything else should be blocked.

          1 Reply Last reply Reply Quote 0
          • P
            paul2019
            last edited by

            alt text
            alt text

            1 Reply Last reply Reply Quote 0
            • NogBadTheBadN
              NogBadTheBad
              last edited by

              Disable them in the actions pull down.

              Screenshot 2020-10-31 at 14.36.26.png

              Andy

              1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

              P 1 Reply Last reply Reply Quote 0
              • P
                paul2019 @NogBadTheBad
                last edited by

                @NogBadTheBad said in How do I whitelist a few countries only?:

                Disable them in the actions pull down.

                Correct, that's what I did, they still remain list in the firewall rules though, is that normal?

                NogBadTheBadN 1 Reply Last reply Reply Quote 0
                • NogBadTheBadN
                  NogBadTheBad @paul2019
                  last edited by NogBadTheBad

                  @paul2019

                  Do an update Firewall -> pfBlockerNG -> Update

                  Also no need to hide RFC1918 IP addresses, they aren't routable on the internet.

                  The ALLOWED_INCOMMING needs to be added to the rules at the bottom, don't allow ALLOWED_INCOMMING to any.

                  Screenshot 2020-10-31 at 14.45.36.png

                  Andy

                  1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                  P 1 Reply Last reply Reply Quote 0
                  • P
                    paul2019 @NogBadTheBad
                    last edited by paul2019

                    @NogBadTheBad said in How do I whitelist a few countries only?:

                    @paul2019

                    Do an update Firewall -> pfBlockerNG -> Update

                    Also no need to hide RFC1918 IP addresses, they aren't routable on the internet.

                    The ALLOWED_INCOMMING needs to be added to the rules at the bottom, don't allow ALLOWED_INCOMMING to any.

                    You mean the protocol here has to be set like this? (I require UDP as well for SIP). I have many ports to open, from sip to rdp, cameras, etc, so setting up a rule to permit each port can be done and I have to agree that is definitely safer;

                    alt text

                    Is this the correct place for the new rule to show up?

                    btw, pfB_IPv4_DENY_v4 is a custom list of US ip addresses that show up every now and then and I need to manually block by adding them to that list.

                    alt text

                    P 1 Reply Last reply Reply Quote 0
                    • P
                      paul2019 @paul2019
                      last edited by

                      @NogBadTheBad Now get it, since I already have those ports open there, of all kinds, I just duplicate them and assign the source to the country permit alias. I have to duplicate cause when editing the source fields are read only for some reason.

                      P 1 Reply Last reply Reply Quote 0
                      • P
                        paul2019 @paul2019
                        last edited by

                        This post is deleted!
                        NogBadTheBadN 1 Reply Last reply Reply Quote 0
                        • NogBadTheBadN
                          NogBadTheBad @paul2019
                          last edited by

                          @paul2019 👍

                          Andy

                          1 x Netgate SG-4860 - 3 x Linksys LGS308P - 1 x Aruba InstantOn AP22

                          P 1 Reply Last reply Reply Quote 0
                          • P
                            paul2019 @NogBadTheBad
                            last edited by

                            @NogBadTheBad said in How do I whitelist a few countries only?:

                            @paul2019 👍

                            Awesome, thanks a lot!

                            1 Reply Last reply Reply Quote 0
                            • P
                              paul2019 @NogBadTheBad
                              last edited by

                              @nogbadthebad said in How do I whitelist a few countries only?:

                              Use pfBlocker to create an Alias permit and use it on an inbound firewall rule:-

                              Screenshot 2020-10-31 at 13.39.19.png

                              I use the above rule to allow sftp inbound from the UK.

                              By default everything is blocked by the default WAN rule.

                              Question, I'm trying to recreate this setup again but after creating this Alias Permit list and force reloading pfblocker the alias doesn't get created and I can't assign it to the source field like I did back in the day when you helped me out here, what could I be doing wrong this time?

                              01.jpg

                              02.jpg

                              03.jpg

                              1 Reply Last reply Reply Quote 0
                              • johnpozJ
                                johnpoz LAYER 8 Global Moderator @paul2019
                                last edited by johnpoz

                                @paul2019 I do this for my plex access, just create a native alias in pfblocker adding the countries you want to allow. Then just use that alias in your port forward.

                                alias.jpg

                                I have family in Morocco temporarily, all others are just in the US. And I also allow status cake IPs to monitor if my plex is up, and then the IPs that plex uses to validate if your remote access is available.

                                An intelligent man is sometimes forced to be drunk to spend time with his fools
                                If you get confused: Listen to the Music Play
                                Please don't Chat/PM me for help, unless mod related
                                SG-4860 24.11 | Lab VMs 2.8, 24.11

                                1 Reply Last reply Reply Quote 1
                                • P
                                  paul2019
                                  last edited by

                                  @johnpoz Just changed it to native alias, saved, went to update, did force update and force reload and it still sees only the default ipv4 list and not the new one I created, what could it be...

                                  Alias table IP Counts
                                  -----------------------------
                                     17630 /var/db/aliastables/pfB_PRI1_v4.txt
                                  

                                  05.jpg

                                  johnpozJ 1 Reply Last reply Reply Quote 0
                                  • johnpozJ
                                    johnpoz LAYER 8 Global Moderator @paul2019
                                    last edited by

                                    @paul2019 well you have them all off

                                    off.jpg

                                    An intelligent man is sometimes forced to be drunk to spend time with his fools
                                    If you get confused: Listen to the Music Play
                                    Please don't Chat/PM me for help, unless mod related
                                    SG-4860 24.11 | Lab VMs 2.8, 24.11

                                    P 1 Reply Last reply Reply Quote 0
                                    • P
                                      paul2019 @johnpoz
                                      last edited by

                                      @johnpoz said in How do I whitelist a few countries only?:

                                      @paul2019 well you have them all off

                                      Damn, that was it! These are OFF by default and went completely unnoticed until you mentioned it, thanks a lot.

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