feat: Added new and renew powershell scripts

This commit is contained in:
Nathan Woodburn 2023-10-27 22:26:53 +11:00
parent 9963068905
commit 16b2e6ce96
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
3 changed files with 49 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
acme-dns.json

46
new.ps1 Normal file
View File

@ -0,0 +1,46 @@
# Install Certify The Web (if not already installed)
#> Install-Module -Name Posh-ACME
$domain = 'example.com'
# Will do wildcard for *.$domain in addition to root
# Make an HTTP POST request
$response = Invoke-RestMethod -Uri "https://auth.acme-dns.io/register" -Method Post
# Print Instructions
Write-Host "Please add the following CNAME to your DNS:"
Write-Host "Host: _acme-challenge"
Write-Host "Target: "
$response.fulldomain
# Save response to use later
$response | ConvertTo-Json | Out-File -FilePath .\acme-dns.json
# Wait for DNS to update
Write-Host "Press any key after adding record..."
$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
# Read file back in (if you closed the shell)
# $response = Get-Content -Raw -Path .\acme-dns.json | ConvertFrom-Json
$reg = @{
"_acme-challenge.$domain" = @(
# the array order of these values is important
$response.subdomain
$response.username
$response.password
$response.fulldomain
)
}
$pArgs = @{
ACMEServer = 'auth.acme-dns.io'
ACMERegistration = $reg
}
$domains = '*.'+$domain,$domain
New-PACertificate $domains -Plugin AcmeDns -PluginArgs $pArgs -Verbose

1
renew.ps1 Normal file
View File

@ -0,0 +1 @@
Submit-Renewal -AllAccounts