-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Kerberos ticket cache on Linux? #468
Comments
sqlcmd hasn't yet added krb5 support. What do you think the sqlcmd command line should look like on Linux for proper krb5 support ? Passing individual file paths and settings on a command line is tedious at best, and we don't have very many short flags left. |
@shueybubbles Thanks for confirming. I browsed some of the older discussions and I also think environment variables are the best way to go, in addition to checking default locations like I personally don't mind not having a sqlcmd flag, the ability to set the environment per invocation fulfils all my needs KRB5_CONFIG=krb1.conf sqlcmd -S server1 ... |
the other required parameter for the driver is If I don't know how to deal with the cache path in a simple way. The MIT Kerberos environment variables described at https://web.mit.edu/kerberos/krb5-1.12/doc/mitK5defaults.html#mitk5defaults don't make sense to me re: specifying path to a cache file. How would I translate |
I guess the cache file would have to be set like I will update the driver to check for |
That seems right, with a fallback to default_realm from the krb5.conf.
The best explanation I could find: The default credential cache name is determined by the following, in descending order of priority:
Source https://web.mit.edu/kerberos/krb5-1.12/doc/basic/ccache_def.html#default-ccache-name |
I am reluctant to have the driver directly load or parse krb5.conf to get the defaults |
Actually I'm having second thoughts about this, that's not how SQLCMD based on ODBC works. You run it without -U/-P and then it automatically uses the credential cache with whatever default principal is present. Useful in scripting where you don't want to pass around the principal name and just use the integrated auth. |
I might be reading the code wrong (I never used Go) but doesn't gokrb5 already contain all the bits to parse the krb5.conf? And it's already used in go-msqldb, for example here |
yeah looking closer I think the main issue is the go-mssqldb change that happened originally could have just tried to load the config from the default location and used it directly if no krb-specific parameters are set. When I first peeked at the jcmturner package, I didn't see any references to the environment variables though. I don't have a TON of time to spend on this, so I think i will just get the minimum going for now. Once the current driver PR goes through, I can update sqlcmd to use it and sqlcmd will set |
Sounds reasonable. 👍 One thing that I found curious is that the driver can handle Kerberos logins with a password or keytab file. I only expected to find support for the credential cache. Contacting the KDC server is usually handled out-of-band like a in a cronjob, isn't it? I don't believe the old SQLCMD supported anything but the credential cache? |
I am far from an expert here. |
I think you are correct. Based on information in https://web.mit.edu/kerberos/krb5-1.12/doc/basic/keytab_def.html And The Client keytab is used to obtain tickets. The other keytab would be used in server applications to decrypt the tickets of inbound users. |
Also just to make sure, did you take notice of my previous #468 (comment) about having to pass a -U with integrated auth? I think it may got lost in the noise. |
I am still a while away from getting to this implementation. My hope is to allow integrated auth with krb5 to "just work" with sqlcmd from the end user perspective, but I will have to work within the limitations of the go-mssqldb implementation. It might be that if you want to force it to use the cache you need to set an environment variable; I'm not 100% clear on the final result yet. |
Hello,
I want to use Kerberos on Debian 11 to authenticate with SQL Server but I'm struggling to get sqlcmd to catch on with what I'm trying to accomplish.
I have
krb5-user
andkrb5-conf
packages installed.I logged in with
kinit
before running sqlcmd, which created a ticket cache in/tmp/krb5cc
as is evident when I runklist
.Is it possible integrated authentication was just not implemented for Linux? I couldn't find any references to
krb5conffile
orkrbcache
in the code (which I believe is what the driver expects according to microsoft/go-mssqldb#35).The text was updated successfully, but these errors were encountered: