不可靠的SSH配置

时间:2015-02-06 17:41:00

标签: ssh configuration ansible

  • 主机(Linux)

[Web服务器]

fgr-lgchefwk201 ansible_ssh_host = 10.7.35.68

  1. 当我尝试这个=> [OK]
  2. ansible webservers -m ping -c paramiko -k

    fgr-lgchefwk201 | success >> {
    "changed": false,
    "ping": "pong"
    }
    
    1. 当我尝试这个=> [ISSUE]
    2. ansible webservers -m ping

      日志:

      2015-02-08 23:54:45,474 p=1553 u=root |  /usr/bin/ansible webservers -m ping -vvvv
      2015-02-08 23:54:45,475 p=1553 u=root |
      2015-02-08 23:54:45,539 p=1553 u=root |  <10.7.35.68> ESTABLISH CONNECTION FOR USER: root
      2015-02-08 23:54:45,544 p=1553 u=root |  <10.7.35.68> REMOTE_MODULE ping
      2015-02-08 23:54:45,570 p=1553 u=root |  <10.7.35.68> EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/root/.ansible/cp/ansible-ssh-%h-%p-%r" -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 10.7.35.68 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1423468485.57-221982977298326 && echo $HOME/.ansible/tmp/ansible-tmp-1423468485.57-221982977298326'
      2015-02-08 23:54:46,867 p=1553 u=root |  fgr-lgchefwk201 | FAILED => SSH encountered an unknown error. The output was:
      OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
      debug1: Reading configuration data /root/.ssh/config^M
      debug1: Reading configuration data /etc/ssh/ssh_config^M
      debug1: Applying options for *^M
      debug1: auto-mux: Trying existing master^M
      debug1: Control socket "/root/.ansible/cp/ansible-ssh-10.7.35.68-22-root" does not exist^M
      debug2: ssh_connect: needpriv 0^M
      debug1: Connecting to 10.7.35.68 [10.7.35.68] port 22.^M
      debug2: fd 3 setting O_NONBLOCK^M
      debug1: fd 3 clearing O_NONBLOCK^M
      debug1: Connection established.^M
      debug3: timeout: 10000 ms remain after connect^M
      debug1: permanently_set_uid: 0/0^M
      debug3: Not a RSA1 key file /root/.ssh/kdump_id_rsa.^M
      debug2: key_type_from_name: unknown key type '-----BEGIN'^M
      debug3: key_read: missing keytype^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug3: key_read: missing whitespace^M
      debug2: key_type_from_name: unknown key type '-----END'^M
      debug3: key_read: missing keytype^M
      debug1: identity file /root/.ssh/kdump_id_rsa type 1^M
      debug1: identity file /root/.ssh/kdump_id_rsa-cert type -1^M
      debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3^M
      debug1: match: OpenSSH_5.3 pat OpenSSH*^M
      debug1: Enabling compatibility mode for protocol 2.0^M
      debug1: Local version string SSH-2.0-OpenSSH_5.3^M
      debug2: fd 3 setting O_NONBLOCK^M
      debug1: SSH2_MSG_KEXINIT sent^M
      debug3: Wrote 960 bytes for a total of 981^M
      debug1: SSH2_MSG_KEXINIT received^M
      debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-rsa,ssh-dss^M
      debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se^M
      debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se^M
      debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96^M
      debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96^M
      debug2: kex_parse_kexinit: zlib@openssh.com,zlib,none^M
      debug2: kex_parse_kexinit: zlib@openssh.com,zlib,none^M
      debug2: kex_parse_kexinit: ^M
      debug2: kex_parse_kexinit: ^M
      debug2: kex_parse_kexinit: first_kex_follows 0 ^M
      debug2: kex_parse_kexinit: reserved 0 ^M
      debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1^M
      debug2: kex_parse_kexinit: ssh-rsa,ssh-dss^M
      debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se^M
      debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se^M
      debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96^M
      debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96^M
      debug2: kex_parse_kexinit: none,zlib@openssh.com^M
      debug2: kex_parse_kexinit: none,zlib@openssh.com^M
      debug2: kex_parse_kexinit: ^M
      debug2: kex_parse_kexinit: ^M
      debug2: kex_parse_kexinit: first_kex_follows 0 ^M
      debug2: kex_parse_kexinit: reserved 0 ^M
      debug2: mac_setup: found hmac-md5^M
      debug1: kex: server->client aes128-ctr hmac-md5 zlib@openssh.com^M
      debug2: mac_setup: found hmac-md5^M
      debug1: kex: client->server aes128-ctr hmac-md5 zlib@openssh.com^M
      debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent^M
      debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP^M
      debug3: Wrote 24 bytes for a total of 1005^M
      debug2: dh_gen_key: priv key bits set: 132/256^M
      debug2: bits set: 540/1024^M
      debug1: SSH2_MSG_KEX_DH_GEX_INIT sent^M
      debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY^M
      debug3: Wrote 144 bytes for a total of 1149^M
      debug3: check_host_in_hostfile: host 10.7.35.68 filename /root/.ssh/known_hosts^M
      debug3: check_host_in_hostfile: host 10.7.35.68 filename /root/.ssh/known_hosts^M
      debug3: check_host_in_hostfile: match line 4^M
      debug1: Host '10.7.35.68' is known and matches the RSA host key.^M
      debug1: Found key in /root/.ssh/known_hosts:4^M
      debug2: bits set: 496/1024^M
      debug1: ssh_rsa_verify: signature correct^M
      debug2: kex_derive_keys^M
      debug2: set_newkeys: mode 1^M
      debug1: SSH2_MSG_NEWKEYS sent^M
      debug1: expecting SSH2_MSG_NEWKEYS^M
      debug3: Wrote 16 bytes for a total of 1165^M
      debug2: set_newkeys: mode 0^M
      debug1: SSH2_MSG_NEWKEYS received^M
      debug1: SSH2_MSG_SERVICE_REQUEST sent^M
      debug3: Wrote 48 bytes for a total of 1213^M
      debug2: service_accept: ssh-userauth^M
      debug1: SSH2_MSG_SERVICE_ACCEPT received^M
      debug2: key: /root/.ssh/kdump_id_rsa (0x7fcd45127da0)^M
      debug3: Wrote 64 bytes for a total of 1277^M
      debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password^M
      debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password^M
      debug3: preferred gssapi-with-mic,gssapi-keyex,hostbased,publickey^M
      debug3: authmethod_lookup gssapi-with-mic^M
      debug3: remaining preferred: gssapi-keyex,hostbased,publickey^M
      debug3: authmethod_is_enabled gssapi-with-mic^M
      debug1: Next authentication method: gssapi-with-mic^M
      debug3: Trying to reverse map address 10.7.35.68.^M
      debug1: Unspecified GSS failure.  Minor code may provide more information
      Credentials cache file '/tmp/krb5cc_0' not found
      ^M
      debug1: Unspecified GSS failure.  Minor code may provide more information
      Credentials cache file '/tmp/krb5cc_0' not found
      ^M
      debug1: Unspecified GSS failure.  Minor code may provide more information
      
      ^M
      debug1: Unspecified GSS failure.  Minor code may provide more information
      Credentials cache file '/tmp/krb5cc_0' not found
      ^M
      debug2: we did not send a packet, disable method^M
      debug3: authmethod_lookup gssapi-keyex^M
      debug3: remaining preferred: hostbased,publickey^M
      debug3: authmethod_is_enabled gssapi-keyex^M
      debug1: Next authentication method: gssapi-keyex^M
      debug1: No valid Key exchange context^M
      debug2: we did not send a packet, disable method^M
      debug3: authmethod_lookup publickey^M
      debug3: remaining preferred: ,publickey^M
      debug3: authmethod_is_enabled publickey^M
      debug1: Next authentication method: publickey^M
      debug1: Offering public key: /root/.ssh/kdump_id_rsa^M
      debug3: send_pubkey_test^M
      debug2: we sent a publickey packet, wait for reply^M
      debug3: Wrote 368 bytes for a total of 1645^M
      debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password^M
      debug2: we did not send a packet, disable method^M
      debug1: No more authentication methods to try.^M
      Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).^M
      

      问题: 它与“不是RSA1密钥文件/root/.ssh/kdump_id_rsa”有关。 ?

1 个答案:

答案 0 :(得分:0)

SELinux可能会妨碍你。这篇文章解决了我类似问题的一部分

https://systembash.com/ssh-unspecified-gss-failure/