{"id":18119733,"url":"https://github.com/mostlygeek/pia-wg","last_synced_at":"2025-04-06T11:18:27.859Z","repository":{"id":66828442,"uuid":"336890444","full_name":"mostlygeek/pia-wg","owner":"mostlygeek","description":"FreeBSD, Private Internet Access (PIA), Wireguard - easy setup","archived":false,"fork":false,"pushed_at":"2021-02-08T00:51:37.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-12T16:51:49.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mostlygeek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-07T21:10:19.000Z","updated_at":"2022-11-09T18:11:08.000Z","dependencies_parsed_at":"2023-05-10T17:30:20.406Z","dependency_job_id":null,"html_url":"https://github.com/mostlygeek/pia-wg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2Fpia-wg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2Fpia-wg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2Fpia-wg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mostlygeek%2Fpia-wg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mostlygeek","download_url":"https://codeload.github.com/mostlygeek/pia-wg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471521,"owners_count":20944158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-01T05:16:52.299Z","updated_at":"2025-04-06T11:18:27.825Z","avatar_url":"https://github.com/mostlygeek.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Manual PIA VPN Connections for FreeNAS Jails\n\nSetting up manual VPN connections to Private Internet Access can be a little confusing.  This repo contains a single script to setup a Wireguard connection to PIA quickly.  \n\n## Usage\n```\nUsage:\n  ./pia-wg.sh setup    - Create configuration files\n  ./pia-wg.sh token    - Fetch an auth token with user/password\n  ./pia-wg.sh pf_set   - setup port forwarding\n  ./pia-wg.sh pf_clean - clean up portforwarding data\n  ./pia-wg.sh pf_port  - last known port forwarding port\n```\n\n## Quickstart\n\n1. Download `pia-wg.sh` into your jail\n2. Run `pia-wg.sh setup`.  Automatically find the fastest region, exchange wireguard keys and create a wireguard configuration.\n3. Copy `pia.conf` to `/usr/local/etc/wireguard`\n4. Start your VPN connection\n5. Done!\n\nIt looks like this:\n\n```\n# check your current IP\n\u003e curl icanhazip.com\n\n# fetch the script into your FreeNAS jail\n\u003e curl -LO https://raw.githubusercontent.com/mostlygeek/pia-wg/main/pia-wg.sh\n\u003e chmod +x pia-wg.sh\n\n# Setup and create configuration files\n\u003e ./pia-wg.sh setup\nPlease enter basic information\n  PIA Username: pXXXXXXX\n  PIA Password:\n  Use portfowarding? [true]: true\nGetting the server list... OK!\nCA Toronto: 0.006924s\nPanama (geo): 0.043789s\n\n#\n# two files will be created.  .settings.env, pia.conf\n\n\u003e cp pia.conf /usr/local/etc/wireguard/pia.conf\n\u003e wg-quick up pia\n\u003e curl icanhazip.com\n```\n\n## Using Port forwarding\n\n__When running `pia-wg.sh setup` make sure use `true` when asked about port-forwarding.__\n\nPIA port forwarding generally works like this.\n\n1. Through an established VPN connection ...\n2. Call the REST API on the wireguard server to request a port forward\n3. Keep port forwarding active with a keep alive request at least every 15 minutes\n\nThere are three commands to make this easier:\n\n1. `pia-wg.sh pf_set`\n2. `pia-wg.sh pf_clean`\n3. `pia-wg.sh pf_port`\n\nUsage example:\n\n```\n# initial run creates a new .portforward.env\n\u003e ./pia-wg.sh pf_set\nFile: .portforward.env not found.  Creating a new one.\n  - Fetching token from metaserver host ... Success!\n  - Fetching payload/signature values from 10.44.128.1 ... Success!\n  - Wrote new .portforward.env\n  - Binding/Refreshing binding on port:49658 ... Success!\n\n\n# ./pia-wg.sh pf_set again uses the cached values\n# to keep the port forward alive.  This can be automated via a cronjob.\n\n\u003e ./pia-wg.sh pf_set\nLoading cached settings from .portforward.env\n  - Binding/Refreshing binding on port:49658 ... Success!\n\n# the last known port can be printed with:\n\u003e ./pia-wg.sh pf_port\n49658\n\n# it can be used like this ...\n\u003e update-something.sh $(./pia-wg.sh pf_port)\n```\n\n### Port Forwarding Expiry\n\nThe port forwarding allocation expires every two months.  This means every few months the configuration needs to be redone.  This can be done like this:\n\n```\n# clean up the old settings\n\u003e ./pia-wg.sh pf_clean\n\n# set up port forwarding again\n\u003e ./pia_wg.sh pf_set\n```\n\nThis can be automated with a cronjob that runs `./pia-wg.sh pf_clean` every few weeks.  On the next run of `./pia-wg.sh pf_set` it will automatically create a new configuration file and set the port.\n\n## Original Repo\n\nSome of the code in this repo was adapted from PIA's official repo,  [pia-foss/manual-connections](https://github.com/pia-foss/manual-connections).  That code is less FreeBSD specific and organized differently.  I wanted a single script file that was easy to fetch and could run without any tweaks.\n\n## License\nThis project is licensed under the [MIT (Expat) license](https://choosealicense.com/licenses/mit/), which can be found [here](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostlygeek%2Fpia-wg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmostlygeek%2Fpia-wg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmostlygeek%2Fpia-wg/lists"}