I'm deploying a script that runs on various clients behind firewalls that I don't control. The script attempts an SSH client login to a remote server that I do control (the script comes pre-loaded with a private key for authentication). Some of the firewalls at some datacenters redirect ALL OUTBOUND port 22 requests to a different server (sysadmins at the various facilities seem to have done this for their own purposes).
In these cases the script fails (because the ssh client login fails). The script has a diagnostic facility which tests user's connections. In order to be able to determine if my remote server is reachable from their workstation on port 22, I want to run the command
telnet my-remote-host 22
From my script, and test the response. My target server responds:
My local development server responds:
NOTE: These are the telnet responses on port 22, not the OpenSSH banner text for my server (which would be unreachable in such situations)
How do I control this text? -- So I can insert a token that would identify my own server as the one being pinged in this situation. The datacenter servers accepting the port 22 requests may possibly have the exact same version of OpenSSH running on them as my own remote server.
(Currently my diagnostics is just reporting failed login, but there are other reasons this can happen - I'm looking for a more fine-grained diagnostic that can test to see if my server is really reachable on port 22 before I attempt a real login)