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

    Restrict Port Forward Only From Certain Domains

    Scheduled Pinned Locked Moved NAT
    3 Posts 3 Posters 930 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.
    • W
      WiFiNetGuy
      last edited by

      I have a customer that I have just installed pfSense for. There is a need to forward incoming port 22 requests to an internal app server but only from a certain domain. In other words, if someone at badcompany.com issues a port 22 request to the company's network, it will get rejected. But if someone at goodcompany.com issues the request they want the port forwarded to the app server.

      I have no problem getting all port 22 requests to get through to the app server but really need to restrict it to just those requests from goodcompany.com.

      Thanks in advance for any help.

      1 Reply Last reply Reply Quote 0
      • DerelictD
        Derelict LAYER 8 Netgate
        last edited by

        If you have a specific FQDN you can make an alias based on what that resolves to.  If they have static IP addresses you can make an alias of just their IP addresses.

        In general, pf uses IP addresses, not names so you need a way to get a list of the valid IPs.  Then just use those as source addresses for the port forward.

        Chattanooga, Tennessee, USA
        A comprehensive network diagram is worth 10,000 words and 15 conference calls.
        DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
        Do Not Chat For Help! NO_WAN_EGRESS(TM)

        1 Reply Last reply Reply Quote 0
        • D
          divsys
          last edited by

          Just a suggestion, but it may be worth considering an OpenVPN link to bypass all this.

          If there are 15 random "Good Companys" then it might not be feasible, but if you're talking < 3 I think it would be worth the effort for the added security.

          Just my $.02

          -jfp

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