重新生成ESXi的SSL证书

虚拟化9个月前发布 刘丰源
138 0 0

通过 SSH 以 Root 用户登录到 ESXi 主机的命令行,使用以下命令重新生成新的 SSL 证书

/sbin/generate-certificates
/etc/init.d/hostd restart && /etc/init.d/vpxa restart
重新生成ESXi的SSL证书

如果你不想一个一个 SSH 登录到 ESXi 主机,也可以运行下面的 Powershell 脚本(管理员身份)来重新生成新的 SSL 证书。

# Install the Posh-SSH module if not already installed
Install-Module -Name Posh-SSH -Force

# Define the ESXi host details
$esxiHost = "192.168.32.62"
$username = "root"
$password = "Vcf5@password"

# Convert the password to a secure string
$securePassword = ConvertTo-SecureString $password -AsPlainText -Force

# Create the credential object
$credential = New-Object System.Management.Automation.PSCredential ($username, $securePassword)

# Establish the SSH session
$session = New-SSHSession -ComputerName $esxiHost -Credential $credential

# Run the command to regenerate certificates
Invoke-SSHCommand -SessionId $session.SessionId -Command '/sbin/generate-certificates'

# Restart the hostd service
Invoke-SSHCommand -SessionId $session.SessionId -Command '/etc/init.d/hostd restart && /etc/init.d/vpxa restart'

# Close the SSH session
Remove-SSHSession -SessionId $session.SessionId
重新生成ESXi的SSL证书
© 版权声明

相关文章

暂无评论

暂无评论...