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

    Automated scripts for Private Internet Access port forwarding

    Scheduled Pinned Locked Moved NAT
    69 Posts 37 Posters 269.8k 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.
    • B
      Bagpuss @PnoT
      last edited by

      @pnot Have re-uploaded the files in post 2. I'm guessing the move to new forum software broke the original links.
      Apologies for not responding sooner.

      1 Reply Last reply Reply Quote 0
      • C
        cobhc
        last edited by cobhc

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • I
          ijdod
          last edited by ijdod

          I had to add a 'sleep 10' top the start of the script, otherwise the script would have tried to query PIA before the link was established when triggered by devd.
          I also added /etc/rc.filter_configure to the end of the script to actually reload the firefall rules.

          1 Reply Last reply Reply Quote 0
          • C
            CyberDave
            last edited by

            Can you post the details of the firewall rules again? I had it working at one point, but then switched ISPs and had to delete and recreate some interfaces and now I can't get the port-forwarding working again. Thanks.

            1 Reply Last reply Reply Quote 0
            • SoloamS
              Soloam
              last edited by

              Hello all, I had made some adjustments to the script, I changed it to update a Alias and not the rule, I need the port to other rules. I was able to get the port and update the alias. I use transmission, so i updated the port in transmission, also working. The problem is that the port still shows as closed in transmission even with the NAT rule (the same rule that was working in the previews version of the API). I tried to add "/etc/rc.filter_configure" but with no success.

              Also the devd rule is not working, I made the setup to ovpnc1 (my interface) ad still not working.

              Any help?

              Thank you

              B 1 Reply Last reply Reply Quote 0
              • B
                Bagpuss @Soloam
                last edited by Bagpuss

                @Soloam said in Automated scripts for Private Internet Access port forwarding:

                Hello all, I had made some adjustments to the script, I changed it to update a Alias and not the rule, I need the port to other rules. I was able to get the port and update the alias. I use transmission, so i updated the port in transmission, also working. The problem is that the port still shows as closed in transmission even with the NAT rule (the same rule that was working in the previews version of the API). I tried to add "/etc/rc.filter_configure" but with no success.

                Also the devd rule is not working, I made the setup to ovpnc1 (my interface) ad still not working.

                Any help?

                Thank you

                Hi Soloam,

                We really need some more detail on what changes you've made.

                As a starting point, please could you attach:

                1. Screenshot of Firewall -> NAT -> Port Forward
                2. Screenshot of Firewall -> Rules -> whatever interface your port forward is configured on (e.g. mine is on my first VPN interface).
                3. More details of how you're using aliases to affect the port forward.
                4. Details on what you're doing that means you have other rules using the port.
                5. The modified script with your changes.

                If Transmission is still saying that the port is closed, then it likely is. You could try using yougetsignal.com to test if it's open. Remember, your outgoing traffic to yougetsignal.com must be coming from the same interface that the port forward is configured on, or you must put the external IP for the appropriate interface into the 'Remote Address' field.

                Andy.

                1 Reply Last reply Reply Quote 0
                • SoloamS
                  Soloam
                  last edited by

                  @Bagpuss thank you, problem is solved! It was a typo error. Sorry

                  Thank You
                  Best Regards

                  H F 2 Replies Last reply Reply Quote 0
                  • H
                    HolyK @Soloam
                    last edited by

                    @Soloam Hi! Could you please share your updated version of the script? Thank you in advance !

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

                      Hi! Thanks for this very useful script. I'm having a problem where the config automatically reverts after a minute or so:

                      Using version 1.06 on 2.4.4-RELEASE-p3 and the devd script. Everything works fine, the port change is pulled from PIA, applied to the config, and placed in pia_port.txt. However, after a minute the config reverts to what is was prior to the script running. If I watch the webGUI Firewall/Aliases/Ports after restarting the openvpn instance, I can see the alias for my port is successfully changed to the new value, but after about a minute it goes back to what it was before running the script. Therefore, only the pia_port.txt has the new value for the port, and the config.xml still has the old one. Is this due to some config file lock or something that prevents scripts from replacing config.xml? I can't find a way around it. No matter what changes this script makes to the config, after running cp /tmp/config.pia $CONFFILE and then rm /tmp/config.cache, the changes only persist for the next 1 minute. Any ideas?

                      1 Reply Last reply Reply Quote 0
                      • F
                        fm808 @Soloam
                        last edited by

                        @Soloam do you mind sharing your script please?

                        H SoloamS 2 Replies Last reply Reply Quote 0
                        • H
                          HolyK @fm808
                          last edited by

                          @fm808 Hey, check the thread bellow. It is a re-written and updated one. Be sure you read the first three port replies as there is a missing piece in the OP.

                          https://forum.netgate.com/topic/150156/pia-automatic-port-forward-update-for-transmission-daemon

                          F 1 Reply Last reply Reply Quote 0
                          • F
                            fm808 @HolyK
                            last edited by

                            @HolyK it didnt work following that guide, i keep getting

                            [PIA] Port forwarding is already activated on this connection, has expired, or you are not connected to a PIA region that supports port forwarding.

                            H 1 Reply Last reply Reply Quote 0
                            • H
                              HolyK @fm808
                              last edited by

                              @fm808 Are you on most-recent version of pfSense ? (currently 2.4.5-RELEASE-p1). I had similar issue on 2.4.4 last month but after update to 2.4.5 issues disappeared. Check the version, update if possible and post in the other thread (as here it is a quite obsolete).

                              F 1 Reply Last reply Reply Quote 0
                              • F
                                fm808 @HolyK
                                last edited by

                                @HolyK i am on latest version

                                1 Reply Last reply Reply Quote 0
                                • SoloamS
                                  Soloam @fm808
                                  last edited by

                                  @fm808 I'll post back when I'm back home

                                  1 Reply Last reply Reply Quote 0
                                  • F
                                    fm808
                                    last edited by

                                    @HolyK i got it to work, just used a different server and made some modification to the script to suit my use case, had to change the ssh user, i am not using 'transmission' but something else (that was part 1 of the issue) then i just had to find a current gen server that worked with the API...DE Frankfurt is what worked for me, tried Switzerland and other locations but it didn't work.

                                    H 1 Reply Last reply Reply Quote 0
                                    • H
                                      HolyK @fm808
                                      last edited by

                                      @fm808 Cool ! Glad you figured it out :]

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