0

I have an environment where all SSH connections go through a jump-box. There are a bunch of linux servers, but to get to them I have to ssh to a bastien host then onwards.

One specific internal host keeps prompting for password

firewall ~ $ ssh m4
Password:

But connections to m4 from elswehere work with key auth fine.

/var/log/secure is unhelpful, with no errors.

 Jul 27 21:34:57 m4 sshd[29240]: pam_unix(sshd:session): session opened for user root by (uid=0)
 Jul 27 21:34:57 m4 sshd[29236]: Accepted keyboard-interactive/pam for root from firewall[192.168.9.248] port 4097 ssh2

 but from another host, pubkey works fine
 Jul 27 21:34:57 m4 sshd[29240]: Accepted publickey for root from m3[192.168.9.9] port 6090 ssh2

Why would SSH prompt for password for this one combination and not for others?

1

I ran ssh-add -L to confirm my key was loaded

 firewall ~ $ ssh-add -L
 ssh-rsa AAAAB3NzaC1yc2EAA.....snip.....VBQ== rsa-key-20170210
 etc...

Then I ran ssh -v m4 to see what SSH thought was going on... and I had a lightbulb moment.

 firewall ~ $ ssh m4 -v
 OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
 debug1: Reading configuration data /root/.ssh/config
 debug1: /root/.ssh/config line 11: Applying options for m4
 debug1: Reading configuration data /etc/ssh/ssh_config
 debug1: /etc/ssh/ssh_config line 56: Applying options for *
 debug1: Connecting to m4 [192.168.9.74] port 22.
 debug1: fd 3 clearing O_NONBLOCK
 debug1: Connection established.
 debug1: permanently_set_uid: 0/0
 debug1: identity file /root/.ssh/id_rsa type 1
 ...snip
 debug1: Enabling compatibility mode for protocol 2.0
 debug1: Local version string SSH-2.0-OpenSSH_6.6.1
 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
 debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
 debug1: SSH2_MSG_KEXINIT sent
 debug1: SSH2_MSG_KEXINIT received
 debug1: kex: server->client aes128-ctr hmac-sha1 none
 debug1: kex: client->server aes128-ctr hmac-sha1 none
 debug1: kex: diffie-hellman-group-exchange-sha256 need=20 dh_need=20
 debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<7680<8192) sent
 debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
 debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
 debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
 debug1: Server host key: RSA 23:87:00:00:00:00:00:00:N0:N0:N0
 debug1: Host 'm4' is known and matches the RSA host key.
 debug1: Found key in /root/.ssh/known_hosts:1869
 debug1: ssh_rsa_verify: signature correct
 debug1: SSH2_MSG_NEWKEYS sent
 debug1: expecting SSH2_MSG_NEWKEYS
 debug1: SSH2_MSG_NEWKEYS received
 debug1: SSH2_MSG_SERVICE_REQUEST sent
 debug1: SSH2_MSG_SERVICE_ACCEPT received
 debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password,keyboard-interactive
 debug1: Next authentication method: gssapi-keyex
 debug1: No valid Key exchange context
 debug1: Next authentication method: gssapi-with-mic
 debug1: Unspecified GSS failure.  Minor code may provide more information
 No Kerberos credentials available (default cache: KEYRING:persistent:0)

 debug1: Unspecified GSS failure.  Minor code may provide more information
 No Kerberos credentials available (default cache: KEYRING:persistent:0)

 debug1: Next authentication method: keyboard-interactive
 Password:  ^C

That line debug1: /root/.ssh/config line 11: Applying options for m4 caught my eye - there shouldn't have been anything specific for this host.

 Host 10.99.2.23       # m4 drac
    PasswordAuthentication=yes
    PubkeyAuthentication=no

So the physical host is a Dell server and has a dedicated OOB port for console access. Dell calls this a DRAC port, and I have a DNS record set up for m4-drac

The DRAC is not configured to use SSH public keys for authentication, so this config stops it trying. But the config was being applied to the hostname m4 because it doesn't honour the hash.

ANSWER ssh's .config file does not observe the Hash as a comment delimiter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.