To remotely manage a Microsoft Active Directory domain controller, you need to configure an HTTPS connection and authorization with a self-signed certificate via WinRM (Windows remote management technology).
Configuring an HTTPS connection to the domain controller via WinRM
You need to configure WinRM to connect to your Microsoft Active Directory domain controller over HTTPS.
To configure a Microsoft Active Directory domain controller:
WinRM enumerate winrm/config/listener
winrm quickconfig
winrm get winrm/config/service/auth
winrm set winrm/config/service/auth '@{Certificate="true"}'
$hostName='<domain controller address>'
$hostIP='<DNS server>'
$srvCert = New-SelfSignedCertificate -DnsName $hostName,$hostIP -CertStoreLocation <path to certificate>
$srvCert variable is set to the value from the step above by running the following command:$srvCert
Listener exist by running the following command:Get-ChildItem wsman:\localhost\Listener
Listener for HTTPS by running the following command:Get-ChildItem wsman:\localhost\Listener\ | Where-Object -Property Keys -like 'Transport=HTTPS*' | Remove-Item -Recurse
Listener instance for HTTPS with the issued certificate by running the following command:New-Item -Path WSMan:\localhost\Listener\ -Transport HTTPS -Address * -CertificateThumbPrint $srvCert.Thumbprint -Force
Restart-Service WinRM
The Microsoft Active Directory domain controller is configured and ready for use. You can proceed to setting up a connection to WinRM.
Configuring a connection to WinRM using a certificate
You need to allow WinRM connections with the user certificate that was issued while configuring the HTTPS connection. After this, entering the user name and password to connect to WinRM will no longer be necessary.
You need a service account in Microsoft Active Directory for the user identity service.
To configure the WinRM connection with a certificate:
winrm configSDDL default
New-SelfSignedCertificate -Type Custom `
-Container test* -Subject "CN=uaws" `
-TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.2","2.5.29.17={text}upn=<user name>") `
-KeyUsage DigitalSignature,KeyEncipherment `
-KeyAlgorithm RSA `
-KeyLength 2048 `
uawsuser.cer file:Get-ChildItem <path to certificate>\<certificate fingerprint> | Export-Certificate -FilePath uawsuser.cer -Type Cert
uawsuser.cer certificate to the store:Import-Certificate -FilePath .\uawsuser.cer -CertStoreLocation Cert:\LocalMachine\TrustedPeople
Import-Certificate -FilePath .\uawsuser.cer -CertStoreLocation Cert:\LocalMachine\Root
New-Item -Path <path to certificate> `
-Subject 'uaws' `
-URI * `
-Issuer <certificate fingerprint> `
-Credential (Get-Credential) `
-Force
Restart-Service WinRM
$mypwd = ConvertTo-SecureString -String '<certificate password>' -Force -AsPlainText
Get-ChildItem -Path <path to certificate>\<certificate fingerprint> | Export-PfxCertificate -FilePath <path to certificate and key>\uawsuser.pfx -Password $mypwd
uawsuser.pfx file to the primary node of the ha-node-1 cluster.uawsuser.pfx file into a certificate and key file with the .pem extension using OpenSSL:openssl pkcs12 -in uawsuser.pfx -clcerts -nokeys -out uawsuser.pem
openssl pkcs12 -in uawsuser.pfx -nocerts -nodes -out uawsuserkey.pem
uawsuser.pem and uawsuserkey.pem to the /var/lib/uaws/collector/ssl directory.To deploy the user identity service in a high-availability cluster, you need to do this on both the primary and the backup node.
dc section, in the user-cert and user-cert-key parameters:user-cert: "/var/lib/uaws/collector/ssl/uawsuser.pem"
user-cert-key: "/var/lib/uaws/collector/ssl/uawsuserkey.pem"
Restart-Service WinRM
Remote connection to the Microsoft Active Directory domain controller via WinRM using a certificate is successfully configured.
Page top