mirror of
				https://github.com/kevinveenbirkenbach/client-playbook.git
				synced 2025-11-04 08:47:55 +00:00 
			
		
		
		
	Implemented wireguard for client
This commit is contained in:
		
							
								
								
									
										22
									
								
								roles/application-wireguard/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								roles/application-wireguard/README.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
			
		||||
# Role Native Wireguard
 | 
			
		||||
Manages wireguard on a 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)"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## See
 | 
			
		||||
- https://golb.hplar.ch/2019/01/expose-server-vpn.html
 | 
			
		||||
- https://wiki.archlinux.org/index.php/WireGuard
 | 
			
		||||
- https://wireguard.how/server/raspbian/
 | 
			
		||||
- https://www.scaleuptech.com/de/blog/was-ist-und-wie-funktioniert-subnetting/
 | 
			
		||||
- https://bodhilinux.boards.net/thread/450/wireguard-rtnetlink-answers-permission-denied
 | 
			
		||||
- https://stackoverflow.com/questions/69140072/unable-to-ssh-into-wireguard-ip-until-i-ping-another-server-from-inside-the-serv
 | 
			
		||||
- https://unix.stackexchange.com/questions/717172/why-is-ufw-blocking-acces-to-ssh-via-wireguard
 | 
			
		||||
- https://forum.openwrt.org/t/cannot-ssh-to-clients-on-lan-when-accessing-router-via-wireguard-client/132709/3
 | 
			
		||||
- https://serverfault.com/questions/1086297/wireguard-connection-dies-on-ubuntu-peer
 | 
			
		||||
							
								
								
									
										6
									
								
								roles/application-wireguard/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								roles/application-wireguard/handlers/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
- name: "restart wireguard"
 | 
			
		||||
  systemd:
 | 
			
		||||
    name: wg-quick@wg0.service
 | 
			
		||||
    state: restarted
 | 
			
		||||
    enabled: yes
 | 
			
		||||
    daemon_reload: yes
 | 
			
		||||
							
								
								
									
										18
									
								
								roles/application-wireguard/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								roles/application-wireguard/tasks/main.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
- name: install wireguard
 | 
			
		||||
  pacman: 
 | 
			
		||||
    name: wireguard-tools
 | 
			
		||||
    state: present
 | 
			
		||||
 | 
			
		||||
- name: enable ipv4-forwarding
 | 
			
		||||
  shell: sysctl net.ipv4.ip_forward=1
 | 
			
		||||
 | 
			
		||||
- name: enable ipv6-forwarding
 | 
			
		||||
  shell: sysctl net.ipv6.conf.all.forwarding=1
 | 
			
		||||
 | 
			
		||||
- name: create /etc/wireguard/wg0.conf
 | 
			
		||||
  copy:
 | 
			
		||||
    src: "{{ inventory_dir }}/files/{{ inventory_hostname }}/etc/wireguard/wg0.conf"
 | 
			
		||||
    dest: /etc/wireguard/wg0.conf
 | 
			
		||||
    owner: root
 | 
			
		||||
    group: root
 | 
			
		||||
  notify: restart wireguard
 | 
			
		||||
		Reference in New Issue
	
	Block a user