問題描述
JumpServer會定期對資產列表進行遍歷更新,它會更新主機的資產信息,如CPU、MEM、DISK、操作系統等信息。此功能是基於SSH完成的,因此Linux可以直接獲取到相應的信息,但Windows無法直接獲取信息。
那麼該如何讓Windows也具備相應的信息呢?
問題解決
-
OpenSSH組件下載
https://github.com/PowerShell/Win32-OpenSSH/releases/latest -
解壓後,將其重命名到 C:\Program Files\OpenSSH
-
通過管理員身份的方式打開 powershell
-
安裝OpenSSH組件
cd "C:\Program Files\OpenSSH"
powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1
Windows防火牆配置
New-NetFirewallRule -Name sshd -DisplayName ‘OpenSSH Server (sshd)’ -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
- OpenSSH服務啓動配置
net start sshd
Set-Service sshd -StartupType Automatic
-
Windows資產增加SSH協議
在 web 的資產列表裏面找到你的 windows 資產, 在協議組裏面加入 rdp 3389, 再添加一個 ssh 22
-
遠程測試
ssh 登錄的賬戶密碼與登錄 windows 系統的賬戶密碼一致
參考資料
Windows 2019設置OpenSSH組件
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
Ansible can generally manage Windows versions under current and extended support from Microsoft. Ansible can manage desktop OSs including Windows 7, 8.1, and 10, and server OSs including Windows Server 2008, 2008 R2, 2012, 2012 R2, 2016, and 2019.
https://docs.ansible.com/ansible/latest/user_guide/windows_setup.html