Solaris 預設可能未啟用 SSH 服務,或配置不符合安全最佳實務。以下為完整啟用與強化步驟:
pkginfo | grep SUNWssh (含 SUNWsshcu, SUNWsshdr, SUNWsshdu, SUNWsshr, SUNWsshu)。缺失時從 Solaris DVD/ISO 安裝:pkgadd -d /path/to/DVD/Solaris_10/Product SUNWssh*。pkg install pkg://solaris/network/ssh (通常預裝)。svcadm enable network/ssh
svcs -l network/ssh # 確認狀態為 online
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePAM yes
AllowUsers adminuser @wheelgroup
# 或 AllowGroups sshusers
MaxAuthTries 3
LoginGraceTime 30
ClientAliveInterval 300
ClientAliveCountMax 2
Banner /etc/issue
LogLevel VERBOSE
# 限制加密演算法 (現代建議)
Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes256-ctr
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N ""
ssh-keygen -t ecdsa -b 521 -f /etc/ssh/ssh_host_ecdsa_key -N ""
ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N ""
ssh-keygen -t ed25519 (推薦) 或 RSA 4096。~/.ssh/authorized_keys (權限 600,目錄 700)。ssh-copy-id user@solaris-host 自動部署。svcadm restart network/ssh
ssh -v user@localhost # 本機測試金鑰登入
/etc/ipf/ipf.conf):pass in quick proto tcp from any to any port = 22 keep state。pf (Solaris 11.4+) 或 fail2ban (需 Python 環境) 封鎖多次失敗 IP。auditconfig -setpolicy +argv
auditconfig -setflags lo,ex,ss
# 登入/登出、執行、SSH 事件將記錄至 /var/audit/
驗證清單: Root 禁登、密碼禁用、金鑰強制、強加密套件、閒閒逾時斷線、暴力破解防護、完整稽核日誌。