Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login
    Introducing Netgate Nexus: Multi-Instance Management at Your Fingertips.

    using domain name in rules

    Scheduled Pinned Locked Moved Firewalling
    10 Posts 4 Posters 382 Views 4 Watching
    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.
    • A Offline
      ageis
      last edited by

      Hi,

      I want to be able to lock down access to my pfsense box ssh/vpn by source ip. however the whole point of my vpn is so i can connect to my pc from anywhere

      Is there way I can filter by a domain which i update using a service like dyndns or afraid.org?

      i am new to pfsense so a tutorial/ youtube would be ideal

      thanks in advance

      SteveITSS GertjanG 2 Replies Last reply Reply Quote 0
      • SteveITSS Offline
        SteveITS Rebel Alliance @ageis
        last edited by

        @ageis Yes you can put an FQDN in an alias. https://docs.netgate.com/pfsense/en/latest/firewall/aliases-types.html#host-aliases
        pfSense will resolve it every 5 minutes.

        A couple tips:
        Do not mix FQDNs and other values (IPs) in the same alias. There are bugs.

        It may take 5+ minutes for your laptop to update its FQDN and pfSense to resolve it again.

        Note using FQDNs for public web sites in outbound rules may not work, because www.netgate.com may have multiple IPs, or different IPs depending on location, CDN, etc.

        To upgrade, select your branch in System/Update/Update Settings. When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
        Only install packages for your version of pfSense.
        Upvote ๐Ÿ‘ helpful posts!

        A 1 Reply Last reply Reply Quote 0
        • A Offline
          ageis @SteveITS
          last edited by

          @SteveITS is there a setting that controls how often pfsense will update the firewall?

          SteveITSS johnpozJ 2 Replies Last reply Reply Quote 0
          • SteveITSS Offline
            SteveITS Rebel Alliance @ageis
            last edited by

            @ageis yes

            https://docs.netgate.com/pfsense/en/latest/firewall/aliases-features.html#:~:text=firewall%20periodically%20resolves%20and%20updates%20hostname%20entries

            To upgrade, select your branch in System/Update/Update Settings. When upgrading, allow 10-15 minutes to reboot, or more depending on packages, CPU, and/or disk speed.
            Only install packages for your version of pfSense.
            Upvote ๐Ÿ‘ helpful posts!

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

              @ageis not sure you want it updating its alias too often to be honest.. But you can edit the interval under advanced, firewall&nat

              alias.jpg

              Your client I would think would update its ddns when it connects to the network where your at.. So you have to wait what 5 minutes from time of connection to when you can ssh/vpn in at most.

              To be honest ssh with public key auth, or typical openvpn auth with a cert are pretty secure.. Locking down to a source IP would normally be to prevent brute force attacks - but these are not really concerns with public key or cert auth.. with openvpn the traffic isn't even looked at for auth unless the tls key matches.

              key.jpg

              I mean you do you, but ssh with publickey only auth, or openvpn having to have a cert issued and signed by your own ca, etc. Pretty much eliminates the possibility of someone guessing or bruteforcing a password.

              You could also geoip lock it down, so only IPs from say the US can talk to your services. Or you set it for what countries you might be traveling in, etc..

              Personally I do not have ssh open to the public - I just vpn in if I need to do anything while remote. Which you can ssh to pfsense via the vpn.

              You adjust the time sure, but keep in mind this is for all your aliases, not just the one entry for your ddns source IP.. Maybe not a big deal if you only have a couple of aliases.. But if you had a lot changing from 5 minutes to 60 seconds is going to be a lot more dns queries. Also your going to want to make sure the ttl on your ddns is 5 minutes or lower.. If its an hour or something, even if pfsense checks every 60 seconds, that ttl would come into play..

              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 26.03 | Lab VMs 2.8.1, 26.03

              1 Reply Last reply Reply Quote 0
              • GertjanG Offline
                Gertjan @ageis
                last edited by Gertjan

                @ageis said in using domain name in rules:

                I want to be able to lock down access to my pfsense box ssh/vpn by source ip. however the whole point of my vpn is so i can connect to my pc from anywhere

                I expose my OpenVPN server on pfSense without restriction **.
                SSH access : No need to expose it : I connect to VPN first, and then the GUI and/or SSH will work just fine (edit : as what pozjohn said).
                OpenVPN has been made to handle this situation. Remember a couple of years ago when we were all working from home ? We were all using a VPN ^^ And afaik, none of the companies that used a VPN access had security issues (I presume a correct VPN setup)

                Do you think OpenVPN can be hacked through by using brute force ? That would have been known by now.

                ** I do use GeoIP blocking for my VPN, so instead of accepting a connection from 'the entire planet' I restrict IP access to 'my country only'.


                edit :
                I was just wondering : @home, I have an ISP connection that changes it's IPv4 every week or so. I don't mind.
                But I have a NAS @home that I used from the office (where I have a pfSense), so I have a "afraid.org" home host name, so I can access my home IPv4 no matter what. This setup is part of one of my 3 off-site backups.
                This works just fine.

                Ones in a while I do connect from home to work using the remote VPN access.
                So, I just created this first, top "Home OpenVPN" rule :
                cd972385-f4ad-42b2-b1bd-761263f61dee-image.png
                If the first rule didn't match, because I wasn't connecting from home, but from somewhere else, I still have to match the second rule, where I GeoIP (Europe) limits the access.
                As soon as I come home tonight, I'll test this.

                No "help me" PM's please. Use the forum, the community will thank you.

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

                  @Gertjan why would you be connecting to the vpn on your wan from the wan side when your home?

                  If you did connect to the vpn listening on your wan - wouldn't you be coming from your lan side networks?

                  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 26.03 | Lab VMs 2.8.1, 26.03

                  GertjanG 1 Reply Last reply Reply Quote 0
                  • GertjanG Offline
                    Gertjan @johnpoz
                    last edited by

                    @johnpoz

                    The rules shown above are from my 'work' pfSense.
                    When I initiate a VPN connection from 'home', I make a connection to this work pfSense and will enter it's WAN.

                    No "help me" PM's please. Use the forum, the community will thank you.

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

                      @Gertjan oh that makes sense - I thought that was home ;) But wouldn't the 2nd rule cover you as well since are you not in the EU?

                      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 26.03 | Lab VMs 2.8.1, 26.03

                      GertjanG 1 Reply Last reply Reply Quote 0
                      • GertjanG Offline
                        Gertjan @johnpoz
                        last edited by Gertjan

                        @johnpoz said in using domain name in rules:

                        since are you not in the EU?

                        Afaik, France, where I am, is still part of the EU ๐Ÿ˜Š

                        No "help me" PM's please. Use the forum, the community will thank you.

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