I added this in my ~/.ssh/config
to help avoid stupid mistakes:
Host *.prod-domain.com
LocalCommand print "WARNING: PROD" && print "continue ?" && read
PermitLocalCommand yes
Which makes ssh
print a warning and a prompt when I try to connect to a host under prod-domain.com
.
Now, most hosts do not expose ssh publically, so we have to go through a gateway. I used to do
ssh -J gateway.prod-domain.com target.prod-domain.com
But with the local command enabled, ssh fails with:
Bad packet length 1231976033.
ssh_dispatch_run_fatal: Connection to UNKNOWN port 65535: message authentication code incorrect
Connecting directly (e.g. ssh gateway.prod-domain.com
) still works fine, and connecting with a jump works if I comment the local command.
Are local commands and ssh jumps incompatible ? Is it documented somewhere, and is there a way to make it work (like disabling the local command when "jumping"), or did I maybe hit a bug ?
PROD
where you'd normally see a low-intensity green or graytesting
orworkstation
or something along the lines of that could certainly call your attention to it, even if you've been logged in for a while and/or are working in different environments simultaneously for some reason.