A service of Daily Data, Inc.
Contact Form

User Tools

Site Tools


software:openssl:installca

This is an old revision of the document!


Install CA on workstations

Installation depends on the operating system of the workstation (or other device) you need the CA installed on. Note, this is only needed on workstations or machines which will be accessing the services. You do not need to install this on the servers which provide the service, though it is acceptable to do so.

For a few workstations, it is easier to do a manual install. For a more complex environment, it is better to spend some time writing scripts to do the installation for you.

Microsoft Windows

Manual Install

Automated Install

The simplest thing I can come up with is to create a share (SMB, whatever) that you can access from all machines, then place the CA Certificate (PEM file) in that share. A possible PowerShell script (untested so far) can be placed in that directory. Now, you can go to that directory on each machine and run the script. The script requires administrator privileges.

installCA.ps1
# Ensure this script runs as an administrator
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
    throw "Run this script as Administrator!"
}
 
# Define the path to the PEM file
$CurrentDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$PemFilePath = Join-Path -Path $CurrentDir -ChildPath "ca.pem"
 
# Function to check if CA is already installed
function Check-CAInstalled {
    $caExists = Get-CertificateAuthority -ErrorAction SilentlyContinue
    if ($caExists) {
        Write-Host "A Certificate Authority is already installed:" -ForegroundColor Yellow
        $caExists | Format-Table -Property CAName, CAType, CADuration
        return $true
    }
    return $false
}
 
# Check if a CA is already installed
if (Check-CAInstalled) {
    Write-Host "Exiting script as CA installation is not required." -ForegroundColor Green
    exit
}
 
# Check if PEM file exists
if (-Not (Test-Path $PemFilePath)) {
    throw "CA PEM file not found at path: $PemFilePath"
}
 
# Install the AD Certificate Services role if it’s not installed
Install-WindowsFeature -Name AD-Certificate -IncludeManagementTools
 
# Import the CA from PEM file using certutil
Write-Host "Importing the Certificate Authority from PEM file..." -ForegroundColor Cyan
 
certutil -addstore -f "ROOT" $PemFilePath
 
# Verify that the CA was imported successfully
$importedCA = Get-ChildItem Cert:\LocalMachine\Root | Where-Object { $_.Subject -like "*CN=*" }
if ($importedCA) {
    Write-Host "Successfully imported CA from PEM file:" -ForegroundColor Green
    $importedCA | Format-Table -Property Subject, Thumbprint
} else {
    Write-Host "Failed to import CA from PEM file." -ForegroundColor Red
}

Using GPO in a Windows Domain

software/openssl/installca.1760910212.txt.gz · Last modified: 2025/10/19 16:43 by rodolico