Con più domande
Renew certificati Lets Encrypt

Domanda
-
Ciao a tutti,
Ho creato un terminal server con distribuzione su due server distinti. Ho installato il ruolo di remote gateway e web access sul server in DMZ e i ruoli di Session Host, Connection Broker e server di Licenze nella rete interna. Ho utilizzato i certificati lets encrypt e per la generazione non ho avuto problemi, i certificati sono stati agganciati correttamente su tutti i ruoli che lo richiedevano. Il problema sorge quando eseguo la renew dei certificati utilizzando uno script in powershell, sembra che non vengono sostituiti con i certificati generati. A qualcuno è già capitato. Mi date quache consiglio? Entrambi i SO sono windows server 2016
Grazie.
Tutte le risposte
-
-
# Hacked together by Anthony Eden (https://mediarealm.com.au/)
#Credit: https://ryanmangansitblog.com/2014/06/17/deploying-rds-2012-wild-card-certificate-using-powershell/
#Credit: https://github.com/Lone-Coder/letsencrypt-win-simple/issues/400
param (
[Parameter(Mandatory=$TRUE, HelpMessage="store the certificate localy (c:\)")]
[String]
$CertificateImport,
[Parameter(Mandatory=$TRUE, HelpMessage="Connection Broker FQDN")]
[String]
$RDCB
)
if ( ((get-date) - (ls $CertificateImport).LastWriteTime).minutes -gt 10){ exit }
# This is where a temporary certificate will be stored (we delete it at the end)
$tempPfxPath = 'C:\ProgramData\win-acme\httpsacme-v01.api.letsencrypt.org'
# Import the RemoteDesktop module
Import-Module RemoteDesktop
# Create the temporary certificate
$newCertPfx = Import-PfxCertificate -FilePath $CertificateImport -CertStoreLocation Cert:\LocalMachine\My -Exportable
$tempPasswordPfx = ConvertTo-SecureString -String "TemporaryPassword" -Force -AsPlainText
Export-PfxCertificate -cert $newCertPfx -FilePath $tempPfxPath -Force -NoProperties -Password $tempPasswordPfx
Remove-Item -Path $newCertPfx.PSPath
# Configure RDPublishing Certificate for RDS
set-RDCertificate -Role RDPublishing `
-ImportPath $tempPfxPath `
-Password $tempPasswordPfx `
-ConnectionBroker $RDCB -Force `
# Configure First RDWebAccess Certificate for RDS
set-RDCertificate -Role RDWebAccess `
-ImportPath $tempPfxPath `
-Password $tempPasswordPfx `
-ConnectionBroker $RDCB -Force `
# Configure Second Certificate for RDS
set-RDCertificate -Role RDWebAccess `
-ImportPath $tempPfxPath `
-Password $tempPasswordPfx `
-ConnectionBroker $RDCB -Force `
# Configure RDRedirector Certificate for RDS
set-RDCertificate -Role RDRedirector `
-ImportPath $tempPfxPath `
-Password $tempPasswordPfx `
-ConnectionBroker $RDCB -force `
# Configure First RDGateway Certificate for RDS
set-RDCertificate -Role RDGateway `
-ImportPath $tempPfxPath `
-Password $tempPasswordPfx `
-ConnectionBroker $RDCB -force `
# Configure Second RDGateway Certificate for RDS
set-RDCertificate -Role RDGateway `
-ImportPath $tempPfxPath `
-Password $tempPasswordPfx `
-ConnectionBroker $RDCB -force `
# Cleanup the temporary PFX file
#Remove-Item -Path $tempPfxPathQuesto è lo script che utilizzo... Vorrei creare un task per automitizzare il processo, altrimenti ogni 90 giorni dovrei riassegnare i certificati manualemnte a tutti i ruoli
-
Ottieni qualche errore?
I certificati in formato PFX si trovano in una cartella che nel percorso è priva di spazi?
Ti consiglio di verificare prima di tutto che $CertificateImport venga popolato correttamente durante l'esecuzione, utilizza PowerShell ISE per eseguire il debug.
In ogni caso i comandi utilizzati nello script dovrebbero essere compatibili anche con Windows Server 2016:
https://technet.microsoft.com/it-it/library/jj215464(v=wps.640).aspx- Modificato Fabrizio GiammariniMVP, Moderator lunedì 16 luglio 2018 10:38
-
Ho verificato tutto. I certificati sono in formato PFX. La variabile viene popolata correttamente. l'unico problema che ho notato dal debug è il fatto che non mi riconosce la disribuzione dei ruoli. Però da server manager riesco a vedere correttamente tutta la distribuzione.
-
-
le istruzioni che segui sono riportate qui
https://mediarealm.com.au/articles/lets-encrypt-microsoft-remote-desktop-services/
puoi essere più preciso sull'errore che ottieni ?
Edoardo Benussi
Microsoft MVP - Cloud and Datacenter Management
e[dot]benussi[at]outlook[dot]it