我有一个通过Digital Ocean运行的Ubuntu服务器,它有一个通过LetsEncrypt获得的SSH证书。
我试图切换到一个更便宜的服务,我需要移动证书到我的新服务器。 我怎样才能做到这一点?
看起来我可以撤销当前DO服务器上的证书。 然后,我可以在我的新服务器上新build一个没有任何问题吗?
其中一些已经说过,但只是给一个完整的答案。 我已经开始使用一些公共服务的LE证书。 移动的选项几乎是不受限制的,更依赖于你用来请求证书的项目。 一旦你获得了证书,你可以将密钥和证书导出到一个文件,以移动到你喜欢的任何服务。 你不需要撤销任何东西来获得新的证书。 由于LE证书的使用寿命短(3个月)和免费,所以我认为它们被视为一次性使用。
我已经使用eBekker项目的ACMEsharpbuild立一个PowerShell脚本来自动获得一个新的证书。 这是我迄今为止。 它目前必须在Web服务器上运行。
https://github.com/ebekker/ACMESharp
## This requires the ACMESharp module from EBekker #Import-Module AcmeSharp $dns = "www.example.com" $webRoot = "C:\inetpub\wwwroot" $idRef = "$($dns.Replace('.','-'))-$(Get-Date -Format "yyyy-MM-dd_HH-mm")" $certRef = "cert-$($dns.Replace('.','-'))-$(Get-Date -Format "yyyy-MM-dd")" Import-Module AcmeSharp Write-Host "Getting a new challenge" New-ACMEIdentifier -Dns $dns -Alias $idRef | Out-Null $challanges = Complete-ACMEChallenge -IdentifierRef $idRef -ChallengeType http-01 -Handler manual $httpChallenge = ($challanges.Challenges | Where-Object {$_.Type -like 'http-01'}).Challenge Write-Host "Creating challenge folder path" New-Item -ItemType Directory -Path "$webRoot\$($httpChallenge.FilePath)" | Out-Null $challengeFilePath = "$webRoot\$($httpChallenge.FilePath)\Default.htm" if (Test-Path -Path $challengeFilePath) { Remove-Item -Path $challengeFilePath -Force } Write-Host "Adding Challenge text to the reuqested path" Add-Content -Path $challengeFilePath -Value $httpChallenge.FileContent -Force | Out-Null Write-Host "Waitin 15 sec..." Start-Sleep -Seconds 15 Write-Host "Submitting Challenge" Submit-ACMEChallenge -IdentifierRef $idRef -ChallengeType http-01 -Force | Out-Null Write-Host "Waiting 15 sec..." Start-Sleep -Seconds 15 $id = Update-ACMEIdentifier -IdentifierRef $idRef if ($id.Status -eq "pending") { Write-Host "Challenge still pending, waiting 30 sec and retrying" Start-Sleep -Seconds 30 Update-ACMEIdentifier -IdentifierRef $idRef } if ($id.Status -ne "valid") { throw "Identifier could not be validated." } else { Write-Host "Challenge appears completed. Building cert" New-ACMECertificate -IdentifierRef $idRef -Alias $certRef -Generate | Out-Null Submit-ACMECertificate -CertificateRef $certRef | Out-Null Start-Sleep -Seconds 15 Update-ACMECertificate -CertificateRef $certRef Get-ACMECertificate -CertificateRef $certRef -ExportKeyPEM C:\SSL\$dns.key.pem -ExportCertificatePEM C:\SSL\$dns.crt.pem -ExportPkcs12 C:\SSL\$dns.pfx #Install Cert #Install-ACMECertificateToIIS -Certificate $certRef }
假设您正在使用certbot工具来pipe理您的Let's Encrypt证书(大多数人所做的),将整个/etc/letsencrypt目录从一台服务器复制到另一台服务器就足够了。 所有的证书以及certbotconfiguration都在里面。 因此,您可以像以前一样继续使用新的服务器。
使用letsencrypt唯一的方法是保证你是站点或服务器的所有者,然后你需要: – 你必须把你的DNS指向新的服务器。 – 在新的服务器上testing证书