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

    List of hooks?

    Scheduled Pinned Locked Moved Development
    18 Posts 9 Posters 2.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.
    • J
      jazzl0ver @luckman212
      last edited by

      Hi,

      Just wanted to describe a use case where this might be an extremely useful.

      We have 3 ISPs connected to pfSense (two of them actually for HA), each of them provides us 2 subnets (one for failover support and another one for our services). While DynDNS service perfectly changes pfSense's public IP when a gateway triggers its state, the other services (that hosted behind pfSense) can't change their public IP addresses allocated from the 2nd subnets.

      It would be really useful to set up a hook on a gateway state change that would run a custom script with all required actions to update other services DNS records.

      One thing that I'd probably change from the @luckman212 suggestion is to look for a custom script in a directory that won't be overwritten upon pfSense update, for example /usr/local/etc/rc.d/rc.gateway_alarm_custom.

      Please, implement this in the next pfSense release!

      1 Reply Last reply Reply Quote 0
      • J
        jazzl0ver
        last edited by

        After some researching I've found that there's a special plugin hook - plugin_gateway. So, here is the package which implements /usr/local/etc/rc.d/rc.gateway_alarm_custom start up upon a gateway up/down event - https://github.com/jazzl0ver/pfSense-pkg-gatewayhook

        C 1 Reply Last reply Reply Quote 1
        • C
          cosmor @jazzl0ver
          last edited by

          @jazzl0ver
          It's great that you discovered the script. However , could you describe according to your previous post what specific actions ( (for common use cases of multi-wan setups ) are needed after the hook, when a gateway is down and another one is selected from the group as default? Would you like to see specific dns servers declared (on general setup) to use a specific gateway change automatically to the new selected gateway? Update local dns service pointing to services to a dmz ? Also, according to your post, please state why a change is needed for dns in relation with the setup, configuration and limitations of dns service you have setup locally.

          Thanks.

          1 Reply Last reply Reply Quote 0
          • J
            jazzl0ver
            last edited by

            @cosmor, we host public DNS zones on a separate server (bind9), so when the ISP channel gets switched to another one on pfSense, we need something to reach that server out and somehow update the zones (by nsupdate if the zones are dynamic or a custom script otherwise).

            In our case we use a custom script, which is triggered by ssh login called from rc.gateway_alarm_custom. The script discovers the current channel, substitutes predefined zone template for a zone, increases the zone serial and reloads the zone.

            Let me know if you need more details on that.

            1 Reply Last reply Reply Quote 0
            • L
              lucifer1413 Banned
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • M
                martintamare
                last edited by

                @jazzl0ver thanks for sharing this !
                We are going to use SIP to target and kill state for specific devices that don't like public IP changes (SIP Phones).

                1 Reply Last reply Reply Quote 0
                • J
                  jazzl0ver
                  last edited by

                  @Moderador-PfSense what are the steps to include my package to the "Available packages" list in the GUI?

                  GertjanG JeGrJ 2 Replies Last reply Reply Quote 0
                  • GertjanG
                    Gertjan @jazzl0ver
                    last edited by Gertjan

                    @jazzl0ver You mean : what to so the package that you build yourself shows up in that list ?

                    First step : before writing a package, you should be able to read a package => packages code written by others.
                    This will learn you everything.
                    Install 'simple' packages like "Notes", "Cron", "Patches", etc.
                    Now, check here /usr/local/pkg/, read ALL the files. You will get the idea.

                    You also need to know how the FreeBSD program pkg works. Where it gets it 'packages from', how a package is assembled.

                    Btw : If you want to make a (your) package is part of the official pfSense package list, you should hos it on github. And wait before the Netgate pfSense team contact you when they decide to do so. This can take a very long time. Ask @BBcan177 - he knows what it takes ;)

                    No "help me" PM's please. Use the forum, the community will thank you.
                    Edit : and where are the logs ??

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      jazzl0ver @Gertjan
                      last edited by jazzl0ver

                      @gertjan said in List of hooks?:

                      If you want to make a (your) package is part of the official pfSense package list,

                      Yeah, that's what I meant. My package is hosted on github (https://github.com/jazzl0ver/pfSense-pkg-gatewayhook).

                      This can take a very long time

                      Alright.. :( Thanks for the reply!

                      1 Reply Last reply Reply Quote 0
                      • JeGrJ
                        JeGr LAYER 8 Moderator @jazzl0ver
                        last edited by

                        @jazzl0ver said in List of hooks?:

                        @Moderador-PfSense what are the steps to include my package to the "Available packages" list in the GUI?

                        Just to follow up (no Netgate staff myself!), this user is NO Moderator of pfSense or related to Netgate at all. You should rather include @jimp or other Netgate folks in your shoutout :)

                        Don't forget to upvote ๐Ÿ‘ those who kindly offered their time and brainpower to help you!

                        If you're interested, I'm available to discuss details of German-speaking paid support (for companies) if needed.

                        1 Reply Last reply Reply Quote 1
                        • J
                          jazzl0ver
                          last edited by

                          @jimp could you please advise?

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

                            Yeah, let that be clear : I'm just a pfSense consumer.

                            @jazzl0ver said in List of hooks?:

                            @jimp could you please advise?

                            As @JeGr said : forum user taht work for Netgate, click on this @jimp and you'll see

                            0523e643-6de4-4d0e-bc49-d560b6193767-image.png

                            so you know he's from Netgate.

                            He is also the author of many Netgate / pfSense videos.
                            https://www.youtube.com/c/NetgateOfficial/videos

                            No "help me" PM's please. Use the forum, the community will thank you.
                            Edit : and where are the logs ??

                            1 Reply Last reply Reply Quote 0
                            • jimpJ
                              jimp Rebel Alliance Developer Netgate
                              last edited by

                              As a general rule do not tag specific people unless they asked to be notified. No matter their role.

                              Remember: Upvote with the ๐Ÿ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

                              Need help fast? Netgate Global Support!

                              Do not Chat/PM for help!

                              JeGrJ 1 Reply Last reply Reply Quote 0
                              • JeGrJ
                                JeGr LAYER 8 Moderator @jimp
                                last edited by

                                @jimp said in List of hooks?:

                                As a general rule do not tag specific people unless they asked to be notified. No matter their role.

                                My bad, sorry.

                                Don't forget to upvote ๐Ÿ‘ those who kindly offered their time and brainpower to help you!

                                If you're interested, I'm available to discuss details of German-speaking paid support (for companies) if needed.

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

                                  Same here.

                                  No "help me" PM's please. Use the forum, the community will thank you.
                                  Edit : and where are the logs ??

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