pia-foss / manual-connections

Scripts for manual connections to Private Internet Access
MIT License
646 stars 168 forks source link

Add WG_INTERFACE environment variable that defaults to "pia" #147

Open lucasrangit opened 2 years ago

lucasrangit commented 2 years ago

Allows overriding the default Wireguard interface "pia" .

Useful when you want to match the Wireguard default /etc/wireguard/wg0.conf (see https://www.wireguard.com/quickstart/).

For example, here is a 3rd party project where they added a similar feature.

https://github.com/triffid/pia-wg/blob/147ef7be1c7e1df6f020d4049535163353d392ee/pia-config.sh#L59

Tested on Ubuntu Server 20.04 and https://github.com/linuxserver/docker-wireguard Docker container.

lucasrangit commented 2 years ago

I didn't see other WG_ variables documented in the README.md. However, if required I will add this and others.

g00nix commented 2 years ago

Can you please add quotes based on shellcheck recommendations?

148: > "/etc/wireguard/${WG_INTERFACE}.conf" || exit 1
157: wg-quick up "$WG_INTERFACE"

I noticed these when reading through the commit. I didn't have time to modify/test myself.

lucasrangit commented 2 years ago

Can you please add quotes based on shellcheck recommendations?

148: > "/etc/wireguard/${WG_INTERFACE}.conf" || exit 1
157: wg-quick up "$WG_INTERFACE"

I noticed these when reading through the commit. I didn't have time to modify/test myself.

Thanks @g00nix for the feedback. I fixed my changes and rebased the PR with the latest master.