diff options
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | wireguard-install.sh | 15 |
2 files changed, 14 insertions, 7 deletions
@@ -1,6 +1,6 @@ # WireGuard installer -Easily set up a dual-stack WireGuard VPN on a Linux server. See the issues for the WIP. +Easily set up a dual-stack [WireGuard](https://www.wireguard.com/) VPN on a Linux server. See the issues for the WIP. ## Requirements @@ -26,3 +26,7 @@ Then run it : ```sh ./wireguard-install.sh ``` + +It will install wireguard on the server, configure, create a systemd service and a client configuration file. Mutliple clients are not yet supported. + +Contributions are welcome! diff --git a/wireguard-install.sh b/wireguard-install.sh index 8b92f3f..7c0ea87 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -84,21 +84,24 @@ fi if [[ "$OS" = 'ubuntu' ]]; then add-apt-repository ppa:wireguard/wireguard apt-get update - apt-get install wireguard + apt-get install "linux-headers-$(uname -r)" + apt-get install wireguard iptables elif [[ "$OS" = 'debian' ]]; then echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable apt update - apt install wireguard + apt-get install "linux-headers-$(uname -r)" + apt install wireguard iptables elif [[ "$OS" = 'fedora' ]]; then dnf copr enable jdoss/wireguard - dnf install wireguard-dkms wireguard-tools + dnf install wireguard-dkms wireguard-tools iptables elif [[ "$OS" = 'centos' ]]; then curl -Lo /etc/yum.repos.d/wireguard.repo https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo yum install epel-release - yum install wireguard-dkms wireguard-tools + yum install wireguard-dkms wireguard-tools iptables elif [[ "$OS" = 'arch' ]]; then - pacman -S wireguard-tools + pacman -S linux-headers + pacman -S wireguard-tools iptables fi # Make sure the directory exists (this does not seem the be the case on fedora) @@ -139,7 +142,7 @@ AllowedIPs = 0.0.0.0/0,::/0" >> "$HOME/$SERVER_WG_NIC-client.conf" # Add pre shared symmetric key to respective files case "$IS_PRE_SYMM" in - [yY][eE][sS]|[yY]) + [yY][eE][sS]|[yY]) CLIENT_SYMM_PRE_KEY=$( wg genpsk ) echo "PresharedKey = $CLIENT_SYMM_PRE_KEY" >> "/etc/wireguard/$SERVER_WG_NIC.conf" echo "PresharedKey = $CLIENT_SYMM_PRE_KEY" >> "$HOME/$SERVER_WG_NIC-client.conf" |