Jenkins and Tomcat use the Reverse-Proxy Auth plugin

I cannot find a good explanation of how to get Jenkins to work on a Tomcat server using basic HTTP authentication.

Basic information:

OS: Windows 7 64 bit
Tomcat Version: 7.0.40
Jenkins Version: 1.516
Auth Plugin Reverse Proxy: 1.0.1
Java SDK Version: 1.7.0_17
Java JRE Version: 7
Tested with Chrome and IE

I currently have Jenkins running and running on my Tomcat server with the Reverse-Proxy Auth plugin enabled ( https://wiki.jenkins-ci.org/display/JENKINS/Reverse+Proxy+Auth+Plugin ), user and role, added to tomcat-users.xml , and a few lines added to me web.xml . Both of them are shown below. (Both files are located in C:/Program Files/Apache Software Foundation/Tomcat 7.0/conf/ )

tomcat-users.xml (all by default, except for adding one role and one user)

 <role rolename="Administrator"/> <user username="John" password="password" roles="Administrator"/> 

web.xml (all default values โ€‹โ€‹except adding this section)

 <security-constraint> <web-resource-collection> <web-resource-name> Jenkins </web-resource-name> <url-pattern>/jenkins/*</url-pattern> <http-method>GET</http-method> <http-method>POST</http-method> </web-resource-collection> <auth-constraint> <role-name>Administrator</role-name> </auth-constraint> </security-constraint> <!-- Define the Login Configuration for this Application --> <login-config> <auth-method>BASIC</auth-method> </login-config> 

I'm not sure why, but whenever I go to http://localhost:8080 or http://localhost:8080/jenkins there is no login prompt, but if I change <url-pattern>/jenkins/*</url-pattern> to <url-pattern>/*</url-pattern> , I get a login prompt just by going to http://localhost:8080 , which is good. After I log in, if I go to / jenkins, I will get information on the login page, which is all "messed up" [none of the resources are displayed, and the page looks broken.)

It looks like this:

Broken jenkins

Here is the link I found that is close to the same issue as mine. https://groups.google.com/forum/?fromgroups#!topic/jenkinsci-users/AVTklGHmzkc

Any help would be appreciated!

EDIT 1
Added Java versions if necessary / relevance

EDIT 2
Added image of what Jenkins looks like when it is โ€œbrokenโ€

UPDATE 1
Still getting the same problems, you tried different combinations of things in the web.xml file but still get the same problem.

UPDATE 2
No Fix was found yet, but I did my best to get around this. I installed the url template in /* , started Tomcat, stopped the server, changed it to /jenkins/* (which I believe did nothing), and started the server again, then go to the Jenkins page to get an authenticated HTTP code headers. Still want to solve my problem but not find it yet ...

+4
source share
1 answer

Here are the problems that I was able to detect:

  • You do not need the Reverse Proxy Auth plugin unless you plan to use Apache or some other web server as a reverse proxy.
  • It should be

     <security-role> <role-name>Administrator</role-name> </security-role> 

    after the <login-config> element

  • C:/Program Files/Apache Software Foundation/Tomcat 7.0/conf/web.xml is the Tomcat servlet configuration "default", which is used to serve static assets. Adding a security constraint to this servlet causes all static assets to become inaccessible, which leads to the filling of your login screen with dead links.

Instead, add a security constraint to C:/Program Files/Apache Software Foundation/Tomcat 7.0/webapps/jenkins/WEB-INF/web.xml

This should work, but setting up the scope may require additional changes to C:/Program Files/Apache Software Foundation/Tomcat 7.0/conf/server.xml . See the Tomcat document related to this .

+1
source

Source: https://habr.com/ru/post/1483416/


All Articles