Skip to content

Instantly share code, notes, and snippets.

@rohanrajpal
Last active April 29, 2020 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohanrajpal/b443e20658cdf3e762a4e9df1a6e31bb to your computer and use it in GitHub Desktop.
Save rohanrajpal/b443e20658cdf3e762a4e9df1a6e31bb to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Whitelist here all domains that need to go through openfortivpn
# Domains and IPs are separated by a space
#
ips='192.168.2.217 192.168.29.151'
domains='example.com example.fr'
let resolved
for domain in $domains; do
resolved=`dig +short $domain | tail -n1`
ips="$ips $resolved"
done
for ip in $ips; do
route add $ip dev ppp0
done
[Unit]
Description = OpenFortiVPN
After=network-online.target
Documentation=man:openfortivpn(1)
[Service]
Type=idle
ExecStart = /usr/bin/openfortivpn -c <path to your config file>
StandardOutput=file:<any-place-where you want to save your logs>
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
host = vpn.iiitd.edu.in
port = 10443
username = <your username>
password = <your pass>
set-routes = 0
set-dns = 0
pppd-use-peerdns = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment