感谢您花时间观看,
我最近将 3 台服务器从 AlmaLinux 8 升级到 AlmaLinux 9(AlmaLinux 项目 ELevate)(两年前,这些服务器从 CentOS 7 升级到 AlmaLinux 8)。升级过程非常顺利,升级后我只需要重新安装 1 个软件包 Zabbix-Agent2。我可以访问这些服务器上运行的服务,网站可以完美访问,通过 SSH,我可以毫无问题地访问系统。甚至可以毫无问题地使用 ansibleuser 进行密钥对 ssh 身份验证。但是,当我使用 ansible 在这些服务器上运行一个剧本时,该剧本在过去始终有效,并且仍然可以在我们所有其他 Ubuntu 和 AlmaLinux 机器上运行,我在有问题的 3 台机器上收到以下错误:
[ /etc/ansible ]$ ansible-playbook playbooks/update-linux.yml -C -l ClamAV -vvv
ansible-playbook [core 2.14.14]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/ansibleuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /home/ansibleuser/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible-playbook
python version = 3.9.18 (main, Aug 23 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
Using /etc/ansible/ansible.cfg as config file
BECOME password:
[WARNING]: Error in vault password file loading (default): A vault password must be specified to decrypt data
Vault password:
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method
Parsed /etc/ansible/hosts inventory source with yaml plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: update-linux.yml *******************************************************************************************************************************
2 plays in playbooks/update-linux.yml
PLAY [landauer] ******************************************************************************************************************************************
TASK [Gathering Facts] ***********************************************************************************************************************************
task path: /etc/ansible/playbooks/update-linux.yml:2
<10.1.1.22> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<10.1.1.22> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=5 -o 'ControlPath="/home/ansibleuser/.ansible/cp/267bb41463"' 10.1.1.22 '/bin/sh -c '"'"'echo ~ansibleuser && sleep 0'"'"''
<10.1.1.22> (0, b'/home/ansibleuser\n', b'')
<10.1.1.22> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<10.1.1.22> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=5 -o 'ControlPath="/home/ansibleuser/.ansible/cp/267bb41463"' 10.1.1.22 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /home/ansibleuser/.ansible/tmp `"&& mkdir "` echo /home/ansibleuser/.ansible/tmp/ansible-tmp-1728362452.3175566-4768-111779545868462 `" && echo ansible-tmp-1728362452.3175566-4768-111779545868462="` echo /home/ansibleuser/.ansible/tmp/ansible-tmp-1728362452.3175566-4768-111779545868462 `" ) && sleep 0'"'"''
<10.1.1.22> (0, b'ansible-tmp-1728362452.3175566-4768-111779545868462=/home/ansibleuser/.ansible/tmp/ansible-tmp-1728362452.3175566-4768-111779545868462\n', b'')
<ClamAV> Attempting python interpreter discovery
<10.1.1.22> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<10.1.1.22> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=5 -o 'ControlPath="/home/ansibleuser/.ansible/cp/267bb41463"' 10.1.1.22 '/bin/sh -c '"'"'echo PLATFORM; uname; echo FOUND; command -v '"'"'"'"'"'"'"'"'python3.11'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.10'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.9'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.8'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.6'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python3.5'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python3'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/libexec/platform-python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python2.7'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'/usr/bin/python'"'"'"'"'"'"'"'"'; command -v '"'"'"'"'"'"'"'"'python'"'"'"'"'"'"'"'"'; echo ENDFOUND && sleep 0'"'"''
<10.1.1.22> (0, b'PLATFORM\nLinux\nFOUND\n/usr/bin/python3.9\n/usr/bin/python3\n/usr/libexec/platform-python\n/usr/bin/python\n/usr/bin/python\nENDFOUND\n', b'')
<10.1.1.22> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<10.1.1.22> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=5 -o 'ControlPath="/home/ansibleuser/.ansible/cp/267bb41463"' 10.1.1.22 '/bin/sh -c '"'"'/usr/bin/python3.9 && sleep 0'"'"''
<10.1.1.22> (0, b'{"platform_dist_result": [], "osrelease_content": "NAME=\\"AlmaLinux\\"\\nVERSION=\\"9.4 (Seafoam Ocelot)\\"\\nID=\\"almalinux\\"\\nID_LIKE=\\"rhel centos fedora\\"\\nVERSION_ID=\\"9.4\\"\\nPLATFORM_ID=\\"platform:el9\\"\\nPRETTY_NAME=\\"AlmaLinux 9.4 (Seafoam Ocelot)\\"\\nANSI_COLOR=\\"0;34\\"\\nLOGO=\\"fedora-logo-icon\\"\\nCPE_NAME=\\"cpe:/o:almalinux:almalinux:9::baseos\\"\\nHOME_URL=\\"https://almalinux.org/\\"\\nDOCUMENTATION_URL=\\"https://wiki.almalinux.org/\\"\\nBUG_REPORT_URL=\\"https://bugs.almalinux.org/\\"\\n\\nALMALINUX_MANTISBT_PROJECT=\\"AlmaLinux-9\\"\\nALMALINUX_MANTISBT_PROJECT_VERSION=\\"9.4\\"\\nREDHAT_SUPPORT_PRODUCT=\\"AlmaLinux\\"\\nREDHAT_SUPPORT_PRODUCT_VERSION=\\"9.4\\"\\nSUPPORT_END=2032-06-01\\n"}\n', b'')
Using module file /usr/lib/python3.9/site-packages/ansible/modules/setup.py
<10.1.1.22> PUT /home/ansibleuser/.ansible/tmp/ansible-local-47643ehs1jje/tmprhb1042q TO /home/ansibleuser/.ansible/tmp/ansible-tmp-1728362452.3175566-4768-111779545868462/AnsiballZ_setup.py
<10.1.1.22> SSH: EXEC scp -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=5 -o 'ControlPath="/home/ansibleuser/.ansible/cp/267bb41463"' /home/ansibleuser/.ansible/tmp/ansible-local-47643ehs1jje/tmprhb1042q '[10.1.1.22]:/home/ansibleuser/.ansible/tmp/ansible-tmp-1728362452.3175566-4768-111779545868462/AnsiballZ_setup.py'
<10.1.1.22> ESTABLISH SSH CONNECTION FOR USER: ansibleuser
<10.1.1.22> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="ansibleuser"' -o ConnectTimeout=5 -o 'ControlPath="/home/ansibleuser/.ansible/cp/267bb41463"' 10.1.1.22 '/bin/sh -c '"'"'rm -f -r /home/ansibleuser/.ansible/tmp/ansible-tmp-1728362452.3175566-4768-111779545868462/ > /dev/null 2>&1 && sleep 0'"'"''
<10.1.1.22> (0, b'', b'')
fatal: [ClamAV]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via scp: Connection closed\r\n",
"unreachable": true
}
在示例中,我使用了 ClamAV 服务器,但在另外 2 台服务器上也遇到了同样的问题。
我们设置中的其他 AlmaLinux 机器从头安装了 AlmaLinux9,并且剧本运行良好。
我还注意到,运行 DNF 时,它会给我 1 个警告:
warning: Signature not supported. Hash algorithm SHA1 not available.
我已经在 redHat 上找到了一篇关于此问题的文章,其中解释说,使用命令:“update-crypto-policies --set FUTURE”,我可以将服务器设置为较新的 SHA256/512 加密策略。但随后,我失去了与该服务器的所有可能通信,除了 HTTP(s) 和物理控制台(通过 vCenter)。我认为这一定与此有关,或者我需要重新生成某些东西。但是有没有人已经找到解决方案/线程来帮助我解决这个问题?我还有 2 台服务器要做,它们对公司来说更为重要,所以不想让它们因为这个问题而受苦太久。
非常感谢您的帮助。
啊,我在 sshd_config 文件中发现了一个差异:在从旧版 CentOS 升级到 EL8 --> EL9 的机器上,行号为:Subsystem sftp /usr/lib/openssh/sftp-server,而在其他新安装的 AlmaLinux 机器上,行号设置为:Subsystem sftp internal-sftp,更改参数并重新启动服务后,它又开始正常工作了。我要感谢 AlmaLinux 论坛提供的提示。