SSH: DH_GEX समूह सीमा से बाहर


18

हमने हाल ही में ओपनएसएसएच के लिए एक विक्रेता द्वारा आपूर्ति पैच लागू किया है। इस पैच ने हाल के लोगजाम हमले के जवाब में कुछ प्रमुख एक्सचेंज प्रोटोकॉल को निष्क्रिय कर दिया। इस पैच को लागू करने के बाद, हमारे पास कुछ विक्रेता हैं, जिनके साथ हम sftp के माध्यम से फाइलों का आदान-प्रदान नहीं कर पाए हैं, क्योंकि कनेक्शन बातचीत विफल हो रही है (संभवतया अपग्रेड किए गए प्रमुख एक्सचेंज एल्गोरिदम के कारण)।

मैं अपने विक्रेताओं से बात करने से पहले कुछ चीजों को सत्यापित करना चाहूंगा। यहाँ समस्या विक्रेताओं में से एक के साथ एक नमूना SSH सत्र है (पंक्ति संख्या जोड़ी गई):

# ssh -vv user@host.domain.com
01 OpenSSH_6.2p2, OpenSSL 0.9.8j-fips 07 Jan 2009
02 debug1: Reading configuration data /etc/ssh/ssh_config
03 debug1: /etc/ssh/ssh_config line 20: Applying options for *
04 debug2: ssh_connect: needpriv 0
05 debug1: Connecting to host.domain.com [1.2.3.4] port 22.
06 debug1: Connection established.
07 debug1: permanently_set_uid: 0/0
08 debug1: identity file /root/.ssh/id_rsa type -1
09 debug1: identity file /root/.ssh/id_rsa-cert type -1
10 debug1: identity file /root/.ssh/id_dsa type -1
11 debug1: identity file /root/.ssh/id_dsa-cert type -1
12 debug1: identity file /root/.ssh/id_ecdsa type -1
13 debug1: identity file /root/.ssh/id_ecdsa-cert type -1
14 debug1: Enabling compatibility mode for protocol 2.0
15 debug1: Local version string SSH-2.0-OpenSSH_6.2
16 debug1: Remote protocol version 2.0, remote software version GXSSSHD_Comments
17 debug1: no match: GXSSSHD_Comments
18 debug2: fd 3 setting O_NONBLOCK
19 debug1: SSH2_MSG_KEXINIT sent
20 debug1: SSH2_MSG_KEXINIT received
21 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
22 debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss
23 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
24 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
25 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
26 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
27 debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
28 debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
29 debug2: kex_parse_kexinit:
30 debug2: kex_parse_kexinit:
31 debug2: kex_parse_kexinit: first_kex_follows 0
32 debug2: kex_parse_kexinit: reserved 0
33 debug2: kex_parse_kexinit: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
34 debug2: kex_parse_kexinit: ssh-dss,ssh-rsa
35 debug2: kex_parse_kexinit: aes128-cbc,3des-ctr,aes128-ctr,3des-cbc,blowfish-cbc,arcfour,arcfour128
36 debug2: kex_parse_kexinit: aes128-cbc,3des-ctr,aes128-ctr,3des-cbc,blowfish-cbc,arcfour,arcfour128
37 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96,hmac-sha256,hmac-sha256@ssh.com
38 debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-md5-96,hmac-sha1-96,hmac-sha256,hmac-sha256@ssh.com
39 debug2: kex_parse_kexinit: none,zlib
40 debug2: kex_parse_kexinit: none,zlib
41 debug2: kex_parse_kexinit:
42 debug2: kex_parse_kexinit:
43 debug2: kex_parse_kexinit: first_kex_follows 0
44 debug2: kex_parse_kexinit: reserved 0
45 debug2: mac_setup: found hmac-md5
46 debug1: kex: server->client aes128-ctr hmac-md5 none
47 debug2: mac_setup: found hmac-md5
48 debug1: kex: client->server aes128-ctr hmac-md5 none
49 debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1536<3072<8192) sent
50 debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
51 DH_GEX group out of range: 1536 !< 1024 !< 8192`

इसलिए प्रमुख विनिमय वार्ता के दौरान, क्लाइंट और सर्वर समर्थित एल्गोरिदम की अपनी सूची (लाइन 21 और 33) का आदान-प्रदान करते हैं। वे इस मामले में दो सूचियों में पाए गए पहले मैच का उपयोग करने के लिए सहमत हैं diffie-hellman-group-exchange-sha1। जैसा कि मैं इसे समझता हूं, यह एल्गोरिथ्म बिट लंबाई की एक सीमा का समर्थन करता है जिसे क्लाइंट और सर्वर को फिर से बातचीत करनी होगी। सामान्य परिस्थितियों में, क्लाइंट और सर्वर थोड़ी लंबाई और विनिमय कुंजियों से सहमत होते हैं moduli, जो फ़ाइल से डीएच प्राइम का उपयोग करते हैं, उदाहरण के लिए /etc/ssh/moduli(मुझे पता है कि यह अंतिम कथन बहुत "आम आदमी की बात है", लेकिन यह लगभग लंबा और छोटा है यह)।

इस मामले में, जो मुझे लगता है कि मैं देख रहा हूं वह यह है कि बिट-लेंथ वार्ता विफल हो रही है। लाइन 49 पर, क्लाइंट (मुझे) कह रहा है "मैं 1536 और 8192 के बीच की लंबाई का समर्थन करता हूं और 30 बिट का उपयोग करना चाहता हूं।" हालांकि, सर्वर वापस जवाब देता है और कहता है "मैं केवल 1024 बिट्स का समर्थन करता हूं।" जिस बिंदु पर ग्राहक देता है और कहता है "मैं आपसे बात नहीं कर सकता।" क्या यह यहां होने वाला उचित विवरण है?

जैसा कि मैं इसे समझता हूं, समस्या पूरी तरह से इस बिंदु पर सर्वर के अंत में है (यह मानते हुए कि हम एक कमजोर एल्गोरिथ्म जैसे बातचीत नहीं करते हैं diffie-hellman-group1-sha1)। सर्वर को कुंजी विनिमय प्रक्रिया के दौरान बड़ी बिट लंबाई का समर्थन करने के लिए संशोधित करना होगा।

मैं यह सुनिश्चित करना चाहता हूं कि मैं आगे बढ़ने से पहले इसे सही ढंग से समझ रहा हूं। इनपुट की सराहना की है।


1
आप इसे सही पढ़ रहे हैं। पृथ्वी पर दूसरे छोर पर क्या है? यह किसी भी सामान्य ssh सर्वर की तरह नहीं दिखता है।
माइकल हैम्पटन

सर्वर क्या है कोई पता नहीं। हम दो अलग-अलग विक्रेताओं के साथ एक ही मुद्दे का सामना कर रहे हैं, दोनों बैंक हैं। न तो सर्वर सत्र में खुद को पहचानता है (जो आश्चर्य की बात नहीं है)।
21

आपको लगता है कि चाहते हैं कि बैंकों को सुरक्षा के शीर्ष पर थोड़ा अधिक होगा, लेकिन अफसोस ...
माइकल हैम्पटन

2
"GXSSSHD_Comments" के लिए खोज करने से विभिन्न SFTP ग्राहक मंचों में टिप्पणियां आती हैं, जो बदले में यह सुझाव देती हैं कि आपका सर्वर GXS MFT एप्लिकेशन है - बहुत ही मनोरंजक
कास्टाग्लिया

जवाबों:


21

यदि आप हटाए गए सर्वर से कनेक्ट करने के लिए नए OpenSSH का उपयोग करना चाहते हैं:

ssh -o KexAlgorithms=diffie-hellman-group14-sha1 -o HostKeyAlgorithms=+ssh-dss my.host.com

Add -v यदि आप देखना चाहते हैं कि क्या हो रहा है, और -हो HostKeyAl एल्गोरिदम = ssh-dss

ssh -v -o HostKeyAlgorithms=ssh-dss -o KexAlgorithms=diffie-hellman-group14-sha1 my.host.com

आप, निश्चित रूप से, संपादन / आदि / ssh / ssh_config या ~ / .ssh / ssh_config, और भी जोड़ सकते हैं:

Host my.host.com *.myinsecure.net 192.168.1.* 192.168.2.*
    HostKeyAlgorithms ssh-dss
    KexAlgorithms diffie-hellman-group1-sha1    

https://forum.ctwug.za.net/t/fyi-openssh-to-access-rbs-openssh-7/6069 में मिकरोटिक राउटरबोर्ड्स पर निम्नलिखित फिक्स का उल्लेख किया गया है:

/ip ssh set strong-crypto=yes

(इसे यहाँ देख रहे हैं क्योंकि यह उत्तर भी इसी तरह के त्रुटि संदेश की तलाश में वेब खोजों पर आता है।)

यदि आप अपने ssh_config को संपादित किए बिना या SSH सर्वर को अपडेट किए बिना इसे Git के ऊपर उपयोग करना चाहते हैं:

GIT_SSH="ssh -oHostKeyAlgorithms=+ssh-dss -oKexAlgorithms=diffie-hellman-group14-sha1" git clone ssh://user@host/path-to-repository

2
यह sftp के लिए भी काम करता है
bao7uo

11

ऐसा लगता है कि आपने इस बग को मारा है ।

कारण

डिफी-हेलमैन ग्रुप एक्सचेंज के साथ काम करते हुए, ओपनश पैकेज में बदलाव किया गया। पहले, 1024 - 8192 आकार की चाबियों का आदान-प्रदान किया जा सकता था। अतिरिक्त सुरक्षा के लिए और "लॉगजम" भेद्यता से बचने के लिए न्यूनतम को 1536 तक बढ़ा दिया गया था। हालाँकि, यदि कुछ तृतीय पक्ष ssh कार्यान्वयनों के साथ उपयोग किया जाता है जो केवल 1024 का समर्थन करते हैं, तो विफलता होगी। आदर्श रूप में, बड़े कुंजी आकारों का उपयोग करने के लिए 3rd पार्टी ssh कॉन्फ़िगरेशन या कोड को अपडेट किया जाना चाहिए।

...

आप लिंक में 3 अलग-अलग रिज़ॉल्यूशन पा सकते हैं। उन स्थितियों में जहां आपके पास पावर नहीं है या गहरे बदलाव लाने के लिए बहुत अधिक नौकरशाही है, सर्वर में SHA-2 की उपलब्धता की प्रतीक्षा करते समय समस्याग्रस्त एल्गोरिथ्म से छुटकारा पाना मेरे लिए सबसे अच्छा विकल्प लगता था। आप इसे अपने $ HOME / .ssh / config फ़ाइल में उपयोगकर्ता-आधारित फैशन में भी प्रदर्शन कर सकते हैं।

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