top of page

OUR PRECONDITIONS

  • The old network infrastructure, referred to as OldNet:
    Doesn’t support 802.1x.
    Two domains on different VLAN’s with a one way trust, referred to as Enterprise and Educational.
    The two domains have their own network infrastructure, different IP Helpers, DNS, DHCP and so on.

  • The new infrastructure, referred to as NewNet:
    802.1x is required using CISCO ISE and Layer 3 switches.
    Only one fallback net with its own IP range, common for both domains, which also supports WebAuth guest access.
    The two domains still have their own IP range, DHCP, DNS etc. but will use the same PXE-server since PXE boot is taking place on the fallback network.

  • Both the old and the new network infrastructure will be used to deploy Windows 10 x64 and Windows 7 x86.

  • MAB will not be used during OSD, the network team don’t want to spread a special OSD VLAN so clients will get an IP address according to its current location and only certificate-based authentication is allowed.

  • The task sequence needs to support both the new computer and refresh scenario as well as BIOS to UEFI conversion regardless of the currently installed operating system.
    The scripts used for managing 802.1x needs to support Windows 7 and its PowerShell version.

Search
Writer's picturesomeguy100

Import certificate using an encrypted password file


One of the things the ADK had problems with was certutil.

So I made a function in powershell to import the certificate.

function ImportCert { $CurrentStep=2 $ObjLabel.Text="Importerar Certifikat" [Int]$Percentage = ($currentStep/$steps)*100 $PB.Value = $Percentage $ObjForm.Refresh() Start-Sleep -Milliseconds 150 $pfx = new-object System.Security.Cryptography.X509Certificates.X509Certificate2 $certPathPFX = "$ScriptDir\Cert.PFX" $certPathCA= "$ScriptDir\RootCA.cer" $Keyfile="$ScriptDir\key.aes" $Import="$ScriptDir\Import.txt" $Key=Get-Content $KeyFile $Imp=Get-Content $Import | ConvertTo-SecureString -Key $key $pfxPass=$Imp $pfx.import($certPathPFX,$pfxPass,"Exportable,PersistKeySet") $store = new-object System.Security.Cryptography.X509Certificates.X509Store( [System.Security.Cryptography.X509Certificates.StoreName]::My, "localmachine" ) $store.open("MaxAllowed") $store.add($pfx) $store.close() $pfx.import($certPathCA) $store = new-object System.Security.Cryptography.X509Certificates.X509Store( [System.Security.Cryptography.X509Certificates.StoreName]::Root, "localmachine" ) $store.open("MaxAllowed") $store.add($pfx) $store.close() }


Creating an encrypted password file.


#Creates random AES-key $KeyFile = ".\key.aes" $Key = New-Object Byte[] 16 [Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($Key) $Key | out-file $KeyFile #Creates the file with the encrypted password #Where "PW" is the password for the certificate. $PwFile = ".\import.txt" $KeyFile = ".\key.aes" $Key = Get-Content $KeyFile $Password = "PW"| ConvertTo-SecureString -AsPlainText -Force $Password | ConvertFrom-SecureString -key $Key | Out-File $PwFile

This creates these 2 files which can be included in a package amongs with the certificate in question and a script that imports it.



Importing the certificate this way also prevents the password from being visible in the smsts log.

361 views0 comments

Comments


bottom of page