Rakesh Gupta created RANGER-5737:
------------------------------------
Summary: Ranger Audit: Solr requests fail with "401 Authentication
required" due to incorrect hostname in URL
Key: RANGER-5737
URL: https://issues.apache.org/jira/browse/RANGER-5737
Project: Ranger
Issue Type: Bug
Components: Ranger
Reporter: Rakesh Gupta
Assignee: Rakesh Gupta
*Overview* Ranger is failing to fetch or write access audit logs from/to Solr.
The requests are being rejected with an {{HTTP ERROR 401 Authentication
required}} exception.
*Root Cause* This issue is caused by an incorrect hostname being used in the
Solr URL ({{{}http://ranger-solr:8983/solr/ranger_audits{}}}). Because the
hostname is invalid, the authentication mechanism fails. Consequently, the
server returns an HTML-formatted 401 Unauthorized error page instead of the
expected binary response ({{{}application/octet-stream{}}}).
*Error Trace*
{code:java}
ERROR [SolrUtil.java:91] Error from Solr server.
org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: Error
from server at http://ranger-solr:8983/solr/ranger_audits: Expected mime type
application/octet-stream but got text/html. <html><head><meta
http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/><title>Error
401 Authentication required</title></head><body><h2>HTTP ERROR 401
Authentication required</h2>... at
org.apache.solr.client.solrj.impl.HttpSolrClient.executeMethod(HttpSolrClient.java:635)
at
org.apache.solr.client.solrj.impl.HttpSolrClient.request(HttpSolrClient.java:266)
at org.apache.ranger.solr.SolrMgr.lambda$queryToSolr$0(SolrMgr.java:125)
at java.base/javax.security.auth.Subject.doAs(Subject.java:439) at
org.apache.ranger.solr.krb.AbstractKerberosUser.doAs(AbstractKerberosUser.java:150)
at org.apache.ranger.solr.krb.KerberosAction.execute(KerberosAction.java:85)
at org.apache.ranger.biz.AssetMgr.getAccessLogs(AssetMgr.java:764) {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)