SSH एजेंट अग्रेषण `ssh -A` का उपयोग करते समय भी काम नहीं कर रहा है


5

सबसे पहले, मैंने सभी जाँच की है

लेकिन उनकी किसी ने मदद नहीं की। तो ये रहा मेरा प्रश्न:

मैं A से B, या A से C से ss कर सकता हूं, लेकिन A से B तक नहीं, तो B से C. ssh -A SSH एजेंट अग्रेषण को बाध्य करने के लिए।
लेकिन मैं अभी भी कनेक्ट नहीं कर पा रहा हूं A -> B -> C पासफ़्रेज़ के लिए पूछे बिना?

अद्यतन करें: लगभग तीन साल बाद, वही समस्या अभी भी मुझे परेशान करती है, लेकिन अब मैंने इस समस्या को थोड़ा कम कर दिया है:

लक्षण: मैं ssh कर सकता हूं A -> B, या A -> C, लेकिन नहीं A -> B -> C, या A -> C -> B

समस्या का वर्णन इस विषय द्वारा किया गया है - SSH एजेंट अग्रेषण काम नहीं कर रहा है

से

SSH समस्याओं का निवारण करें
https://confluence.atlassian.com/bitbucket/troubleshoot-ssh-issues-271943403.html

इसे कहते हैं:

अपनी भरी हुई कुंजियों को सूचीबद्ध करने के लिए, दर्ज करें ssh-add -l। यदि आप SSH कुंजी का उपयोग नहीं करना चाहते हैं ...

तब समस्या है - SSH कुंजी जिसे आप उपयोग करना चाहते हैं वह लोड नहीं है

यह वही है जब मैं कर रहा हूँ A -> B या A -> C। यानी, ठीक उसके बाद मैंने किया ssh -A एक मध्यवर्ती सर्वर में। SSH कुंजी खो गई है, अग्रेषित नहीं है और लोड नहीं है

$ ssh-add -l
The agent has no identities.

यही कारण है कि मैं पासफ़्रेज़ के बिना आगे ssh नहीं कर सकता।

यह करता है SSH_AUTH_SOCK चर सेटअप और कई ssh-agent हालांकि आसपास:

$ echo "$SSH_AUTH_SOCK"
/tmp/ssh-RtEuLOmFDBet/agent.3722

$ ps -e  | grep [s]sh-agent
 3723 ?        00:00:00 ssh-agent
 4613 ?        00:00:00 ssh-agent

यह मेरे स्वयं के पर्यावरण से संबंधित नहीं लगता है क्योंकि वे समान हैं, या /etc/ssh/sshd_config फ़ाइल, जैसे मैंने उन मध्यवर्ती सर्वरों से तुलना की है जो काम कर रहे हैं या काम नहीं कर रहे हैं।

अद्यतन अंत।

अधिक जानकारी: सभी तीन मशीनें, मानक उबंटु ssh विन्यास के साथ विन्यस्त हैं यानी, द AllowAgentForwarding विकल्प में नहीं है /etc/ssh/sshd_config, हालांकि मुझे संदेह है कि क्या यह होना चाहिए, क्योंकि मैंने देखा "चूंकि एजेंट डिफॉल्ट को आगे बढ़ाता है, इसलिए sshd_config से किसी भी AllowAgentForwarding लाइन को हटाने के लिए पर्याप्त होना चाहिए।" से Ssh- एजेंट अग्रेषण के लिए आवश्यक अतिरिक्त विन्यास?

कुछ का कहना है ssh-add करेगा, लेकिन जब मैं इसे B या C पर करता हूं, तो यह मुझसे पूछता है Enter passphrase for मेरे .ssh/id_rsa। कुछ का कहना है कि जाँच करें SSH_AUTH_SOCK, लेकिन मेरे पास यह B या C पर है (या तो A से B तक, या A से C तक):

$ env | grep SSH_AUTH_SOCK
SSH_AUTH_SOCK=/tmp/ssh-RTScJ5PZh9Mh/agent.2083

क्या एजेंट अग्रेषण लापता होने के कारण काम नहीं कर रहा है AllowAgentForwarding विकल्प? फिर मुझे कौन सा (ए, बी, या सी) इसे लगाना चाहिए नहीं होगा ssh -A काफी होना? इसके अलावा मेरे पास है .ssh/id_rsa B और C दोनों पर फ़ाइलें, इसका कारण है ssh-add उनके लिए पासफ़्रेज़ के लिए पूछें?

संपादित करें:

यहाँ का लॉग है -Avvv B से C:

OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /home/myid/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to boxc.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/myid/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/myid/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-1024
debug1: identity file /home/myid/.ssh/id_rsa-cert type -1
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/myid/.ssh/id_dsa" as a RSA1 public key
debug1: identity file /home/myid/.ssh/id_dsa type 2
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: identity file /home/myid/.ssh/id_dsa-cert type -1
debug1: identity file /home/myid/.ssh/id_ecdsa type -1
debug1: identity file /home/myid/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2p2 Ubuntu-6ubuntu0.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2p2 Ubuntu-6
debug1: match: OpenSSH_6.2p2 Ubuntu-6 pat OpenSSH*
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: boxc
debug3: load_hostkeys: loading entries for host "boxc" from file "/home/myid/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /home/myid/.ssh/known_hosts:15
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: zlib@openssh.com,zlib,none
debug2: kex_parse_kexinit: zlib@openssh.com,zlib,none
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5-etm@openssh.com
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com zlib@openssh.com
debug2: mac_setup: found hmac-md5-etm@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com zlib@openssh.com
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA ed:26:20:93:4c:88:ef:17:70:e3:d4:7a:42:4c:8e:69
debug3: put_host_port: [192.168.2.122]:21
debug3: put_host_port: boxc
debug3: load_hostkeys: loading entries for host "boxc" from file "/home/myid/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /home/myid/.ssh/known_hosts:15
debug3: load_hostkeys: loaded 1 keys
debug3: load_hostkeys: loading entries from file "/home/myid/.ssh/known_hosts"
debug3: load_hostkeys: found key type RSA in file /home/myid/.ssh/known_hosts:16
debug3: load_hostkeys: loaded 1 keys
debug1: Host 'boxc' is known and matches the RSA host key.
debug1: Found key in /home/myid/.ssh/known_hosts:15
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/myid/.ssh/id_rsa (0x7f7e....e760),
debug2: key: /home/myid/.ssh/id_dsa (0x7f7e....e7a0),
debug2: key: /home/myid/.ssh/id_ecdsa ((nil)),
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/myid/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 149
debug2: input_userauth_pk_ok: fp 22:32:...:1d:e3
debug3: sign_and_send_pubkey: RSA 22:32:...:1d:e3
debug1: key_parse_private_pem: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/myid/.ssh/id_rsa': 

मैंने अपने अच्छे सत्र (A- & gt; C) के साथ तुलना की है, और पाया कि सभी अलग नहीं हैं, अंतिम 3 लाइनों के अलावा, जो कि " key_parse_private_pem: PEM_read_PrivateKey failed "इसके बजाय अच्छा सत्र है:

debug1: Enabling compression at level 6.
debug1: Authentication succeeded (publickey).
Authenticated to boxc

बाकी सब वही हैं।

फिर से, मेरा वातावरण:

$ apt-cache policy openssh-server
openssh-server:
  Installed: 1:6.2p2-6ubuntu0.1
  Candidate: 1:6.2p2-6ubuntu0.4
  Version table:
     1:6.2p2-6ubuntu0.4 0
        500 http://archive.ubuntu.com/ubuntu/ saucy-updates/main amd64 Packages
     1:6.2p2-6ubuntu0.3 0
        500 http://security.ubuntu.com/ubuntu/ saucy-security/main amd64 Packages

% sshd -v
sshd: illegal option -- v
OpenSSH_6.2p2 Ubuntu-6ubuntu0.1, OpenSSL 1.0.1e 11 Feb 2013

धन्यवाद


आपने कोशिश की है ssh -Avv (या शायद अधिक -v, मैं दिल से अधिकतम क्रिया स्तर नहीं जानता) और आउटपुट देखा?
ua2b

हाँ, मैंने कोशिश की, 4 वी के साथ। लेकिन विशेष रूप से देखने के लिए पता नहीं है, और कुछ भी संदिग्ध नहीं मिला ... संपादित करें: पकड़ो, कुछ मिला ...
xpt

1
तो तुम ssh-add A पर आपकी कुंजी, ssh-add -l दिखाता है कि कुंजी लोड हो गई है, तो आप B का उपयोग करके लॉग इन करते हैं ssh -A। कर देता है ssh-add -l अभी भी वही कुंजी दिखाओ? आप की जरूरत नहीं है (उसी कुंजी में) .ssh/id_rsa B. मैं मानता हूं, आपकी कुंजी उस कूटशब्द के साथ एन्क्रिप्ट की गई है जो यदि आप उस प्रॉम्प्ट पर अच्छी तरह से काम करते हैं, जिसे आप देखना नहीं चाहते हैं?
ua2b

हाँ, आपकी सारी बातें मुझ पर अच्छी तरह लागू होती हैं, सिवाय इसके कि, बी ssh-add -l उसी कुंजी को और अधिक नहीं दिखाता है। वास्तव में मुझे मिल गया The agent has no identities। इसके अलावा मैं भी एक ही कुंजी है .ssh/id_rsa बी पर फिर से धन्यवाद!
xpt

जवाबों:


1

मैं लगभग इस समस्या का निवारण करने की कोशिश कर रहा हूं सात वर्षों , और अंत में यह हल हो जाता है - मैं लॉन्च करता हूं keychain मेरे में ~/.profile, जो अपनी शुरुआत करता है ' ssh-agent ', यहां तक ​​कि मशीन B & amp; सी। यह है स्रोत समस्या की, क्योंकि keychain की ssh-agent ओवरशेडो sshd एक प्रदान किया।

इसे हटाना ( keychain ) मेरे से ~/.profile समस्या का हल किया।

अद्यतन, एक और संभावना, ssh-agent आदि आमतौर पर शुरू करने के हिस्से के रूप में शुरू हो जाते हैं जीयूआई स्थानीय प्रणाली पर। उदाहरण के लिए, किसी अन्य मामले में, कॉल इन छिपा हुआ है /etc/X11/xdm/sys.xsession!

मैं पुष्टि करता हूं कि मेरे SSH एजेंट फॉरवर्डिंग मशीनस में काम कर रहा है,

ssh -t MachineB ssh MachineC

जबकि ssh MachineB फिर, इसके भीतर ssh MachineC विफल हो रहा था।

मैं इसे शुरू करूँगा ( ssh-agent से keychain आदि) अब से केवल मशीन ए से मैन्युअल रूप से।

हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.