ssh指定的密钥协商方式以及Ansible的hosts文件修改密钥协商方式

一、首先你要知道用什么加密协商。

复制代码
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
10.10.2.190 | UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: Unable to negotiate with 10.10.2.190 port 22: no matching key exchange method found. Their offer: curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256",
    "unreachable": true
}

这里会告诉你:

Their offer: curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256"

然后你可以通过ssh先进行测试:

复制代码
ssh -l root -o KexAlgorithms=diffie-hellman-group-exchange-sha256 10.10.2.190

-o 后根指定的协商方式

二、修改Ansible特定的hosts协商方式

复制代码
[klin]
10.10.2.190 ansible_ssh_user='root' ansible_ssh_pass='Admin123@pl' ansible_ssh_args='-o KexAlgorithms=diffie-hellman-group-exchange-sha256'

在hosts文件中加上 ansible_ssh_args='-o KexAlgorithms=diffie-hellman-group-exchange-sha256'

此时Ansible的ssh命令等价于上面的ssh命令。

相关推荐
JuiceFS11 小时前
从 MLPerf Storage v2.0 看 AI 训练中的存储性能与扩展能力
运维·后端
chen94517 小时前
mysql 3节点mgr集群部署
运维·后端
LH_R17 小时前
OneTerm开源堡垒机实战(三):功能扩展与效率提升
运维·后端·安全
dessler18 小时前
Hadoop HDFS-高可用集群部署
linux·运维·hdfs
少妇的美梦2 天前
logstash教程
运维
chen9452 天前
k8s集群部署vector日志采集器
运维
chen9452 天前
aws ec2部署harbor,使用s3存储
运维
東雪蓮☆2 天前
深入理解 LVS-DR 模式与 Keepalived 高可用集群
linux·运维·服务器·lvs
qq_264220892 天前
LVS负载均衡群集和LVS+Keepalived群集
运维·负载均衡·lvs
乌萨奇也要立志学C++2 天前
【Linux】进程概念(二):进程查看与 fork 初探
linux·运维·服务器