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

    Rules based on real world events

    Scheduled Pinned Locked Moved General pfSense Questions
    12 Posts 5 Posters 1.1k 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.
    • A
      akuma1x
      last edited by akuma1x

      I'm pretty sure there are no "If, then..." modes for pfsense firewall rules.

      Best I can think of for your situation is to open the rules tab and "activate" or "disable" the rules based on when you are home. That might get tedious after a while, however. And, since they are cameras, if you forgot to reactivate when you left the home network, you wouldn't get any outside access to your camera system. That would probably be bad, I'm guessing.

      It's a long shot, but you could put the block/allow rule on a schedule, if you're pretty regular for when you're home, or not home.

      Jeff

      1 Reply Last reply Reply Quote 1
      • S
        seqteq
        last edited by seqteq

        yeah thats basically what i have done. I can VPN from my phone to my home network and log on to pfSense.

        Next best thing for me would be a widget on the dashboard to turn a rule on or off. Doesn't seem to be one.

        Clearing the states table is necessary as well.

        GrimsonG 1 Reply Last reply Reply Quote 0
        • GrimsonG
          Grimson Banned @seqteq
          last edited by

          @seqteq said in Rules based on real world events:

          Next best thing for me would be a widget on the dashboard to turn a rule on or off. Doesn't seem to be one.

          Create your own then: https://docs.netgate.com/pfsense/en/latest/development/creating-widgets.html

          S 1 Reply Last reply Reply Quote 2
          • S
            seqteq @Grimson
            last edited by

            @grimson Thanks, I'll do my best!

            1 Reply Last reply Reply Quote 1
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              Thinking outside the box here....
              You could enable your phone as a gateway in pfSense. It would need to have a static DHCP lease etc.
              Then add rules to policy route the camera traffic to that gateway IP.

              By default the rule will omit the gateway if it's down, when you're not at home. When you are at home any outbound traffic matched will be routed to your phone and hence go nowhere. I'm not certain though if it would reload the ruleset when your 'gateway' became available.

              You could also add drop outbound rules so any traffic never actually gets sent to your phone.

              Steve

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

                That is for sure out of the box thinking @stephenw10 But what if his phone doesn't get on the home wifi for some reason when home.. Maybe he turned off his wifi on his phone to save battery?

                If your concerned with sending video to the cloud - if you could be in it.. Wouldn't it be better to just not ever send video to the cloud? And just access your video streams via vpn into your network, etc.

                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
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by stephenw10

                  Yeah, it would require the phone to become visible on the network. Or something else to detect the phone and make itself visible. But if you have that you could do something with a script that worked cleaner.

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

                    You could prob getting something working with IFTT for your phone... It's pretty freaking powerful.. Use it for GPS fencing alerts on my phone, etc. etc.

                    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
                    • S
                      seqteq
                      last edited by

                      @stephenw10 I like that phone as gateway idea, I will try that this week.

                      About scripting it: how would i Script this though? is there documentation on scripting events in pfSense, then tie that javascript or PHP to a widget include

                      GrimsonG 1 Reply Last reply Reply Quote 0
                      • GrimsonG
                        Grimson Banned @seqteq
                        last edited by

                        @seqteq

                        All the documentation is here: https://docs.netgate.com/pfsense/en/latest/ for more you need to go through the pfSense sources: https://github.com/pfsense/pfSense

                        1 Reply Last reply Reply Quote 0
                        • stephenw10S
                          stephenw10 Netgate Administrator
                          last edited by

                          I imagine you would script it via something else. So maybe a RasPi running something that the phone geolocator can push updates to. That then runs a script to ssh into pfSense and enable/disable a firewall rule.
                          Not something I've ever tried myself.

                          Steve

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