Browse Source

run hooks when VPN is connected / disconnected

HgO 1 year ago
parent
commit
52065437e0
2 changed files with 9 additions and 0 deletions
  1. 4 0
      conf/openvpn_client.conf.tpl
  2. 5 0
      scripts/_common.sh

+ 4 - 0
conf/openvpn_client.conf.tpl

@@ -40,3 +40,7 @@ log-append /var/log/openvpn-client.log
 # Routing
 route-ipv6 2000::/3
 redirect-gateway def1 bypass-dhcp
+
+script-security 2
+route-up "/usr/bin/run-parts /etc/openvpn/scripts/route-up.d"
+route-down "/usr/bin/run-parts /etc/openvpn/scripts/route-down.d"

+ 5 - 0
scripts/_common.sh

@@ -35,6 +35,11 @@ function vpnclient_deploy_files_and_services()
   mkdir -pm 0770 /etc/openvpn/keys/
   chown root:${app} /etc/openvpn/keys/
 
+  # Create scripts directory
+  mkdir -pm 0775 /etc/openvpn/scripts
+  mkdir -pm 0775 /etc/openvpn/scripts/route-up.d
+  mkdir -pm 0775 /etc/openvpn/scripts/route-down.d
+
   #=================================================
 
   # Copy init script