AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 735176
Accepted
Henrik Pingel
Henrik Pingel
Asked: 2015-11-11 01:40:42 +0800 CST2015-11-11 01:40:42 +0800 CST 2015-11-11 01:40:42 +0800 CST

如何列出我的 ssh 服务器支持的 MAC、密码和 KexAlogrithms?

  • 772

如何确定我的 ssh 服务器支持的 MAC、密码、密钥长度和 KexAlogrithms?

我需要为外部安全审计创建一个列表。我正在寻找类似的东西openssl s_client -connect example.com:443 -showcerts。根据我的研究,ssh使用中列出的默认密码man sshd_config。但是,我需要一个可以在脚本中使用的解决方案,并且man sshd_config不列出有关 key length的信息。我需要在这里更正自己:您可以ServerKeyBits在sshd_config.

我想这会ssh -vv localhost &> ssh_connection_specs.out返回我需要的信息,但我不确定列出的密码是客户端还是服务器支持的密码。另外我不确定如何在脚本中运行这个非交互式的。

有没有方便的方法来获取SSH连接信息?

linux
  • 2 2 个回答
  • 84961 Views

2 个回答

  • Voted
  1. Stéphane Gourichon
    2018-05-23T03:42:40+08:002018-05-23T03:42:40+08:00

    如何确定我的 ssh 服务器支持的 MAC、密码、密钥长度和 KexAlogrithms?

    看起来https://superuser.com/a/1219759/173408上的答案也是您问题的答案。它适合一行:

    nmap --script ssh2-enum-algos -sV -p 22 1.2.3.4
    

    这是具有当前 SSH 版本的普通 Debian 9.4 机器上的输出:

    在 2018-05-22 13:40 CEST 开始 Nmap 7.01 ( https://nmap.org )
    1.2.3.4 的 Nmap 扫描报告
    主机已启动(0.00024 秒延迟)。
    港口国服务版
    22/tcp open ssh OpenSSH 7.4p1 Debian 10+deb9u3(协议2.0)
    | ssh2-枚举算法:
    | kex_algorithms: (10)
    | 曲线25519-sha256
    | [email protected]
    | ecdh-sha2-nistp256
    | ecdh-sha2-nistp384
    | ecdh-sha2-nistp521
    | diffie-hellman-group-exchange-sha256
    | diffie-hellman-group16-sha512
    | diffie-hellman-group18-sha512
    | diffie-hellman-group14-sha256
    | diffie-hellman-group14-sha1
    | server_host_key_algorithms:(5)
    | SSH-RSA
    | rsa-sha2-512
    | rsa-sha2-256
    | ecdsa-sha2-nistp256
    | ssh-ed25519
    | 加密算法:(6)
    | [email protected]
    | aes128-ctr
    | aes192-ctr
    | aes256-ctr
    | [email protected]
    | [email protected]
    | mac_algorithms: (10)
    | [email protected]
    | [email protected]
    | [email protected]
    | [email protected]
    | [email protected]
    | [email protected]
    | [email protected]
    | hmac-sha2-256
    | hmac-sha2-512
    | hmac-sha1
    | 压缩算法:(2)
    | 没有任何
    |_ [email protected]
    服务信息:操作系统:Linux;CPE: cpe:/o:linux:linux_kernel
    
    执行服务检测。请在 https://nmap.org/submit/ 报告任何不正确的结果。
    Nmap 完成:在 0.52 秒内扫描 1 个 IP 地址(1 个主机启动)
    
    • 24
  2. Best Answer
    Jakuje
    2015-11-11T08:13:09+08:002015-11-11T08:13:09+08:00

    您在问题中遗漏了几点:

    • 你的openssh版本是什么?它可能会因版本而有所不同。
    • ServerKeyBits是协议版本 1 的选项,您希望禁用它!

    支持的密码、MAC 和 KexAlgorithms 始终以手册形式提供,这与密钥长度没有任何共同之处。

    正如您所指出的,启用的 Chiphers、MAC 和 KexAlgorithms 是使用连接提供的。但它们也可以通过其他方式获得,例如使用sshd -T | grep "\(ciphers\|macs\|kexalgorithms\)"

    要获取服务器密钥的密钥长度,可以使用 ssh-keygen:ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub

    但是您可能还需要在密钥交换期间提供和使用的模数大小,但这实际上取决于密钥交换方法,但它也应该可以从调试输出中读取ssh -vvv host。

    • 22

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve