Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGrok integration with LDAP issue #2352

Closed
tiffanyzhou opened this issue Sep 10, 2018 · 9 comments
Closed

OpenGrok integration with LDAP issue #2352

tiffanyzhou opened this issue Sep 10, 2018 · 9 comments
Labels

Comments

@tiffanyzhou
Copy link

After my OpenGrok integration with LDAP, the following error is reported at reindex when the code is update. How can I solve this problem.

2018-09-10 08:35:37.789+0800 FINEST t1 HttpURLConnection$1.run: Requesting Authentication: host =127.0.0.1 url = http://127.0.0.1:8080/source/api/v1/configuration?reindex=true
2018-09-10 08:35:37.789+0800 FINEST t1 HttpURLConnection$1.run: Authentication returned: null
2018-09-10 08:35:37.789+0800 FINER t1 HttpURLConnection.getServerAuthentication: Server Authentication for AuthenticationHeader: prefer Basic realm="Authentication required" returned null
2018-09-10 08:35:37.789+0800 SEVERE t1 Indexer.sendToConfigHost: Failed to send configuration to http://127.0.0.1:8080/source (is web application server running with opengrok deployed?)
java.io.IOException: InboundJaxrsResponse{context=ClientResponse{method=PUT, uri=http://127.0.0.1:8080/source/api/v1/configuration?reindex=true, status=401, reason=Unauthorized}}
at org.opensolaris.opengrok.configuration.RuntimeEnvironment.writeConfiguration(RuntimeEnvironment.java:1395)
at org.opensolaris.opengrok.index.Indexer.sendToConfigHost(Indexer.java:1124)
at org.opensolaris.opengrok.index.Indexer.main(Indexer.java:311)

@vladak
Copy link
Member

vladak commented Sep 10, 2018 via email

@tiffanyzhou
Copy link
Author

tiffanyzhou commented Sep 10, 2018

I configured ldap in apache-tomcat-8.5.33/conf/server.xml , and added "" in apache-tomcat-8.5.33/webapps/source/WEB-INF/web.xml , The validation is in effect when I visit the opengrok home page. Configuration details are as follows:

web xml

@tulinkry
Copy link
Contributor

For me it seems that you have to setup the authorization so it allows requests from localhost. But I have no other insights.

@vladak
Copy link
Member

vladak commented Sep 10, 2018 via email

@tulinkry
Copy link
Contributor

I meant that for /source/api/* there should be no authorization nor authentication.

The part that I allows only requests from localhost is already part of opengrok.

@vladak
Copy link
Member

vladak commented Sep 26, 2018

Yes, it seems that the url-pattern value needs to be smarter or add another security-constraint section to explicitly allow /api/*.

@vladak
Copy link
Member

vladak commented Oct 4, 2018

I.e. this worked for me:

  • web.xml:
    <security-constraint>                                                       
        <web-resource-collection>                                               
            <web-resource-name>API endpoints are checked separately by the web app</web-resource-name>
            <url-pattern>/api/*</url-pattern>                                   
        </web-resource-collection>                                              
    </security-constraint>                                                      
                                                                                
    <security-constraint>                                                       
        <web-resource-collection>                                               
            <web-resource-name>In general everything needs to be authenticated</web-resource-name>
            <url-pattern>/*</url-pattern>                                       
        </web-resource-collection>                                              
        <auth-constraint>                                                       
            <role-name>tomcat</role-name>                                       
        </auth-constraint>                                                      
    </security-constraint>                                                      
                                                                                
    <login-config>                                                              
        <auth-method>BASIC</auth-method>                                        
    </login-config>                                                             
                                                                                
    <security-role>                                                             
       <role-name>*</role-name>                                                 
    </security-role>
  • tomcat-users.xml:
  <user username="foobar" password="foobar" roles="tomcat,manager-script"/>

I was only able to see locations like /xref when supplying the Authorization HTTP header (otherwise HTTP error 401 was returned) however /api was accessible from localhost without the header just fine - I ran the reindex with -U to confirm that the configuration can be set successfully.

@vladak vladak closed this as completed Oct 4, 2018
@vladak
Copy link
Member

vladak commented Oct 4, 2018

This works because of the longest-path match used by the container (next to the other matching rules).

@vladak
Copy link
Member

vladak commented Oct 9, 2018

@oracle oracle locked and limited conversation to collaborators Dec 13, 2022
@vladak vladak converted this issue into discussion #4129 Dec 13, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants