mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 18:29:21 +00:00 
			
		
		
		
	Optimized wireguard for ubuntu
This commit is contained in:
		| @@ -1,4 +1,5 @@ | ||||
| - name: apt update all packages to their latest version | ||||
|   apt: | ||||
|     name: "*" | ||||
|     state: latest | ||||
|     update_cache: yes | ||||
|     upgrade: dist | ||||
|     force_apt_get: yes | ||||
|   | ||||
| @@ -1,4 +1,5 @@ | ||||
| # native-wireguard-behind-nat | ||||
|  | ||||
| # see  | ||||
| # see | ||||
| - https://gist.github.com/insdavm/b1034635ab23b8839bf957aa406b5e39 | ||||
| - https://wiki.debian.org/iptables | ||||
|   | ||||
| @@ -1,10 +1,23 @@ | ||||
| # Role Native Wireguard | ||||
| Manages wireguard natively on host. More information are available in the [Arch wiki](https://wiki.archlinux.org/index.php/WireGuard#Manual_WireGuard_setup). | ||||
| Manages wireguard on host. | ||||
|  | ||||
| ## Create Client Key | ||||
| ``bash | ||||
| wg genkey | tee peer_A.key | wg pubkey > peer_A.pub | ||||
| `` | ||||
| ## Client | ||||
| ### Create Client Keys | ||||
| ```bash | ||||
|   wg_private_key="$(wg genkey)" | ||||
|   wg_public_key="$(echo "$wg_private_key" | wg pubkey)" | ||||
|   echo "PrivateKey: $wg_private_key" | ||||
|   echo "PublicKey: $wg_public_key" | ||||
|   echo "PresharedKey: $(wg genpsk)" | ||||
| ``` | ||||
|  | ||||
| chown root:systemd-network /etc/systemd/network/99-*.netdev | ||||
| chmod 0640 /etc/systemd/network/99-*.netdev | ||||
| ### Activate Configuration | ||||
| ```bash | ||||
|   cp /path/to/wg0.conf /etc/wireguard/wg0.conf | ||||
|   systemctl enable wg-quick@wg0.service --now | ||||
| ``` | ||||
|  | ||||
| ## See | ||||
| - https://golb.hplar.ch/2019/01/expose-server-vpn.html | ||||
| - https://wiki.archlinux.org/index.php/WireGuard | ||||
| - https://wireguard.how/server/raspbian/ | ||||
|   | ||||
| @@ -1,5 +1,10 @@ | ||||
| - name: install wireguard | ||||
| - name: install wireguard for Arch | ||||
|   pacman: name=wireguard-tools state=present | ||||
|   when: ansible_os_family == "Arch" | ||||
|  | ||||
| - name: install wireguard for Ubuntu | ||||
|   apt: name=wireguard state=present | ||||
|   when: ansible_os_family == "Debian" | ||||
|  | ||||
| - name: create /etc/wireguard/wg0.conf | ||||
|   copy: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user