デジサートがDV証明書を発行する前に、証明書申請に含まれるドメインに対する利用権の証明が行われる必要があります。
DV証明書のインストールを自動化するには、DNS統合を使用してDV証明書申請のドメインに対する利用権を証明します。このDCV方式では、申請を送信する前にDNS統合を作成する必要があります。
DNS統合は、デジサートの自動化サービスがDNSサーバーにDNSチャレンジを設置して、検証チェックを完了するために認証情報を使用できるようにします。DNSチャレンジは、自動化プロセスの一環として自動的に生成されます。ドメインの検証が完了すると、自動化が正常に行われ、DV証明書をインストールします。
DNS統合は、サポートされるDNSプロバイダー、またはカスタマイズされたDNSスクリプトを使用して作成できます。
例:DNSチャレンジ
example.com,example1.com,example2.com dns-txt-token 342893284294sfjdkfjshfCOPY
ターゲットロードバランサーがセンサーに追加されていることを確認します。「センサー設定を確認して確定する」を参照してください。
サポートされているDNSを使用します。以下の「自動化対応のDNSプロバイダーを表示する」を参照してください。
センサーホストにログインします。
センサーのCLIディレクトリに移動します。
cd install_dir/cli
このinstall_dirは、センサーのインストールディレクトリです。
listsupporteddns
コマンドを実行します。Windows:
listsupporteddns.bat
Linux:
./listsupporteddns.sh
Amazon Route 53 |
Azure |
Cloudflare |
CloudXNS |
Digital Ocean |
DNS Trust Manager (DNS Made Easy) |
DreamHost |
GoogleDNS |
Go Daddy |
NS1 |
OVH |
RFC2136 |
Sakura Cloud |
センサーホストにログインします。
センサーのCLIディレクトリに移動します。
cd install_dir/cli
このinstall_dirは、センサーのインストールディレクトリです。
adddnsintegration
コマンドを実行します。Windows:
adddnsintegration.bat -type <dns_provider_name>
Linux:
./adddnsintegration.sh -type <dns_provider_name>
コマンドを入力すると、各プロバイダーの一連のプロンプトが表示されます。情報を入力して、Enterを押します。
例:adddnsintegration.bat -type route53
C:\Program Files\DigiCert\DigiCert sensor\cli>adddnsintegration.bat -type route53 Sensor CLI. Copyright 2023, DigiCert Inc. Add a DNS integration to automate DV certificates. Enter alias:Route53Valid Access key id:AKIAZC26PJRAX775JVKE Secret key: Confirm secret key: DNS integration route53 added. After adding the DNS integration, go back to CertCentral and link the integration to the load balancer where you want to automate a DV certificate.
開始する前に、DV証明書のインストールを自動化するオペレーティングシステム用のDNSスクリプトを作成します。スクリプトを作成する、またはサンプルスクリプトのいずれかを変更して独自のスクリプトを定義することができます。
重要
デジサートは、センサーのインストールディレクトリなどのデフォルトの場所にスクリプトを設置することをお勧めします。例:sensorinstalldir/localscripts/script-to-upload.bat
Windowsの場合は、ドメインの利用権を証明するためにDNS .batスクリプトと埋め込みのPowerShellポストスクリプト(.ps1、.py、.ps、またはその他形式)の2つのスクリプトが必要になります。
Notepad、またはその他のテキスト編集ツールを開きます。
ログイン認証情報、DNSチャレンジ、および終了コードを定義します。
.ps1、.py、.ps、または使用したいその他の拡張子を使用してファイルを保存します。保存場所をメモしておくようにしてください。
Notepad、またはその他のテキスト編集ツールを開きます。
PowerShellポストスクリプトのファイルの場所のパス、DNSチャレンジを渡すための引数、および終了コードを定義します。
.bat拡張子を使用してファイルを保存します。保存場所をメモしておくようにしてください。
Linuxの場合は、ドメインの利用権を証明するためにDNS .shスクリプトが必要になります。
Notepad、またはその他のテキスト編集ツールを開きます。
ログイン認証情報、DNSチャレンジ、および終了コードを定義します。
.sh拡張子を使用してファイルを保存します。保存場所をメモしておくようにしてください。
センサーホストにログインします。
センサーのCLIディレクトリに移動します。
cd install_dir/cli
このinstall_dirは、センサーのインストールディレクトリです。
adddnsintegration
コマンドを実行します。Windows:
adddnsintegration.bat -type custom
Linux:
./adddnsintegration.sh -type custom
コマンドを入力すると、一連のプロンプトが表示されます。情報を入力して、Enterを押します。
例:./adddnsintegration.sh -type custom
[root@c7-sowjanya-124 cli]# ./adddnsintegration.sh -type custom Sensor CLI. Copyright 2023, DigiCert Inc. Add a DNS integration to automate DV certificates. Enter alias:CustomeDNS Script file path:/tmp/test.sh DNS integration custom added. After adding the DNS integration, go back to CertCentral and link the integration to the load balancer where you want to automate a DV certificate.
開始するプログラムはすべて終了コードで終了し、それをオペレーティングシステムに報告します。終了コード(戻りコードと呼ばれることもあります)は、実行可能ファイルによって親プロセスに返されるコードです。
#ensure AWS PStools are installed incl
#https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up-windows.html
#Install-Module -Name AWS.Tools.Installer
#Install-AWSToolsModule AWS.Tools.Route53
#Set-AWSCredential -AccessKey <accesskey> -SecretKey <secretkey> -StoreAs TestDNSProfile
Import-Module AWSPowerShell
Function Set-R53Record {
# Entry parameters
Param (
[Parameter(Mandatory=$True)] [String]$Profile,
[Parameter(Mandatory=$True)][String]$Domain,
[Parameter(Mandatory=$True)][String]$Type,
[Parameter(Mandatory=$True)][String]$Name,
[Parameter(Mandatory=$True)][String]$Value,
[Int]$TTL = 300,
[String]$Comment
)
$DomainDot = $Domain + "."
# Create two objects for R53 update
$Change = New-Object Amazon.Route53.Model.Change
$Change.Action = "UPSERT"
# CREATE: Creates a resource record set that has the specified values.
# DELETE: Deletes an existing resource record set that has the specified values.
# UPSERT: If a resource record set doesn't already exist, AWS creates it. If it does, Route 53 updates it with values in the request.
$Change.ResourceRecordSet = New-Object Amazon.Route53.Model.ResourceRecordSet
$Change.ResourceRecordSet.Name = "$Name.$Domain"
$Change.ResourceRecordSet.Type = $Type
$Change.ResourceRecordSet.TTL = $TTL
# For TXT-based DNS challenges, value must be in quotes
$challengeValue = if ($Type -eq "TXT") {"""$Value"""} else {$Value}
$Change.ResourceRecordSet.ResourceRecords.Add(@{Value=$challengeValue})
# Get hosted zone
$HostedZone = Get-R53HostedZones -ProfileName $Profile| Where-Object { $DomainDot.EndsWith($_.Name) }
Write-Output "Found HostedZone:$HostedZone"
# Set final parameters and execute
$Parameters = @{
HostedZoneId = $HostedZone.Id
ChangeBatch_Change = $Change # Object
ChangeBatch_Comment = $Comment # "Edited A record"
}
return Edit-R53ResourceRecordSet -ProfileName $Profile @Parameters
}
if($args.Length -ne 1){
Write-Output "Args not found"
exit -1;
}
$fileInput = Get-Content $args[0]
if ($fileInput.Length -lt 3){
Write-Output "File not found"
exit -1;
}
$tempDomains = $fileInput[0].Split(",")
$challenge = $fileInput[2]
$domains = @()
foreach ($d in $tempDomains)
{
if ("$d" -ne "null")
{
Write-Output $d
$domains = $domains += $d
}
}
foreach ($domain in $domains)
{
Set-R53Record -Profile DNSProfileName -Domain $domain -Type "TXT" -Name "_dnsauth" -Value $challenge -TTL 86400 -Comment "DNS challenge for $domain"
}
echo "Invoking DNS script" pushd %~dp0 powershell.exe -File {DNSPostscriptPath} %* echo "Exit Code : %errorlevel%" set returnCode=%errorlevel% popd EXIT /B %returnCode%
注記
%*はDNSチャレンジを決定します。これは、ポストスクリプトからその値を取得します。
#!/usr/bin/bash
set_R53_Record(){
Profile=$1
Domain=$2
Type=$3
Name=$4
Value=$5
TTL=$6
Comment=$7
DomainDot="$Domain."
echo "Profile:$Profile Domain:$Domain"
HOSTEDZONEID=$(/usr/local/bin/aws route53 list-hosted-zones --profile $Profile | jq '.HostedZones | .[] | select(.Name|inside('\"$DomainDot\"')) | .Id' | tr -d '"')
cat > change-batch.json << EOL
{"Comment":"$Comment","Changes":[{"Action":"UPSERT","ResourceRecordSet":{"Name":"$Name.$Domain","Type":"$Type","TTL":$TTL,"ResourceRecords":[{"Value":"\"$Value\""}]}}]}
EOL
/usr/local/bin/aws route53 change-resource-record-sets --hosted-zone-id $HOSTEDZONEID --profile $Profile --change-batch file://change-batch.json
}
if [ "$#" -ne 1 ]; then
echo "Args not found"
exit -1;
fi
IFS=$'\n' read -d '' -r -a lines < $1
if [ ${#lines[@]} != 3 ]; then
echo "File not found"
exit -1;
fi
challenge=${lines[2]}
IFS=',' read -ra domains <<< "${lines[0]}"
for domain in "${domains[@]}"; do
set_R53_Record default $domain "TXT" "_dnsauth" $challenge 86400 "DNS challenge for $domain"
done
ロードバランサーでのDV証明書自動化のためにセンサーにDNS統合またはプロバイダーを追加して設定するためのWindowとLinuxコマンドです。
コマンド | 構文 | 説明 |
---|---|---|
Windows: |
| DNS統合を追加してDV証明書を自動化します。 |
Linux: |
| |
Windows: | - | サポートされるDNSプロバイダーの完全なリストを表示します。 |
Linux: | ||
Windows: |
| センサーに設定されたDNS統合のリストを表示します。 |
Linux: |
| |
Windows: |
| DNS統合を更新します。 |
Linux: |
| |
Windows: |
| センサーからDNS統合を削除します。 |
Linux: |
|