til/Applications/Network/OpenVPN.md

39 lines
953 B
Markdown
Raw Normal View History

2020-04-30 16:32:50 +00:00
# OpenVPN
2020-03-13 08:06:32 +00:00
2020-06-08 17:18:10 +00:00
| Distribution | Package |
| ------------ | --------- |
| Arch Linux | `openvpn` |
| Ubuntu | `openvpn` |
2020-03-13 08:06:32 +00:00
Read [update-systemd-resolved](https://github.com/jonathanio/update-systemd-resolved).
2020-05-20 09:50:13 +00:00
| Distribution | Package |
| ------------ | --------------------------------------- |
2020-05-24 10:44:40 +00:00
| Arch Linux | `openvpn-update-systemd-resolved` (AUR) |
2020-05-20 09:50:13 +00:00
| Ubuntu | `openvpn-systemd-resolved` |
2020-03-13 08:19:30 +00:00
2020-05-20 09:50:13 +00:00
Start and enable service:
2020-03-13 08:06:32 +00:00
```sh
2020-05-20 09:50:13 +00:00
systemctl enable --now systemd-resolved.service
2020-03-13 08:06:32 +00:00
```
2020-03-13 08:19:30 +00:00
Edit `client.ovpn`:
2020-03-13 08:06:32 +00:00
```txt
2020-05-20 09:54:26 +00:00
script-security 2
setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2020-03-13 08:06:32 +00:00
up /etc/openvpn/scripts/update-systemd-resolved
up-restart
down /etc/openvpn/scripts/update-systemd-resolved
down-pre
```
2020-03-13 08:19:30 +00:00
2020-05-20 09:50:13 +00:00
Connect with factor authentication and start as a dameon:
2020-03-13 08:19:30 +00:00
```sh
2020-05-20 09:50:13 +00:00
sudo openvpn --config /path/to/client.ovpn \
--auth-user-pass --auth-retry interact \
--daemon
2020-03-13 08:19:30 +00:00
```