I am using a vendor-provided configuration of Apache Tomcat that utilizes JNDI Realms to connect to Active Directory to perform user authentication. Part of the configuration includes specifying the connectionUrl and an optional alternateUrl for targets to use for user authentication.
With the latest iteration of the software bundled using Apache Tomcat v9.0.68.0 running with Eclipse Adoptium 11.0.17+8, the connection attempts are being directed to our cloud-based AD domain controllers to service the authentication request. There are no firewall rules to allow this traffic in or out of the corporate network. When we look at packet captures using WireShark we can see traffic outbound from the application server with a destination port of 636 (LDAPS) and a destination server of either of the local domain controllers defined in the connectionUrl and/or alternateUrl realm options.
When we look at the firewall logs using Panorama, we see a source of the application server and a destination server of either our AWS domain controllers or Azure domain controllers on port 636. These correspond to the logs in the application where we see these:
Aug 03, 2023 2:55:27 PM org.apache.catalina.realm.JNDIRealm authenticate
SEVERE: Exception performing authentication
javax.naming.PartialResultException [Root exception is javax.naming.CommunicationException: cpr.ca:636 [Root exception is java.net.SocketTimeoutException: connect timed out]]
I have worked with the vendor's R&D team as well as our Domain Admins and network/firewall team and no one has been able to come up with a reason or a resolution to prevent this from happening. If nothing else, I'm looking to try to get more information from the process, whether it is through debug logging, other options for the connector, engine, realm, etc. or black magic!
This is an excerpt of the server.xml file's JNDI Realm definition:
<Realm className="com.bmc.bcan.catalina.realm.BNALockOutRealm"
failureCount="5"
lockOutTime="86400"
cacheSize="1000"
cacheRemovalWarningTime="3600">
<Realm className="com.bmc.bcan.catalina.realm.BNAJNDIRealm"
connectionURL="ldaps://<FQDN1>:636"
alternateURL="ldaps://<FQDN2>:636"
connectionName="CN=*****,OU=*****,OU=*****,OU=*****,OU=*****,OU=*****,DC=**,DC=**"
connectionPassword="<password>"
userBase="DC=**,DC=**"
userSearch="(sAMAccountName={0})"
userSubtree="true"
referrals="follow"
/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false">
<Valve className="org.apache.catalina.valves.ErrorReportValve" showReport="false" showServerInfo="false" />
</Host>
</Engine>```