Support Questions
Find answers, ask questions, and share your expertise

Adding service to knox gateway

Contributor

Some services are already configured such as : yarnui, hive, ranger ...

I'm trying to enable access to ams-grafana through knox,i followed these offical links :

  1. I added a service in knox topology

 

<service>
  <role>GRAFANA</role>
  <url>http://mnode2.7458907e-6f32-4f4a-b33e-6820be708ad4.datalake:3000</url>
</service>​

 

  • I created services.xml and rewrite.xml in <GATEWAY_HOME>/data/services/grafana/0.0.1/

 

<service role="GRAFANA" name="grafana" version="0.0.1">
    <policies>
        <policy role="webappsec"/>
        <policy role="authentication" name="Anonymous"/>
        <policy role="rewrite"/>
        <policy role="authorization"/>
    </policies>
    <routes>
        <route path="/grafana">
        </route>
        <route path="/grafana/**">
        </route>
    </routes>
    <dispatch classname="org.apache.hadoop.gateway.dispatch.PassAllHeadersDispatch"/>
</service>​
<rules>
    <rule dir="IN" name="GRAFANA/grafana/inbound/root" pattern="*://*:*/**/grafana/">
        <rewrite template="{$serviceUrl[GRAFANA]}/"/>
    </rule>
    <rule dir="IN" name="GRAFANA/grafana/inbound/path" pattern="*://*:*/**/grafana/{**}">
        <rewrite template="{$serviceUrl[GRAFANA]}/{**}"/>
    </rule>
</rules>​

 

  • I restarted knox gateway

 

bin/gateway.sh stop
bin/gateway.sh start​

 

logs are showing Unauthorized exception

  • gateway-audit.log

 

21/10/04 15:39:35 ||e3682e4e-5294-4b05-bad9-39cd82d6ff2d|audit|10.1.2.49|GRAFANA||||access|uri|/gateway/default/grafana|unavailable|Request method: GET
21/10/04 15:39:35 ||e3682e4e-5294-4b05-bad9-39cd82d6ff2d|audit|10.1.2.49|GRAFANA||||authorization|uri|/gateway/default/grafana|success|
21/10/04 15:39:35 ||e3682e4e-5294-4b05-bad9-39cd82d6ff2d|audit|10.1.2.49|GRAFANA||||dispatch|uri|http://mnode2.7458907e-6f32-4f4a-b33e-6820be708ad4.datalake:3000/|unavailable|Request method: GET
21/10/04 15:39:35 ||e3682e4e-5294-4b05-bad9-39cd82d6ff2d|audit|10.1.2.49|GRAFANA||||dispatch|uri|http://mnode2.7458907e-6f32-4f4a-b33e-6820be708ad4.datalake:3000/|success|Response status: 401
21/10/04 15:39:35 ||e3682e4e-5294-4b05-bad9-39cd82d6ff2d|audit|10.1.2.49|GRAFANA||||access|uri|/gateway/default/grafana|success|Response status: 401

 

  • grafana.log

 

2021/10/04 15:41:36 [middleware.go:151 initContextWithBasicAuth()] [E] Basic auth failed: User not found
2021/10/04 15:41:36 [I] Completed 109.190.254.30,10.1.2.49 - "GET / HTTP/1.1" 401 Unauthorized 31 bytes in 1852us
​

 

When i try to access my knox uri : https://knox.7458907e-6f32-4f4a-b33e-6820be708ad4.datalake/gateway/default/grafana i'm getting a 404 error

 

What i'm missing ?

0 REPLIES 0
; ;