IT Consultant Everyday Notes

Just some problems/solutions storage

Entra ID: Enabling LDAPS for Entra ID Connect Sync.

One of my Customers has a requirement to switch connection from Entra ID Connect to AD Domain Controller from regular LDAP to LDAPS.

By default Microsoft uses a regular LDAP port 389, but the traffic is encrypted with Kerberos. A wireshark trace can easily prove that.

If you still need to switch to LDAPS you need to do it in Synchronization Manager:

RemoteDesktopManager_3OcA2Wp4RF

Please note, there is a similar settings under “Connect to Active Directory Forest” but they do not do the trick.

After restarting the service you can observe connection to port 636 and certificate usage.

Not sure if TLS is better than Kerberos signing and encryption, but the option is there.

RemoteDesktopManager_NYVunANBZY

Windows Server: A huge MachineKeys folder issue

With a server upgrade I noted a %ProgramData%\Microsoft\Crypto\RSA\MachineKeys folder contains millions of files and several GigaBytes in size.

Fortunate;ly, there is an article explaining how to clean it (modified script is in Comments section) : Remove older files in MachineKeys folder – port135.com

Azure: Nested Virtualization fails

I am building an Azure-based Lab for one of my Customers.

I selected a VM supporting Nested Virtualization (Standard_E8s_v6), but when I tried to enable Hyper-V on it I received an error:

“Hyper-V cannot be installed because virtualization support is not enabled in the BIOS”

Copilot brought suggestion to add properties.additionalCapabilities and set nestedVirtualization to True using Powershell:

Update-AzVM -ResourceGroupName <YourResourceGroup> ` -VMName <YourVMName> ` -Set @{ "additionalCapabilities.virtualization" = "true" }

unfortunately that did not work – the error says there is no such member. I tried to edit ARM directly using Resource Explorer, but got the same error:

"Could not find member 'nestedVirtualization' on object of type 'AdditionalCapabilities'. Path 'properties.additionalCapabilities.nestedVirtualization', line 1, position XXX."

Resolution:

from the new VM I run the following command in an elevated Command line:

bcdedit /set hypervisorlaunchtype auto

after that I rebooted the VM and installed Hyper-V successfully.

Intune: SSO to on-prem resources failed with cloud trust for EntraID-joined devices

Some of my Customers are moving for Entra-joined devices from Hybrid-joined scenario.

One of the question in such configuration is SSO with on-prem resources joined to a traditional AD.

When a user uses account/password combination for logon (or for lock screen) SSO works out of the box, but if there is Windows Hello for Business in picture (and it is a default) some special steps need to be performed to be sure it works when a user using a PIN (or Biometry) for logon.

The latest technique recommended by Microsoft is called “Cloud Kerberos Trust” and outlined here: Windows Hello for Business cloud Kerberos trust deployment guide | Microsoft Learn.

Please note supported and unsupported scenarios as described by Microsoft:

Supported scenarios

The scenario in this article supports SSO in both of the following instances:

Cloud resources such as Microsoft 365 and other Security Assertion Markup Language (SAML)-enabled applications.

On-premises resources, and Windows-integrated authentication to websites. The resources can include websites and SharePoint sites that require IIS authentication and/or resources that use NTLM authentication.

Unsupported scenarios

The following scenarios aren’t supported:

Windows Server Active Directory Domain Services (AD DS)-joined (on-premises only devices) deployment.

Remote Desktop Protocol (RDP), virtual desktop infrastructure (VDI), and Citrix scenarios by using a security key.

S/MIME by using a security key.

Run as by using a security key.

Log in to a server by using a security key.

There is also a Deep Dive document here: https://learn.microsoft.com/en-us/windows/security/identity-protection/hello-for-business/how-it-works-authentication#microsoft-entra-hybrid-join-authentication-using-cloud-kerberos-trust

The process is pretty straight-forward

– Check that your Domain controller in the AD-site is writable, has a certificate issued from Kerberos Authentication template (in case of Microsoft PKI, or has proper subject name and EKU (including KDC Authentication) in case of a third-party CA – see more here: https://learn.microsoft.com/en-us/windows/security/identity-protection/hello-for-business/hello-deployment-issues#resolve-on-premises-resource-access-issue-with-non-microsoft-cas) and has proper encryption policy (AES256_HMAC_SHA1) enabled as described here: https://learn.microsoft.com/en-us/entra/identity/authentication/howto-authentication-passwordless-security-key-on-premises#prerequisites

– be sure your EntraID Connect syncs attributes as described here: https://learn.microsoft.com/en-us/entra/identity/authentication/howto-authentication-passwordless-security-key-on-premises#prerequisites. Those attributes should be synced by default.

– you need to deploy Entra Kerberos (Passwordless security key sign-in to on-premises resources – Microsoft Entra ID | Microsoft Learn) which will bring an additional object under Domain Controllers container.

– after that several Windows Hello For Business policies must be assigned using Intune. Either Settings Catalog or Custom CSP can be used. I used CSP because I added a parameter CloudKerberosTicketRetrievalEnabled to get a Kerberos ticket during sign-in and that is not supported by a settings catalog (yet). The key usage is described in Peter’s article here: All about Microsoft Intune | Configuring Azure AD Kerberos authentication on Azure file shares for Windows devices

I configured the clous trust and applied WHB policies to my test device where I used a test account to log on.

I checked Event Viewer Microsoft-Windows-User Device Registration log and looked for Event ID 358 outlining WHB registration. It looked good

I also ran klist command and saw a Kerberos ticket issued by Entra.

But when I tried to access a file share where I set permissions for the user I received a logon pop-up windows which asked me to use a WNB PIN and with a message “The system cannot contact a domain controller to service the authentication request windows hello for business” in red. If I put the PIN the connection fails with access denied.

I ran a wireshark and in the trace I see the Kerberos ticket request failed with “kdc_error_client_name_mismatch” 

Resolution: As per Microsoft Doc: “Similar rules and restrictions used for RODCs apply to the AzureADKerberos computer object. For example, users that are direct or indirect members of privileged built-in security groups won’t be able to use cloud Kerberos trust.” My test user had “Builtin\Administrators” group membersip via one of other groups. So I created another non-privileged user, re-assign it as a Primary user for the Test  machine and logged in. Immediately after the logon the user got a WHB enrollment page. after that I lock the device and unlocked it using WHB PIN. Next I tried to access a file share and SSO worked as expected.


Troubleshooting resources:

dsregcmd /status

klist

klist cloud_debug

Event Viewer:

Application and Services\Microsoft\Windows\User Device Registration

Application and Services\Microsoft\Windows\SMBClient\Security

WHB CSP policies: PassportForWork CSP | Microsoft Learn

If you need to protect your DC with a Kerberos Proxy (or there is no direct sight to DC from a Client): Windows Hello for Business Cloud Trust and KDC proxy – Cloudbrothers





Windows: Separate Wi-Fi NPS policies for BYOD and Corp-owned devices

One of my Customers uses NPS to configure wifi network policies for their IoS devices.

They do have two Network Policies:

1. Wifi policy for Corp-owned devices. The policy required EAP-TLS Authentication (the clients has both root and user certificate installed)

2. Wifi policy for BYOD devices. Those devices may miss the certificates and the policy allows MSCAPv2 password-based authentication and will put the devices to a “Public” VLAN

The problem is in priority settings for the policies to be sure the right policy will be assign to a right device.

It can be done easily for windows devices using security group filtering, but IoS devices are not in AD so we needed using a different constraints condition.

The solution has been found by Brett he noted a condition “Allowed EAP Types” in Network Policy. The condition analyzes connection request policy and either allow or not allow the policy based on that.

So if CRP has MSCHAP and it is in condition of networking policy the policy will be applied, otherwise skipped. Same for EAP-TLS policy.

Here is the condition configuration;

image

PKI: Create a cloud CDP and sync CRLs using AzCopy v10

My previous article described the same process for an old version of AZCopy. Microsoft introduced the new version of AZCopy and it is not clear how long the v8 will be supported.


So, I re-created the process for the new version using the same logic:

I an copying my offline Root CA CRL and Root CA .CRT to c:\windows\system32\certsrv\certenroll folder on my Issuing CA and after that I manually copy both root and Issuing .CRT files to an Azure Storage account and create a scheduled task to SYNC all *.CRL files from that folder to a PKI container in the storage account.


Azure side:

1. Create a v2 LRS Storage account

2. Disable “Secure Transfer Required” option (revocation function uses HTTP)

3. Enable “Allow Blob Anonymous access”

4. Create a container

5. Create a Stored Access Policy allowing Read, write, delete and List

6. Create Shared Access Token which will use Stored Access Policy and set an expiration date (keep in mind that after that date the token must be updates as well as the script (see below))

7. Add a custom domain to Networking configuration of the Storage Account (you will need access to your external DNS to create a CNAME record to verify ownership)

7. Upload Root CA and Enterprise Issuing CA certificates (.CRT or .CER  files)


Script side (on an Issuing CA)

1. Downlaad AZCopy v10 (https://aka.ms/downloadazcopy-v10-windows)

2. Extract the tool from .ZIP archive and save it in a folder

3. Add a path to the folder to your SYSTEM PATH vartiable

4. Test AZcopy with Shared access token added to the container URL. Please keep in mind Microsoft note about quotation – for Powershell you must use a single quotation mark, for CMD – double quotation. Smile

so for CMD you will have something like:

azcopy sync “c:\windows\system32\certsrv\certenroll” https://<storageaccountname>.blob.core.windows.net/pki?<your Shared Access Token> –include-pattern “*.crl*”

in this example I am syncyng all files with .crl extension

check if the files will appear in Azure and verify the log to be sure only new files will be sync’ed

When happy – create a scheduled task to do the same periodically.

Azure: Private link name resolution for P2S (vWAN) VPN Clients

Goal: disable Public access to Azure KeyVault; enable access via VPN.

Options:

1. Service Endpoint

2. Private endpoint

I selected Private Endpoint, it gives more granular control.

Configuration:

1. Create a Private Endpoint for the Keyvault and publish it to a Private DNS zone.

2. Set up a Private DNS resolver to be able resolving resource names via VPN (its IP address will be used as a Custom DNS for VPN)

3. Add a custom DNS in “VPN Server configuration” of VWAN hub used for VPN (User VPN (Point to site) tab)

4. Link Private DNS zone created in step 1 to vNet where Private DNS resolver resides.

SCCM: Installation failed with “ERROR(13): Failed to iterate cab file.”

I tried to install SCCM 2307 TP in my LAb and the installation failed with “ERROR(13): Failed to iterate cab file” in ConfigMgrSetup.log.

Here are errors around it:

INFO: Extracted file e:\Program Files\Microsoft Configuration Manager\AI\LU_SoftwareHash.csv    Configuration Manager Setup    10/17/2023 11:59:31 PM    188 (0x00BC)

ERROR(13): Failed to iterate cab file.    Configuration Manager Setup    10/17/2023 11:59:31 PM    188 (0x00BC)

ERROR(13): Failed to expand the look up table files to the folder: e:\Program Files\Microsoft Configuration Manager\AI.    Configuration Manager Setup    10/17/2023 11:59:31 PM    188 (0x00BC)
ERROR: Failed to import Asset Intelligence data into the site database.    Configuration Manager Setup    10/17/2023 11:59:31 PM    188 (0x00BC)

I reconfigured SQL with MIN memory set to 8GB an restarted the SQL service. After that I re-started SCCM setup and it finished successfully.

SCCM: Certificate import failed, Digicert tool cannot find a certificate in a file

I recently installed an MCM for one of my Customers and we needed a certificate for CMG. The Customer has internal standalone PKI and asked me to generate a CSR for the certificate. I used Digicert tool  DigiCert Certificate Utility for Windows | DigiCert.com

CSR has been successfully accepted by the CA and a signed certificate has been generated, but when I tried to import it using DigiCert Certificate Utility the operation failed with an error “The file XXXXXXX.cer does not have any SSL or code signing enabled certificates contained in it.

Resolution:  I open Certificate MMC for Computer cert storage (certlm) as Admin and double checked my request is there. After that I right-click Personal container and imported the .cer file received from CA. This time the operation finished successfully added a signed certificate with bound private key in my local machine cert store.

SCCM (MCM): 0x87d00231 in ccmmessaging.log on connection to CMG

I installed CMG for one of my Customers. The Clients use internal PKI certs and CMG uses a public wildcard cert.

When I put one of the Clients on the Internet and tried to get an app installed, the attempt failed, as well, the Client went grey in SCCM console.

I checked the Client settings and found it knows about CMG, but cannot connect to it. in ccmMessaging.log I saw:

image

I ran CMG Connection analyzer

1. With AAD credentials it was all green

2. I generated a client certificate and tried authenticate with it. This time Analyzer gave me a message saying CMG does not trust my cert. That was interesting, because I provided the certificate chain root cert for internal PKI during CMG configuration and I disabled revocation list check (since PKI was not configured as per best practice and did not have CRL properly published publicly).

So I tried removing the root certificate, resync configuration to CMG, add the certificate back and resync again. That did not help.

Resolution: with the root certificate added to the configuration I stopped CMG and start it back (it initiates re-deployment).  After that the messages were delivered successfully, the client went green in SCCM console and the app has been download and installed successfully:

image

Create your own website, free on WordPress.com.Create your own website.
Start free