Skip to content

Instantly share code, notes, and snippets.

@nqxcode
Last active July 1, 2024 14:41
Show Gist options
  • Save nqxcode/e71039b69c90dd13eb2cb088728ad297 to your computer and use it in GitHub Desktop.
Save nqxcode/e71039b69c90dd13eb2cb088728ad297 to your computer and use it in GitHub Desktop.
Openvpn3 autoload
  1. Create openvpn3 autoload config file
mkdir -p $HOME/.openvpn3/autoload/

touch $HOME/.openvpn3/autoload/x5.autoload

vim $HOME/.openvpn3/autoload/x5.autoload
{
  "autostart": true
}

  1. Copy .ovpn file to autoload config directory with same name like .autoload file
cp /home/andrey/Загрузки/apokoev.retn.ovpn $HOME/.openvpn3/autoload/x5.ovpn

chmod 600 $HOME/.openvpn3/autoload/x5.ovpn && chmod 600 $HOME/.openvpn3/autoload/x5.autoload
  1. Create systemd sevice to autostart of openvpn3 session
sudo vim /usr/lib/systemd/system/openvpn3-autoload.service
[Unit]
Description=OpenVPN 3 Linux configuration auto loader and starter
After=network.target dbus.service

[Service]
Type=oneshot
User=andrey
ExecStart=/usr/sbin/openvpn3-autoload --directory /home/andrey/.openvpn3/autoload
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
  1. Run commands
systemctl daemon-reload
systemctl enable openvpn3-autoload.service
systemctl start openvpn3-autoload.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment