Jenkins connection to LDAP - java

Ok, I am completely stumped here. I am running the Jenkins application (v1.635) for Mac OSX. I am trying to connect to Active Directory through the LDAP Security Realm. No matter what I try (and I have tried a good 30+ variants), the login fails and nothing gets written to the jenkins.log file.
I have ApacheDirectoryStudio installed and it connects flawlessly, so I know it is a Jenkins issue (and not a network or ACL issue).
The LDAP server is using a self-signed SSL certificate, which I installed into the relevant cacerts file.
Here's my LDAP configuration (minus the sensitive corporate stuff)
Server: ldaps://subdomain.domain.com:636
root DN: DC=domain,DC=com
User search base: OU=Users and Computers
User search filter: sAMAccountName={0}
Group search base: OU=Jenkins Groups,OU=Groups
Group search filter: (&(objectclass=group)(cn={0}))
Group membership: Parse user attribute for list of groups
Group membership attribute: memberOf
Manager DN: CN=jenkins,OU=Users and Computers,DC=domain,DC=com
Manager Password: password
Display Name LDAP attribute: displayname
Email Address LDAP attribute: mail
Disable Ldap Email Resolver: unchecked
Any help is greatly appreciated. Even getting the log file to spit out some info would be great.
Thanks!
Edit #1: Sometimes an exception does show up in the log file. Hopefully this helps.
Nov 09, 2015 12:00:49 PM hudson.security.LDAPSecurityRealm$LDAPUserDetailsService loadUserByUsername
WARNING: Failed to search LDAP for username=myuser
org.acegisecurity.ldap.LdapDataAccessException: Unable to connect to LDAP server; nested exception is javax.naming.CommunicationException: subdomain.domain.com:636 [Root exception is java.net.SocketTimeoutException: Connect timed out]
Edit #2: I have to go to an 1 1/2 hour meeting, so my responses will be delayed. Sorry.

So it's not ideal, but I was able to get the connection to work with the plain ldap connection (not ldaps). All I can figure is that Apache Directory Studio is smarter than Jenkins when it comes to establishing the connection. I suspect there may be an issue with the self-signed SSL certificate chain that Jenkins can't quite figure out. I really wish there was more verbosity to the logs in this matter. But for now, I have it working and since it is behind the corporate firewalls, the non-secure connection is less of a risk. I still intend to figure out the root cause, but for now, this will have to do. Thanks for your suggestions.

Related

WMI Providers Not Working after Windows DCOM Server Hardening for CVE-2021-26414

We have application which was using by Customer and customer like to update authentication from our application to AD from NTLM to Kerberos. Based on this article, it may have to be done by early 2022.
https://support.microsoft.com/en-us/topic/kb5004442-manage-changes-for-windows-dcom-server-security-feature-bypass-cve-2021-26414-f1400b52-c141-43d2-941e-37ed901c769c
In the document below, it is listing the different levels that are required, and Microsoft is stating that RPC_C_AUTHN_LEVEL_PKT_INTEGRITY or higher is required shortly. Right now the error we are having on their DC's from Our application authentications is that the user in our AD scope under passive ID for monitoring is attempting to connect to our domain at too low of a security level.
https://docs.microsoft.com/en-us/windows/win32/rpc/authentication-level-constants
In our application Admin Web UI we are geeing the issue:
The connection was tested on '' PassiveID active node.
Connection to 'ws2022-a.lab2022.local' failed.
Access is denied. Please check credentials, permissions and configure the Windows machine for WMI access.
In AD event viewer > Administrative Events: 10036 Errors. which says that
"The server-side authentication level policy does not allow the user LAB2022\dev-admin SID (S-1-5-21-4164125427-177154609-51000486-1108) from address to activate DCOM server. Please raise the activation authentication level at least to RPC_C_AUTHN_LEVEL_PKT_INTEGRITY in client application".
Can anyone help me how we can fix the issue from application side since MS workaround was not working(disabling the registry key in DC)?
we found some possible solution from sourceforge forum site discussion (https://sourceforge.net/p/j-interop/discussion/600729/thread/731d99133f/) that need to fix the issue in third party library j-interop-ng and tried the solution to set the sign and seal flags in JIComserver.java before init() block but not worked as expected.
We are using j-interop-ng-3.0.jar in our application and need some quick solution to fix the issue further to work the WMI provider.

Access IBM MQ Remotely

When I try to access IBM MQ remotely, I get the errors below in my log file. Could someone give me some tip about what could I do to solve this?
AMQ5534E: the authentication user id usermq failed.
AMQ5542I: The authentication verification with fail was caused by configuration CONNAUTH CHCKCLNT (RECDADMIN) of queue manager.
I asked my network administrator to create another user for me to make the access, but didn't solve.

Jenkins proxy 407 error

I'm running Jenkins CI inside a corporate network which uses a proxy for internet access.
I tried to configure proxy details in Plugins->Advanced, but even though the credentials are correct (yeah, I checked it a bunch of times), it cannot validate "Test URL" even on http://google.com and returns
Failed to connect to http://google.com (code 407).
Strangely, Jenkins is still able to download plugins itself (whoa!), but totally unable to connect to any HTTP resource. The message that outputs from the console is:
←[0mApr 16, 2015 1:58:56 PM
org.apache.commons.httpclient.HttpMethodDirector pro
cessProxyAuthChallenge INFO: Failure authenticating with NTLM #proxyrye.asg.com:80 Apr 16, 2015 2:09:09 PM
org.apache.commons.httpclient.HttpMethodDirector execute WithRetry
INFO: I/O exception (java.net.ConnectException) caught when processing
request: Connection timed out: connect Apr 16, 2015 2:09:09 PM
org.apache.commons.httpclient.HttpMethodDirector execute WithRetry
INFO: Retrying request Apr 16, 2015 2:09:10 PM
org.apache.commons.httpclient.auth.AuthChallengeProcesso r
selectAuthScheme INFO: ntlm authentication scheme selected ←[31mApr
16, 2015 2:09:10 PM org.apache.commons.httpclient.HttpMethodDirector
au thenticate SEVERE: Credentials cannot be used for NTLM
authentication: org.apache.commons.h
ttpclient.UsernamePasswordCredentials
org.apache.commons.httpclient.auth.InvalidCredentialsException:
Credentials cann ot be used for NTLM authentication:
org.apache.commons.httpclient.UsernamePasswo rdCredentials
at org.apache.commons.httpclient.auth.NTLMScheme.authenticate(NTLMScheme
.java:332)
We had this issue a rather long time with our Jenkins behind our company's proxy. The other day they changed the order of authentication schemes our proxy desires. This was the day our Jenkins stopped connecting to the internet.
Obviously Jenkins is not able to connect via a proxy that requires NTML authentication. This was what lead me to issue an improvement for Jenkins to extend the proxy configuration screen. During the work on the extension I discovered that Jenkins does not make use of all proxy related system properties, therefore it cannot work with NTLM.
As such the answer for a proxy that allows only NTLM authentication is: it will not work via the Jenkins UI.
But if your proxy allows other authentication schemes, you can follow our workaround, it is rather simple: add the java system property -Dhttp.auth.preference="basic" to your Jenkins startup script or to that one of your container.
This will force the underlying libraries and Java mechanisms Jenkins makes use of to connect to your proxy using basic authentication, not NTLM.
for Java JDK8 and above, Oracle has disabled basic auth tunnelling for Basic authentication. If you want to use Basic mode again (security will be compromised), execute Jenkins adding this parameter to your JAVA_OPTS variable
"-Djdk.http.auth.tunneling.disabledSchemes="
default value is
"-Djdk.http.auth.tunneling.disabledSchemes=Basic",
as Basic scheme is DISABLED by default, it will return HTTP 407 error even if your credentials were OK.
more on link https://issues.jenkins-ci.org/browse/JENKINS-48775 Thanks to Israel Romero Fiji
The below solution worked for me for the 407 problem in Windows 7 machine.
1. Stop Jenkins from Windows Services
2. Goto Services.msc > Jenkins > Right Click > Properties > Logon > This account and type in your username and password
3. Click Apply and Ok
3. Start Jenkins
I was getting this error while running jenkins with jetty server on jdk 8.
To resolve issue follow below steps:
Step 1:
Open URL https://updates.jenkins.io/ in browser
Step 2:
To export the Intermediate certificate:
Internet Explorer -> Tools -> Internet Options -> Content -> Certificates ->
Go to Trusted Root Certification Authorities Tab and find out the DST Root CA X3 certificate. Then Export the Certificate:
Select Certificate -> Export -> DER encoded Binary Format -> Save
save the certificate as jenkins.cer (for me it was saved to C:\jenkins\jenkins.cer
( From Firefox -> Tools -> Options -> Advanced -> Encryption -> View Certificates )
Step 3:
create keystore with name cacertskeystore
JAVA_HOME\bin\keytool -keystore C:\jenkins\cacertskeystore -genkey -alias cacerts
Step 4:
Add jenkins.cer to cacertskeystore using below command
JAVA_HOME\bin\keytool -import -trustcacerts -Keystore C:\jenkins\cacertskeystore -alias jenkins -file C:\jenkins\jenkins.cer
Step 5: Start jetty server with below command
JAVA_HOME\bin\java -DJENKINS_HOME=C:/jenkins/home -Djavax.net.ssl.trustStore=C:/jenkins/cacertskeystore -Djavax.net.ssl.trustStorePassword=password-provided-while-creating-keystore -jar jenkins.war --httpPort=8080--httpListenAddress=localhost
I found this question while affected by bug: https://issues.jenkins-ci.org/browse/JENKINS-48775
The temporary workaround is to open the Jenkins script console and type
ProxyConfiguration.open(new java.net.URL("http://jenkins.io")).content
Since it's an http url, and not an https url, it will refresh some caches and make the plugin manager work with the proxy settings, at least for some time. See the bug report for more details.
If you parse the exception, it states
Credentials cannot be used for NTLM authentication
So according to https://www.safaribooksonline.com/library/view/jenkins-the-definitive/9781449311155/ch04s09.html you might need to provide a domain name as well.
If your proxy is using Microsoft’s NTLM authentication scheme, then you will need to provide a domain name as well as a username. You can place both in the User name field: just enter the domain name, followed by a back-slash (\), followed by the username, such as “MyDomain\Joe Bloggs”.
Maybe that's the issue?
I ran into this issue today, and it finally ended up being a space at the end of the Spira URI in the Spira configuration. Must've been a bad copy and paste.
I got the Failed to connect to http://google.com (code 407) error in Test. But jenkins can check new version and install plugins&updates.
Put in credentials regardless of the Test. Then Save and go to available plugins/check jenkins version to check if it works.
Simple Hack:
Try using the IP of the domain rather than the address. -Dhttp.auth.preference="basic" actually didn't work for me :(
PS. Change both the browser and proxy and the Jenkins proxy to the IP
I have also faced same issue of jenkins-proxy-407-error
I have found work around for that, I Hope it will be useful for other users :
You can install Cntlm Authentication Proxy , it stands between your applications and the corporate proxy, adding NTLM authentication on-the-fly.
See here http://cntlm.sourceforge.net/
Once you install CNTLM, add your NTLM credentials in a file cntlm.ini . You can also configure Listen port or default to 3128 .
Find detailed instruction of CNTLM installation here
https://vijiboy.wordpress.com/2018/03/14/configure-cntlm-to-generate-hash-for-your-password-h-and-verify-m/
Start CNTLM service and go to jenkins, add
host: host name or localhost
port: Listen port specified in cntlm.ini or default 3128
keep username and password blank and you are set to use Jenkins.
Solution is so simple
If you tried to edit
jdk.http.auth.tunneling.disabledSchemes=Basic
to
jdk.http.auth.tunneling.disabledSchemes=
at location C:.......\java-1.8.0-openjdk\jre\lib\net.properties
Then later try to enter
fill this section with proper entries
Done.
Check this screenshot

WebScarab : Getting a PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException while connecting via https

Hope you are doing well.I know there are many answers alike to the issue that i am going to ask but still no one seems to help.
Please help!!!
Issue:-
I am trying to connect to a secure website(HTTPS) using WebScarab, so that i can capture the traffic.Http is working fine for me.
For this i am using WebScarab as a proxy.
'client.getHostConfiguration().setProxy("127.0.0.1", 8008);'
but everytime i gets an exception (
SunCertPathBuilderException
) as stated above.
I have tried adding the website certificate to the Java using Keytool utility also.
I then added a proxy (reverse) entry in WebScarab (127.0.0.1 , 443) and changed the program to use it as a proxy server.
'client.getHostConfiguration().setProxy("127.0.0.1", 443);'
Then i got the following exception :-
org.apache.commons.httpclient.ProtocolException: The server stbeehive.oracle.com failed to respond with a valid HTTP response.
I also tried creating a .p12 certificate (for the website which i want to connect to) and importing it to WebScarab.
But inspite of all these methods i am not able to get the proper response.
I am using WebScarab as a proxy for firefox to capture its traffic and it is working fine (for both http and https).
Please help me as i have run out of ideas now :(
Are you using WebScarab or WebScarab-NG?
Please try WebScarab "classic", rather than the -NG variant. NG was a failed experiment, and no real effort was put into validating the client-side certificate functionality.
Also, what version of Java are you using, what operating system, 32 bit or 64-bit, etc, etc
Regards,
Rogan

Kerberos SSO with Apache and Tomcat under JDK5

I'm new with this authentication through kerberos protocol so I tried to read a lot of howto on it but seems like I can't find any specifics with my constraints. Here is what I have :
An Active Directory Server on which users authenticate to log into their workstations
Each end user uses IE 7 to connect to my intranet application
An Apache server with load balancing
Some Tomcats servers acting as workers for the Apache server.
on each tomcat, I have 2 jakarta servlet running, users connect only on one servlet (further i will call it the servlet as if there is only one)
my tomcats need to run under jdk5. not jdk6 or jdk4. it's jdk5 period.
Now I want one to automatically get logged on my servlet. Basically I just need my servlet to retrieve the client's principal then I can manage the rest.
Based on what I understood, my client has a ticket, he ask the KDC for a special ticket for accessing the apache server, then he tries to connect to the Apache server. Based on his keytab, the apache server then decode the auth data and grant/refuse the access to specified resource.
Am I right? please guide me through this, I've been reading pages for 4 days and still no clue on which solution is the more appropriate. I tried mod_auth_kerberos for Apache but instead of grabbing the user's ticket he ask it like a basic auth. Apparently spgneo
Thanks
Ok I got this working :
Install Kerberos 5 + apache 2 + mod_auth_kerb.
On your AD, generate a keytab with only the principal you will use for Apache, I use HTTP/apache.mydom.com#MYDOM.COM
Put this keytab file on your apache server and make it readable only
by your Apache user.
Then edit your apache conf with these directive for your secure
location
apache.conf:
[…]
ServerName apache.mydom.com:80
[…]
LoadModule auth_kerb_module modules/mod_auth_kerb.so
[…]
<LocationMatch /secure)>
[… some other stuff …]
Order allow,deny
Allow from all
AuthType Kerberos
AuthName "Authentification requise"
KrbAuthRealms MYDOM.COM
#this allows user to be saved in the request
KrbSaveCredentials on
#this one force Negotiate AuthType instead of basic fallback
KrbMethodNegotiate on
#this trim the realm from username saved in the request (request.getRemoteUser() will give you "user" instead of "user#MYDOM.COM"
KrbLocalUserMapping on
KrbAuthoritative on
KrbVerifyKDC on
Krb5Keytab /install/binaries/httpd/apache.keytab
KrbServiceName HTTP
require valid-user
</LocationMatch>
And the one thing I almost failed to find on the web, you have to modify your tomcat server config (tomcat/conf/server.xml) :
<Connector [... AJP connector configuration ...] request.tomcatAuthentication="false"/>
This is really important because without it you tomcat won't retrieve any info from tomcat auth.
Don't forget too, DNS is really really really really important for a Kerberos install. If you have any issue try checking your DNS for all of your servers.

Categories

Resources