Code Monkey home page Code Monkey logo

Comments (13)

makirby avatar makirby commented on July 30, 2024 1

Having very much the same problem as @Code-DJ my config looks very much the same.

@saurabh500 After running setspn -l SQLSERVERNAME against the SQL server I cannot see MSSQLSvc/SQLSERVERNAME listed, only RestrictedKrbHost/SQLSERVERNAME would this be causing the issue?

from azuredatastudio.

Code-DJ avatar Code-DJ commented on July 30, 2024

Additionally, I have followed the instructions for the mssql extension of vscode and still get the error:

klist shows the following:

Credentials cache: API:40D6C9CB-493E-4FEB-A227-1B551220F829
        Principal: [email protected]

  Issued                Expires               Principal
Nov 15 10:30:32 2017  Nov 15 20:30:32 2017  krbtgt/[email protected]
Nov 15 10:42:06 2017  Nov 15 20:30:32 2017  HTTP/[email protected]
Nov 15 10:53:15 2017  Nov 15 20:30:32 2017  HTTP/[email protected]

I have dotnet 2.0 installed

❯ dotnet --version
2.0.0

/etc/pam.d/authorization added default_principal at the end of first line as shown below

auth       optional       pam_krb5.so use_first_pass use_kcminit default_principal

/etc/pam.d/screensaver added default_principal at the end of first line as shown below

auth       optional       pam_krb5.so use_first_pass use_kcminit default_principal

created a new file /etc/krb5.conf

[libdefaults]
  default_realm = DOMAIN.COM

[realms] DOMAIN.COM = {
   kdc = DOMAINADSVR.domain.com
}

Rebooted the machine
Tried to connect, didn't work
Ran kinit [email protected]
Entered password
Tried to connect, didn't work

from azuredatastudio.

jpcho83 avatar jpcho83 commented on July 30, 2024

I am also having this exact same issue. Please advise.

from azuredatastudio.

saurabh500 avatar saurabh500 commented on July 30, 2024

Can you follow the recommendations mentioned at
microsoft/vscode-mssql#985 (comment)
microsoft/vscode-mssql#985 (comment)

from azuredatastudio.

gedasss avatar gedasss commented on July 30, 2024

same here on ubuntu 17.10

from azuredatastudio.

tjbjr02 avatar tjbjr02 commented on July 30, 2024

I was having the same issues following these instructions.
Make sure your domain information in the /etc/krb5.conf is in all caps. Also ensure when you kinit you put the domain information in your login information in all caps also. Once I did this, it worked immediately.

from azuredatastudio.

haled avatar haled commented on July 30, 2024

I used all caps as @tjbjr02 stated above and it worked. My command looked like: kinit [email protected]

from azuredatastudio.

Code-DJ avatar Code-DJ commented on July 30, 2024

Same as @makirby ran setspn and only see RestrictedKrbHost/SQLSERVERNAME

Tried @tjbjr02 suggestion. Verified that domain information in my /etc/krb5.conf is all uppercase. Even though I am logged in as domain user on the Mac and klist does list Credentials cache. Ran klist [email protected]. Tried both SQLSERVERNAME and SQLSERVERNAME.DOMAIN.COM in SQL Ops Studio. Still get the same error.

Here's what my /etc/krb5.conf looks like:

[libdefaults]
  default_realm = DOMAIN.COM

[realms] DOMAIN.COM = {
   kdc = DOMAINAD.DOMAIN.COM
}

Here's what my klist looks like immediately after login - note the username is lowercase:

❯ klist
Credentials cache: API:C263F9FC-2D3B-4A1A-88D7-BE4970B51830
        Principal: [email protected]

  Issued                Expires               Principal
Nov 17 09:51:24 2017  Nov 17 19:51:24 2017  krbtgt/[email protected]
Nov 17 09:51:27 2017  Nov 17 19:51:24 2017  cifs/[email protected]

from azuredatastudio.

saurabh500 avatar saurabh500 commented on July 30, 2024

Thanks @Code-DJ and @makirby for the information.
@makirby Yes, not having a Sql Server SPN registered on the Sql Server means that your client OS cannot get a Kerberos token for Windows authentication on the Client machine.
The SPN is registered and used by the KDC to generate a token for the SQL server. Looks like your SQL Server is not configured to allow Kerberos authentication.

From Unix / macOS we support integrated authentication using Kerberos only. You will need to register an SPN for the SQL server to make sure a token can be generated for the server and Kerberos auth can proceed.

from azuredatastudio.

Code-DJ avatar Code-DJ commented on July 30, 2024

Thanks @saurabh500 I can confirm this works.

Ran the following command on my SQL Server:

setspn -A MSSQLSvc/SERVERNAME.Domain.com username

For username I used the same name that is running the SQL Server Service. I hope it is correct and does not have any security impact. Thanks!

Through process of elimination I will try and figure out which items I don't need. For example in trying this out, I had to create the following files:
~/.ssh/config file
/etc/krb5.conf

Didn't have default_principal in:
/etc/pam.d/authorization
/etc/pam.d/screensaver

Side note: After running the setspn -A command, I re-ran setspn -L %COMPUTERNAME%. I still only see RestrictedKrbHost.

from azuredatastudio.

Code-DJ avatar Code-DJ commented on July 30, 2024

Verified that it still works after I did the following:

Deleted the following files:
rm ~/.ssh/config
sudo rm /etc/krb5.conf

Removed default_principal from the following files:
/etc/pam.d/authorization
/etc/pam.d/screensaver

Rebooted the Mac. After login, SQL Ops Studio continues to work. Note that I login to the Mac as a active directory domain user (not a local macOS user).

from azuredatastudio.

saurabh500 avatar saurabh500 commented on July 30, 2024

Thanks for the confirmation @Code-DJ

For username I used the same name that is running the SQL Server Service. I hope it is correct and does not have any security impact. Thanks!

You are good here wrt security.

Side note: After running the setspn -A command, I re-ran setspn -L %COMPUTERNAME%. I still only see RestrictedKrbHost.

I have observed this as well. I think this may have to do with the AD replication of the SPN. I am no expert with the internals of AD and its handling and propagation of data. However I have seen these delay in SPN propagation in our corp environment as well.

from azuredatastudio.

saurabh500 avatar saurabh500 commented on July 30, 2024

Folks I will close this issue considering that we know about the end to end setup requirements for Windows Authentication to work.

In case of @Code-DJ he could set an SPN but that may always not be possible based on the permissions provided by the Administrators of the Active Directory in the organization.
However since many developers in an organization may need to setup their server SPNs for different servers like IIS or Sql Server, it is a common scenario to allow the members of AD to allow SPN registration.

from azuredatastudio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.