Let’s Encrypt na Windows Server 2016 – PowerShell a ACMESharp #2 – skript PoC

Rychlá a nedokonalá implementace automatizace vystavování nových Let’s Encrypt certifikátů pro Web Application Proxy na Windows Serveru 2016. Samozřejmě předpokládáme již nakonfigurované prostředí (vault, ověřené domény a definované aliasy pro domény)  – např. podle http://www.jan-zak.cz/lets-encrypt-ws2016-powershell-acmesharp/  🙂

Doporučná perioda vystavování je 60 dnů, takže stačí nastavit Task Scheduler na každé dva měsíce a máme vystaráno (samozřejmě dokud se něco nezmění na straně LE).

####################################################################################################
######## This script generates new Let’s Encrypt certificate (vault has to be already configured)
######## Version 1.0 (2016-12-31), PoC only, no errors handling implmented
######## Jan Zak (www.jan-zak.cz)
####################################################################################################

### Get variables ####
$Path2Module="C:\ACME\ACMESharp\0.8.1\ACMESharp.psd1" #Load module file directly instad of "Import-Module ACMESharp"
$DomainAlias="fscloudtestcz" #Already configured alias in ACME vault
$DomainSANAlias="fscloudtestcz","appcloudtestcz","claimappcloudtestcz" #Already configured aliases in ACME vault
$CertificatePwd="Password123"
$CertificatePwdSecure=ConvertTo-SecureString -String $CertificatePwd -Force -AsPlainText
$WorkDir="C:\ACME\Certificates\"
$Date2Name=Get-Date -Format yyyyMMdd_HHmm
$CertificateAlias="fscloudtestcz_cert_" + $Date2Name
$CertificatePath=$WorkDir + $DomainAlias + "_" + $Date2Name + ".pfx"
$CAName="Let's Encrypt Authority X3" #To identify LE certificates during cean-up phase

### Create and submit request ###
Import-Module $Path2Module
New-ACMECertificate $DomainAlias -Generate -AlternativeIdentifierRefs $DomainSANAlias -Alias $CertificateAlias
Submit-ACMECertificate $CertificateAlias
Update-ACMECertificate $CertificateAlias
Get-ACMECertificate $CertificateAlias -ExportPkcs12 $CertificatePath -CertificatePassword $CertificatePwd

### Import certificate into Win Cert Store, delete expired certificates and source .pfx file
Import-PfxCertificate $CertificatePath -Password $CertificatePwdSecure -CertStoreLocation Cert:\LocalMachine\My\ -Exportable
Remove-Item $CertificatePath -Force
Get-ChildItem Cert:\LocalMachine\My |? Issuer -Like "CN=$CAName*" |? NotAfter -LT (Get-Date) |Remove-Item

### Set new certificate as active (example only!)
$NewCertThumbprint=Get-ChildItem Cert:\LocalMachine\My |? Issuer -like "CN=$CAName*" |? NotBefore -GT ((Get-Date).AddMinutes(-120)) |Select-Object Thumbprint
Set-WebApplicationProxySslCertificate -Thumbprint $NewCertThumbprint.Thumbprint #Optional, configures WebApplicationProxy with a new certificate

 

ADFS 4 (2016) není schopen přidat nebo aktualizovat RPT z metadat

Taková škaredá chyba v GUI ADFS serveru 2016 – v posledních buildech nelze aktualizovat RPT z metadat, a dokonce není možné vytvořit nový RPT.
Veškeré pokusy končí chybyou „An error occured during an attempt to read the federation metadata. Verify that specified URL or host name is valid federation metadata endpoint.“
2016-11-27_10-44-46

Naštěstí je možné použít např. Add-AdfsRelyingPartyTrust nebo Update-AdfsRelyingPartyTrust:

2016-11-27_10-44-46_01

Tak snad nám to soudruzi z Redmondu brzy opraví.

ADAL a ADFS authorization rules

Office modern authentication (ADAL) v O365 tenantu (OAuth2ClientProfileEnabled: True) znefunkční ADFS authorization rule „Block all external access to Office 365 except Browser-based apps“.

http://social.technet.microsoft.com/wiki/contents/articles/30253.office-2013-and-office-365-proplus-modern-authentication-and-client-access-filtering-policies-things-to-know-before-onboarding.aspx 

Block all external access to Office 365 except Browser-based apps Implement conditional policies in Office 365/Azure AD to block “Rich Client” traffic (allow on ADFS). This scenario is not yet supported for public preview and we recommend organizations that rely on this scenario to not onboard their tenants for modern authentication.

If scenario # 3 applies to you, and you enable modern authentication on your tenant, rich clients (Outlook and other Office apps) will be able to bypass your client access filtering policies and in ADFS access resources like Exchange Online and SharePoint online.

 

Zapnutí ADALu: HKCU\SOFTWARE\Microsoft\Office\15.0\Common\Identity\EnableADAL – REG_DWORD – 1

Vypnutí DALu: HKCU\SOFTWARE\Microsoft\Office\15.0\Common\Identity\EnableADAL – REG_DWORD – 0

Nové smart linky pro O365

Tak nám Microsoft změnil způsob přesměrování z O365/SharePoint Online na ADFS – už tam není HTTP 302 ale JSON.

Takže původní návod http://blog.kloud.com.au/2012/10/12/office-365-smart-links/ se nedá použít.

Alternativa snad může být http://web.sharepointedutech.com/?p=1395 – ale výsledný link mi prozatím nefunguje správně. Budu to holt muset rozebrat :/

Změna hesla přes ADFS3

Na tohle admini čekali od spuštění O365, a MS to tak nějak potichu vypustil:

ADFS 2012 R2 now supports Password Change (not reset) across all devices

http://blogs.msdn.com/b/samueld/archive/2015/05/13/adfs-2012-r2-now-supports-password-change-not-reset-across-all-devices.aspx

KB3035025 se mi nepodařilo ani nainstalovat, změna hesla přesto funguje (asi díky jiné záplatě).

Update: ve skutečnosti to povoluje kb3045711

Používáme cookies. Další informace

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close