1ebfedea0SLionel Sambuc@c Id 2*0a6a1f1dSLionel Sambuc@c $NetBSD: win2k.texi,v 1.1.1.3 2014/04/24 12:45:27 pettai Exp $ 3ebfedea0SLionel Sambuc 4ebfedea0SLionel Sambuc 5ebfedea0SLionel Sambuc@node Windows compatibility, Programming with Kerberos, Kerberos 4 issues, Top 6ebfedea0SLionel Sambuc@comment node-name, next, previous, up 7ebfedea0SLionel Sambuc@chapter Windows compatibility 8ebfedea0SLionel Sambuc 9ebfedea0SLionel SambucMicrosoft Windows, starting from version 2000 (formerly known as Windows NT 5), implements Kerberos 5. Their implementation, however, has some quirks, 10ebfedea0SLionel Sambucpeculiarities, and bugs. This chapter is a short summary of the compatibility 11ebfedea0SLionel Sambucissues between Heimdal and various Windows versions. 12ebfedea0SLionel Sambuc 13ebfedea0SLionel SambucThe big problem with the Kerberos implementation in Windows 14ebfedea0SLionel Sambucis that the available documentation is more focused on getting 15ebfedea0SLionel Sambucthings to work rather than how they work, and not that useful in figuring 16ebfedea0SLionel Sambucout how things really work. It's of course subject to change all the time and 17ebfedea0SLionel Sambucmostly consists of our not so inspired guesses. Hopefully it's still 18ebfedea0SLionel Sambucsomewhat useful. 19ebfedea0SLionel Sambuc 20ebfedea0SLionel Sambuc@menu 21ebfedea0SLionel Sambuc* Configuring Windows to use a Heimdal KDC:: 22ebfedea0SLionel Sambuc* Inter-Realm keys (trust) between Windows and a Heimdal KDC:: 23ebfedea0SLionel Sambuc* Create account mappings:: 24ebfedea0SLionel Sambuc* Encryption types:: 25ebfedea0SLionel Sambuc* Authorisation data:: 26ebfedea0SLionel Sambuc* Quirks of Windows 2000 KDC:: 27ebfedea0SLionel Sambuc* Useful links when reading about the Windows:: 28ebfedea0SLionel Sambuc@end menu 29ebfedea0SLionel Sambuc 30ebfedea0SLionel Sambuc@node Configuring Windows to use a Heimdal KDC, Inter-Realm keys (trust) between Windows and a Heimdal KDC, Windows compatibility, Windows compatibility 31ebfedea0SLionel Sambuc@comment node-name, next, precious, up 32ebfedea0SLionel Sambuc@section Configuring Windows to use a Heimdal KDC 33ebfedea0SLionel Sambuc 34ebfedea0SLionel SambucYou need the command line program called @command{ksetup.exe}. This program comes with the Windows Support Tools, available from either the installation CD-ROM (@file{SUPPORT/TOOLS/SUPPORT.CAB}), or from Microsoft web site. Starting from Windows 2008, it is already installed. This program is used to configure the Kerberos settings on a Workstation. 35ebfedea0SLionel Sambuc 36ebfedea0SLionel Sambuc@command{Ksetup} store the domain information under the registry key: 37ebfedea0SLionel Sambuc@code{HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\LSA\Kerberos\Domains}. 38ebfedea0SLionel Sambuc 39ebfedea0SLionel SambucUse the @command{kadmin} program in Heimdal to create a host principal in the 40ebfedea0SLionel SambucKerberos realm. 41ebfedea0SLionel Sambuc 42ebfedea0SLionel Sambuc@example 43ebfedea0SLionel Sambucunix% kadmin 44ebfedea0SLionel Sambuckadmin> ank --password=password host/datan.example.com 45ebfedea0SLionel Sambuc@end example 46ebfedea0SLionel Sambuc 47ebfedea0SLionel SambucThe name @samp{datan.example.com} should be replaced with DNS name of 48ebfedea0SLionel Sambucthe workstation. 49ebfedea0SLionel Sambuc 50ebfedea0SLionel SambucYou must configure the workstation as a member of a workgroup, as opposed 51ebfedea0SLionel Sambucto a member in an NT domain, and specify the KDC server of the realm 52ebfedea0SLionel Sambucas follows: 53ebfedea0SLionel Sambuc@example 54ebfedea0SLionel SambucC:> ksetup /setdomain EXAMPLE.COM 55ebfedea0SLionel SambucC:> ksetup /addkdc EXAMPLE.COM kdc.example.com 56ebfedea0SLionel Sambuc@end example 57ebfedea0SLionel Sambuc 58ebfedea0SLionel SambucSet the machine password, i.e.@: create the local keytab: 59ebfedea0SLionel Sambuc@example 60ebfedea0SLionel SambucC:> ksetup /SetComputerPassword password 61ebfedea0SLionel Sambuc@end example 62ebfedea0SLionel Sambuc 63ebfedea0SLionel SambucThe password used in @kbd{ksetup /setmachpassword} must be the same 64ebfedea0SLionel Sambucas the password used in the @kbd{kadmin ank} command. 65ebfedea0SLionel Sambuc 66ebfedea0SLionel SambucThe workstation must now be rebooted. 67ebfedea0SLionel Sambuc 68ebfedea0SLionel SambucA mapping between local NT users and Kerberos principals must be specified. 69ebfedea0SLionel SambucYou have two choices. First: 70ebfedea0SLionel Sambuc 71ebfedea0SLionel Sambuc@example 72ebfedea0SLionel SambucC:> ksetup /mapuser user@@MY.REALM nt_user 73ebfedea0SLionel Sambuc@end example 74ebfedea0SLionel Sambuc 75ebfedea0SLionel SambucThis will map a user to a specific principal; this allows you to have 76ebfedea0SLionel Sambucother usernames in the realm than in your NT user database. (Don't ask 77ebfedea0SLionel Sambucme why on earth you would want that@enddots{}) 78ebfedea0SLionel Sambuc 79ebfedea0SLionel SambucYou can also say: 80ebfedea0SLionel Sambuc@example 81ebfedea0SLionel SambucC:> ksetup /mapuser * * 82ebfedea0SLionel Sambuc@end example 83ebfedea0SLionel SambucThe Windows machine will now map any user to the corresponding principal, 84ebfedea0SLionel Sambucfor example @samp{nisse} to the principal @samp{nisse@@MY.REALM}. 85ebfedea0SLionel Sambuc(This is most likely what you want.) 86ebfedea0SLionel Sambuc 87ebfedea0SLionel Sambuc@node Inter-Realm keys (trust) between Windows and a Heimdal KDC, Create account mappings, Configuring Windows to use a Heimdal KDC, Windows compatibility 88ebfedea0SLionel Sambuc@comment node-name, next, precious, up 89ebfedea0SLionel Sambuc@section Inter-Realm keys (trust) between Windows and a Heimdal KDC 90ebfedea0SLionel Sambuc 91ebfedea0SLionel SambucSee also the Step-by-Step guide from Microsoft, referenced below. 92ebfedea0SLionel Sambuc 93ebfedea0SLionel SambucInstall Windows, and create a new controller (Active Directory 94ebfedea0SLionel SambucServer) for the domain. 95ebfedea0SLionel Sambuc 96ebfedea0SLionel SambucBy default the trust will be non-transitive. This means that only users 97ebfedea0SLionel Sambucdirectly from the trusted domain may authenticate. This can be changed 98ebfedea0SLionel Sambucto transitive by using the @command{netdom.exe} tool. @command{netdom.exe} 99ebfedea0SLionel Sambuccan also be used to add the trust between two realms. 100ebfedea0SLionel Sambuc 101ebfedea0SLionel SambucYou need to tell Windows on what hosts to find the KDCs for the 102ebfedea0SLionel Sambucnon-Windows realm with @command{ksetup}, see @xref{Configuring Windows 103ebfedea0SLionel Sambucto use a Heimdal KDC}. 104ebfedea0SLionel Sambuc 105ebfedea0SLionel SambucThis needs to be done on all computers that want enable cross-realm 106ebfedea0SLionel Sambuclogin with @code{Mapped Names}. @c XXX probably shouldn't be @code 107ebfedea0SLionel Sambuc 108ebfedea0SLionel SambucThen you need to add the inter-realm keys on the Windows KDC@. Start the 109ebfedea0SLionel SambucDomain Tree Management tool (found in Programs, Administrative tools, 110ebfedea0SLionel SambucActive Directory Domains and Trusts). 111ebfedea0SLionel Sambuc 112ebfedea0SLionel SambucRight click on Properties of your domain, select the Trust tab. Press 113ebfedea0SLionel SambucAdd on the appropriate trust windows and enter domain name and 114ebfedea0SLionel Sambucpassword. When prompted if this is a non-Windows Kerberos realm, press 115ebfedea0SLionel SambucOK. 116ebfedea0SLionel Sambuc 117ebfedea0SLionel SambucDo not forget to add trusts in both directions (if that's what you want). 118ebfedea0SLionel Sambuc 119ebfedea0SLionel SambucIf you want to use @command{netdom.exe} instead of the Domain Tree 120ebfedea0SLionel SambucManagement tool, you do it like this: 121ebfedea0SLionel Sambuc 122ebfedea0SLionel Sambuc@example 123ebfedea0SLionel Sambucnetdom trust NT.REALM.EXAMPLE.COM /Domain:EXAMPLE.COM /add /realm /passwordt:TrustPassword 124ebfedea0SLionel Sambuc@end example 125ebfedea0SLionel Sambuc 126ebfedea0SLionel SambucYou also need to add the inter-realm keys to the Heimdal KDC. But take 127ebfedea0SLionel Sambuccare to the encryption types and salting used for those keys. There should be 128ebfedea0SLionel Sambucno encryption type stronger than the one configured on Windows side for this 129ebfedea0SLionel Sambucrelationship, itself limited to the ones supported by this specific version of 130ebfedea0SLionel SambucWindows, nor any Kerberos 4 salted hashes, as Windows does not seem to 131ebfedea0SLionel Sambucunderstand them. Otherwise, the trust will not works. 132ebfedea0SLionel Sambuc 133ebfedea0SLionel SambucHere are the version-specific needed information: 134ebfedea0SLionel Sambuc@enumerate 135ebfedea0SLionel Sambuc@item Windows 2000: maximum encryption type is DES 136ebfedea0SLionel Sambuc@item Windows 2003: maximum encryption type is DES 137ebfedea0SLionel Sambuc@item Windows 2003RC2: maximum encryption type is RC4, relationship defaults to DES 138ebfedea0SLionel Sambuc@item Windows 2008: maximum encryption type is AES, relationship defaults to RC4 139ebfedea0SLionel Sambuc@end enumerate 140ebfedea0SLionel Sambuc 141ebfedea0SLionel SambucFor Windows 2003RC2, to change the trust encryption type, you have to use the 142ebfedea0SLionel Sambuc@command{ktpass}, from the Windows 2003 Resource kit *service pack2*, available 143ebfedea0SLionel Sambucfrom Microsoft web site. 144ebfedea0SLionel Sambuc 145ebfedea0SLionel Sambuc@example 146ebfedea0SLionel SambucC:> ktpass /MITRealmName UNIX.EXAMPLE.COM /TrustEncryp RC4 147ebfedea0SLionel Sambuc@end example 148ebfedea0SLionel Sambuc 149ebfedea0SLionel SambucFor Windows 2008, the same operation can be done with the @command{ksetup}, installed by default. 150ebfedea0SLionel Sambuc 151ebfedea0SLionel Sambuc@example 152ebfedea0SLionel SambucC:> ksetup /SetEncTypeAttre EXAMPLE.COM AES256-SHA1 153ebfedea0SLionel Sambuc@end example 154ebfedea0SLionel Sambuc 155ebfedea0SLionel SambucOnce the relationship is correctly configured, you can add the required 156ebfedea0SLionel Sambucinter-realm keys, using heimdal default encryption types: 157ebfedea0SLionel Sambuc 158ebfedea0SLionel Sambuc@example 159ebfedea0SLionel Sambuckadmin add krbtgt/NT.REALM.EXAMPLE.COM@@EXAMPLE.COM 160ebfedea0SLionel Sambuckadmin add krbtgt/REALM.EXAMPLE.COM@@NT.EXAMPLE.COM 161ebfedea0SLionel Sambuc@end example 162ebfedea0SLionel Sambuc 163ebfedea0SLionel SambucUse the same passwords for both keys. 164ebfedea0SLionel Sambuc 165ebfedea0SLionel SambucAnd if needed, to remove unsupported encryptions, such as the following ones for a Windows 2003RC2 server. 166ebfedea0SLionel Sambuc 167ebfedea0SLionel Sambuc@example 168ebfedea0SLionel Sambuckadmin del_enctype krbtgt/REALM.EXAMPLE.COM@@NT.EXAMPLE.COM aes256-cts-hmac-sha1-96 169ebfedea0SLionel Sambuckadmin del_enctype krbtgt/REALM.EXAMPLE.COM@@NT.EXAMPLE.COM des3-cbc-sha1 170ebfedea0SLionel Sambuckadmin del_enctype krbtgt/NT.EXAMPLE.COM@@EXAMPLE.COM aes256-cts-hmac-sha1-96 171ebfedea0SLionel Sambuckadmin del_enctype krbtgt/NT.EXAMPLE.COM@@EXAMPLE.COM des3-cbc-sha1 172ebfedea0SLionel Sambuc@end example 173ebfedea0SLionel Sambuc 174ebfedea0SLionel SambucDo not forget to reboot before trying the new realm-trust (after 175ebfedea0SLionel Sambucrunning @command{ksetup}). It looks like it might work, but packets are 176ebfedea0SLionel Sambucnever sent to the non-Windows KDC. 177ebfedea0SLionel Sambuc 178ebfedea0SLionel Sambuc@node Create account mappings, Encryption types, Inter-Realm keys (trust) between Windows and a Heimdal KDC, Windows compatibility 179ebfedea0SLionel Sambuc@comment node-name, next, precious, up 180ebfedea0SLionel Sambuc@section Create account mappings 181ebfedea0SLionel Sambuc 182ebfedea0SLionel SambucStart the @code{Active Directory Users and Computers} tool. Select the 183ebfedea0SLionel SambucView menu, that is in the left corner just below the real menu (or press 184ebfedea0SLionel SambucAlt-V), and select Advanced Features. Right click on the user that you 185ebfedea0SLionel Sambucare going to do a name mapping for and choose Name mapping. 186ebfedea0SLionel Sambuc 187ebfedea0SLionel SambucClick on the Kerberos Names tab and add a new principal from the 188ebfedea0SLionel Sambucnon-Windows domain. 189ebfedea0SLionel Sambuc 190ebfedea0SLionel Sambuc@c XXX check entry name then I have network again 191ebfedea0SLionel SambucThis adds @samp{authorizationNames} entry to the users LDAP entry to 192ebfedea0SLionel Sambucthe Active Directory LDAP catalog. When you create users by script you 193ebfedea0SLionel Sambuccan add this entry instead. 194ebfedea0SLionel Sambuc 195ebfedea0SLionel Sambuc@node Encryption types, Authorisation data, Create account mappings, Windows compatibility 196ebfedea0SLionel Sambuc@comment node-name, next, previous, up 197ebfedea0SLionel Sambuc@section Encryption types 198ebfedea0SLionel Sambuc 199ebfedea0SLionel SambucWindows 2000 supports both the standard DES encryptions (@samp{des-cbc-crc} and 200ebfedea0SLionel Sambuc@samp{des-cbc-md5}) and its own proprietary encryption that is based on MD4 and 201ebfedea0SLionel SambucRC4 that is documented in and is supposed to be described in 202ebfedea0SLionel Sambuc@file{draft-brezak-win2k-krb-rc4-hmac-03.txt}. New users will get both 203ebfedea0SLionel SambucMD4 and DES keys. Users that are converted from a NT4 database, will 204ebfedea0SLionel Sambuconly have MD4 passwords and will need a password change to get a DES 205ebfedea0SLionel Sambuckey. 206ebfedea0SLionel Sambuc 207ebfedea0SLionel Sambuc@node Authorisation data, Quirks of Windows 2000 KDC, Encryption types, Windows compatibility 208ebfedea0SLionel Sambuc@comment node-name, next, previous, up 209ebfedea0SLionel Sambuc@section Authorisation data 210ebfedea0SLionel Sambuc 211ebfedea0SLionel SambucThe Windows 2000 KDC also adds extra authorisation data in tickets. 212ebfedea0SLionel SambucIt is at this point unclear what triggers it to do this. The format of 213ebfedea0SLionel Sambucthis data is only available under a ``secret'' license from Microsoft, 214ebfedea0SLionel Sambucwhich prohibits you implementing it. 215ebfedea0SLionel Sambuc 216ebfedea0SLionel SambucA simple way of getting hold of the data to be able to understand it 217ebfedea0SLionel Sambucbetter is described here. 218ebfedea0SLionel Sambuc 219ebfedea0SLionel Sambuc@enumerate 220ebfedea0SLionel Sambuc@item Find the client example on using the SSPI in the SDK documentation. 221ebfedea0SLionel Sambuc@item Change ``AuthSamp'' in the source code to lowercase. 222ebfedea0SLionel Sambuc@item Build the program. 223ebfedea0SLionel Sambuc@item Add the ``authsamp'' principal with a known password to the 224ebfedea0SLionel Sambucdatabase. Make sure it has a DES key. 225ebfedea0SLionel Sambuc@item Run @kbd{ktutil add} to add the key for that principal to a 226ebfedea0SLionel Sambuckeytab. 227ebfedea0SLionel Sambuc@item Run @kbd{appl/test/nt_gss_server -p 2000 -s authsamp 228ebfedea0SLionel Sambuc@kbd{--dump-auth}=@var{file}} where @var{file} is an appropriate file. 229ebfedea0SLionel Sambuc@item It should authenticate and dump for you the authorisation data in 230ebfedea0SLionel Sambucthe file. 231ebfedea0SLionel Sambuc@item The tool @kbd{lib/asn1/asn1_print} is somewhat useful for 232ebfedea0SLionel Sambucanalysing the data. 233ebfedea0SLionel Sambuc@end enumerate 234ebfedea0SLionel Sambuc 235ebfedea0SLionel Sambuc@node Quirks of Windows 2000 KDC, Useful links when reading about the Windows, Authorisation data, Windows compatibility 236ebfedea0SLionel Sambuc@comment node-name, next, previous, up 237ebfedea0SLionel Sambuc@section Quirks of Windows 2000 KDC 238ebfedea0SLionel Sambuc 239ebfedea0SLionel SambucThere are some issues with salts and Windows 2000. Using an empty salt---which is the only one that Kerberos 4 supported, and is therefore known 240ebfedea0SLionel Sambucas a Kerberos 4 compatible salt---does not work, as far as we can tell 241ebfedea0SLionel Sambucfrom out experiments and users' reports. Therefore, you have to make 242ebfedea0SLionel Sambucsure you keep around keys with all the different types of salts that are 243ebfedea0SLionel Sambucrequired. Microsoft have fixed this issue post Windows 2003. 244ebfedea0SLionel Sambuc 245ebfedea0SLionel SambucMicrosoft seems also to have forgotten to implement the checksum 246ebfedea0SLionel Sambucalgorithms @samp{rsa-md4-des} and @samp{rsa-md5-des}. This can make Name 247ebfedea0SLionel Sambucmapping (@pxref{Create account mappings}) fail if a @samp{des-cbc-md5} key 248ebfedea0SLionel Sambucis used. To make the KDC return only @samp{des-cbc-crc} you must delete 249ebfedea0SLionel Sambucthe @samp{des-cbc-md5} key from the kdc using the @kbd{kadmin 250ebfedea0SLionel Sambucdel_enctype} command. 251ebfedea0SLionel Sambuc 252ebfedea0SLionel Sambuc@example 253ebfedea0SLionel Sambuckadmin del_enctype lha des-cbc-md5 254ebfedea0SLionel Sambuc@end example 255ebfedea0SLionel Sambuc 256ebfedea0SLionel SambucYou should also add the following entries to the @file{krb5.conf} file: 257ebfedea0SLionel Sambuc 258ebfedea0SLionel Sambuc@example 259ebfedea0SLionel Sambuc[libdefaults] 260ebfedea0SLionel Sambuc default_etypes = des-cbc-crc 261ebfedea0SLionel Sambuc default_etypes_des = des-cbc-crc 262ebfedea0SLionel Sambuc@end example 263ebfedea0SLionel Sambuc 264ebfedea0SLionel SambucThese configuration options will make sure that no checksums of the 265ebfedea0SLionel Sambucunsupported types are generated. 266ebfedea0SLionel Sambuc 267ebfedea0SLionel Sambuc@node Useful links when reading about the Windows, , Quirks of Windows 2000 KDC, Windows compatibility 268ebfedea0SLionel Sambuc@comment node-name, next, previous, up 269ebfedea0SLionel Sambuc@section Useful links when reading about the Windows 270ebfedea0SLionel Sambuc 271ebfedea0SLionel SambucSee also our paper presented at the 2001 Usenix Annual Technical 272ebfedea0SLionel SambucConference, available in the proceedings or at 273ebfedea0SLionel Sambuc@uref{http://www.usenix.org/publications/library/proceedings/usenix01/freenix01/westerlund.html}. 274ebfedea0SLionel Sambuc 275ebfedea0SLionel SambucThere are lots of texts about Kerberos on Microsoft's web site, here is a 276ebfedea0SLionel Sambucshort list of the interesting documents that we have managed to find. 277ebfedea0SLionel Sambuc 278ebfedea0SLionel Sambuc@itemize @bullet 279ebfedea0SLionel Sambuc 280ebfedea0SLionel Sambuc@item Step-by-Step Guide to Kerberos 5 (krb5 1.0) Interoperability: 281ebfedea0SLionel Sambuc@uref{http://www.microsoft.com/technet/prodtechnol/windows2000serv/howto/kerbstep.mspx}. 282ebfedea0SLionel SambucKerberos GSS-API (in Windows-eze SSPI), Windows as a client in a 283ebfedea0SLionel Sambucnon-Windows KDC realm, adding unix clients to a Windows 2000 KDC, and 284ebfedea0SLionel Sambucadding cross-realm trust (@pxref{Inter-Realm keys (trust) between Windows 285ebfedea0SLionel Sambucand a Heimdal KDC}). 286ebfedea0SLionel Sambuc 287ebfedea0SLionel Sambuc@item Windows 2000 Kerberos Authentication: 288ebfedea0SLionel Sambuc@uref{www.microsoft.com/technet/prodtechnol/windows2000serv/deploy/confeat/kerberos.mspx}. 289ebfedea0SLionel SambucWhite paper that describes how Kerberos is used in Windows 2000. 290ebfedea0SLionel Sambuc 291ebfedea0SLionel Sambuc@item Overview of Kerberos: 292ebfedea0SLionel Sambuc@uref{http://support.microsoft.com/support/kb/articles/Q248/7/58.ASP}. 293ebfedea0SLionel SambucLinks to useful other links. 294ebfedea0SLionel Sambuc 295ebfedea0SLionel Sambuc@c @item Klist for Windows: 296ebfedea0SLionel Sambuc@c @uref{http://msdn.microsoft.com/library/periodic/period00/security0500.htm}. 297ebfedea0SLionel Sambuc@c Describes where to get a klist for Windows 2000. 298ebfedea0SLionel Sambuc 299ebfedea0SLionel Sambuc@item Event logging for Kerberos: 300ebfedea0SLionel Sambuc@uref{http://support.microsoft.com/support/kb/articles/Q262/1/77.ASP}. 301ebfedea0SLionel SambucBasically it say that you can add a registry key 302ebfedea0SLionel Sambuc@code{HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\Kerberos\Parameters\LogLevel} 303ebfedea0SLionel Sambucwith value DWORD equal to 1, and then you'll get logging in the Event 304ebfedea0SLionel SambucLogger. 305ebfedea0SLionel Sambuc 306ebfedea0SLionel Sambuc@c @item Access to the Active Directory through LDAP: 307ebfedea0SLionel Sambuc@c @uref{http://msdn.microsoft.com/library/techart/kerberossamp.htm} 308ebfedea0SLionel Sambuc 309ebfedea0SLionel Sambuc@end itemize 310ebfedea0SLionel Sambuc 311ebfedea0SLionel SambucOther useful programs include these: 312ebfedea0SLionel Sambuc 313ebfedea0SLionel Sambuc@itemize @bullet 314ebfedea0SLionel Sambuc@item pwdump2 315*0a6a1f1dSLionel Sambuc@uref{http://www.bindview.com/Support/RAZOR/Utilities/Windows/pwdump2_readme.cfm} 316*0a6a1f1dSLionel Sambuc@end itemize 317