Skip to content
Snippets Groups Projects

Build: Adjust STS deployment script for production

Merged Marcel Nellesen requested to merge Hotfix/748-stsCert into Sprint/2020-05
1 file
+ 10
9
Compare changes
  • Side-by-side
  • Inline
+ 10
9
$name = 'Coscine STS'
$certAuthorityName = 'Coscine STS certificate'
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue
Remove-SPTrustedIdentityTokenIssuer $name
Remove-SPTrustedRootAuthority $certAuthorityName
$pfx = $( consul kv get 'coscine/global/sts/pfx' )
if(!$pfx) {
$pfxFilePath = $( Read-Host "Input the file path to the pfx file please" )
consul kv put 'coscine/global/sts/pfx' @$pfxFilePath
}
# For production, use the coscine.rwth-aachen.de pfx
$pfxFilePath = $( Read-Host "Input the file path to the pfx file please" )
consul kv put 'coscine/global/sts/pfx' @$pfxFilePath
$pfxpassword = $( consul kv get 'coscine/global/sts/pfxpassword' )
if(!$pfxpassword) {
@@ -16,13 +16,14 @@ if(!$pfxpassword) {
consul kv put 'coscine/global/sts/pfxpassword' $pfxpassword
}
$certText = consul kv get 'traefik/entrypoints/https/tls/certificates/0/certFile'
$enc = [system.Text.Encoding]::UTF8
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($pfxFilePath, $pfxpassword, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]::Exportable)
$certBytes = $cert.Export([System.Security.Cryptography.X509Certificates.X509ContentType]::Cert)
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import($enc.GetBytes($certText))
$cert.Import($certBytes)
New-SPTrustedRootAuthority -Name 'Coscine STS certificate' -Certificate $cert
New-SPTrustedRootAuthority -Name $certAuthorityName -Certificate $cert
# TODO work on Claim Mapping
# Also figure out why the search is not working
Loading