add systemd services
This commit is contained in:
12
systemd/vpnclient-wg-restart.service
Normal file
12
systemd/vpnclient-wg-restart.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Wireguard Restart
|
||||
After=network-online.target vpnclient-mount.service
|
||||
Requires=network-online.target
|
||||
Requisite=vpnclient-mount.service
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
Type=oneshot
|
||||
ExecStart=/snacks/wireguard/scripts/rotate.py
|
||||
NetworkNamespacePath=/run/vpn/net
|
12
systemd/vpnclient-wg-restart.timer
Normal file
12
systemd/vpnclient-wg-restart.timer
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Reconnect to WireGuard if down
|
||||
|
||||
[Timer]
|
||||
OnBootSec=5m
|
||||
OnUnitActiveSec=1m
|
||||
Persistent=False
|
||||
Unit=vpnclient-wg-restart.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
|
17
systemd/vpnclient-wg.service
Normal file
17
systemd/vpnclient-wg.service
Normal file
@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Wireguard
|
||||
After=network-online.target vpnclient-mount.service
|
||||
Requires=network-online.target
|
||||
Requisite=vpnclient-mount.service
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Group=root
|
||||
Type=oneshot
|
||||
EnvironmentFile=/snacks/wireguard/env
|
||||
ExecStart=/snacks/wireguard/scripts/connect.py
|
||||
NetworkNamespacePath=/run/vpn/net
|
||||
RemainAfterExit=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
16
systemd/wireguard-mount.service
Normal file
16
systemd/wireguard-mount.service
Normal file
@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Wireguard namespace mountpoint
|
||||
Requires=network.target
|
||||
After=network.target
|
||||
RefuseManualStop=true
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
NotifyAccess=main
|
||||
RuntimeDirectory=vpn
|
||||
RuntimeDirectoryMode=0755
|
||||
ExecStart=/snacks/wireguard/bin/wireguard-mount
|
||||
PrivateNetwork=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user