Skip To Content

도메인 인증서 생성

ArcGIS Enterprise는 HTTPS를 사용하므로 포털에 인증서가 구성되어 있어야 합니다. 2017년부터 Chrome 인터넷 브라우저는 주체 대체 이름(SAN) 매개변수가 포함된 도메인 인증서만 신뢰하고 있습니다. 이 매개변수는 IIS 관리자 응용프로그램 단독으로 구성할 수 없습니다. 즉, 해당 워크플로에서 생성된 인증서는 Chrome에서 신뢰하지 않습니다.

대부분의 경우 IT 관리자는 사용자에게 필수 도메인 인증서를 제공합니다. 아래 스크립트에서는 SAN이 포함된 인증서를 생성한 다음 포털로 가져올 수 있는 형식으로 IIS 관리자에서 내보냅니다.

인증서 스크립트 저장 및 실행

도메인 인증서를 생성하려면 도메인에 인증 기관이 있고 머신에 IIS 관리자가 설치되어 있어야 합니다. 이 워크플로에는 스크립트 창과 명령 프롬프트 창이 모두 제공되는 Windows PowerShell ISE 환경이 권장됩니다.

호스트 이름의 인증서가 머신에 있는 경우, 스크립트에서는 기존 인증서를 덮어쓸지 여부에 대한 메시지가 표시됩니다.

  1. 관리자 권한으로 실행 옵션을 사용하여 머신에서 Windows PowerShell ISE 응용프로그램을 열고 스크립트를 생성합니다.
  2. 아래 텍스트를 응용프로그램의 스크립트 창에 복사합니다.
  3. 스크립트를 .ps1 파일(예시: certificateScript.ps1)로 저장합니다.
  4. ISE 응용프로그램의 명령 프롬프트 패널에서 디렉터리를 스크립트가 저장된 디렉터리로 변경한 후 .\certificateScript.ps1 스크립트를 실행합니다.

PowerShell에서 실행할 인증서 스크립트

function New-CertificateRequest {
    param ( [string]$hostname )
 
    $CATemplate = "WebServer"
    $CertificateINI = "cert.ini"
    $CertificateREQ = "cert.req"
    $CertificateRSP = "cert.rsp"
    $CertificateCER = "cert.cer"
    $Subject = 'Subject="CN=' + $hostname + '"'
    $FriendlyName = 'FriendlyName=' + $hostname
    $SAN = '_continue_ = "dns=' + $hostname + '&"'
 
    ### INI file generation
    new-item -type file $CertificateINI -force
    add-content $CertificateINI '[Version]'
    add-content $CertificateINI 'Signature="$Windows NT$"'
    add-content $CertificateINI ''
    add-content $CertificateINI '[NewRequest]'
    add-content $CertificateINI $Subject
    add-content $CertificateINI 'Exportable=TRUE'
    add-content $CertificateINI 'KeyLength=2048'
    add-content $CertificateINI 'KeySpec=1'
    add-content $CertificateINI 'KeyUsage=0xA0'
    add-content $CertificateINI 'MachineKeySet=True'
    add-content $CertificateINI 'ProviderName="Microsoft RSA SChannel Cryptographic Provider"'
    add-content $CertificateINI 'ProviderType=12'
    add-content $CertificateINI 'SMIME=FALSE'
    add-content $CertificateINI 'RequestType=PKCS10'
    add-content $CertificateINI $FriendlyName
    add-content $CertificateINI '[Strings]'
    add-content $CertificateINI 'szOID_ENHANCED_KEY_USAGE = "2.5.29.37"'
    add-content $CertificateINI 'szOID_PKIX_KP_SERVER_AUTH = "1.3.6.1.5.5.7.3.1"'
    add-content $CertificateINI 'szOID_PKIX_KP_CLIENT_AUTH = "1.3.6.1.5.5.7.3.2"'
    add-content $CertificateINI 'szOID_SUBJECT_ALT_NAME2 = "2.5.29.17"'
    add-content $CertificateINI '[Extensions]'
    add-content $CertificateINI '2.5.29.17 = "{text}"'
    add-content $CertificateINI $SAN

 
    ### Certificate request generation
    if (test-path $CertificateREQ) {del $CertificateREQ}
    certreq -new $CertificateINI $CertificateREQ
 
    ### Online certificate request and import
    if ($OnlineCA) {
        if (test-path $CertificateCER) {del $CertificateCER}
        if (test-path $CertificateRSP) {del $CertificateRSP}
        certreq -submit -attrib "CertificateTemplate:$CATemplate" -config $OnlineCA $CertificateREQ $CertificateCER
        certreq -accept $CertificateCER
    }
    
    ### Delete certificate request files
    if (test-path $CertificateINI) {del $CertificateINI}
    if (test-path $CertificateREQ) {del $CertificateREQ}
    if (test-path $CertificateRSP) {del $CertificateRSP}
    if (test-path $CertificateCER) {del $CertificateCER}
}

## Main
if ($args.length -ne 0) {$hostname = $args[0]}
else {$hostname = "$env:computername.$env:userdnsdomain".ToLower()}

# Check if a CA exists in the domain and if IIS is installed
if (@(certutil -dump | select-string "Config:")) {
    $OnlineCA = (certutil -dump | select-string "Config:")[-1].Line.replace("``",'"').replace("'",'"').split('"')[1]
} else {
    Write-Host "Unable to determine certificate authority (CA) for this domain"
    Exit
}
if (-not @(Get-Service W3SVC -ErrorAction Ignore)) {
    Write-Host "IIS is not installed on this machine"
    Exit
}

# Check if a certificate already exists and prompt user to overwrite
if (@(Get-ChildItem cert:\LocalMachine\My | where-object { $_.FriendlyName -eq "$hostname" }).count -ne 0) {
    Write-Host "A certificate for $hostname already exists"
    $reply = Read-Host -Prompt "Overwrite existing certificate? (y/n)"
    if ( $reply -notmatch "[yY]" ) { Exit }
    Get-ChildItem cert:\LocalMachine\My | where-object { $_.FriendlyName -eq "$hostname" } | Remove-Item
}
New-CertificateRequest -hostname $hostname > $null
Write-Host "`nCreated a new certificate for $hostname"

# Create https binding if necessary and add new cert to https binding
import-module WebAdministration
if (@(Get-WebBinding -name "Default Web Site" | Where-Object {$_.protocol -eq "https"}).count -eq 0) {
    New-WebBinding -name "Default Web Site" -Protocol https -Port 443
    Write-Host 'Created https binding for "Default Web Site"'
}
if (@(netsh http show sslcert ipport="0.0.0.0:443" | select-string -pattern "IP:port").count -ne 0) {
    netsh http delete sslcert ipport="0.0.0.0:443" > $null
}
$cert = (Get-ChildItem cert:\LocalMachine\My | where-object { $_.FriendlyName -eq "$hostname" } | Select-Object -First 1).Thumbprint
$guid = [guid]::NewGuid().ToString("B")
netsh http add sslcert ipport="0.0.0.0:443" certhash=$cert certstorename=MY appid="$guid" > $null
Write-Host "Updated https binding to use this certificate"

# Export certificate to .pfx (Windows 2012 and higher)
$scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
if ([Environment]::OSVersion.Version -ge (new-object 'Version' 6,2)) {
    $pfxname = $hostname.Split(".")[0]
    if ($pfxname -eq '*') {$pfxname = "wildcard"}
    $pfxname = $pfxname + ".pfx"
    Remove-Item $scriptPath\$pfxname -ErrorAction Ignore
    $pfxpwd = ConvertTo-SecureString -String "certificate" -Force -AsPlainText
    $cert = (Get-ChildItem cert:\LocalMachine\My | where-object { $_.FriendlyName -eq "$hostname" } | Select-Object -First 1).Thumbprint
    Get-ChildItem -Path cert:\localMachine\My\$cert | Export-PfxCertificate -FilePath $scriptPath\$pfxname -Password $pfxpwd -ChainOption EndEntityCertOnly > $null
    Write-Host "Exported certificate in PFX format with password 'certificate' to"
    Write-Host "    $scriptPath\$pfxname"
}

# Export domain CA root certificate to domainRoot.cer
Remove-Item $scriptPath\domainRoot.cer -ErrorAction Ignore
certutil -config $OnlineCA '-ca.cert' $scriptPath\domainRoot.cer > $null
Write-Host "Exported domain root certificate to"
Write-Host "    $scriptPath\domainRoot.cer"

기존 배포에 새 인증서 가져오기

ArcGIS Enterprise 배포가 이미 설정되어 있는 경우 아래 단계에 따라 새 인증서를 ArcGIS Enterprise portal 및 호스팅 서버에 가져오고 해당 인증서를 양쪽 컴포넌트의 기본 웹 인증서로 설정할 수 있습니다.

이 단계에서는 스크립트에서 내보낸 두 인증서 파일(.cer 파일의 도메인 루트 인증서와 .pfx 파일의 서버 인증서)을 가져오는 방법을 안내합니다. 두 파일의 위치는 스크립트가 저장된 동일한 폴더여야 하며 스크립트 실행 시 명령 프롬프트 결과에도 제공됩니다.

  1. https://sample.domain.com:7443/arcgis/portaladmin에서 ArcGIS Portal 관리자 디렉터리에 로그인합니다.
  2. 보안 > SSL 인증서로 이동한 다음 루트 또는 중간 인증서 가져오기를 클릭합니다.
  3. 인증서 별칭과 위의 스크립트에서 내보낸 domainRoot.cer 파일의 경로를 제공합니다. 가져온 후 포털을 다시 시작하지 않음 옵션을 선택하고(7단계 작업에서 포털을 다시 시작하게 됨) 가져오기를 클릭합니다.
  4. SSL 인증서로 다시 돌아간 다음 기존 서버 인증서 가져오기를 클릭합니다.
  5. 인증서 비밀번호(certificate)와 루트 인증서에 지정한 별칭과 다른 인증서 별칭을 입력한 다음 머신의 .pfx 파일 위치로 이동합니다. 가져오기를 클릭합니다.
  6. SSL 인증서 페이지로 돌아가서 업데이트를 클릭합니다.
  7. 웹서버 SSL 인증서의 값을 5단계에서 가져온 .pfx 인증서의 별칭으로 바꿉니다. 업데이트를 클릭합니다.

    포털이 다시 시작되며 이 작업은 몇 분 정도 걸릴 수 있습니다.

  8. https://sample.domain.com:6443/arcgis/admin에서 ArcGIS Server 관리자 디렉터리에 로그인합니다.
  9. 머신 > <머신 이름> > SSL 인증서로 이동한 다음 루트 또는 중간 인증서 가져오기를 클릭합니다.
  10. 3단계와 같이 별칭을 입력하고 domainRoot.cer 파일 위치로 이동합니다. 가져오기를 클릭합니다.
  11. 머신 페이지로 돌아간 다음 기존 서버 인증서 가져오기를 클릭합니다.
  12. 비밀번호(certificate)와 머신의 .pfx 인증서 위치를 입력합니다. 제출을 클릭합니다.
  13. 머신 페이지로 돌아가서 편집을 클릭합니다.
  14. 웹 서버 SSL 인증서의 값을 새 도메인 인증서의 별칭으로 바꿉니다. 편집 내용 저장을 클릭합니다.

    서버 머신이 다시 시작되며 이 작업은 몇 분 정도 걸릴 수 있습니다.

ArcGIS Enterprise portal과 호스팅 서버의 새 인증서를 모든 웹 브라우저에서 신뢰하게 됩니다.