Script called from ~/.ssh/config loses TTY

Viewed 52

I'm using a site-specific authentication script that issues a 24-hour certificate for password-less login. What I'm trying to do is rig my ~/.ssh/config so ssh triggers the script if the certificate has expired:

Match originalhost remotehost.site exec "test $(file.age ~/.ssh/certificate) -ge 86400" exec ~/bin/authentication_script

This almost works -- it tests the age of the latest certificate file ok, and invokes the authentication_script if it's out-of-date. The problem is that this script is using TTY read operations to take the password input, and giving these errors:

stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
authentication_script: The sshproxy server said: Authentication failed. Failed login: myname: 
authentication_script: This usually means you did not enter the correct password or OTP: 
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
authentication_script: The sshproxy server said: Authentication failed. Failed login: myname: 
authentication_script: This usually means you did not enter the correct password or OTP: 
stty: 'standard input': Inappropriate ioctl for device

This doesn't happen when I run the script on the command-line from a regular login session. Is there some mode that I can flip to get it to work?

1 Answers
Related