<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Keytab based kerberos authentication  failing while making API calls with Atlas in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175154#M137415</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/39302/srikanthvelammal.html" nodeid="39302"&gt;@Srikanth Gorripati&lt;/A&gt;, &lt;/P&gt;&lt;P&gt; Can you check this implementation, it worked for me on kerberos mode.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/nixonrodrigues/java-samples/commit/f3a75090ef3196874b051d78fe2dff35d69bd9d9" target="_blank"&gt;https://github.com/nixonrodrigues/java-samples/commit/f3a75090ef3196874b051d78fe2dff35d69bd9d9&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
    <dc:creator>nixonrodrigues</dc:creator>
    <dc:date>2017-09-12T01:24:36Z</dc:date>
    <item>
      <title>Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175152#M137413</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt; I am trying to call Apache Atlas using java code  by passing my username and password as credentials as mentioned below:&lt;/P&gt;&lt;P&gt;Client client = Client.create(config);
client.addFilter(new HTTPBasicAuthFilter(prop.getProperty("user"), prop.getProperty("password")));&lt;/P&gt;&lt;P&gt;service = client.resource(prop.getProperty("rest_uri")); &lt;/P&gt;&lt;P&gt;addService = service.path(AtlasBaseClient.LOGIN);&lt;/P&gt;&lt;P&gt;addService = service.path(AtlasBaseClient.ATLAS_API).path(AtlasBaseClient.ENTITIES)
.queryParam(AtlasBaseClient.TYPE, "hive_process");&lt;/P&gt;&lt;P&gt;processOut.write(getOutputAsJSON(addService).getBytes());&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The above code snippet is working fine.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;But,  when i tried to use keytab based authentication using principalname and keytab file , I am getting authorized but I couldn't able to read the response from atlas. I have programmed this approach in 3 steps as mentioned below :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 1 : set Config properties&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  String genericId = "peaXXXXX";&lt;/P&gt;&lt;P&gt; 
String genericId_principalName = "&lt;A href="mailto:peaXXXX@xyz.XXX.XXX"&gt;peaXXXX@xyz.XXX.XXX&lt;/A&gt;";&lt;/P&gt;&lt;P&gt;  String keytabPath = "/home/peaXXXXX/peaXXXXX.keytab";&lt;/P&gt;&lt;P&gt; 
Configuration configuration = &lt;STRONG&gt;new&lt;/STRONG&gt; Configuration();&lt;/P&gt;&lt;P&gt; 
configuration.set("fs.defaultFS", "&lt;A href="http://tdXXXX.XXX.XX:21000"&gt;http://XXXX.XXX.XX:21000&lt;/A&gt;");&lt;/P&gt;&lt;P&gt;configuration.set("hbase.master.kerberos.principal", genericId_principalName);&lt;/P&gt;&lt;P&gt; 
configuration.set("hadoop.security.authentication", "kerberos");&lt;/P&gt;&lt;P&gt;configuration.set("atlas.authentication.method.kerberos", "true");&lt;/P&gt;&lt;P&gt;configuration.set("atlas.http.authentication.enabled","true");&lt;/P&gt;&lt;P&gt;configuration.set("atlas.http.authentication.type","kerberos");&lt;/P&gt;&lt;P&gt;configuration.set("hadoop.security.authorization", "true");&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Step 2: User authorization using keytab file and principal name&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt; 
UserGroupInformation.&lt;EM&gt;setConfiguration&lt;/EM&gt;(configuration);&lt;/P&gt;&lt;P&gt;//UserGroupInformation.loginUserFromKeytab(genericId_principalName,
keytabPath);  &lt;/P&gt;&lt;P&gt; 
UserGroupInformation.&lt;EM&gt;loginUserFromKeytab&lt;/EM&gt;(genericId, keytabPath);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;step 3: cal atlas URL by using doAs()&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;URL url = new URL("&lt;A href="http://td2XXXX.XXXXX.XXX:21000/api/atlas/entities?type=hive_table"&gt;http://XXXX.XXXXX.XXX:21000/api/atlas/entities?type=hive_table&lt;/A&gt;");&lt;/P&gt;&lt;P&gt;HttpURLConnection connection =
UserGroupInformation.getLoginUser().doAs(&lt;/P&gt;&lt;P&gt;  new
PrivilegedExceptionAction&amp;lt;HttpURLConnection&amp;gt;() {&lt;/P&gt;&lt;P&gt;  public
HttpURLConnection run() throws Exception {&lt;/P&gt;&lt;P&gt;  AuthenticatedURL.Token
token = new AuthenticatedURL.Token();&lt;/P&gt;&lt;P&gt;  return
new AuthenticatedURL().openConnection(url, token);&lt;/P&gt;&lt;P&gt;  }&lt;/P&gt;&lt;P&gt;  });&lt;/P&gt;&lt;P&gt;  System.out.println("KeyTabTest.main()--&amp;gt;
connection "+connection);&lt;/P&gt;&lt;P&gt;  //reading
the response from url cal&lt;/P&gt;&lt;P&gt;connection.addRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); &lt;/P&gt;&lt;P&gt; 
connection.connect();&lt;/P&gt;&lt;P&gt;   BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));&lt;/P&gt;&lt;P&gt;    String inputLine;&lt;/P&gt;&lt;P&gt;    while ((inputLine = in.readLine()) !=
null) &lt;/P&gt;&lt;P&gt;      System.out.println(inputLine);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;We are getting the below 403 forbidden error when we are
trying to read the response from url cal.&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Exception in thread "main"
java.lang.reflect.InvocationTargetException&lt;/P&gt;&lt;P&gt;   at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)&lt;/P&gt;&lt;P&gt;  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)&lt;/P&gt;&lt;P&gt;  at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)&lt;/P&gt;&lt;P&gt;  at
java.lang.reflect.Method.invoke(Method.java:498)&lt;/P&gt;&lt;P&gt;  at
org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Caused by: java.io.IOException: Server returned HTTP
response code: 403 for URL: &lt;A href="http://td2vatl1.travp.net:21000/api/atlas/entities?type=hive_table"&gt;http://XXXXX.XXX.XXX:21000/api/atlas/entities?type=hive_table&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  at
sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)&lt;/P&gt;&lt;P&gt;  at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)&lt;/P&gt;&lt;P&gt;  at atlas.KeyTabTest.main(KeyTabTest.java:107)&lt;/P&gt;&lt;P&gt;  ... 5 more&lt;/P&gt;&lt;P&gt;Kindly help me with the below questions :&lt;/P&gt;&lt;P&gt;1.) Can some one please help me out to overcome this 403 forbidden error. &lt;/P&gt;&lt;P&gt;2.) Also, I have a doubt here., we are passing url
and token values to httpConnection . But where we do assigned the value for
token variable ?  Will it be read by
default ? &lt;/P&gt;&lt;P&gt;3.) If the UserGroupInformation from step 2 not being passed to step 3 for atlas URL cal ., please suggest how can I pass the UGI credentials to HttpConnection.&lt;/P&gt;&lt;P&gt; Kindly respond. Thank You.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175152#M137413</guid>
      <dc:creator>srikanth_velamm</dc:creator>
      <dc:date>2017-09-12T01:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175153#M137414</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/39302/srikanthvelammal.html"&gt;Srikanth Gorripati&lt;/A&gt;&lt;/P&gt;&lt;P&gt;What are the contents of your &lt;STRONG&gt;/etc/atlas/2.6.1.0-129/0/atlas_jaas.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Client {
   com.sun.security.auth.module.Krb5LoginModule required
   useKeyTab=true
   useTicketCache=false
   storeKey=true
   doNotPrompt=false
   keyTab="/etc/security/keytabs/atlas.service.keytab"
   principal="atlas/FQDN@REALM";
}&lt;/PRE&gt;&lt;P&gt;Revert&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175153#M137414</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175154#M137415</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/39302/srikanthvelammal.html" nodeid="39302"&gt;@Srikanth Gorripati&lt;/A&gt;, &lt;/P&gt;&lt;P&gt; Can you check this implementation, it worked for me on kerberos mode.&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/nixonrodrigues/java-samples/commit/f3a75090ef3196874b051d78fe2dff35d69bd9d9" target="_blank"&gt;https://github.com/nixonrodrigues/java-samples/commit/f3a75090ef3196874b051d78fe2dff35d69bd9d9&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175154#M137415</guid>
      <dc:creator>nixonrodrigues</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175155#M137416</link>
      <description>&lt;P&gt;Hi Geoffrey, &lt;/P&gt;&lt;P&gt;Thanks for your quick response. Please find atlas_jaas.conf content in my environment as mentioned below:&lt;/P&gt;&lt;P&gt;Client { &lt;/P&gt;&lt;P&gt;   com.sun.security.auth.module.Krb5LoginModule required&lt;/P&gt;&lt;P&gt;
   useKeyTab=true &lt;/P&gt;&lt;P&gt;   useTicketCache=false&lt;/P&gt;&lt;P&gt;
   storeKey=true &lt;/P&gt;&lt;P&gt;   doNotPrompt=false &lt;/P&gt;&lt;P&gt;   keyTab="/etc/security/keytabs/atlas.service.keytab" &lt;/P&gt;&lt;P&gt;   principal="atlas/XXXXX.XXXX.XXX@ADMIN.XXXX.XXX";&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;Is there anything missing here ? Do I need to change any configurations ?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175155#M137416</guid>
      <dc:creator>srikanth_velamm</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175156#M137417</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/39302/srikanthvelammal.html"&gt;@Srikanth Gorripati&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Great can you accept and close the thread!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175156#M137417</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175157#M137418</link>
      <description>&lt;P&gt;Thank you Nixon and Goffrey for your responses.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175157#M137418</guid>
      <dc:creator>srikanth_velamm</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175158#M137419</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/39302/srikanthvelammal.html"&gt;@Srikanth Gorripati&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Have you corrected the entries in the Atlas jaas.conf? Please revert if the problem persists&lt;/P&gt;&lt;P&gt;To grab a valid kerberos ticket you need to run this command replacing the values appropriately&lt;/P&gt;&lt;PRE&gt;# kinit  -kt /etc/security/keytabs/atlas.service.keytab atlas/xxxx.xxxx.xxxx@REALM.COM&lt;/PRE&gt;&lt;P&gt;Revert&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175158#M137419</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175159#M137420</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/39302/srikanthvelammal.html"&gt;Srikanth Gorripati&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In the above jaas.conf the &lt;STRONG&gt;principal="atlas/td2XXXXX.XXXX.XXX@ADMIN.XXXX.XXX"; &lt;/STRONG&gt; should match the output of command&lt;/P&gt;&lt;P&gt;# klist -kt /etc/security/keytabs/atlas.service.keytab &lt;/P&gt;&lt;PRE&gt;Keytab name: FILE:/etc/security/keytabs/atlas.service.keytab 
KVNO Timestamp Principal 
---- ------------------- ------------------------------------------------------ 
1 08/24/2017 15:42:23 atlas/xxxx.xxxx.xxxx@REALM.COM 
1 08/24/2017 15:42:23 atlas/xxxx.xxxx.xxxx@REALM.COM 
1 08/24/2017 15:42:23 atlas/xxxx.xxxx.xxxx@REALM.COM 
1 08/24/2017 15:42:23 atlas/xxxx.xxxx.xxxx@REALM.COM 
1 08/24/2017 15:42:23 atlas/xxxx.xxxx.xxxx@REALM.COM&lt;/PRE&gt;&lt;P&gt; eg &lt;STRONG&gt;atlas&lt;/STRONG&gt;&lt;STRONG&gt;/xxxx.xxxx.xxxx&lt;/STRONG&gt;&lt;STRONG&gt;@REALM.COM&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175159#M137420</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2017-09-12T01:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175160#M137421</link>
      <description>&lt;P&gt;Hi Geoffrey , it's working now .. thank you very much . request you to mask the host details as xxxxx in your previous responses for security reasons else please delete your responses .. &lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175160#M137421</guid>
      <dc:creator>srikanth_velamm</dc:creator>
      <dc:date>2017-09-12T01:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175161#M137422</link>
      <description>&lt;P&gt;Thank you .Please mask the host name in eg., as well &lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:37 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175161#M137422</guid>
      <dc:creator>srikanth_velamm</dc:creator>
      <dc:date>2017-09-12T01:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175162#M137423</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/39302/srikanthvelammal.html"&gt;@Srikanth Gorripati&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Entries obscured. I am happy it worked, please can you accept the best answe!&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:38 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175162#M137423</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2017-09-12T01:24:38Z</dc:date>
    </item>
    <item>
      <title>Re: Keytab based kerberos authentication  failing while making API calls with Atlas</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175163#M137424</link>
      <description>&lt;P&gt;&lt;A href="https://community.hortonworks.com/users/39302/srikanthvelammal.html"&gt;@Srikanth Gorripati&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Done accept an answer and close the thread.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 01:24:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Keytab-based-kerberos-authentication-failing-while-making/m-p/175163#M137424</guid>
      <dc:creator>Shelton</dc:creator>
      <dc:date>2017-09-12T01:24:39Z</dc:date>
    </item>
  </channel>
</rss>

