saving
This commit is contained in:
4
.env.example
Normal file
4
.env.example
Normal file
@@ -0,0 +1,4 @@
|
||||
PEM_PASS=pass..
|
||||
VPN_USER=zsolt.alfoldi@nokia.com
|
||||
VPN_USER_PASS=saaapp...
|
||||
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.env
|
||||
43
run.exp
Executable file
43
run.exp
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/expect -f
|
||||
#
|
||||
# Usage:
|
||||
# vpn-auto.exp <connection-name> <vpn-user> <vpn-pass> <otp-secret>
|
||||
#
|
||||
# Example:
|
||||
# ./vpn-auto.exp PEM_PASS VPN_USER VPN_PASS MS_AUTH_OTP
|
||||
# ./vpn-auto.exp pass1234 zsolt.alfoldi@nokia.com 1234pass 987456
|
||||
|
||||
# never timeout
|
||||
set timeout -1
|
||||
|
||||
# pull args off the command line
|
||||
if { $argc != 4 } {
|
||||
puts stderr "Usage: $argv0 <vpn-name> <user> <pass> <otp-secret>"
|
||||
exit 1
|
||||
}
|
||||
lassign $argv vpn_pem_pass vpn_user vpn_pass otp
|
||||
|
||||
# start the connection
|
||||
spawn nmcli connection up Nokia --ask
|
||||
|
||||
# watch for the prompts and supply answers
|
||||
expect {
|
||||
-re "Enter PEM pass phrase" {
|
||||
send "$vpn_pem_pass\r"
|
||||
exp_continue
|
||||
}
|
||||
-re "Username:" {
|
||||
send "$vpn_user\r"
|
||||
exp_continue
|
||||
}
|
||||
-re "PASSCODE:" {
|
||||
send "$vpn_pass\r"
|
||||
exp_continue
|
||||
}
|
||||
-re "Response:" {
|
||||
send "$otp\r"
|
||||
exp_continue
|
||||
}
|
||||
eof
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user