How to pass username and password to OpenVPN client

I created small script that passes username/password to openvpn using named pipe.

USER=my_user
sudo killall openvpn 2>/dev/null
PIN=$(zenity --entry --title="OpenVPN" --text="Enter your password:" --hide-text)
[ $? -ne 0 ] && echo PIN was not entered, exiting && exit 1
FIFO=/tmp/ovpn.fifo
[ -p $FIFO ] || mkfifo -m 600 $FIFO
echo Connecting to VPN network
sudo nohup openvpn --config /etc/openvpn/my_config.conf --auth-user-pass $FIFO >/dev/null 2>&1 &
echo -ne "$USER\n$PIN\n" > $FIFO
echo Connected

Although it should be safe to use it, I recommend to use it only with OTP tokens.
02 August 2011 | bash | vpn | script | openvpn
twitter.com linkedin.com
google.com/+ facebook.com
flickr.com youtube.com