The method to organize all the tasks in my professional and personal life.
Category: Uncategorized
-
Playing with /etc/hosts by Ansible
dnsmasq is a better solution for this purpose, but the goal is to play with Ansible.
It’s the continuation of the post: My own VPN on a VPS
The main goal is to play with Ansible. The second goal is to be able to connect to the hosts by their names rather then by their IPs. For this purpose, I will update /etc/hosts file on each host automatically by Ansible.
Preparing the host files on the Ansible server
In first place, I edit the hosts file on Ansible:
[root@vps-dc91297d ~]# tail -n3 /etc/hosts 10.8.0.1 vps 10.8.0.2 komputer01 10.8.0.3 piNow, I will be able to use the hosts name in the Ansible configuration file.
Ansible installation
-
My own VPN on a VPS
Why?
As described in the Privacy Project, I use my own Domain Name Server. It works great in the local network, but I am not able to access it from outside.
That’s why I need my own VPN server.
Other possible solutions
Port Forwarding on my home router – impossible, because I don’t have access to the admin’s configuration. Besides, I don’t have static IP. There are solutions like Dynamic DNS, but they are not reliable on the long run,
Tailscale (or other similar commercial solution) – it would work, but it’s not so much fun.
The VPN server configuration
The configuration is simple:
[root@vps-dc91297d fedora]# cat /etc/wireguard/wg0.conf [Interface] Address = 10.8.0.1/24 ListenPort = 51820 PrivateKey = (redacted) PostUp = firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i wg0 -j ACCEPT PostDown = firewall-cmd --direct --remove-rule ipv4 filter FORWARD 0 -i wg0 -j ACCEPT # Example peer (add one per client) [Peer] PublicKey = (redacted) AllowedIPs = 10.8.0.2/32 [Peer] PublicKey = (redacted) AllowedIPs = 10.8.0.3/32The VPN Clients’ configuration
root@komputer01:/etc/wireguard# cat wg0.conf [Interface] PrivateKey = (redacted) Address = 10.8.0.3/24 [Peer] PublicKey = (redacted) Endpoint = vpn.tomasz-avila.pl:51820 AllowedIPs = 10.8.0.0/24 # route all VPN traffic through the server PersistentKeepalive = 25The results
[root@vps-dc91297d fedora]# wg show interface: wg0 public key: (redacted) private key: (hidden) listening port: 51820 peer: c2dz9nLrd7bYfyTFj7fMQHBMkHaIz7GFoH1bRK+ermY= endpoint: 46.205.194.178:60080 allowed ips: 10.8.0.3/32 latest handshake: 15 seconds ago transfer: 10.89 MiB received, 3.80 MiB sent peer: XoOt5kWRfvUSFf8I+SGUHcDcC9TeNloifDspq9uw0BI= endpoint: 185.246.208.88:39392 allowed ips: 10.8.0.2/32 latest handshake: 1 minute, 5 seconds ago transfer: 4.07 MiB received, 11.15 MiB sentNow, I am able to connect to all my devices from all around the world.
-
Privacy Project
Why does it matters?
Why does it matters paragraph
Web Browser: Librewolf
Paragraph
Custom DNS on Raspberry PI
Paragraph
Private notes: Joplin
Paragraph
Private files: Cryptomator
Paragraph
Accessing DNS from outside LAN
I will describe it in the following article: