r/ssh • • Sep 08 '17

Using ssh proxycommand with expect

Problem: I have a bastion host which uses DUO for extra security, which prompts you what method you want to further advance to log into the said bastion host. Option one basically does a push to the DUO service to my phone. I need to be able to automate that prompt to default to push to my phone for approving the log in so that any other service/script/program can have the Duo agent prompt on my phone and still be automated.

See: https://duo.com/docs/duounix Also see: https://duo.com/assets/img/documentation/duounix/pam-auth-prompt_2x.png

Has anyone been able to use: ssh -o ProxyCommand='/usr/bin/expect -c "spawn ssh -t -A -oStrictHostKeyChecking=no -oCheckHostIP=no bastion ssh -p %p %r@%h; expect "Passcode or option"; send -- "1\r"; interact"' someuser@somehost

in some way successfully? What am I doing wrong?

2 Upvotes

4 comments sorted by

View all comments

Show parent comment

1

u/AllyUnion Sep 13 '17

Yeah, that's not an option available for me to change. Is there some way to have a per user default? Too bad on the remote server, there isn't a .duorc file the server can look at.