-
-
Save habedi/62bf68cbd960c637c300 to your computer and use it in GitHub Desktop.
Make OpenVPN run automatically as a service on Ubuntu. This includes an Upstart job and an expect script to automate OpenVPN private key password entry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# openvpn | |
# | |
description "OpenVPN - virtual private network daemon(s)" | |
author "Jay" | |
version "1.0.0" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
#exec /usr/sbin/openvpn --status /var/run/openvpn.client.status 10 --cd /etc/openvpn --config /etc/openvpn/client.conf --syslog openvpn | |
exec /etc/openvpn/autovpn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/expect -f | |
set force_conservative 0 | |
if {$force_conservative} { | |
set send_slow {1 .1} | |
proc send {ignore arg} { | |
sleep .1 | |
exp_send -s -- $arg | |
} | |
} | |
set timeout -1 | |
spawn /usr/sbin/openvpn --config /etc/openvpn/klout.conf | |
match_max 100000 | |
expect -exact "Enter Private Key Password:" | |
send -- "PASSWORD_GOES_HERE\r" | |
expect eof |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment