So my question is, if I just installed spark, how does it know where to look for that principal to use for SSO?
Obviously, Spark connections to my Openfire server (all running under Windows) work perfectly and without any problems.
I think I have properly configured everything necessary for SSO in Openfire, but I think I am at a previous step before this can be validated, checked and/or corrected.
I knew and followed your video. It helped me a lot and I only had to make a few small changes.
But everything you said in that video is about the Openfire server and I was wondering why Spark says it’s unable to find the primary to use for SSO.
I mean, how does Spark know which SPN to query?
In this link https://discourse.igniterealtime.org/t/sso-configuration/49064, Jay was talking about Principal vs Service Principal.
So, If Spark is looking for about Principal, how does Spark know who that user is?
it reads it from kerberos ticket and using dns. did you make the correct registry edits on your windows client running spark so that java can read the ticket?
mainly
On workstations make the following registry change
can you post your logs. spark and openfire, as there may be clues there. usually the issue is related to DNS, keytab file, or incorrect case being used in the config files.
you’re limited the enc types to old types that are now disable by default in current windows. in your AD for your keytab user account, check the box for aes128, and recreate your keytab file.
also, the logs in spark indicate that you might be having some connection issues due to certificate. or testing, in spark, set it to accept all certificates
You are right, I had been doing some tests in order to replace the self-signed certificate with another one from my internal CA, and nowdays it’s working properly.
All right, I remove those lines from the libdefaults section in the krb5.ini file on both computers.
About keytab file, the keytab user in account options they are checked: user cannot change password, password never expires and this account supports 128-bit Kereros AES encryption (I was using 256 bits because I had read that nowadays you should use 256 bits).
Then I recreate the keytab file running this command:
After that, I copy the file to the right location on the openfire server.
Finally, I restart the Openfire server (I know that restarting the service is enough, but I prefer the first option).
P.S.: I have noticed that after running the keytab command, in the properties of the keytab user, in its account tab, the user login name has been changed from keytab to xmpp/myxmppserver.mydomain.local.
In fact, if I undo this change and rerun the command, it happens the same.
The user login name pre-Windows 2000 (under MYDOMAIN) is never changed
I’m using Windows Server 2022 Standard in both servers (DC & Openfire)
You should then check use single sign on and use dns. does spark not let you do this?
256 is recommended, but its only works if your JRE supports it. Older versions don’t include the needed libraries out of the box. I’m not sure if that’s changed or not.
I follow your instructions and after configuring SSO (clicking on the checkbox " Use Single Sign-On (SSO) via GSSAPI" and selecting the checkbutton “Use DNS”, when I click on the login button I get this:
If I click in “Details” It give back this:
org.jivesoftware.smack.sasl.javax.SmackJavaxSaslException: javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null))]
at org.jivesoftware.smack.sasl.javax.SASLJavaXMechanism.getAuthenticationText(SASLJavaXMechanism.java:127)
at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:202)
at org.jivesoftware.smack.sasl.SASLMechanism.authenticate(SASLMechanism.java:169)
at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:200)
at org.jivesoftware.smack.AbstractXMPPConnection.authenticate(AbstractXMPPConnection.java:897)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginInternal(XMPPTCPConnection.java:382)
at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:638)
at org.jivesoftware.gui.LoginUIPanel.login(LoginUIPanel.java:1273)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null))]
at com.sun.security.sasl.gsskerb.GssKrb5Client.evaluateChallenge(Unknown Source)
at org.jivesoftware.smack.sasl.javax.SASLJavaXMechanism.getAuthenticationText(SASLJavaXMechanism.java:124)
… 12 more
Caused by: GSSException: No valid credentials provided (Mechanism level: Attempt to obtain new INITIATE credentials failed! (null))
at sun.security.jgss.krb5.Krb5InitCredential.getTgt(Unknown Source)
at sun.security.jgss.krb5.Krb5InitCredential.getInstance(Unknown Source)
at sun.security.jgss.krb5.Krb5MechFactory.getCredentialElement(Unknown Source)
at sun.security.jgss.krb5.Krb5MechFactory.getMechanismContext(Unknown Source)
at sun.security.jgss.GSSManagerImpl.getMechanismContext(Unknown Source)
at sun.security.jgss.GSSContextImpl.initSecContext(Unknown Source)
at sun.security.jgss.GSSContextImpl.initSecContext(Unknown Source)
… 14 more
Caused by: javax.security.auth.login.LoginException: Unable to obtain Principal Name for authentication
at com.sun.security.auth.module.Krb5LoginModule.promptForName(Unknown Source)
at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Unknown Source)
at com.sun.security.auth.module.Krb5LoginModule.login(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.invoke(Unknown Source)
at javax.security.auth.login.LoginContext.access$000(Unknown Source)
at javax.security.auth.login.LoginContext$4.run(Unknown Source)
at javax.security.auth.login.LoginContext$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(Unknown Source)
at javax.security.auth.login.LoginContext.login(Unknown Source)
at sun.security.jgss.GSSUtil.login(Unknown Source)
at sun.security.jgss.krb5.Krb5Util.getInitialTicket(Unknown Source)
at sun.security.jgss.krb5.Krb5InitCredential$1.run(Unknown Source)
at sun.security.jgss.krb5.Krb5InitCredential$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
… 21 more
P.S.: I have noticed that after running the keytab command, in the properties of the keytab user, in its account tab, the user login name has been changed from keytab to xmpp/myxmppserver.mydomain.local.
this might require a bit more troubleshooting. try closing spark/ending the application and refresh your tgt ticket. you can do this by locking and unlocking our screen. then start spark and see if you get your username password prefilled? if not, close spark and try running as administrator.
I restart the computer rather than lock and unlock it.
After that, if I start spark and I get both username and domain prefilled.
Finally, if I start spark running as administrator, I also get both textboxs prefilled, but SSO settings aren’t configured.
Once I configure SSO setting and click on login button, I get this:
org.jivesoftware.smack.sasl.SASLErrorException: SASLError using GSSAPI: not-authorized
at org.jivesoftware.smack.SASLAuthentication.authenticationFailed(SASLAuthentication.java:286)
at org.jivesoftware.smack.AbstractXMPPConnection.lambda$new$2(AbstractXMPPConnection.java:407)
at org.jivesoftware.smack.NonzaCallback$ClassAndConsumer.accept(NonzaCallback.java:177)
at org.jivesoftware.smack.NonzaCallback$ClassAndConsumer.access$200(NonzaCallback.java:166)
at org.jivesoftware.smack.NonzaCallback.onNonzaReceived(NonzaCallback.java:46)
at org.jivesoftware.smack.AbstractXMPPConnection.parseAndProcessNonza(AbstractXMPPConnection.java:1440)
at org.jivesoftware.smack.tcp.XMPPTCPConnection.access$1700(XMPPTCPConnection.java:131)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1010)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$700(XMPPTCPConnection.java:916)
at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:939)
at java.lang.Thread.run(Unknown Source)
#0> Cliente: my_user @ MYDOMAIN.LOCAL
Servidor: krbtgt/MYDOMAIN.LOCAL @ MYDOMAIN.LOCAL
Tipo de cifrado de vale Kerberos: AES-256-CTS-HMAC-SHA1-96
Marcas de vale 0x60a10000 → forwardable forwarded renewable pre_authent name_canonicalize
Hora de inicio: 8/19/2024 19:27:56 (local)
Hora de finalización: 8/20/2024 5:27:50 (local)
Hora de renovación: 8/26/2024 19:27:50 (local)
Tipo de clave de sesión: AES-256-CTS-HMAC-SHA1-96
Marcas de caché: 0x2 → DELEGATION
KDC llamado: MYDC.mydomain.local
#1> Cliente: my_user @ MYDOMAIN.LOCAL
Servidor: krbtgt/MYDOMAIN.LOCAL @ MYDOMAIN.LOCAL
Tipo de cifrado de vale Kerberos: AES-256-CTS-HMAC-SHA1-96
Marcas de vale 0x40e10000 → forwardable renewable initial pre_authent name_canonicalize
Hora de inicio: 8/19/2024 19:27:50 (local)
Hora de finalización: 8/20/2024 5:27:50 (local)
Hora de renovación: 8/26/2024 19:27:50 (local)
Tipo de clave de sesión: AES-256-CTS-HMAC-SHA1-96
Marcas de caché: 0x1 → PRIMARY
KDC llamado: MYDC.mydomain.local
#2> Cliente: my_user @ MYDOMAIN.LOCAL
Servidor: cifs/MYDC.mydomain.local/mydomain.local @ MYDOMAIN.LOCAL
Tipo de cifrado de vale Kerberos: AES-256-CTS-HMAC-SHA1-96
Marcas de vale 0x40a50000 → forwardable renewable pre_authent ok_as_delegate name_canonicalize
Hora de inicio: 8/19/2024 19:27:56 (local)
Hora de finalización: 8/20/2024 5:27:50 (local)
Hora de renovación: 8/26/2024 19:27:50 (local)
Tipo de clave de sesión: AES-256-CTS-HMAC-SHA1-96
Marcas de caché: 0
KDC llamado: MYDC.mydomain.local
#3> Cliente: my_user @ MYDOMAIN.LOCAL
Servidor: LDAP/MYDC.mydomain.local/mydomain.local @ MYDOMAIN.LOCAL
Tipo de cifrado de vale Kerberos: AES-256-CTS-HMAC-SHA1-96
Marcas de vale 0x40a50000 → forwardable renewable pre_authent ok_as_delegate name_canonicalize
Hora de inicio: 8/19/2024 19:27:54 (local)
Hora de finalización: 8/20/2024 5:27:50 (local)
Hora de renovación: 8/26/2024 19:27:50 (local)
Tipo de clave de sesión: AES-256-CTS-HMAC-SHA1-96
Marcas de caché: 0
KDC llamado: MYDC.mydomain.local
not-authorized is good. that means it reading your session ticket, but there is a likely mismatch somewhere. review your openfire logs. what do you have for the system setting, xmpp fqdn?