Pass private key password to openvpn command directly in Ubuntu 10.10 [closed]
In my openvpn.conf
:
...askpass /etc/openvpn/jdoe.pass <<< new line hereca /etc/openvpn/jdoe_ca.crtcert /etc/openvpn/jdoe.crtkey /etc/openvpn/jdoe.key...
The file /etc/openvpn/jdoe.pass
just contains the password.You can chmod
this file to 600
.This method save my life... ;-)
Ubuntu 12.04.4 LTSOpenVPN 2.2.1 x86_64-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] [eurephia] [MH] [PF_INET6] [IPv6 payload 20110424-2 (2.2RC2)] built on Mar 13 2014
How about storing it into a file and using --askpass /your/file
? --askpass
option was added in OpenVPN version 2.0-beta20, Maverick has version 2.1.0-3ubuntu1.
Try a shell script such as:
#!/usr/bin/expect -fspawn openvpn client.warriors.conf.openmatch_max 100000expect "*?assword:*"send -- "mypassword"send -- "\r"expect eof
You'll need to chmod +x this, you can also set it as an environment variable so you don't have to type out the directory.
Looks like they got this script to work: https://unix.stackexchange.com/questions/9055/establish-openvpn-tunnel-in-bash-script