<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;">
<div>
<div>
<div>Will do.</div>
<div><br>
</div>
<div>This is Active Directory. &nbsp;</div>
<div><br>
</div>
<div>-Jason</div>
<div>
<div id="MAC_OUTLOOK_SIGNATURE"></div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Marek Posolda &lt;<a href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Thursday, February 18, 2016 at 8:15 AM<br>
<span style="font-weight:bold">To: </span>Jason Axley &lt;<a href="mailto:jaxley@expedia.com">jaxley@expedia.com</a>&gt;, &quot;<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&quot; &lt;<a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>Re: [keycloak-user] LDAPS configuration fails &quot;Test authentication&quot;<br>
</div>
<div><br>
</div>
<div>
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">That's possible. Could you please create JIRA for this?
<br>
<br>
Which LDAP server are you using btv? Not sure if it's related, but maybe yes...<br>
<br>
Thanks,<br>
Marek<br>
<br>
On 18/02/16 17:04, Jason Axley wrote:<br>
</div>
<blockquote cite="mid:7237EFC8-93C7-400D-BAB7-545A5850F950@expedia.com" type="cite">
<div>
<div>
<div>I got the keystore working in the keycloak-server.json config to enable SMTP TLS connections to Amazon SES so I know that is being picked up:</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
&quot;truststore&quot;: {</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
&nbsp; &nbsp; &nbsp; &quot;file&quot;: {</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;file&quot;: &quot;${jboss.server.config.dir}/keycloak.jks&quot;,</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;password&quot;: “password&quot;,</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
<span class="Apple-tab-span" style="white-space:pre"></span>&nbsp; &quot;hostname-verification-policy&quot;: &quot;WILDCARD&quot;,</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
<span class="Apple-tab-span" style="white-space:pre"></span>&nbsp; &quot;disabled&quot;: false</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
&nbsp; &nbsp; &nbsp; }</p>
<p style="margin: 0px; font-size: 12px; font-family:
              Courier; color: rgb(255, 240, 165); background-color:
              rgb(19, 119, 62);">
&nbsp; }</p>
</div>
<div></div>
</div>
</div>
<div><br>
</div>
<div>But, this same configuration is not applied to the LDAP connections. &nbsp;I finally got it to work by adding the Java keystore arguments to the startup:</div>
<div><br>
</div>
<div>
<p style="margin: 0px; font-size: 12px; font-family: Courier;
          color: rgb(76, 47, 45); background-color: rgb(223, 219, 196);">
nohup ../bin/standalone.sh -Djavax.net.ssl.trustStore=/opt/keycloak/keycloak-1.8.1.Final/standalone/configuration/keycloak.jks -Djavax.net.ssl.trustStorePassword=password</p>
</div>
<div><br>
</div>
<div>Would seem to be a bug to not apply the same keystore configuration to the LDAP connections?</div>
<div><br>
</div>
<div>-Jason</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:12pt;
          text-align:left; color:black; BORDER-BOTTOM: medium none;
          BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT:
          0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid;
          BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<span style="font-weight:bold">From: </span>Marek Posolda &lt;<a moz-do-not-send="true" href="mailto:mposolda@redhat.com">mposolda@redhat.com</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Wednesday, February 17, 2016 at 11:10 PM<br>
<span style="font-weight:bold">To: </span>Jason Axley &lt;<a moz-do-not-send="true" href="mailto:jaxley@expedia.com"></a><a class="moz-txt-link-abbreviated" href="mailto:jaxley@expedia.com">jaxley@expedia.com</a>&gt;, &quot;<a moz-do-not-send="true" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&quot;
 &lt;<a moz-do-not-send="true" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>Re: [keycloak-user] LDAPS configuration fails &quot;Test authentication&quot;<br>
</div>
<div><br>
</div>
<div>
<div bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 17/02/16 22:46, Jason Axley wrote:<br>
</div>
<blockquote cite="mid:73069D77-A2F8-418C-BBC6-522938C1E4A2@expedia.com" type="cite">
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
I followed some documentation like&nbsp;<a moz-do-not-send="true" href="https://developer.jboss.org/wiki/LDAPSecurityRealmExamples"></a><a class="moz-txt-link-freetext" href="https://developer.jboss.org/wiki/LDAPSecurityRealmExamples">https://developer.jboss.org/wiki/LDAPSecurityRealmExamples</a>&nbsp;for
 configuring JBOSS to use LDAP over SSL to Active Directory but can’t seem to get Keycloak to honor the trust settings in the configured keystore.</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
2016-02-17 21:33:49,670 ERROR [org.keycloak.services.managers.LDAPConnectionTestManager] (default task-2) Error when authenticating to LDAP: simple bind failed: server.example.com:636: javax.naming.CommunicationException: simple bind failed: server.example.com:636
 [Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
&nbsp; &nbsp; &nbsp; &nbsp; at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:219)</p>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
This is the configuration I’m using for the standalone server:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<br>
</div>
<div>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span>&lt;security-realm
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #00a500">
name</span><span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">=</span><span style="font-variant-ligatures: no-common-ligatures;
                    color: #b12512">&quot;LdapSSLRealm&quot;</span>&gt;</p>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>&lt;authentication&gt;</p>
<p style="color: rgb(177, 37, 18); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span><span style="font-variant-ligatures:
                    no-common-ligatures; color: #01a3af">&lt;truststore
</span><span style="font-variant-ligatures:
                    no-common-ligatures; color: #00a500">path</span><span style="font-variant-ligatures: no-common-ligatures;
                    color: #4c2f2d">=</span>&quot;keycloak.jks&quot;<span style="font-variant-ligatures: no-common-ligatures;
                    color: #01a3af"></span><span style="font-variant-ligatures: no-common-ligatures;
                    color: #00a500">relative-to</span><span style="font-variant-ligatures: no-common-ligatures;
                    color: #4c2f2d">=</span>&quot;jboss.server.config.dir&quot;<span style="font-variant-ligatures: no-common-ligatures;
                    color: #01a3af"></span><span style="font-variant-ligatures: no-common-ligatures;
                    color: #00a500">keystore-password</span><span style="font-variant-ligatures: no-common-ligatures;
                    color: #4c2f2d">=</span>“password&quot;<span style="font-variant-ligatures: no-common-ligatures;
                    color: #01a3af">
 /&gt;</span></p>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>&lt;/authentication&gt;</p>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</span>&lt;/security-realm&gt;</p>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp; &nbsp; &nbsp; &nbsp;
</span>&lt;/security-realms&gt;</p>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp; &nbsp; &nbsp; &nbsp;
</span>&lt;outbound-connections&gt;</p>
<p style="margin: 0px; background-color: rgb(223, 219,
                  196);">
<span style="color: rgb(76, 47, 45);
                    font-family: Courier; font-size: 12px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span><span style="color: rgb(1, 163, 175); font-family:
                    Courier; font-size: 12px;">&lt;ldap
</span><span style="color: rgb(0, 165, 0);
                    font-family: Courier; font-size: 12px;">name</span><span style="color: rgb(76, 47, 45); font-family: Courier;
                    font-size: 12px;">=</span><font face="Courier" color="#b12512"><span style="font-size: 12px;">“AD&quot;</span></font><span style="color: rgb(1, 163, 175); font-family:
                    Courier; font-size: 12px;"></span><span style="color: rgb(0, 165, 0); font-family: Courier;
                    font-size: 12px;">url</span><span style="color:
                    rgb(76, 47, 45); font-family: Courier; font-size:
                    12px;">=</span><span style="color: rgb(177, 37, 18);
                    font-family: Courier; font-size: 12px;"><a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="ldaps://server.example.com:636"></a><a class="moz-txt-link-rfc2396E" href="ldaps://server.example.com:636">&quot;ldaps://server.example.com:636&quot;</a></span><span style="color: rgb(1, 163, 175); font-family:
                    Courier; font-size: 12px;"></span><span style="color: rgb(0, 165, 0); font-family: Courier;
                    font-size: 12px;">security-realm</span><span style="color: rgb(76, 47, 45); font-family: Courier;
                    font-size: 12px;">=</span><span style="color:
                    rgb(177, 37, 18); font-family: Courier; font-size:
                    12px;">&quot;LdapSSLRealm&quot;</span><span style="color:
                    rgb(1, 163, 175); font-family: Courier; font-size:
                    12px;">
 /&gt;</span></p>
<p style="color: rgb(1, 163, 175); font-family: Courier;
                  font-size: 12px; margin: 0px; background-color:
                  rgb(223, 219, 196);">
<span style="font-variant-ligatures:
                    no-common-ligatures; color: #4c2f2d">&nbsp; &nbsp; &nbsp; &nbsp;
</span>&lt;/outbound-connections&gt;</p>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
I have all of the certs in the chain imported into the keystore:</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
keytool -list -keystore ../configuration/keycloak.jks&nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Enter keystore password: &nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196); min-height: 14px;">
<br>
</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Keystore type: JKS</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Keystore provider: SUN</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196); min-height: 14px;">
<br>
</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Your keystore contains 5 entries</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196); min-height: 14px;">
<br>
</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
cert1, Feb 17, 2016, trustedCertEntry,&nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Certificate fingerprint (SHA1): D5:BA:F5:07:21:7D:71:AA:F6:9B:53:41:C1:05:0C:48:A9:3F:57:CE</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
rootcert2, Feb 17, 2016, trustedCertEntry,&nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Certificate fingerprint (SHA1): 86:70:AB:0A:96:58:4D:73:C0:D5:13:A8:4D:B3:1D:EC:08:D7:7B:1A</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
mykey, Feb 12, 2016, trustedCertEntry,&nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Certificate fingerprint (SHA1): 20:8C:D9:BD:B7:75:12:53:F8:68:04:82:48:5C:D7:70:F5:6C:28:15</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
rootcert, Feb 17, 2016, trustedCertEntry,&nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Certificate fingerprint (SHA1): 36:28:1E:74:E0:A9:6E:0F:53:99:75:DA:62:20:24:D4:F6:34:CD:BD</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
intermediateu, Feb 17, 2016, trustedCertEntry,&nbsp;</p>
<p style="margin: 0px; font-size: 12px; font-family:
                  Courier; color: rgb(76, 47, 45); background-color:
                  rgb(223, 219, 196);">
Certificate fingerprint (SHA1): E9:66:EE:CF:79:6A:C1:D0:13:18:59:9C:B4:29:08:54:DF:91:27:2D</p>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<br>
</div>
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
Is there a way to find out if Keycloak/jboss is picking up this truststore config? &nbsp;Seems that it’s not. &nbsp;Any other ideas?</div>
</blockquote>
Yes, it seems that it's not picking it. AFAIK we don't support retrieve truststore from the wildfly configuration of security-realm in standalone.xml . Maybe we should...<br>
<br>
At this moment, what should work to configure truststore is either:<br>
- Configure truststore SPI in keycloak-server.json. See <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://keycloak.github.io/docs/userguide/keycloak-server/html/server-installation.html#d4e231">
</a><a class="moz-txt-link-freetext" href="http://keycloak.github.io/docs/userguide/keycloak-server/html/server-installation.html#d4e231">http://keycloak.github.io/docs/userguide/keycloak-server/html/server-installation.html#d4e231</a><br>
- add system properties <code class="literal">javax.net.ssl.trustStore and </code>
<code class="literal">javax.net.ssl.trustStorePassword<br>
<br>
Marek<br>
</code>
<blockquote cite="mid:73069D77-A2F8-418C-BBC6-522938C1E4A2@expedia.com" type="cite">
<div style="color: rgb(0, 0, 0); font-family: Calibri,
                sans-serif; font-size: 14px;">
<div id="">
<div style="font-size: 14px;">
<div>-Jason</div>
</div>
<div>
<p class="MsoNormal" style="font-size: 11pt; margin:
                      0in 0in 0.0001pt;">
<span style="font-size: 8pt; color: rgb(31, 73,
                        125);"></span></p>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">_______________________________________________
keycloak-user mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/keycloak-user">https://lists.jboss.org/mailman/listinfo/keycloak-user</a></pre>
</blockquote>
<br>
</div>
</div>
</span></blockquote>
<br>
</div>
</div>
</span>
</body>
</html>