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

    Restrict access from a public IP range for a specific user

    Scheduled Pinned Locked Moved OpenVPN
    18 Posts 4 Posters 1.3k 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.
    • M
      mroushdy
      last edited by

      Hello,
      one of our users has a dynamically changing IP for his home internet router and his IP is changed once or twice every week by his ISP. Our VPN security policy instructs that remote users can access by whitelisting their home IPs, but for that user we need to whitelist his neighbourhood IP range, but this violates our policy, so, my question is: is it possible to allow VPN access from that whitelisted IP range only for that user account? so if another user tries to VPN via the same range get's access denied?

      Thank you,

      N 1 Reply Last reply Reply Quote 0
      • N
        netblues @mroushdy
        last edited by netblues

        @mroushdy Consider revising your policy.
        Or pay for a static ip for your users.
        You can have country level restrictions via pfblockerng
        but thats a bit broader from what you are asking.

        You could do the following.
        a. Setup an alias hostname for your user
        b. make this alias updateable with an rfc2136 that updates within 90secs. Consider using pfsense at the client vpn endpoint.
        c. modify pfsense alias update frequency
        https://forum.netgate.com/topic/114364/change-url-table-update-frequency
        d. make your alias list small.

        Omitting any of these steps WILL lead into problems each time the ip changes.
        The key issue is how fast the dns system that pfsense is using and how much time you want to invest on this.
        e.g using cloudflare or google for pf is probably a no go, if they cache entries for more.
        It might work, but be prepare to test how fast ip address changes are propagated.

        M 1 Reply Last reply Reply Quote 0
        • M
          mroushdy @netblues
          last edited by

          @netblues Thank you for responding. Amending the policy is the easiest path. Unfortunatelly the ISP doesn't offer static IPs for home users, so we keep updating the alias entries (unfortunatelly).

          Thanks again,

          N 1 Reply Last reply Reply Quote 0
          • N
            netblues @mroushdy
            last edited by netblues

            @mroushdy I suppose they do, if you upgrade to business though.

            As for the policy, If you are really restricting access to specific ip's, you could also get away without a vpn, especially if https is available at the application level.

            A source ip can always be spoofed at the end of the day.
            I'm not truly suggesting to anyone NOT to use a vpn, on the contrary.
            But for example, openvpn has a tls key, which effectively protects from random connections, before reaching the auth level.
            Also restricting and excluding countries reduces the attack vector.
            vpn access servers are DESIGNED to be open to the public internet. Also installing an ids/ips will give you an extra level of security.
            A paid feed of current threats is also far more effective, than restricting by ip and hoping noone makes a typo, opening to the world.

            M 1 Reply Last reply Reply Quote 0
            • M
              mroushdy @netblues
              last edited by

              @netblues well, having an IPs/IDS is not an option I'm afraid, that's why the policy is strict for whitelisting IPs. But, can't PFsense work as an Identity-Based Firewall so I can bond a user account to his/her IP? (or range)

              johnpozJ N 2 Replies Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @mroushdy
                last edited by johnpoz

                @mroushdy Why don't you just have the client update a ddns entry, and whitelist that fqdn to be able to use the vpn?

                Then it doesn't matter when his IP changes.

                Also whitelisting IPs that have to AUTH to a secure vpn seems a bit over the top.. I mean I could see if it was just open access to a port..

                But doesn't the user need to have a cert and a username and password to auth to the vpn anyway.. Having to also allow only 1 specific IP seems over zealous..

                Then just lock down your vpn to your country - if your worried about Russian h@ck0rs ;)

                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

                N M 2 Replies Last reply Reply Quote 0
                • N
                  netblues @mroushdy
                  last edited by

                  @mroushdy You can run ips/ids on pfsense, which I guess you are using as a vpn access server

                  johnpozJ 1 Reply Last reply Reply Quote 0
                  • N
                    netblues @johnpoz
                    last edited by

                    @johnpoz This has been suggested, however ddns entries tend not to update very fast, especially if you have remote workers and you can't wait for long for ip name propagation to occur.

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

                      @netblues what would be the point of the ids/ips? Makes no sense in a vpn scenario to be honest..

                      As you mentioned the tls key prevents rando attempts to the vpn port anyway. And authing to a vpn is more then secure enough to validate it is the user that is authing. They need a CERT, that only the company issued and a username and password.

                      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 0
                      • johnpozJ
                        johnpoz LAYER 8 Global Moderator @netblues
                        last edited by johnpoz

                        @netblues said in Restrict access from a public IP range for a specific user:

                        ddns entries tend not to update very fast

                        Not sure where you got that idea.. Its not like the IP is changing every freaking minute... Every time the IP changes it would be updated. The alias that looks to see what this fqdn is would check every 5 minutes.

                        The whole point of ddns is changing IPs - ttls could be as short as couple of minutes.

                        To be honest the whitelisting of an IP for a vpn connection screams your tinfoil hat is too freaking tight in the first place.

                        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

                        N 1 Reply Last reply Reply Quote 1
                        • M
                          mroushdy @johnpoz
                          last edited by

                          @johnpoz I already agree with you that a cert-based auth with a password is quite enough, but the security officer is more masticulous, I even suggested whitelisting our country and that's it.. I may consider DDNS.

                          Thanks,

                          johnpozJ N 2 Replies Last reply Reply Quote 0
                          • N
                            netblues @johnpoz
                            last edited by

                            @johnpoz I stand corrected
                            https://docs.netgate.com/pfsense/en/latest/firewall/aliases.html
                            300 seconds .
                            However if you stumble upon minimum ttl dns server setting, set to 86400, then you won't get it that fast.

                            Always something to worry about.

                            I wouldn't do it large scale by no means.

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

                              @mroushdy said in Restrict access from a public IP range for a specific user:

                              but the security officer is more masticulous

                              I would use a different word ;) hehehe to describe such nonsense..

                              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 0
                              • N
                                netblues @mroushdy
                                last edited by

                                @mroushdy said in Restrict access from a public IP range for a specific user:

                                @johnpoz I already agree with you that a cert-based auth with a password is quite enough, but the security officer is more masticulous, I even suggested whitelisting our country and that's it.. I may consider DDNS.

                                Thanks,

                                So we suppose you have already invested into zerotrust approach, with endpoint protection et al.

                                Right?
                                Give your security "expert" a few more things to improve his attitude. :)

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

                                  @netblues said in Restrict access from a public IP range for a specific user:

                                  However if you stumble upon minimum ttl dns server setting,

                                  And where would you see that - the user setting up the ddns would be able to pick that - cloudflare ddns allows for a 1 min ttl.

                                  Now your thinking DNS the company is using to check this ddns that server is overwriting the ttls of records with a min 1 day - wtf would they be using such a dns server for that doesn't honor the TTL of a record?

                                  I can see limiting the VPN access to a specific country of origin - really just to lower the spam to the vpn log ;)

                                  Mar 20 01:08:36 	openvpn 	30029 	TLS Error: tls-crypt unwrapping failed from [AF_INET]162.142.125.138:38028 
                                  

                                  With a proper setup vpn - if the client doesn't use the correct TLS key - they can not even start to auth to the vpn server.

                                  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

                                  N 1 Reply Last reply Reply Quote 0
                                  • N
                                    netblues @johnpoz
                                    last edited by

                                    @johnpoz I'm just saying that there are other intermediates that need to be checked upon, and they might also change their minds without telling anyone too.

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

                                      @netblues Well guess the client has to call in then - just like they are doing now when their IP changes every few days ;)

                                      edit: Just out of curiosity what are your vpn settings? Sure and the hell hope your just not using shared key?

                                      So lets think about what would be required for some unwanted user to auth to a your vpn. They have to have the TLS key. They have to have a cert issued by your CA (which could have a password on it). They need a user name and password.

                                      And if your tin foil hat is really tight - setup MFA for authing to the vpn as well.

                                      Trying to use the IP of the client on top of all of that seems just pointless, especially when you have clients that have IPs that change on a regular basis. What if this client internet is out and they have to go to the local starbucks, or hotspot off their phone cell connection to vpn into work? They now also have to call someone to get them to update the IP on the firewall that can talk to the vpn server?

                                      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

                                      noplanN 1 Reply Last reply Reply Quote 2
                                      • noplanN
                                        noplan @johnpoz
                                        last edited by

                                        @johnpoz

                                        OH yeah totally agree on this one
                                        Had a couple of IT managers only want to allow static ipv4 from their homeOffice users and forced them to pay the upgrade (and that's floppy expensive here where I live) for that static IP and we are Not talking about gov contractors

                                        Was a hard piece of work to finally talk some sense into

                                        Multi factor Auth on openVPN was the key for success

                                        Np

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