My login server is behind a firewall that uses port knocking to allow entry. The login-flow is
- Enter in port knocking command. This requires my external IP to be entered.
- When prompted, enter in my port-knocking password.
- Enter in ssh command
- Enter in password
I may get permission to use ssh keys, but I am trying to write a script that will allow me to cut down on my login times, since I have to go through this flow for each shell I want to bring up.
#!/bin/expect spawn fwknop -A tcp/22 -a `curl http://ipecho.net/plain` -D foo.org -P tcp -p 9999 expect "Enter encryption password:" send "pass1\r" spawn ssh -Y email@example.com expect "firstname.lastname@example.org's password:" send "pass2\r"
Running each command works fine from the command line. But when I try to run the first spawn command
spawn fwknop -A tcp/22 -a `curl http://ipecho.net/plain` -D foo.org -P tcp -p 9999
I get error:
fwknop: fko_set_spa_message: Error 10 - Invalid allow IP address in the SPA message data send: spawn id exp7 not open
But copy/paste the same command to the command line works perfectly fine.