Last active
November 19, 2020 17:34
-
-
Save mootinator/1d2870d2ba55d7173ea3ad9d3ca827ef to your computer and use it in GitHub Desktop.
Use sexpect to initiate OpenVPN connection which uses DUO mobile from router.
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
#!/bin/sh | |
if ! which sexpect >& /dev/null; then | |
echo "sexpect not found in your \$PATH" | |
exit 1 | |
fi | |
export SEXPECT_SOCKFILE=/tmp/sexpect-openvpn-aa0.sock | |
sexpect spawn openvpn --config /root/client.ovpn | |
sexpect expect -re 'Enter Auth Password:' | |
sexpect send -enter `cat /root/password2.txt` | |
sexpect expect -re '^.*CRV1:R,E:([A-Za-z0-9+/=]+).*$' | |
out=`sexpect expect_out -index 1` | |
sexpect expect -re 'Enter Auth Password:' | |
sexpect send -enter CRV1::$out::push | |
sexpect interact |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sexpect binary tests successfully on OpenWRT on a TP-LINK Archer C7.