Home
%3CLINGO-SUB%20id%3D%22lingo-sub-1027962%22%20slang%3D%22en-US%22%3EUse%20KTPASS%20instead%20of%20adden%20to%20configure%20mssql.keytab%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1027962%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20is%20a%20known%20issue%20with%20the%20krb5%20library%20that%20is%20shipped%20on%20RHEL(7.3%2C%207.4%2C%207.5%2C%20or%207.6)%20and%20Ubuntu(16.04)%20where%20AES%20keys%20are%20incorrectly%20salted%20on%20Windows%20AD%20systems.%20There%20has%20been%20a%20patch%20in%20the%20krb5%20library%2C%20but%20that%20patched%20version%20hasn%E2%80%99t%20shipped%20on%20the%20version%20Microsoft%20supports.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20incorrect%20salted%20value(created%20by%20addent%20command)%20may%20cause%20Windows%20authentication%20fail.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI'm%20going%20to%20list%20the%20updated%20process(We%20are%20going%20to%20update%20the%20official%20document%20soon.)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E1.Create%20AD%20user%20(or%20MSA)%20for%20SQL%20Server%20and%20set%20SPN%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E1)AD%20User.%3C%2FP%3E%0A%3CP%3EOn%20your%20domain%20controller%2C%20run%20the%20%3CA%20href%3D%22https%3A%2F%2Ftechnet.microsoft.com%2Flibrary%2Fee617253.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ENew-ADUser%3C%2FA%3E%20PowerShell%20command%20to%20create%20a%20new%20AD%20user%20with%20a%20password%20that%20never%20expires.%20The%20following%20example%20names%20the%20account%20mssql%2C%20but%20the%20account%20name%20can%20be%20anything%20you%20like.%20You%20will%20be%20prompted%20to%20enter%20a%20new%20password%20for%20the%20account.%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3EImport-Module%20ActiveDirectory%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3ENew-ADUser%20mssql%20-AccountPassword%20(Read-Host%20-AsSecureString%20%22Enter%20Password%22)%20-PasswordNeverExpires%20%24true%20-Enabled%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)Managed%20Service%20account%3C%2FP%3E%0A%3CP%3EOn%20your%20domain%20controller%2C%20run%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fmodule%2Factivedirectory%2Fnew-adserviceaccount%3Fview%3Dwinserver2012-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ENew-ADServiceAccount%20%3C%2FA%3EPowerShell%20command%20to%20create%20a%20Managed%20Service%20Account%20with%20a%20password%20that%20never%20expires.%20The%20following%20example%20names%20the%20account%20mssql%2C%20but%20the%20account%20name%20can%20be%20anything%20you%20like.%20You%20will%20be%20prompted%20to%20enter%20a%20new%20password%20for%20the%20account.%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3EImport-Module%20ActiveDirectory%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3ENew-ADServiceAccount%20-Name%20mssql%20-Enabled%20%24true%26nbsp%3B%26nbsp%3B%20-AccountPassword%20(Read-Host%20-AsSecureString%20%22Enter%20Password%22)%26nbsp%3B%20-RestrictToSingleComputer%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E2.Get%20the%20KVNO%20of%20the%20account.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%201)Run%20following%20powershell%20command%20for%20AD%20User%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3EImport-Module%20ActiveDirectory%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Eget-aduser%20userName%20-property%20msDs-KeyVersionNumber%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B2)Run%20following%20powershell%20command%20for%20MSA%20account%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3EImport-Module%20ActiveDirectory%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Eget-ADServiceAccount%20-Identity%20MsaName%20-property%20msDS-KeyVersionNumber%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E3.Prepare%20mssql.keytab%20(this%20step%20is%20applicable%20to%20both%20AD%20user%20and%20MSA)%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E(KVNO%20should%20be%20replaced%20with%20the%20value%20in%20step%202)%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2F**%3CFULLY%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%20of%3D%22%22%20host%3D%22%22%20machine%3D%22%22%3E**%3A**%3CTCP%20port%3D%22%22%3E**%40**%3CFULL%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%3E**%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20aes256-sha1%20%2Fmapuser%20domainName%5CaccountName%26nbsp%3B%26nbsp%3B%20%2Fout%20mssql.keytab%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20-setpass%20-setupn%20%2Fkvno%20**%3CKVNO%20from%3D%22%22%20above%3D%22%22%3E**%20%2Fpass%20%3CSTRONGPASSWORD%3E%3C%2FSTRONGPASSWORD%3E%3C%2FKVNO%3E%3C%2FFULL%3E%3C%2FTCP%3E%3C%2FFULLY%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2F**%3CFULLY%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%20of%3D%22%22%20host%3D%22%22%20machine%3D%22%22%3E**%3A**%3CTCP%20port%3D%22%22%3E**%40**%3CFULL%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%3E**%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20rc4-hmac-nt%20%2Fmapuser%20domainName%5CaccountName%26nbsp%3B%26nbsp%3B%20%2Fin%20mssql.keytab%20%2Fout%20mssql.keytab%20-setpass%20-setupn%20%2Fkvno%20**%3CKVNO%20from%3D%22%22%20above%3D%22%22%3E**%20%2Fpass%20%3CSTRONGPASSWORD%3E%3C%2FSTRONGPASSWORD%3E%3C%2FKVNO%3E%3C%2FFULL%3E%3C%2FTCP%3E%3C%2FFULLY%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2F**%3CNETBIOS%20name%3D%22%22%20of%3D%22%22%20the%3D%22%22%20host%3D%22%22%20machine%3D%22%22%3E**%3A**%3CTCP%20port%3D%22%22%3E**%40**%3CFULL%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%3E**%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20aes256-sha1%20%2Fmapuser%20domainName%5CaccountName%26nbsp%3B%26nbsp%3B%20%2Fin%20mssql.keytab%20%2Fout%20mssql.keytab%20-setpass%20-setupn%20%2Fkvno%20**%3CKVNO%20from%3D%22%22%20above%3D%22%22%3E**%20%2Fpass%20%3CSTRONGPASSWORD%3E%3C%2FSTRONGPASSWORD%3E%3C%2FKVNO%3E%3C%2FFULL%3E%3C%2FTCP%3E%3C%2FNETBIOS%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2F**%3CNETBIOS%20name%3D%22%22%20of%3D%22%22%20the%3D%22%22%20host%3D%22%22%20machine%3D%22%22%3E**%3A**%3CTCP%20port%3D%22%22%3E**%40**%3CFULL%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%3E**%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20rc4-hmac-nt%20%2Fmapuser%20domainName%5CaccountName%26nbsp%3B%26nbsp%3B%20%2Fin%20mssql.keytab%20%2Fout%20mssql.keytab%20-setpass%20-setupn%20%2Fkvno%20**%3CKVNO%20from%3D%22%22%20above%3D%22%22%3E**%20%2Fpass%20%3CSTRONGPASSWORD%3E%3C%2FSTRONGPASSWORD%3E%3C%2FKVNO%3E%3C%2FFULL%3E%3C%2FTCP%3E%3C%2FNETBIOS%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPlease%20note%3C%2FSTRONG%3E%2CThis%20step%20will%20create%20two%20SPNs%20as%20well%20if%20they%20don%E2%80%99t%20exist.%20So%20you%20don%E2%80%99t%20need%20to%20run%20setspn%20anymore.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CI%3EFor%20MSA%20account%20only%2C%20add%20following%20MSA%20UPN%20entries%20in%20the%20keytab%20file%20using%20ktpass.%3C%2FI%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20msaAccount%40%3CFULL%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20aes256-sha1%20%2Fmapuser%20domainName%5CaccountName%20%26nbsp%3B%26nbsp%3B%2Fin%20%26nbsp%3Bmssql.keytab%20%2Fout%20mssql.keytab%20%26nbsp%3B-setpass%20-setupn%20%2Fkvno%20**%3CKVNO%20from%3D%22%22%20above%3D%22%22%3E**%20%2Fpass%20%3CSTRONGPASSWORD%3E%3C%2FSTRONGPASSWORD%3E%3C%2FKVNO%3E%3C%2FFULL%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20msaAccount%40%3CFULL%20qualified%3D%22%22%20domain%3D%22%22%20name%3D%22%22%3E%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20rc4-hmac-nt%20%2Fmapuser%20domainName%5CaccountName%20%26nbsp%3B%26nbsp%3B%2Fin%20%26nbsp%3Bmssql.keytab%20%2Fout%20mssql.keytab%20%26nbsp%3B-setpass%20-setupn%20%2Fkvno%20**%3CKVNO%20from%3D%22%22%20above%3D%22%22%3E**%20%2Fpass%20%3CSTRONGPASSWORD%3E%3C%2FSTRONGPASSWORD%3E%3C%2FKVNO%3E%3C%2FFULL%3E%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHere%20is%20an%20example%3C%2FP%3E%0A%3CP%3EEnv%3C%2FP%3E%0A%3CP%3E%3D%3D%3D%3C%2FP%3E%0A%3CP%3ESQL%20Linux%20box%3Ared1%3C%2FP%3E%0A%3CP%3Eport%3A1433%3C%2FP%3E%0A%3CP%3EFQDN%3Ared1.CONTOSO.COM%3C%2FP%3E%0A%3CP%3EDomain%3ACONTOSO.COM%3C%2FP%3E%0A%3CP%3EAccount%20Name%3Acontoso%5Csqlcss%3C%2FP%3E%0A%3CP%3EKVNO%3A2%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2Fred1.CONTOSO.COM%3A1433%40CONTOSO.COM%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20aes256-sha1%20%2Fmapuser%20contoso%5Csqlcss%20%2Fout%20mssql.keytab%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20-setpass%20-setupn%20%2Fkvno%202%20%2Fpass%20Password1%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2Fred1.CONTOSO.COM%3A1433%40CONTOSO.COM%20%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20rc4-hmac-nt%20%2Fmapuser%20contoso%5Csqlcss%26nbsp%3B%26nbsp%3B%20%2Fin%20mssql.keytab%20%2Fout%20mssql.keytab%20-setpass%20-setupn%20%2Fkvno%202%20%2Fpass%20Password1%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2Fred1%3A1433%40CONTOSO.COM%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20aes256-sha1%20%2Fmapuser%20contoso%5Csqlcss%26nbsp%3B%26nbsp%3B%20%2Fin%20mssql.keytab%20%2Fout%20mssql.keytab%20-setpass%20-setupn%20%2Fkvno%202%20%2Fpass%20Password1%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20MSSQLSvc%2Fred1%3A1433%40CONTOSO.COM%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20rc4-hmac-nt%20%2Fmapuser%20contoso%5Csqlcss%26nbsp%3B%26nbsp%3B%20%2Fin%20mssql.keytab%20%2Fout%20mssql.keytab%20-setpass%20-setupn%20%2Fkvno%202%20%2Fpass%20Password1%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20this%20is%20a%20MSA%20account%2C%20additional%20steps%20are%20needed%3A%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20sqlcss%40CONTOSO.COM%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20aes256-sha1%20%2Fmapuser%20contoso%5Cmsa01%20%26nbsp%3B%26nbsp%3B%2Fin%20%26nbsp%3Bmssql.keytab%20%2Fout%20mssql.keytab%20%26nbsp%3B-setpass%20-setupn%20%2Fkvno%202%20%2Fpass%20Password1%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%221%22%20color%3D%22%230000ff%22%3Ektpass%20%2Fprinc%20sqlcss%40CONTOSO.COM%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2Fptype%20KRB5_NT_PRINCIPAL%20%2Fcrypto%20rc4-hmac-nt%20%2Fmapuser%20contoso%5Cmsa01%20%26nbsp%3B%26nbsp%3B%2Fin%20%26nbsp%3Bmssql.keytab%20%2Fout%20mssql.keytab%20%26nbsp%3B-setpass%20-setupn%20%2Fkvno%202%20%2Fpass%20Password1%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3ECopy%20over%20the%20keytab%20file%20to%20Linux%20server%2C%20place%20it%20in%20%2Fvar%2Fopt%2Fmssql%2Fsecrets%20folder%20as%20mssql.keytab.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CI%3E%3CBR%20%2F%3E%3C%2FI%3E%3C%2FSTRONG%3EThe%20next%20step%20is%20almost%20same%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Flinux%2Fsql-server-linux-active-directory-authentication%3Fview%3Dsql-server-ver15%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Flinux%2Fsql-server-linux-active-directory-authentication%3Fview%3Dsql-server-ver15%3C%2FA%3E%20%2C%20with%20little%20change.%3C%2FP%3E%0A%3CP%3EOption%201%3A%20Using%20UPN%20to%20configure%20the%20keytab(No%20change%20here)%3C%2FP%3E%0A%3CP%3EAdd%20the%20machine%20account%20to%20your%20keytab%20with%20%3CSTRONG%3Ektutil%3C%2FSTRONG%3E.%20The%20machine%20account%20(also%20called%20a%20UPN)%20is%20present%20in%20%3CSTRONG%3E%2Fetc%2Fkrb5.keytab%3C%2FSTRONG%3E%20in%20the%20form%20%3CHOSTNAME%3E%24%40%3CREALM.COM%3E%20(for%20example%2C%20sqlhost%24%40CONTOSO.COM).%20Copy%20these%20entries%20from%20%3CSTRONG%3E%2Fetc%2Fkrb5.keytab%3C%2FSTRONG%3E%20to%20%3CSTRONG%3Emssql.keytab%3C%2FSTRONG%3E.%3C%2FREALM.COM%3E%3C%2FHOSTNAME%3E%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EStart%20%3CSTRONG%3Ektuil%3C%2FSTRONG%3E%20with%20the%20following%20command%3A%3CBR%20%2F%3Esudo%20ktutil%3C%2FLI%3E%0A%3CLI%3EUse%20the%20%3CSTRONG%3Erkt%3C%2FSTRONG%3E%20command%20to%20read%20all%20of%20the%20entries%20from%20%3CSTRONG%3E%2Fetc%2Fkrb5.keytab%3C%2FSTRONG%3E.%3CBR%20%2F%3Erkt%20%2Fetc%2Fkrb5.keytab%3C%2FLI%3E%0A%3CLI%3ENext%2C%20list%20out%20the%20entries.%3CBR%20%2F%3Elist%3C%2FLI%3E%0A%3CLI%3EDelete%20all%20the%20entries%20by%20their%20slot%20number%20that%20are%20not%20the%20UPN.%20Do%20this%20one%20at%20a%20time%20by%20repeating%20the%20following%20command%3A%3CBR%20%2F%3Edelent%20%3CSLOT%20num%3D%22%22%3E%3CBR%20%2F%3E%3CBR%20%2F%3EImportant%3CBR%20%2F%3EWhen%20an%20entry%20is%20deleted%2C%20such%20as%20slot%201%2C%20all%20values%20slide%20up%20by%20one%20to%20take%20its%20place.%20This%20means%20the%20entry%20in%20slot%202%20moves%20to%20slot%201%20when%20slot%201's%20entry%20is%20deleted.%3C%2FSLOT%3E%3C%2FLI%3E%0A%3CLI%3EList%20out%20the%20entries%20again%20until%20only%20UPN%20entries%20are%20left.%3CBR%20%2F%3Elist%3C%2FLI%3E%0A%3CLI%3EWhen%20only%20UPN%20entries%20are%20left%2C%20append%20these%20values%20to%20%3CSTRONG%3Emssql.keytab%3C%2FSTRONG%3E%3A%3CBR%20%2F%3Ewkt%20%2Fvar%2Fopt%2Fmssql%2Fsecrets%2Fmssql.keytab%3C%2FLI%3E%0A%3CLI%3EQuit%20%3CSTRONG%3Ektutil%3C%2FSTRONG%3E.%3CBR%20%2F%3Equit%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOption%202%3A%20Using%20MSA%20to%20configure%20the%20keytab%3C%2FP%3E%0A%3CP%3EThe%20original%20step1~4%20are%20not%20needed%2C%20just%20the%20step%205%3C%2FP%3E%0A%3CP%3E5.When%20using%20the%20MSA%20approach%2C%20a%20configuration%20option%20needs%20to%20be%20set%20with%20the%20%3CSTRONG%3Emssql-conf%3C%2FSTRONG%3E%20tool%20to%20specify%20the%20MSA%20to%20be%20used%20while%20accessing%20the%20keytab%20file.%20Ensure%20the%20values%20below%20are%20in%20%3CSTRONG%3E%2Fvar%2Fopt%2Fmssql%2Fmssql.conf%3C%2FSTRONG%3E.%3CBR%20%2F%3Esudo%20mssql-conf%20set%20network.privilegedadaccount%20%3CMSA_NAME%3E%3CBR%20%2F%3E%3CBR%20%2F%3ENote%3CBR%20%2F%3EOnly%20include%20the%20MSA%20name%20and%20not%20the%20domain%5Caccount%20name.%3C%2FMSA_NAME%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20rest%20of%20steps%20are%20exactly%20same%20as%20the%20steps%20in%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Flinux%2Fsql-server-linux-active-directory-authentication%3Fview%3Dsql-server-ver15%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsql%2Flinux%2Fsql-server-linux-active-directory-authentication%3Fview%3Dsql-server-ver15%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1027962%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20579px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F158547iB9EC07B962243534%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22sql-loves-linux_2_twitter-002-640x358-100648879-large.png%22%20title%3D%22sql-loves-linux_2_twitter-002-640x358-100648879-large.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1027962%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ELinux%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

There is a known issue with the krb5 library that is shipped on RHEL(7.3, 7.4, 7.5, or 7.6) and Ubuntu(16.04) where AES keys are incorrectly salted on Windows AD systems. There has been a patch in the krb5 library, but that patched version hasn’t shipped on the version Microsoft supports.

 

The incorrect salted value(created by addent command) may cause Windows authentication fail.

 

I'm going to list the updated process(We are going to update the official document soon.)

 

1.Create AD user (or MSA) for SQL Server and set SPN

1)AD User.

On your domain controller, run the New-ADUser PowerShell command to create a new AD user with a password that never expires. The following example names the account mssql, but the account name can be anything you like. You will be prompted to enter a new password for the account.

Import-Module ActiveDirectory

New-ADUser mssql -AccountPassword (Read-Host -AsSecureString "Enter Password") -PasswordNeverExpires $true -Enabled

 

2)Managed Service account

On your domain controller, run the New-ADServiceAccount PowerShell command to create a Managed Service Account with a password that never expires. The following example names the account mssql, but the account name can be anything you like. You will be prompted to enter a new password for the account.

Import-Module ActiveDirectory

New-ADServiceAccount -Name mssql -Enabled $true   -AccountPassword (Read-Host -AsSecureString "Enter Password")  -RestrictToSingleComputer

 

2.Get the KVNO of the account.

   1)Run following powershell command for AD User

Import-Module ActiveDirectory

get-aduser userName -property msDs-KeyVersionNumber

   2)Run following powershell command for MSA account

Import-Module ActiveDirectory

get-ADServiceAccount -Identity MsaName -property msDS-KeyVersionNumber

 

3.Prepare mssql.keytab (this step is applicable to both AD user and MSA)

(KVNO should be replaced with the value in step 2)

ktpass /princ MSSQLSvc/**<fully qualified domain name of host machine>**:**<tcp port>**@**<Full qualified domain name>**            /ptype KRB5_NT_PRINCIPAL /crypto aes256-sha1 /mapuser domainName\accountName   /out mssql.keytab                   -setpass -setupn /kvno **<kvno from above>** /pass <StrongPassword>

ktpass /princ MSSQLSvc/**<fully qualified domain name of host machine>**:**<tcp port>**@**<Full qualified domain name>**     /ptype KRB5_NT_PRINCIPAL /crypto rc4-hmac-nt /mapuser domainName\accountName   /in mssql.keytab /out mssql.keytab -setpass -setupn /kvno **<kvno from above>** /pass <StrongPassword>

ktpass /princ MSSQLSvc/**<netbios name of the host machine>**:**<tcp port>**@**<Full qualified domain name>**                      /ptype KRB5_NT_PRINCIPAL /crypto aes256-sha1 /mapuser domainName\accountName   /in mssql.keytab /out mssql.keytab -setpass -setupn /kvno **<kvno from above>** /pass <StrongPassword>

ktpass /princ MSSQLSvc/**<netbios name of the host machine>**:**<tcp port>**@**<Full qualified domain name>**                      /ptype KRB5_NT_PRINCIPAL /crypto rc4-hmac-nt /mapuser domainName\accountName   /in mssql.keytab /out mssql.keytab -setpass -setupn /kvno **<kvno from above>** /pass <StrongPassword>

Please note,This step will create two SPNs as well if they don’t exist. So you don’t need to run setspn anymore.

 

For MSA account only, add following MSA UPN entries in the keytab file using ktpass.

ktpass /princ msaAccount@<Full qualified domain name>        /ptype KRB5_NT_PRINCIPAL /crypto aes256-sha1 /mapuser domainName\accountName   /in  mssql.keytab /out mssql.keytab  -setpass -setupn /kvno **<kvno from above>** /pass <StrongPassword>

ktpass /princ msaAccount@<Full qualified domain name>        /ptype KRB5_NT_PRINCIPAL /crypto rc4-hmac-nt /mapuser domainName\accountName   /in  mssql.keytab /out mssql.keytab  -setpass -setupn /kvno **<kvno from above>** /pass <StrongPassword>

 

Here is an example

Env

===

SQL Linux box:red1

port:1433

FQDN:red1.CONTOSO.COM

Domain:CONTOSO.COM

Account Name:contoso\sqlcss

KVNO:2

 

ktpass /princ MSSQLSvc/red1.CONTOSO.COM:1433@CONTOSO.COM         /ptype KRB5_NT_PRINCIPAL /crypto aes256-sha1 /mapuser contoso\sqlcss /out mssql.keytab                   -setpass -setupn /kvno 2 /pass Password1

ktpass /princ MSSQLSvc/red1.CONTOSO.COM:1433@CONTOSO.COM /ptype KRB5_NT_PRINCIPAL /crypto rc4-hmac-nt /mapuser contoso\sqlcss   /in mssql.keytab /out mssql.keytab -setpass -setupn /kvno 2 /pass Password1

ktpass /princ MSSQLSvc/red1:1433@CONTOSO.COM                     /ptype KRB5_NT_PRINCIPAL /crypto aes256-sha1 /mapuser contoso\sqlcss   /in mssql.keytab /out mssql.keytab -setpass -setupn /kvno 2 /pass Password1

ktpass /princ MSSQLSvc/red1:1433@CONTOSO.COM                     /ptype KRB5_NT_PRINCIPAL /crypto rc4-hmac-nt /mapuser contoso\sqlcss   /in mssql.keytab /out mssql.keytab -setpass -setupn /kvno 2 /pass Password1

 

If this is a MSA account, additional steps are needed:

ktpass /princ sqlcss@CONTOSO.COM        /ptype KRB5_NT_PRINCIPAL /crypto aes256-sha1 /mapuser contoso\msa01   /in  mssql.keytab /out mssql.keytab  -setpass -setupn /kvno 2 /pass Password1

ktpass /princ sqlcss@CONTOSO.COM        /ptype KRB5_NT_PRINCIPAL /crypto rc4-hmac-nt /mapuser contoso\msa01   /in  mssql.keytab /out mssql.keytab  -setpass -setupn /kvno 2 /pass Password1

 

 

  1. Copy over the keytab file to Linux server, place it in /var/opt/mssql/secrets folder as mssql.keytab.

 


The next step is almost same to https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-active-directory-authentication?view=sql... , with little change.

Option 1: Using UPN to configure the keytab(No change here)

Add the machine account to your keytab with ktutil. The machine account (also called a UPN) is present in /etc/krb5.keytab in the form <hostname>$@<realm.com> (for example, sqlhost$@CONTOSO.COM). Copy these entries from /etc/krb5.keytab to mssql.keytab.

  1. Start ktuil with the following command:
    sudo ktutil
  2. Use the rkt command to read all of the entries from /etc/krb5.keytab.
    rkt /etc/krb5.keytab
  3. Next, list out the entries.
    list
  4. Delete all the entries by their slot number that are not the UPN. Do this one at a time by repeating the following command:
    delent <slot num>

    Important
    When an entry is deleted, such as slot 1, all values slide up by one to take its place. This means the entry in slot 2 moves to slot 1 when slot 1's entry is deleted.
  5. List out the entries again until only UPN entries are left.
    list
  6. When only UPN entries are left, append these values to mssql.keytab:
    wkt /var/opt/mssql/secrets/mssql.keytab
  7. Quit ktutil.
    quit

 

Option 2: Using MSA to configure the keytab

The original step1~4 are not needed, just the step 5

5.When using the MSA approach, a configuration option needs to be set with the mssql-conf tool to specify the MSA to be used while accessing the keytab file. Ensure the values below are in /var/opt/mssql/mssql.conf.
sudo mssql-conf set network.privilegedadaccount <MSA_Name>

Note
Only include the MSA name and not the domain\account name.

 

 

 

The rest of steps are exactly same as the steps in https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-active-directory-authentication?view=sql...