1

I have an old application that we setup with delegation based kerberos. Everything with the application worked fine till we tried it out on one of our new Windows 10 machines.

After awhile, we finally figured out that Credential guard is not playing nice with this old application.

According to https://learn.microsoft.com/en-us/windows/security/identity-protection/credential-guard/credential-guard-considerations

Kerberos Considerations

When you enable Windows Defender Credential Guard, you can no longer use Kerberos unconstrained delegation or DES encryption. Unconstrained delegation could allow attackers to extract Kerberos keys from the isolated LSA process. Use constrained or resource-based Kerberos delegation instead.

We have to switch our implementation to use Constrained based Kerberos. I'm at a bit of a loss on how to do that.

Our current SPN are set against the web application name - (Scenario 2 from this link - https://support.microsoft.com/en-ca/help/929650/how-to-use-spns-when-you-configure-web-applications-that-are-hosted-on)

setspn -a http/WebSiteName webServerName
setspn -a http/WebSiteName.domain.com webServerName

The application only talks to Active Directory. No database is involved. The site is currently running the application pool with a domain account.

When I try commands like

$comp = Get-ADComputer DcOrAnotherComputer
Set-AdComputer -identity webServerName -PrincipalsAllowedToDelegateToAccount $comp

I get the following powershell error.

Set-AdComputer : The attribute cannot be modified because it is owned by the system
At line:2 char:1
+ Set-AdComputer -identity hql-dmeds01 -PrincipalsAllowedToDelegateToAccount $comp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (hql-dmeds01:ADComputer) [Set-ADComputer], ADException
    + FullyQualifiedErrorId : ActiveDirectoryServer:8369,Microsoft.ActiveDirectory.Management.Commands.SetADComputer

I've boiled down the application to an example that works on Win7/win2012 but not on win10 with credential guard.

<%@ Language=VBScript %>
<%


' Create the connection the AD
    set con = createobject("ADODB.connection")
    set Com = createobject("ADODB.command")
    con.Provider = "ADsDSOObject"
    con.Open "Active Directory Provider"
    Set Com.ActiveConnection = con

    dim ldapCall 
    ldapCall = "SELECT ADsPath, distinguishedname, displayName"   &_ 
                   "  FROM '" & "LDAP://DC=mydomain,DC=com'  " &_
                      " WHERE objectClass = 'group' AND name = 'SomeTestGroupName'" & _
                     " ORDER BY displayName "
    'response.write ldapCall

' Execute the search call
    Com.CommandText = ldapCall
    Set rs = Com.Execute

    if not(rs.EOF) then
        response.write "SomethingHappended<br />"
    else 
        response.write "Why don't you work???"
    end if

%>

Update 1 - Answer to T-Heron's question Here are the results of doing

setspn -q http/WebSiteName.domain.com  - 
Checking domain DC=Mydomain
no such SPN found.

if i do

setspan -q http/WebSiteName- I get the following

Checking domain DC=Mydomain
CN=Webserver,OU=OuLocation,DC=MyDomain
        http/WebSite.myDomain
        http/WebSite
        CmRcService/Webserver
        CmRcService/Webserver.myDomain
        WSMAN/Webserver.myDomain
        TERMSRV/Webserver.myDomain
        RestrictedKrbHost/Webserver.myDomain
        HOST/Webserver
        WSMAN/WSMAN/Webserver
        TERMSRV/WSMAN/Webserver
        RestrictedKrbHost/WSMAN/Webserver
        HOST/Webserver

update 2- the reason the -q in update 1 didn't work was that the spn was set to http/WebsiteName.domain.com and not http/WebsiteName.a.b.domain.com (which is what i was trying)

So all the -q commands work now. But the problem persists

Here's the screenshot of the delegation tab. enter image description here

Update 3 -

Here's a new picture of the delegate tab I tried it both with "Use Kerberos Only" and "Use any authentication protocol" after doing an IISReset, i get the same issue. (i added the webserver when I pressed the "add" button. in the picture, the red boxes where entries with the webServername the orange boxes where entries with the spn setup (beside HTTP - service type)

enter image description here

Lareau
  • 1,982
  • 1
  • 26
  • 47
  • 1
    We worked together on a previous question. Can we see the output of the following: setspn -Q *http/Webhostname.domain.com* – T-Heron Jun 16 '18 at 16:55
  • Wow, awesome to hear again from you! I finally got a bit further with my other issue. The great thing is that it's not only affecting my old app anymore (well it's not that great ;). We have another app that doesn't play nice with Kerberos and credential guard. – Lareau Jun 18 '18 at 13:06
  • 1
    Please add *http/Webhostname.domain.com* as an SPN to the *Webserver* AD account. After you do that, let us know if it works. If it doesn't, add a screenshot of the Delegation tab of the *Webserver* account into the question. Then there's a counter-intuitive operation needed to done in here to make it work using constrained delegation. – T-Heron Jun 20 '18 at 12:00
  • Added the image as requested. – Lareau Jun 20 '18 at 14:03
  • I see you have an open delegation as you stated. To set up a constrained delegation, click *Trust this computer for delegation to specified services only* > click *Add..* > click *Users or Computers* > type in *Webhostname* in the resulting dialog box > click OK. That should find all of your SPNs to be delegated > click *Select All* > click OK > click the *Expanded* checkbox > take a screenshot of that to post here then click Apply and OK. Let me know if this constrained delegation does not work. – T-Heron Jun 20 '18 at 15:29
  • Add more information as requested again. (I won't reply till next week fyi) – Lareau Jun 20 '18 at 20:08

1 Answers1

2

Ok, so I was able to get the test page above to finally work. T-Heron's comments were on point, I just added the wrong services to delegate.

Once I added the ldap service from the domain controller then the test page started working.
(Our domain controllers had 2 ldap services. One with a guid and one with the domain name. I chose the domain one).

[Screenshot of the delegation tab for the webserver]

Update 1- the testing for the solution was initially done on win2k8. Doing the same on win2k12 didn't work.

I ended up having to change my application pool to the built-in ApplicationPoolId (or localsystem) to have it work.

Lareau
  • 1,982
  • 1
  • 26
  • 47