<?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 Getting &amp;quot;Server not found in Kerberos database&amp;quot; while trying to get API access token with SPNEGO on NiFi in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-quot-Server-not-found-in-Kerberos-database-quot/m-p/209569#M66443</link>
    <description>&lt;P&gt;
	Hi,&lt;BR /&gt;
	&lt;BR /&gt;
	First a couple of things that work : &lt;BR /&gt;
	-Nifi cluster running on 3 nodes (running Apache upstream V1.1.2) on Centos 6&lt;BR /&gt;
	-Login identity provider is kerberos and works A1 using username &amp;amp; password fields in the UI or though the API. &lt;BR /&gt;
	-Once I get an API token using username &amp;amp; password, I can query the API without any issues.&lt;BR /&gt;
	-KDC is Active Directory&lt;BR /&gt;
	-Service is using nifi.kerberos.service.principal as "serviceaccount@DOMAIN.ORG" with corresponding keytab.&lt;/P&gt;&lt;P&gt;
	Now I'm trying a little POC where I want a script to use the API to interact with some of my flows.  Because I don't want to store a username &amp;amp; password for the script to use, I wanted to setup SPNEGO and just use a plain "kinit" with a keytab and fetch the API access token using something like : "curl --negotiate -X POST -v  -u : https://myhost.mydomain.org:8989/nifi-api/access/kerberos"&lt;/P&gt;&lt;P&gt;
	Steps I've taken:&lt;BR /&gt;
	1-Create 3 new accounts in AD with the logon name (principal) named "HTTP/myhost.mydomain.org".  One for each of of my machine.&lt;BR /&gt;
	2-Created a keytab for each of those machine by using ktutil.  Tested this with a "kinit HTTP/myhost.mydomain.org@DOMAIN.ORG" and they work.&lt;BR /&gt;
	3-Setup the 3 SPNEGO properties in nifi.properties : &lt;BR /&gt;
	   -nifi.kerberos.spnego.principal=HTTP/myhost.mydomain.org@DOMAIN.ORG&lt;BR /&gt;
	   -nifi.kerberos.spnego.keytab.location=[the_location_of_the_key_tab]&lt;BR /&gt;
	   -nifi.kerberos.spnego.authentication.expiration=12 hours&lt;/P&gt;&lt;P&gt;
	After a service restart, I try to run the curl command mentioned above and I get the following error : &lt;BR /&gt;
	&lt;/P&gt;&lt;PRE&gt;curl --negotiate -X POST -v  -u : &lt;A href="https://myhost.mydomain.org:8989/nifi-api/access/kerberos" target="_blank"&gt;https://myhost.mydomain.org:8989/nifi-api/access/kerberos&lt;/A&gt;
* About to connect() to myhost.mydomain.org port 8989 (#0)
*   Trying [îp address]... connected
* Connected to myhost.mydomain.org ([îp address]) port 8989 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: [redacted]
  CApath: none
* NSS: client certificate not found (nickname not specified)
* SSL connection using [redacted]
* Server certificate:
*       [redacted]
&amp;gt; POST /nifi-api/access/kerberos HTTP/1.1
&amp;gt; User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
&amp;gt; Host: myhost.mydomain.org:8989
&amp;gt; Accept: */*
&amp;gt;
&amp;lt; HTTP/1.1 401 Unauthorized
&amp;lt; Date: Thu, 10 Aug 2017 17:10:41 GMT
* gss_init_sec_context() failed: : Server not found in Kerberos databaseWWW-Authenticate: Negotiate
&amp;lt; Content-Type: text/plain
&amp;lt; Content-Length: 0
&amp;lt; Server: Jetty(9.3.9.v20160517)
&amp;lt;
* Connection #0 to host myhost.mydomain.org left intact
* Closing connection #0
&lt;/PRE&gt;&lt;P&gt;I was wondering what's missing.  DNS and Reverse DNS is setup properly and everything else is working fine (like HUE, also using SPNEGO with the same method).&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 00:46:57 GMT</pubDate>
    <dc:creator>AceWinner</dc:creator>
    <dc:date>2017-08-11T00:46:57Z</dc:date>
    <item>
      <title>Getting "Server not found in Kerberos database" while trying to get API access token with SPNEGO on NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-quot-Server-not-found-in-Kerberos-database-quot/m-p/209569#M66443</link>
      <description>&lt;P&gt;
	Hi,&lt;BR /&gt;
	&lt;BR /&gt;
	First a couple of things that work : &lt;BR /&gt;
	-Nifi cluster running on 3 nodes (running Apache upstream V1.1.2) on Centos 6&lt;BR /&gt;
	-Login identity provider is kerberos and works A1 using username &amp;amp; password fields in the UI or though the API. &lt;BR /&gt;
	-Once I get an API token using username &amp;amp; password, I can query the API without any issues.&lt;BR /&gt;
	-KDC is Active Directory&lt;BR /&gt;
	-Service is using nifi.kerberos.service.principal as "serviceaccount@DOMAIN.ORG" with corresponding keytab.&lt;/P&gt;&lt;P&gt;
	Now I'm trying a little POC where I want a script to use the API to interact with some of my flows.  Because I don't want to store a username &amp;amp; password for the script to use, I wanted to setup SPNEGO and just use a plain "kinit" with a keytab and fetch the API access token using something like : "curl --negotiate -X POST -v  -u : https://myhost.mydomain.org:8989/nifi-api/access/kerberos"&lt;/P&gt;&lt;P&gt;
	Steps I've taken:&lt;BR /&gt;
	1-Create 3 new accounts in AD with the logon name (principal) named "HTTP/myhost.mydomain.org".  One for each of of my machine.&lt;BR /&gt;
	2-Created a keytab for each of those machine by using ktutil.  Tested this with a "kinit HTTP/myhost.mydomain.org@DOMAIN.ORG" and they work.&lt;BR /&gt;
	3-Setup the 3 SPNEGO properties in nifi.properties : &lt;BR /&gt;
	   -nifi.kerberos.spnego.principal=HTTP/myhost.mydomain.org@DOMAIN.ORG&lt;BR /&gt;
	   -nifi.kerberos.spnego.keytab.location=[the_location_of_the_key_tab]&lt;BR /&gt;
	   -nifi.kerberos.spnego.authentication.expiration=12 hours&lt;/P&gt;&lt;P&gt;
	After a service restart, I try to run the curl command mentioned above and I get the following error : &lt;BR /&gt;
	&lt;/P&gt;&lt;PRE&gt;curl --negotiate -X POST -v  -u : &lt;A href="https://myhost.mydomain.org:8989/nifi-api/access/kerberos" target="_blank"&gt;https://myhost.mydomain.org:8989/nifi-api/access/kerberos&lt;/A&gt;
* About to connect() to myhost.mydomain.org port 8989 (#0)
*   Trying [îp address]... connected
* Connected to myhost.mydomain.org ([îp address]) port 8989 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: [redacted]
  CApath: none
* NSS: client certificate not found (nickname not specified)
* SSL connection using [redacted]
* Server certificate:
*       [redacted]
&amp;gt; POST /nifi-api/access/kerberos HTTP/1.1
&amp;gt; User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
&amp;gt; Host: myhost.mydomain.org:8989
&amp;gt; Accept: */*
&amp;gt;
&amp;lt; HTTP/1.1 401 Unauthorized
&amp;lt; Date: Thu, 10 Aug 2017 17:10:41 GMT
* gss_init_sec_context() failed: : Server not found in Kerberos databaseWWW-Authenticate: Negotiate
&amp;lt; Content-Type: text/plain
&amp;lt; Content-Length: 0
&amp;lt; Server: Jetty(9.3.9.v20160517)
&amp;lt;
* Connection #0 to host myhost.mydomain.org left intact
* Closing connection #0
&lt;/PRE&gt;&lt;P&gt;I was wondering what's missing.  DNS and Reverse DNS is setup properly and everything else is working fine (like HUE, also using SPNEGO with the same method).&lt;BR /&gt;&lt;BR /&gt;Any idea?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 00:46:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-quot-Server-not-found-in-Kerberos-database-quot/m-p/209569#M66443</guid>
      <dc:creator>AceWinner</dc:creator>
      <dc:date>2017-08-11T00:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "Server not found in Kerberos database" while trying to get API access token with SPNEGO on NiFi</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-quot-Server-not-found-in-Kerberos-database-quot/m-p/209570#M66444</link>
      <description>&lt;P&gt;Was about to delete my question (if that's even possible) but I managed to isolate the issue after triple-checking everything so I figure I'd post that here.  &lt;/P&gt;&lt;P&gt;Turns out the 3 accounts in AD did not have the SPN set (servicePrincipalName) correctly.  Changed them to "HTTP/myhost.mydomain.org" and everything works great now.&lt;/P&gt;&lt;P&gt;Lessons learned : don't eyeball the correctness of properties : copy paste them in an editor and check them there.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 02:08:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/Getting-quot-Server-not-found-in-Kerberos-database-quot/m-p/209570#M66444</guid>
      <dc:creator>AceWinner</dc:creator>
      <dc:date>2017-08-11T02:08:40Z</dc:date>
    </item>
  </channel>
</rss>

