يصف هذا وثيقة الخطوات أن يضيف (أو) يزيل تشفير، MACs، وخوارزميات KEX في Nexus منصة.
توصي Cisco بأن تفهم أساسيات Linux و Bash.
تستند المعلومات الواردة في هذا المستند إلى إصدارات المكونات المادية والبرامج التالية:
تم إنشاء المعلومات الواردة في هذا المستند من الأجهزة الموجودة في بيئة معملية خاصة. بدأت جميع الأجهزة المُستخدمة في هذا المستند بتكوين ممسوح (افتراضي). إذا كانت شبكتك قيد التشغيل، فتأكد من فهمك للتأثير المحتمل لأي أمر.
يمكن أن تجد بعض عمليات الفحص الأمني طرق تشفير ضعيفة تستخدم من قبل أجهزة Nexus. إذا حدث هذا، يلزم إجراء تغييرات على ملف dco_sshd_config على المحولات لإزالة الخوارزميات غير الآمنة.
ولتأكيد أي شفرات و MACs و خوارزميات KEX يستخدمها النظام الأساسي، تحقق من هذا من جهاز خارجي. يمكنك إستخدام الخيارات التالية:
افتح خط CMD على جهاز كمبيوتر شخصي يمكنه الوصول إلى جهاز Nexus وتشغيل الأمر ssh -vvv
C:\Users\xxxxx>ssh -vvv
--------- snipped ------------
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,curve25519-sha256@libssh.org <--- Kex algorithms
debug2: host key algorithms: ssh-rsa
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc <--- encryption algorithms
debug2: MACs ctos: hmac-sha1
debug2: MACs stoc: hmac-sha1 <--- mac algorithms
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com <--- compression algorithms
ينطبق هذا على:
1. مكنت ال bash-shell سمة وفي bash أسلوب:
switch(config)# feature bash-shell
switch(config)#
switch(config)# run bash
bash-4.3$
2. راجع المحتويات من ملف dcos_sshd_config:
bash-4.3$ cat /isan/etc/dcos_sshd_config
ملاحظة: يمكنك إستخدام egrep للنظر في أسطر معينة: cat /isan/etc/dco_sshd_config | جروب ماك
ينطبق هذا على:
الخطوات:
1. افتح حالة مركز المساعدة الفنية للحصول على ملف التوصيل الذي يطابق إصدار NXOS الذي يعمل على المحول.
2. قم بتحميل ملف التوصيل التوصيل إلى ذاكرة التمهيد المؤقتة (bootflash) وإنشاء نسخة منه.
switch# copy bootflash:nuova-or-dplug-mzg.7.3.8.N1.1 bootflash:dp
ملاحظة: يتم إنشاء نسخة ("dp") من ملف DPLUG الأصلي في bootflash، لذلك، تتم إزالة النسخة فقط بعد تحميل التوصيل ويبقى ملف dplug الأصلي في bootflash للتشغيل اللاحق.
3. قم بتحميل نسخة الأمر dplug عن طريق تشغيل الأمر load.
n5k-1# load bootflash:dp
Loading plugin version 7.3(8)N1(1)
###############################################################
Warning: debug-plugin is for engineering internal use only!
For security reason, plugin image has been deleted.
###############################################################
Successfully loaded debug-plugin!!!
Linux(debug)#
Linux(debug)#
2. راجع ملف dcos_sshd_config.
Linux(debug)# cat /isan/etc/dcos_sshd_config
1. إرسال نسخة من ملف dco_sshd_config إلى bootflash:
Linux(debug)# cd /isan/etc/
Linux(debug)# copy dcos_sshd_config /bootflash/dcos_sshd_config
Linux(debug)# exit
2. تأكد من أن النسخة موجودة على bootflash:
switch(config)# dir bootflash: | i ssh
7372 Mar 24 02:24:13 2023 dcos_sshd_config
3. التصدير إلى خادم:
switch# copy bootflash: ftp:
Enter source filename: dcos_sshd_config
Enter vrf (If no input, current vrf 'default' is considered): management
Enter hostname for the ftp server: <hostname>
Enter username: <username>
Password:
***** Transfer of file Completed Successfully *****
Copy complete, now saving to disk (please wait)...
Copy complete.
4. قم بإكمال أي تغييرات ضرورية على الملف ثم قم باستيرادها مرة أخرى إلى ذاكرة التمهيد المؤقتة (bootflash).
1. قم بتحميل ملف dcos_sshd_config المعدل إلى ذاكرة التمهيد المؤقتة.
switch# copy ftp: bootflash:
Enter source filename: dcos_sshd_config_modified.txt
Enter vrf (If no input, current vrf 'default' is considered): management
Enter hostname for the ftp server: <hostname>
Enter username: <username>
Password:
***** Transfer of file Completed Successfully *****
Copy complete, now saving to disk (please wait)...
Copy complete.
switch#
باستبدال الملف dco_sshd_config الموجود تحت /isan/etc/ بملف dco_sshd_config معدل موجود في bootflash. هذه العملية غير مستمرة عبر عمليات إعادة التمهيد
ssh configإلى bootflash:switch# dir bootflash: | i ssh
7372 Mar 24 02:24:13 2023 dcos_sshd_config_modified
2. أثناء التواجد في الوضع base أو linux (debug)#، قم باستبدال الملف dco_sshd_config الموجود بالملف الموجود في bootflash:
bash-4.3$ sudo su
bash-4.3# copy /bootflash/dcos_sshd_config_modified /isan/etc/dcos_sshd_config
3. تأكد من نجاح التغييرات:
bash-4.3$ cat /isan/etc/dcos_sshd_config
باستخدام برنامج نصي ل EEM، يتم تشغيل ذلك عند تحديث السجل "VDC_MGR-2-VDC_ONLINE" بعد إعادة التحميل. في حالة تشغيل IM، يتم تشغيل برنامج نصي لمحرك الأقراص ويستبدل الملف dco_sshd_config الموجود تحت /isan/etc/ بملف dco_sshd_config معدل الموجود في bootflash. ينطبق هذا فقط على إصدارات NX-OS التي تدعم "feature bash-shell".
switch# dir bootflash: | i ssh
7404 Mar 03 16:10:43 2023 dcos_sshd_config_modified_7k
switch#
2. قم بإنشاء نص تنفيذي يطبق التغييرات على ملف dcos_sshd_config. تأكد من حفظ الملف باستخدام الملحق "PY".
#!/usr/bin/env python
import os
os.system("sudo usermod -s /bin/bash root")
os.system("sudo su -c \"cp /bootflash/dcos_sshd_config_modified_7k /isan/etc/dcos_sshd_config\"")
3. تحميل البرنامج النصي Python إلى bootflash.
switch# dir bootflash:///scripts
175 Mar 03 16:11:01 2023 ssh_workaround_7k.py
ملاحظة: تكون نصوص Python النصية متماثلة إلى حد كبير على جميع الأنظمة الأساسية، باستثناء N7K الذي يحتوي على بعض الخطوط الإضافية للتغلب على معرف تصحيح الأخطاء من Cisco CSCva14865.
4. تأكد من أن اسم ملف dco_sshd_config من البرنامج النصي و bootflash (في الخطوة 1.) هي نفسها:
switch# dir bootflash: | i ssh
7404 Mar 03 16:10:43 2023 dcos_sshd_config_modified_7k
switch#
switch# show file bootflash:///scripts/ssh_workaround_7k.py
#!/usr/bin/env python
import os
os.system("sudo usermod -s /bin/bash root")
os.system("sudo su -c \"cp /bootflash/dcos_sshd_config_modified_7k /isan/etc/dcos_sshd_config\"")
switch#
5. قم بتشغيل البرنامج النصي مرة واحدة، لذلك، تم تغيير ملف dcos_sshd_config.
switch# source ssh_workaround_7k.py
switch#
6. قم بتكوين برنامج نصي IM، بمجرد تشغيل برنامج نصي PY في كل مرة يتم فيها إعادة تشغيل المحول، فيعود مرة أخرى.
EEM N7K:
event manager applet SSH_workaround
event syslog pattern "vdc 1 has come online"
action 1.0 cli command "source ssh_workaround_7k.py"
action 2 syslog priority alerts msg "SSH Workaround implemented"
ملاحظة: يمكن أن تختلف صياغة EEM على إصدارات NXOS المختلفة (تتطلب بعض الإصدارات "واجهة سطر الأوامر (CLI) للعمل" و"أمر واجهة سطر الأوامر (CLI) للإجراء")، فتأكد من دقة أوامر IM.
switch# dir | i i ssh
7732 Jun 18 16:49:47 2024 dcos_sshd_config
7714 Jun 18 16:54:20 2024 dcos_sshd_config_modified
switch#
2. قم بإنشاء نص تنفيذي يطبق التغييرات على ملف dcos_sshd_config. تأكد من حفظ الملف باستخدام الملحق "PY".
#!/usr/bin/env python
import os
os.system("sudo su -c \"cp /bootflash/dcos_sshd_config_modified /isan/etc/dcos_sshd_config\"")
3. تحميل البرنامج النصي python إلى bootflash.
switch# dir | i i .py
127 Jun 18 17:21:39 2024 ssh_workaround_9k.py
switch#
4. تأكد من أن اسم ملف dco_sshd_config من البرنامج النصي و bootflash (الخطوة 1.) هي نفسها:
switch# dir | i i ssh
7732 Jun 18 16:49:47 2024 dcos_sshd_config
7714 Jun 18 16:54:20 2024 dcos_sshd_config_modified
127 Jun 18 17:21:39 2024 ssh_workaround_9k.py
switch#
switch# sh file bootflash:ssh_workaround_9k.py
#!/usr/bin/env python
import os
os.system("sudo su -c \"cp /bootflash/dcos_sshd_config_modified /isan/etc/dcos_sshd_config\"")
switch#
5. قم بتشغيل البرنامج النصي مرة واحدة، لذلك، تم تغيير ملف dcos_sshd_config.
switch# python bootflash:ssh_workaround_9k.py
6. قم بتكوين برنامج نصي IM، بمجرد تشغيل البرنامج النصي PY في كل مرة، يتم إعادة تمهيد المحول ثم يعود مرة أخرى.
EEM N9K و N3K:
event manager applet SSH_workaround
event syslog pattern "vdc 1 has come online"
action 1.0 cli python bootflash:ssh_workaround_9k.py
action 2 syslog priority alerts msg SSH Workaround implemented
ملاحظة: يمكن أن تختلف صياغة EEM على إصدارات NXOS المختلفة (تتطلب بعض الإصدارات "واجهة سطر الأوامر (CLI) للعمل" و"أمر واجهة سطر الأوامر (CLI) للإجراء")، فتأكد من دقة أوامر IM.
تم إنشاء ملف DPLUG معدل عبر معرف تصحيح الأخطاء من Cisco CSCvr23488 لإزالة خوارزميات KEX هذه:
إن ملفات dpug الموفرة عبر cisco بق id CSCvr23488 ليست نفسها التي استعملت أن ينفذ ال linux طبقة. افتح حالة مركز المساعدة الفنية للحصول على المكون الإضافي المعدل من معرف تصحيح الأخطاء من Cisco CSCvr23488.
C:\Users\user>ssh -vvv admin@
---- snipped ----
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: 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 <--- kex algorithms
debug2: host key algorithms: ssh-rsa
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr <--- encryption algorithms
debug2: MACs ctos: hmac-sha1
debug2: MACs stoc: hmac-sha1 <--- mac algorithms
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com <--- compression algorithms
2. قم بإنشاء نسخة من ملف DPLUG المعدل.
switch# copy bootflash:nuova-or-dplug-mzg.7.3.14.N1.1_CSCvr23488.bin bootflash:dp
ملاحظة: يتم إنشاء نسخة ("dp") من ملف DPLUG الأصلي في bootflash، ويتم إزالة النسخة فقط بعد تحميل التوصيل ويبقى ملف dplug الأصلي في bootflash للتشغيل اللاحق.
3. تطبيق ملف التوصيل من معرف تصحيح الأخطاء من Cisco CSCvr23488 يدويا:
switch# load bootflash:dp2
Loading plugin version 7.3(14)N1(1)
###############################################################
Warning: debug-plugin is for engineering internal use only!
For security reason, plugin image has been deleted.
###############################################################
Successfully loaded debug-plugin!!!
Workaround for CSCvr23488 implemented
switch#
4. تحقق من إعدادات dco_sshd_config الجديدة:
C:\Users\user>ssh -vvv admin@<hostname>
---- snipped ----
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
debug2: host key algorithms: ssh-rsa
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr
debug2: MACs ctos: hmac-sha1
debug2: MACs stoc: hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
5. تأكد من إستمرار هذا التغيير عبر عمليات إعادة التشغيل باستخدام برنامج IM:
event manager applet CSCvr23488_workaround
event syslog pattern "VDC_MGR-2-VDC_ONLINE"
action 1 cli command "copy bootflash:nuova-or-dplug-mzg.7.3.14.N1.1_CSCvr23488.bin bootflash:dp"
action 2 cli command "load bootflash:dp"
action 3 cli command "conf t ; no feature ssh ;feature ssh"
action 4 syslog priority alerts msg "CSCvr23488 Workaround implemented"
ملاحظة: بعد تطبيق المكون الإضافي المعدل، يجب إعادة تعيين ميزة SSH على هذا النظام الأساسي. يجب أن يكون ملف DPLUG موجودا في bootflash، ويجب تكوين IM باستخدام اسم ملف التوصيل الصحيح. يمكن أن يختلف اسم ملف التوصيل بناء على إصدار المحول، تأكد من تعديل النص التنفيذي حسب الحاجة. ينشئ الإجراء 1 نسخة من ملف DPLUG الأصلي في Bootflash إلى آخر يسمى "dp"، بحيث لا يتم حذف ملف DPLUG الأصلي بمجرد تحميله.
F241.06.24-N7706-1(config)# feature bash-shell
F241.06.24-N7706-1(config)# run bash
bash-4.3$ sudo su
Cannot execute /isanboot/bin/nobash: No such file or directory <---
bash-4.3$
للتغلب على هذا، قم بتشغيل:
bash-4.3$ sudo usermod -s /bin/bash root
بعد تشغيل الأمر السابق، تعمل "sudo su":
bash-4.3$ sudo su
bash-4.3#
ملاحظة: لا ينجو هذا التغيير من إعادة تحميل.
هناك ملف dcos_sshd_config منفصل لكل VDC، إذا كان يجب تعديل معلمات SSH على VDC مختلف، فتأكد من تعديل ملف dco_sshd_config المتوافق.
N7K# run bash
bash-4.3$ cd /isan/etc/
bash-4.3$ ls -la | grep ssh
-rw-rw-r-- 1 root root 7564 Mar 27 13:48 dcos_sshd_config <--- VDC 1
-rw-rw-r-- 1 root root 7555 Mar 27 13:48 dcos_sshd_config.2 <--- VDC 2
-rw-rw-r-- 1 root root 7555 Mar 27 13:48 dcos_sshd_config.3 <--- VDC 3
مثال CLI من مفتاح يركض 10.5(1):
switch(config)# ssh ?
cipher-mode Set Cipher-mode for ssh
ciphers Ciphers to encrypt the connection <<<<<<<<<
idle-timeout SSH Client session idle timeout value
kexalgos Key exchange methods that are used to generate per-connection keys <<<<<<<<<
key Generate SSH Key
keytypes Public key algorithms that the server can use to authenticate itself to the client
login-attempts Set maximum login attempts from ssh
login-gracetime Set login gracetime for ssh connection
macs Message authentication codes used to detect traffic modification <<<<<<<<<
port Set port number for ssh
rekey Renegotiate ssh key
switch(config)# ssh ciphers ?
WORD Algorithm name to be configured (Max Size 128)
aes256-gcm <Deprecated> enable aes256-gcm
all Control known weak SSH algorithms in current version of NX-OS in addition to the base set of strong algorithms
switch(config)# ssh macs ?
WORD Algorithm name to be configured (Max Size 128)
all Control known weak SSH algorithms in current version of NX-OS in addition to the base set of strong algorithms
switch(config)# ssh kexalgos ?
WORD Algorithm name to be configured (Max Size 128)
all Control known weak SSH algorithms in current version of NX-OS in addition to the base set of strong algorithms
بالنسبة للأنظمة الأساسية التي تعمل بتعليمات برمجية سابقة، يمكنك إضافة شفرة، ماك، وخوارزميات كيكس. لا توفر هذه الإصدارات خيار تحديد خوارزميات معينة بشكل فردي؛ يتم دعم الخيار 'all' فقط.
N9000(config)# ssh macs ?
all Enable algorithms supported in current version of SSH
N9000(config)# ssh kexalgos ?
all Enable algorithms supported in current version of SSH
ecdh-sha2-nistp384 Enable ecdh-sha2-nistp384
N9000(config)# ssh ciphers ?
aes256-gcm Enable aes256-gcm
all Enable algorithms supported in current version of SSH
ملاحظة: تتوفر هذه الأوامر على Nexus 7000 مع الإصدارات 8.3(1) والإصدارات الأحدث. بالنسبة للنظام الأساسي Nexus 3000/9000، يصبح الأمر متوفرا مع الإصدار 7.0(3)I7(8) والإصدارات الأحدث. (تتضمن جميع إصدارات 9.3(x) هذا الأمر أيضا. راجع دليل تكوين أمان Cisco Nexus 9000 Series NX-OS، الإصدار 9.3(x)).
| المراجعة | تاريخ النشر | التعليقات |
|---|---|---|
2.0 |
31-Jul-2026
|
تم تحديث التدقيق الإملائي والنحوي والعنوان وأدرج أسطر أفقية لفصل المقاطع/إمكانية القراءة وتنبيهات CCW الثابتة. |
1.0 |
01-Jul-2024
|
الإصدار الأولي |