knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject svn commit: r1580891 [2/2] - /knox/site/books/knox-incubating-0-4-0/knox-incubating-0-4-0-new.html
Date Mon, 24 Mar 2014 15:53:06 GMT

Added: knox/site/books/knox-incubating-0-4-0/knox-incubating-0-4-0-new.html
URL: http://svn.apache.org/viewvc/knox/site/books/knox-incubating-0-4-0/knox-incubating-0-4-0-new.html?rev=1580891&view=auto
==============================================================================
--- knox/site/books/knox-incubating-0-4-0/knox-incubating-0-4-0-new.html (added)
+++ knox/site/books/knox-incubating-0-4-0/knox-incubating-0-4-0-new.html Mon Mar 24 15:53:05 2014
@@ -0,0 +1,2858 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+--><p><link href="book.css" rel="stylesheet"/></p>
+<div id="logo" style="width:100%; text-align:center">
+  <!--img src="knox-logo.gif" alt="Knox"/-->
+</div><div id="page-wrap"><div id="banner"><p><br>  <img src="knox-logo.gif" alt="Knox"/>  <img src="apache-incubator-logo.png" align="right" alt="Incubator"/></p><h1><a id="Apache+Knox+Gateway+0.4.x+(Incubator)+User's+Guide"></a>Apache Knox Gateway 0.4.x (Incubator) User&rsquo;s Guide</h1></div><div id="sidebar">
+<ul>
+  <li><a href="#Introduction">Introduction</a></li>
+  <li><a href="#Quick+Start">Quick Start</a></li>
+  <li><a href="#Apache+Knox+Details">Apache Knox Details</a>
+  <ul>
+    <li><a href="#Apache+Knox+Directory+Layout">Apache Knox Directory Layout</a></li>
+    <li><a href="#Supported+Services">Supported Services</a></li>
+    <li><a href="#Configure+Sandbox+port+mapping+for+VirtualBox">Configure Sandbox port mapping for VirtualBox</a></li>
+  </ul></li>
+  <li><a href="#Gateway+Details">Gateway Details</a>
+  <ul>
+    <li><a href="#Configuration">Configuration</a></li>
+    <li><a href="#Knox+CLI">Knox CLI</a></li>
+    <li><a href="#Authentication">Authentication</a></li>
+    <li><a href="#LDAPGroupLookup">LDAPGroupLookup</a></li>
+    <li><a href="#Identity+Assertion">Identity Assertion</a></li>
+    <li><a href="#Authorization">Authorization</a></li>
+    <li><a href="#Secure+Clusters">Secure Clusters</a></li>
+    <li><a href="#High+Availability">High Availability</a></li>
+    <li><a href="#Web+App+Security+Provider">Web App Security Provider</a></li>
+    <li><a href="#Preauthenticated+SSO+Provider">Preauthenticated SSO Provider</a></li>
+    <li><a href="#Audit">Audit</a></li>
+  </ul></li>
+  <li><a href="#Client+Details">Client Details</a></li>
+  <li><a href="#Service+Details">Service Details</a>
+  <ul>
+    <li><a href="#WebHDFS">WebHDFS</a></li>
+    <li><a href="#WebHCat">WebHCat</a></li>
+    <li><a href="#Oozie">Oozie</a></li>
+    <li><a href="#HBase">HBase</a></li>
+    <li><a href="#Hive">Hive</a></li>
+  </ul></li>
+  <li><a href="#Limitations">Limitations</a></li>
+  <li><a href="#Troubleshooting">Troubleshooting</a></li>
+  <li><a href="#Export+Controls">Export Controls</a></li>
+</ul></div><div id="content"><div id="Introduction"><h2><a id="Introduction"></a>Introduction</h2><p>The Apache Knox Gateway is a system that provides a single point of authentication and access for Apache Hadoop services in a cluster. The goal is to simplify Hadoop security for both users (i.e. who access the cluster data and execute jobs) and operators (i.e. who control access and manage the cluster). The gateway runs as a server (or cluster of servers) that provide centralized access to one or more Hadoop clusters. In general the goals of the gateway are as follows:</p>
+<ul>
+  <li>Provide perimeter security for Hadoop REST APIs to make Hadoop security easier to setup and use
+  <ul>
+    <li>Provide authentication and token verification at the perimeter</li>
+    <li>Enable authentication integration with enterprise and cloud identity management systems</li>
+    <li>Provide service level authorization at the perimeter</li>
+  </ul></li>
+  <li>Expose a single URL hierarchy that aggregates REST APIs of a Hadoop cluster
+  <ul>
+    <li>Limit the network endpoints (and therefore firewall holes) required to access a Hadoop cluster</li>
+    <li>Hide the internal Hadoop cluster topology from potential attackers</li>
+  </ul></li>
+</ul></div><div id="Quick+Start"><h2><a id="Quick+Start"></a>Quick Start</h2><p>Here are the steps to have Apache Knox up and running against a Hadoop Cluster:</p>
+<ol>
+  <li>Verify system requirements</li>
+  <li>Download a virtual machine (VM) with Hadoop</li>
+  <li>Download Apache Knox Gateway</li>
+  <li>Start the virtual machine with Hadoop</li>
+  <li>Install Knox</li>
+  <li>Start the LDAP embedded within Knox</li>
+  <li>Start the Knox Gateway</li>
+  <li>Do Hadoop with Knox</li>
+</ol><h3><a id="1+-+Requirements"></a>1 - Requirements</h3><h4><a id="Java"></a>Java</h4><p>Java 1.6 or later is required for the Knox Gateway runtime. Use the command below to check the version of Java installed on the system where Knox will be running.</p>
+<pre><code>java -version
+</code></pre><h4><a id="Hadoop"></a>Hadoop</h4><p>Knox supports Hadoop 1.x or 2.x, the quick start instructions assume a Hadoop 2.x virtual machine based environment. </p><h3><a id="2+-+Download+Hadoop+2.x+VM"></a>2 - Download Hadoop 2.x VM</h3><p>The quick start provides a link to download Hadoop 2.0 based Hortonworks virtual machine <a href="http://hortonworks.com/products/hdp-2/#install">Sandbox</a>. Please note Knox supports other Hadoop distributions and is configurable against a full blown Hadoop cluster. Configuring Knox for Hadoop 1.x/2.x version, or Hadoop deployed in EC2 or a custom Hadoop cluster is documented in advance deployment guide.</p><h3><a id="3+-+Download+Apache+Knox+Gateway"></a>3 - Download Apache Knox Gateway</h3><p>Download one of the distributions below from the <a href="http://www.apache.org/dyn/closer.cgi/incubator/knox">Apache mirrors</a>.</p>
+<ul>
+  <li>Source archive: <a href="http://www.apache.org/dyn/closer.cgi/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0-src.zip">knox-incubating-0.4.0-src.zip</a> (<a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-0.4.0-incubating-src.zip.asc">PGP signature</a>, <a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0-src.zip.sha">SHA1 digest</a>, <a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0-src.zip.md5">MD5 digest</a>)</li>
+  <li>Binary archive: <a href="http://www.apache.org/dyn/closer.cgi/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.zip">knox-incubating-0.4.0.zip</a> (<a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.zip.asc">PGP signature</a>, <a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.zip.sha">SHA1 digest</a>, <a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.zip.md5">MD5 digest</a>)</li>
+  <li>RPM package: <a href="http://www.apache.org/dyn/closer.cgi/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.rpm">knox-incubating-0.4.0.rpm</a> (<a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-0.4.0-incubating.rpm.asc">PGP signature</a>, <a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.rpm.sha">SHA1 digest</a>, <a href="http://www.apache.org/dist/incubator/knox/0.4.0-incubating/knox-incubating-0.4.0.rpm.md5">MD5 digest</a>)</li>
+</ul><p>Apache Knox Gateway releases are available under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>. See the NOTICE file contained in each release artifact for applicable copyright attribution notices.</p><h3><a id="Verify"></a>Verify</h3><p>While recommended, verify is an optional step. You can verify the integrity of any downloaded files using the PGP signatures. Please read <a href="http://httpd.apache.org/dev/verification.html">Verifying Apache HTTP Server Releases</a> for more information on why you should verify our releases.</p><p>The PGP signatures can be verified using PGP or GPG. First download the KEYS file as well as the .asc signature files for the relevant release packages. Make sure you get these files from the main distribution directory linked above, rather than from a mirror. Then verify the signatures using one of the methods below.</p>
+<pre><code>% pgpk -a KEYS
+% pgpv knox-incubating-0.4.0.zip.asc
+</code></pre><p>or</p>
+<pre><code>% pgp -ka KEYS
+% pgp knox-incubating-0.4.0.zip.asc
+</code></pre><p>or</p>
+<pre><code>% gpg --import KEYS
+% gpg --verify knox-incubating-0.4.0.zip.asc
+</code></pre><h3><a id="4+-+Start+Hadoop+virtual+machine"></a>4 - Start Hadoop virtual machine</h3><p>Start the Hadoop virtual machine.</p><h3><a id="5+-+Install+Knox"></a>5 - Install Knox</h3><p>The steps required to install the gateway will vary depending upon which distribution format (zip | rpm) was downloaded. In either case you will end up with a directory where the gateway is installed. This directory will be referred to as your <code>{GATEWAY_HOME}</code> throughout this document.</p><h4><a id="ZIP"></a>ZIP</h4><p>If you downloaded the Zip distribution you can simply extract the contents into a directory. The example below provides a command that can be executed to do this. Note the <code>{VERSION}</code> portion of the command must be replaced with an actual Apache Knox Gateway version number. This might be 0.4.0 for example and must patch the value in the file downloaded.</p>
+<pre><code>jar xf knox-incubating-{VERSION}.zip
+</code></pre><p>This will create a directory <code>knox-incubating-{VERSION}</code> in your current directory. The directory <code>knox-incubating-{VERSION}</code> will considered your <code>{GATEWAY_HOME}</code></p><h4><a id="RPM"></a>RPM</h4><p>If you downloaded the RPM distribution you can install it using normal RPM package tools. It is important that the user that will be running the gateway server is used to install. This is because several directories are created that are owned by this user. These command will install Knox to <code>/usr/lib/knox</code> following the pattern of other Hadoop components. This directory will be considered your <code>{GATEWAY_HOME}</code>.</p>
+<pre><code>sudo yum localinstall knox-incubating-{VERSION}.rpm
+</code></pre><p>or</p>
+<pre><code>sudo rpm -ihv knox-incubating-{VERSION}.rpm
+</code></pre><h3><a id="6+-+Start+LDAP+embedded+in+Knox"></a>6 - Start LDAP embedded in Knox</h3><p>Knox comes with an LDAP server for demonstration purposes.</p>
+<pre><code>cd {GATEWAY_HOME}
+java -jar bin/ldap.jar conf &amp;
+</code></pre><h3><a id="7+-+Start+Knox"></a>7 - Start Knox</h3><p>The gateway can be started in one of two ways, as java -jar or with a shell script.</p><h6><a id="Starting+via+Java"></a>Starting via Java</h6><p>This is the simplest way to start the gateway. Starting this way will result in all logging being written directly to standard output.</p>
+<pre><code>cd {GATEWAY_HOME}
+java -jar bin/gateway.jar
+</code></pre><p>Upon start, Knox server will prompt you for the master secret (i.e. password). This secret is used to secure artifacts used by the gateway server for things like SSL and credential/password aliasing. This secret will have to be entered at startup unless you choose to persist it.</p><h6><a id="Starting+via+script+(*nix+only)"></a>Starting via script (*nix only)</h6><p>Run the setup command with root privileges.</p>
+<pre><code>cd {GATEWAY_HOME}
+sudo bin/gateway.sh setup
+</code></pre><p>The server will prompt you for the master secret (i.e. password).</p><p>The server can then be started without root privileges using this command.</p>
+<pre><code>cd {GATEWAY_HOME}
+bin/gateway.sh start
+</code></pre><p>When starting the gateway this way the process will be run in the backgroud. The log output is written into the directory /var/log/knox. In addition a PID (process ID) is written into /var/run/knox.</p><p>In order to stop a gateway that was started with the script use this command.</p>
+<pre><code>cd {GATEWAY_HOME}
+bin/gateway.sh stop
+</code></pre><p>If for some reason the gateway is stopped other than by using the command above you may need to clear the tracking PID.</p>
+<pre><code>cd {GATEWAY_HOME}
+bin/gateway.sh clean
+</code></pre><p><strong>NOTE: This command will also clear any log output in /var/log/knox so use this with caution.</strong></p><h3><a id="8+-+Do+Hadoop+with+Knox"></a>8 - Do Hadoop with Knox</h3><h4><a id="Put+a+file+in+HDFS+via+Knox."></a>Put a file in HDFS via Knox.</h4><h4><a id="CAT+a+file+in+HDFS+via+Knox."></a>CAT a file in HDFS via Knox.</h4><h4><a id="Invoke+the+LISTSATUS+operation+on+WebHDFS+via+the+gateway."></a>Invoke the LISTSATUS operation on WebHDFS via the gateway.</h4><p>This will return a directory listing of the root (i.e. /) directory of HDFS.</p>
+<pre><code>curl -i -k -u guest:guest-password -X GET \
+    &#39;https://localhost:8443/gateway/sandbox/webhdfs/v1/?op=LISTSTATUS&#39;
+</code></pre><p>The results of the above command should result in something to along the lines of the output below. The exact information returned is subject to the content within HDFS in your Hadoop cluster. Successfully executing this command at a minimum proves that the gateway is properly configured to provide access to WebHDFS. It does not necessarily provide that any of the other services are correct configured to be accessible. To validate that see the sections for the individual services in <a href="#Service+Details">Service Details</a>.</p>
+<pre><code>HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 760
+Server: Jetty(6.1.26)
+
+{&quot;FileStatuses&quot;:{&quot;FileStatus&quot;:[
+{&quot;accessTime&quot;:0,&quot;blockSize&quot;:0,&quot;group&quot;:&quot;hdfs&quot;,&quot;length&quot;:0,&quot;modificationTime&quot;:1350595859762,&quot;owner&quot;:&quot;hdfs&quot;,&quot;pathSuffix&quot;:&quot;apps&quot;,&quot;permission&quot;:&quot;755&quot;,&quot;replication&quot;:0,&quot;type&quot;:&quot;DIRECTORY&quot;},
+{&quot;accessTime&quot;:0,&quot;blockSize&quot;:0,&quot;group&quot;:&quot;mapred&quot;,&quot;length&quot;:0,&quot;modificationTime&quot;:1350595874024,&quot;owner&quot;:&quot;mapred&quot;,&quot;pathSuffix&quot;:&quot;mapred&quot;,&quot;permission&quot;:&quot;755&quot;,&quot;replication&quot;:0,&quot;type&quot;:&quot;DIRECTORY&quot;},
+{&quot;accessTime&quot;:0,&quot;blockSize&quot;:0,&quot;group&quot;:&quot;hdfs&quot;,&quot;length&quot;:0,&quot;modificationTime&quot;:1350596040075,&quot;owner&quot;:&quot;hdfs&quot;,&quot;pathSuffix&quot;:&quot;tmp&quot;,&quot;permission&quot;:&quot;777&quot;,&quot;replication&quot;:0,&quot;type&quot;:&quot;DIRECTORY&quot;},
+{&quot;accessTime&quot;:0,&quot;blockSize&quot;:0,&quot;group&quot;:&quot;hdfs&quot;,&quot;length&quot;:0,&quot;modificationTime&quot;:1350595857178,&quot;owner&quot;:&quot;hdfs&quot;,&quot;pathSuffix&quot;:&quot;user&quot;,&quot;permission&quot;:&quot;755&quot;,&quot;replication&quot;:0,&quot;type&quot;:&quot;DIRECTORY&quot;}
+]}}
+</code></pre><h4><a id="Submit+a+MR+job+via+Knox."></a>Submit a MR job via Knox.</h4><h4><a id="Get+status+of+a+MR+job+via+Knox."></a>Get status of a MR job via Knox.</h4><h4><a id="Cancel+a+MR+job+via+Knox."></a>Cancel a MR job via Knox.</h4><h3><a id="More+Examples"></a>More Examples</h3></div><div id="Apache+Knox+Details"><h2><a id="Apache+Knox+Details"></a>Apache Knox Details</h2><p>This section provides everything you need to know to get the Knox gateway up and running against a Hadoop cluster.</p><h4><a id="Hadoop"></a>Hadoop</h4><p>An an existing Hadoop 1.x or 2.x cluster is required for Knox sit in front of and protect. It is possible to use a Hadoop cluster deployed on EC2 but this will require additional configuration not covered here. It is also possible to use a limited set of services in Hadoop cluster secured with Kerberos. This too required additional configuration that is not described here. See <a href="#Supported+Services">Supported Services</a> for details on what
  is supported for this release.</p><p>The Hadoop cluster should be ensured to have at least WebHDFS, WebHCat (i.e. Templeton) and Oozie configured, deployed and running. HBase/Stargate and Hive can also be accessed via the Knox Gateway given the proper versions and configuration.</p><p>The instructions that follow assume a few things:</p>
+<ol>
+  <li>The gateway is <em>not</em> collocated with the Hadoop clusters themselves.</li>
+  <li>The host names and IP addresses of the cluster services are accessible by the gateway where ever it happens to be running.</li>
+</ol><p>All of the instructions and samples provided here are tailored and tested to work &ldquo;out of the box&rdquo; against a <a href="http://hortonworks.com/products/hortonworks-sandbox">Hortonworks Sandbox 2.x VM</a>.</p></div><div id="Apache+Knox+Directory+Layout"><h4><a id="Layout"></a>Apache Knox Directory Layout</h4><p>Knox can be installed by expanding the zip file or with rpm. With rpm based install the following directories are created in addition to those described in this section.</p>
+<pre><code>/usr/lib/knox
+/var/log/knox
+/var/run/knox
+</code></pre><p>The directory <code>/usr/lib/knox</code> is considered your <code>{GATEWAY_HOME}</code> and will adhere to the layout described below. The directory <code>/var/log/knox</code> will contain the output files from the server. The directory <code>/var/run/knox</code> will contain the process ID for a currently running gateway server.</p><p>Regardless of the installation method used the layout and content of the <code>{GATEWAY_HOME}</code> will be identical. The table below provides a brief explanation of the important files and directories within <code>{GATEWWAY_HOME}</code></p>
+<table>
+  <thead>
+    <tr>
+      <th>Directory </th>
+      <th>Purpose </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>conf/ </td>
+      <td>Contains configuration files that apply to the gateway globally (i.e. not cluster specific ). </td>
+    </tr>
+    <tr>
+      <td>bin/ </td>
+      <td>Contains the executable shell scripts, batch files and JARs for clients and servers. </td>
+    </tr>
+    <tr>
+      <td>deployments/ </td>
+      <td>Contains topology descriptors used to configure the gateway for specific Hadoop clusters. </td>
+    </tr>
+    <tr>
+      <td>lib/ </td>
+      <td>Contains the JARs for all the components that make up the gateway. </td>
+    </tr>
+    <tr>
+      <td>dep/ </td>
+      <td>Contains the JARs for all of the components upon which the gateway depends. </td>
+    </tr>
+    <tr>
+      <td>ext/ </td>
+      <td>A directory where user supplied extension JARs can be placed to extends the gateways functionality. </td>
+    </tr>
+    <tr>
+      <td>samples/ </td>
+      <td>Contains a number of samples that can be used to explore the functionality of the gateway. </td>
+    </tr>
+    <tr>
+      <td>templates/ </td>
+      <td>Contains default configuration files that can be copied and customized. </td>
+    </tr>
+    <tr>
+      <td>README </td>
+      <td>Provides basic information about the Apache Knox Gateway. </td>
+    </tr>
+    <tr>
+      <td>ISSUES </td>
+      <td>Describes significant know issues. </td>
+    </tr>
+    <tr>
+      <td>CHANGES </td>
+      <td>Enumerates the changes between releases. </td>
+    </tr>
+    <tr>
+      <td>LICENSE </td>
+      <td>Documents the license under which this software is provided. </td>
+    </tr>
+    <tr>
+      <td>NOTICE </td>
+      <td>Documents required attribution notices for included dependencies. </td>
+    </tr>
+    <tr>
+      <td>DISCLAIMER </td>
+      <td>Documents that this release is from a project undergoing incubation at Apache. </td>
+    </tr>
+  </tbody>
+</table></div><div id="Supported+Services"><h3><a id="Supported+Services"></a>Supported Services</h3><p>This table enumerates the versions of various Hadoop services that have been tested to work with the Knox Gateway. Only more recent versions of some Hadoop components when secured via Kerberos can be accessed via the Knox Gateway.</p>
+<table>
+  <thead>
+    <tr>
+      <th>Service </th>
+      <th>Version </th>
+      <th>Non-Secure </th>
+      <th>Secure </th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>WebHDFS </td>
+      <td>2.1.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="check.png"  alt="y"/> </td>
+    </tr>
+    <tr>
+      <td>WebHCat/Templeton </td>
+      <td>0.11.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+    <tr>
+      <td> </td>
+      <td>0.12.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="check.png"  alt="y"/> </td>
+    </tr>
+    <tr>
+      <td>Ozzie </td>
+      <td>4.0.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="check.png"  alt="y"/> </td>
+    </tr>
+    <tr>
+      <td>HBase/Stargate </td>
+      <td>0.95.2 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+    <tr>
+      <td>Hive (via WebHCat) </td>
+      <td>0.11.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+    <tr>
+      <td> </td>
+      <td>0.12.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="check.png"  alt="y"/> </td>
+    </tr>
+    <tr>
+      <td>Hive (via JDBC) </td>
+      <td>0.11.0 </td>
+      <td><img src="error.png"  alt="n"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+    <tr>
+      <td> </td>
+      <td>0.12.0 </td>
+      <td><img src="check.png"  alt="y"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+    <tr>
+      <td>Hive (via ODBC) </td>
+      <td>0.11.0 </td>
+      <td><img src="error.png"  alt="n"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+    <tr>
+      <td> </td>
+      <td>0.12.0 </td>
+      <td><img src="error.png"  alt="n"/> </td>
+      <td><img src="error.png"  alt="n"/> </td>
+    </tr>
+  </tbody>
+</table><h3><a id="More+Examples"></a>More Examples</h3><p>These examples provide more detail about how to access various Apache Hadoop services via the Apache Knox Gateway.</p>
+<ul>
+  <li><a href="#WebHDFS+Examples">WebHDFS Examples</a></li>
+  <li><a href="#WebHCat+Examples">WebHCat Examples</a></li>
+  <li><a href="#Oozie+Examples">Oozie Examples</a></li>
+  <li><a href="#HBase+Examples">HBase Examples</a></li>
+  <li><a href="#Hive+Examples">Hive Examples</a></li>
+</ul></div><div id="Gateway+Details"><h2><a id="Gateway+Details"></a>Gateway Details</h2><p>TODO</p><h3><a id="URL+Mapping"></a>URL Mapping</h3><p>The gateway functions much like a reverse proxy. As such it maintains a mapping of URLs that are exposed externally by the gateway to URLs that are provided by the Hadoop cluster. Examples of mappings for the WebHDFS, WebHCat, Oozie and Stargate/HBase are shown below. These mapping are generated from the combination of the gateway configuration file (i.e. <code>{GATEWAY_HOME}/conf/gateway-site.xml</code>) and the cluster topology descriptors (e.g. <code>{GATEWAY_HOME}/deployments/{cluster-name}.xml</code>). The port numbers show for the Cluster URLs represent the default ports for these services. The actual port number may be different for a given cluster.</p>
+<ul>
+  <li>WebHDFS
+  <ul>
+    <li>Gateway: <code>https://{gateway-host}:{gateway-port}/{gateway-path}/{cluster-name}/webhdfs</code></li>
+    <li>Cluster: <code>http://{webhdfs-host}:50070/webhdfs</code></li>
+  </ul></li>
+  <li>WebHCat (Templeton)
+  <ul>
+    <li>Gateway: <code>https://{gateway-host}:{gateway-port}/{gateway-path}/{cluster-name}/templeton</code></li>
+    <li>Cluster: <code>http://{webhcat-host}:50111/templeton}</code></li>
+  </ul></li>
+  <li>Oozie
+  <ul>
+    <li>Gateway: <code>https://{gateway-host}:{gateway-port}/{gateway-path}/{cluster-name}/oozie</code></li>
+    <li>Cluster: <code>http://{oozie-host}:11000/oozie}</code></li>
+  </ul></li>
+  <li>Stargate (HBase)
+  <ul>
+    <li>Gateway: <code>https://{gateway-host}:{gateway-port}/{gateway-path}/{cluster-name}/hbase</code></li>
+    <li>Cluster: <code>http://{hbase-host}:60080</code></li>
+  </ul></li>
+  <li>Hive JDBC
+  <ul>
+    <li>Gateway: <code>jdbc:hive2://{gateway-host}:{gateway-port}/?hive.server2.transport.mode=https;hive.server2.thrift.http.path={gateway-path}/{cluster-name}/hive</code></li>
+    <li>Cluster: <code>http://{hive-host}:10001/cliservice</code></li>
+  </ul></li>
+</ul><p>The values for <code>{gateway-host}</code>, <code>{gateway-port}</code>, <code>{gateway-path}</code> are provided via the gateway configuration file (i.e. <code>{GATEWAY_HOME}/conf/gateway-site.xml</code>).</p><p>The value for <code>{cluster-name}</code> is derived from the file name of the cluster topology descriptor (e.g. <code>{GATEWAY_HOME}/deployments/{cluster-name}.xml</code>).</p><p>The value for <code>{webhdfs-host}</code>, <code>{webhcat-host}</code>, <code>{oozie-host}</code>, <code>{hbase-host}</code> and <code>{hive-host}</code> are provided via the cluster topology descriptor (e.g. <code>{GATEWAY_HOME}/deployments/{cluster-name}.xml</code>).</p><p>Note: The ports 50070, 50111, 11000, 60080 and 10001 are the defaults for WebHDFS, WebHCat, Oozie, Stargate/HBase and Hive respectively. Their values can also be provided via the cluster topology descriptor if your Hadoop cluster uses different ports.</p></div><div id="Configuration"><h3><a id="Configuration"></a>Confi
 guration</h3><h4><a id="Topology+Descriptors"></a>Topology Descriptors</h4><p>The topology descriptor files provide the gateway with per-cluster configuration information. This includes configuration for both the providers within the gateway and the services within the Hadoop cluster. These files are located in <code>{GATEWAY_HOME}/deployments</code>. The general outline of this document looks like this.</p>
+<pre><code>&lt;topology&gt;
+    &lt;gateway&gt;
+        &lt;provider&gt;
+        &lt;/provider&gt;
+    &lt;/gateway&gt;
+    &lt;service&gt;
+    &lt;/service&gt;
+&lt;/topology&gt;
+</code></pre><p>There are typically multiple <code>&lt;provider&gt;</code> and <code>&lt;service&gt;</code> elements.</p>
+<dl><dt>/topology</dt><dd>Defines the provider and configuration and service topology for a single Hadoop cluster.</dd><dt>/topology/gateway</dt><dd>Groups all of the provider elements</dd><dt>/topology/gateway/provider</dt><dd>Defines the configuration of a specific provider for the cluster.</dd><dt>/topology/service</dt><dd>Defines the location of a specific Hadoop service within the Hadoop cluster.</dd>
+</dl><h5><a id="Provider+Configuration"></a>Provider Configuration</h5><p>Provider configuration is used to customize the behavior of a particular gateway feature. The general outline of a provider element looks like this.</p>
+<pre><code>&lt;provider&gt;
+    &lt;role&gt;authentication&lt;/role&gt;
+    &lt;name&gt;ShiroProvider&lt;/name&gt;
+    &lt;enabled&gt;true&lt;/enabled&gt;
+    &lt;param&gt;
+        &lt;name&gt;&lt;/name&gt;
+        &lt;value&gt;&lt;/value&gt;
+    &lt;/param&gt;
+&lt;/provider&gt;
+</code></pre>
+<dl><dt>/topology/gateway/provider</dt><dd>Groups information for a specific provider.</dd><dt>/topology/gateway/provider/role</dt><dd>Defines the role of a particular provider. There are a number of pre-defined roles used by out-of-the-box provider plugins for the gateay. These roles are: authentication, identity-assertion, authentication, rewrite and hostmap</dd><dt>/topology/gateway/provider/name</dt><dd>Defines the name of the provider for which this configuration applies. There can be multiple provider implementations for a given role. Specifying the name is used identify which particular provider is being configured. Typically each topology descriptor should contain only one provider for each role but there are exceptions.</dd><dt>/topology/gateway/provider/enabled</dt><dd>Allows a particular provider to be enabled or disabled via <code>true</code> or <code>false</code> respectively. When a provider is disabled any filters associated with that provider are excluded from the pr
 ocessing chain.</dd><dt>/topology/gateway/provider/param</dt><dd>These elements are used to supply provider configuration. There can be zero or more of these per provider.</dd><dt>/topology/gateway/provider/param/name</dt><dd>The name of a parameter to pass to the provider.</dd><dt>/topology/gateway/provider/param/value</dt><dd>The value of a parameter to pass to the provider.</dd>
+</dl><h5><a id="Service+Configuration"></a>Service Configuration</h5><p>Service configuration is used to specify the location of services within the Hadoop cluster. The general outline of a service element looks like this.</p>
+<pre><code>&lt;service&gt;
+    &lt;role&gt;WEBHDFS&lt;/role&gt;
+    &lt;url&gt;http://localhost:50070/webhdfs&lt;/url&gt;
+&lt;/service&gt;
+</code></pre>
+<dl><dt>/topology/service</dt><dd>Provider information about a particular service within the Hadoop cluster. Not all services are necessarily exposed as gateway endpoints.</dd><dt>/topology/service/role</dt><dd>Identifies the role of this service. Currently supported roles are: WEBHDFS, WEBHCAT, WEBHBASE, OOZIE, HIVE, NAMENODE, JOBTRACKER Additional service roles can be supported via plugins.</dd><dt>topology/service/url</dt><dd>The URL identifying the location of a particular service within the Hadoop cluster.</dd>
+</dl><h4><a id="Hostmap+Provider"></a>Hostmap Provider</h4><p>The purpose of the Hostmap provider is to handle situations where host are know by one name within the cluster and another name externally. This frequently occurs when virtual machines are used and in particular using cloud hosting services. Currently the Hostmap provider is configured as part of the topology file. The basic structure is shown below.</p>
+<pre><code>&lt;topology&gt;
+    &lt;gateway&gt;
+        ...
+        &lt;provider&gt;
+            &lt;role&gt;hostmap&lt;/role&gt;
+            &lt;name&gt;static&lt;/name&gt;
+            &lt;enabled&gt;true&lt;/enabled&gt;
+            &lt;param&gt;&lt;name&gt;external-host-name&lt;/name&gt;&lt;value&gt;internal-host-name&lt;/value&gt;&lt;/param&gt;
+        &lt;/provider&gt;
+        ...
+    &lt;/gateway&gt;
+    ...
+&lt;/topology&gt;
+</code></pre><p>This mapping is required because the Hadoop servies running within the cluster are unaware that they are being accessed from outside the cluster. Therefore URLs returned as part of REST API responses will typically contain internal host names. Since clients outside the cluster will be unable to resolve those host name they must be mapped to external host names.</p><h5><a id="Hostmap+Provider+Example+-+EC2"></a>Hostmap Provider Example - EC2</h5><p>Consider an EC2 example where two VMs have been allocated. Each VM has an external host name by which it can be accessed via the internet. However the EC2 VM is unaware of this external host name and instead is configured with the internal host name.</p>
+<pre><code>External HOSTNAMES:
+ec2-23-22-31-165.compute-1.amazonaws.com
+ec2-23-23-25-10.compute-1.amazonaws.com
+
+Internal HOSTNAMES:
+ip-10-118-99-172.ec2.internal
+ip-10-39-107-209.ec2.internal
+</code></pre><p>The Hostmap configuration required to allow access external to the Hadoop cluster via the Apache Knox Gateway would be this.</p>
+<pre><code>&lt;topology&gt;
+    &lt;gateway&gt;
+        ...
+        &lt;provider&gt;
+            &lt;role&gt;hostmap&lt;/role&gt;
+            &lt;name&gt;static&lt;/name&gt;
+            &lt;enabled&gt;true&lt;/enabled&gt;
+            &lt;param&gt;
+                &lt;name&gt;ec2-23-22-31-165.compute-1.amazonaws.com&lt;/name&gt;
+                &lt;value&gt;ip-10-118-99-172.ec2.internal&lt;/value&gt;
+            &lt;/param&gt;
+            &lt;param&gt;
+                &lt;name&gt;ec2-23-23-25-10.compute-1.amazonaws.com&lt;/name&gt;
+                &lt;value&gt;ip-10-39-107-209.ec2.internal&lt;/value&gt;
+            &lt;/param&gt;
+        &lt;/provider&gt;
+        ...
+    &lt;/gateway&gt;
+    ...
+&lt;/topology&gt;
+</code></pre><h5><a id="Hostmap+Provider+Example+-+Sandbox"></a>Hostmap Provider Example - Sandbox</h5><p>Hortonwork&rsquo;s Sandbox 2.x poses a different challenge for host name mapping. This version of the Sandbox uses port mapping to make the Sandbox VM appear as though it is accessible via localhost. However the Sandbox VM is internally configured to consider sandbox.hortonworks.com as the host name. So from the perspective of a client accessing Sandbox the external host name is localhost. The Hostmap configuration required to allow access to Sandbox from the host operating system is this.</p>
+<pre><code>&lt;topology&gt;
+    &lt;gateway&gt;
+        ...
+        &lt;provider&gt;
+            &lt;role&gt;hostmap&lt;/role&gt;
+            &lt;name&gt;static&lt;/name&gt;
+            &lt;enabled&gt;true&lt;/enabled&gt;
+            &lt;param&gt;&lt;name&gt;localhost&lt;/name&gt;&lt;value&gt;sandbox,sandbox.hortonworks.com&lt;/value&gt;&lt;/param&gt;
+        &lt;/provider&gt;
+        ...
+    &lt;/gateway&gt;
+    ...
+&lt;/topology&gt;
+</code></pre><h5><a id="Hostmap+Provider+Configuration"></a>Hostmap Provider Configuration</h5><p>Details about each provider configuration element is enumerated below.</p>
+<dl><dt>topology/gateway/provider/role</dt><dd>The role for a Hostmap provider must always be <code>hostmap</code>.</dd><dt>topology/gateway/provider/name</dt><dd>The Hostmap provider supplied out-of-the-box is selected via the name <code>static</code>.</dd><dt>topology/gateway/provider/enabled</dt><dd>Host mapping can be enabled or disabled by providing <code>true</code> or <code>false</code>.</dd><dt>topology/gateway/provider/param</dt><dd>Host mapping is configured by providing parameters for each external to internal mapping.</dd><dt>topology/gateway/provider/param/name</dt><dd>The parameter names represent an external host names associated with the internal host names provided by the value element. This can be a comma separated list of host names that all represent the same physical host. When mapping from internal to external host name the first external host name in the list is used.</dd><dt>topology/gateway/provider/param/value</dt><dd>The parameter values represent the inte
 rnal host names associated with the external host names provider by the name element. This can be a comma separated list of host names that all represent the same physical host. When mapping from external to internal host names the first internal host name in the list is used.</dd>
+</dl><h4><a id="Logging"></a>Logging</h4><p>If necessary you can enable additional logging by editing the <code>log4j.properties</code> file in the <code>conf</code> directory. Changing the rootLogger value from <code>ERROR</code> to <code>DEBUG</code> will generate a large amount of debug logging. A number of useful, more fine loggers are also provided in the file.</p><h4><a id="Java+VM+Options"></a>Java VM Options</h4><p>TODO - Java VM options doc.</p><h4><a id="Persisting+the+Master+Secret"></a>Persisting the Master Secret</h4><p>The master secret is required to start the server. This secret is used to access secured artifacts by the gateway instance. Keystore, trust stores and credential stores are all protected with the master secret.</p><p>You may persist the master secret by supplying the <em>-persist-master</em> switch at startup. This will result in a warning indicating that persisting the secret is less secure than providing it at startup. We do make some provisions in ord
 er to protect the persisted password.</p><p>It is encrypted with AES 128 bit encryption and where possible the file permissions are set to only be accessible by the user that the gateway is running as.</p><p>After persisting the secret, ensure that the file at config/security/master has the appropriate permissions set for your environment. This is probably the most important layer of defense for master secret. Do not assume that the encryption if sufficient protection.</p><p>A specific user should be created to run the gateway this user will be the only user with permissions for the persisted master file.</p><p>See the Knox CLI section for descriptions of the command line utilties related to the master secret.</p><h4><a id="Management+of+Security+Artifacts"></a>Management of Security Artifacts</h4><p>There are a number of artifacts that are used by the gateway in ensuring the security of wire level communications, access to protected resources and the encryption of sensitive data. T
 hese artifacts can be managed from outside of the gateway instances or generated and populated by the gateway instance itself.</p><p>The following is a description of how this is coordinated with both standalone (development, demo, etc) gateway instances and instances as part of a cluster of gateways in mind.</p><p>Upon start of the gateway server we:</p>
+<ol>
+  <li>Look for an identity store at <code>conf/security/keystores/gateway.jks</code>.  The identity store contains the certificate and private key used to represent the identity of the server for SSL connections and signature creation.
+  <ul>
+    <li>If there is no identity store we create one and generate a self-signed certificate for use in standalone/demo mode.  The certificate is stored with an alias of gateway-identity.</li>
+    <li>If there is an identity store found than we ensure that it can be loaded using the provided master secret and that there is an alias with called gateway-identity.</li>
+  </ul></li>
+  <li>Look for a credential store at <code>conf/security/keystores/__gateway-credentials.jceks</code>.  This credential store is used to store secrets/passwords that are used by the gateway.  For instance, this is where the pass-phrase for accessing the gateway-identity certificate is kept.
+  <ul>
+    <li>If there is no credential store found then we create one and populate it with a generated pass-phrase for the alias <code>gateway-identity-passphrase</code>.  This is coordinated with the population of the self-signed cert into the identity-store.</li>
+    <li>If a credential store is found then we ensure that it can be loaded using the provided master secret and that the expected aliases have been populated with secrets.</li>
+  </ul></li>
+</ol><p>Upon deployment of a Hadoop cluster topology within the gateway we:</p>
+<ol>
+  <li>Look for a credential store for the topology. For instance, we have a sample topology that gets deployed out of the box. We look for <code>conf/security/keystores/sandbox-credentials.jceks</code>. This topology specific credential store is used for storing secrets/passwords that are used for encrypting sensitive data with topology specific keys.
+  <ul>
+    <li>If no credential store is found for the topology being deployed then one is created for it.  Population of the aliases is delegated to the configured providers within the system that will require the use of a secret for a particular task.  They may programmatic set the value of the secret or choose to have the value for the specified alias generated through the AliasService.</li>
+    <li>If a credential store is found then we ensure that it can be loaded with the provided master secret and the configured providers have the opportunity to ensure that the aliases are populated and if not to populate them.</li>
+  </ul></li>
+</ol><p>By leveraging the algorithm described above we can provide a window of opportunity for management of these artifacts in a number of ways.</p>
+<ol>
+  <li>Using a single gateway instance as a master instance the artifacts can be generated or placed into the expected location and then replicated across all of the slave instances before startup.</li>
+  <li>Using an NFS mount as a central location for the artifacts would provide a single source of truth without the need to replicate them over the network. Of course, NFS mounts have their own challenges.</li>
+  <li>Using the KnoxCLI to create and manage the security artifacts.</li>
+</ol><p>See the Knox CLI section for descriptions of the command line utilties related to the security artifact management.</p><h4><a id="Keystores"></a>Keystores</h4><p>In order to provide your own certificate for use by the gateway, you will need to either import an existing key pair into a Java keystore or generate a self-signed cert using the Java keytool.</p><h5><a id="Importing+a+key+pair+into+a+Java+keystore"></a>Importing a key pair into a Java keystore</h5><h1><a id="----NEEDS+TESTING"></a>&mdash;-NEEDS TESTING</h1><p>One way to accomplish this is to start with a PKCS12 store for your key pair and then convert it to a Java keystore or JKS.</p>
+<pre><code>openssl pkcs12 -export -in cert.pem -inkey key.pem &gt; server.p12
+</code></pre><p>The above example uses openssl to create a PKCS12 encoded store for your provided certificate private key.</p>
+<pre><code>keytool -importkeystore -srckeystore {server.p12} -destkeystore gateway.jks -srcstoretype pkcs12
+</code></pre><p>This example converts the PKCS12 store into a Java keystore (JKS). It should prompt you for the keystore and key passwords for the destination keystore. You must use the master-secret for both.</p><p>While using this approach a couple of important things to be aware of:</p>
+<ol>
+  <li>the alias MUST be &ldquo;gateway-identity&rdquo;</li>
+  <li>the name of the expected identity keystore for the gateway MUST be gateway.jks</li>
+  <li>the passwords for the keystore and the imported key MUST both be the master secret for the gateway install</li>
+</ol><p>NOTE: The password for the keystore as well as that of the imported key must be the master secret for the gateway instance.</p><h1><a id="----END+NEEDS+TESTING"></a>&mdash;-END NEEDS TESTING</h1><h5><a id="Generating+a+self-signed+cert+for+use+in+testing+or+development+environments"></a>Generating a self-signed cert for use in testing or development environments</h5>
+<pre><code>keytool -genkey -keyalg RSA -alias gateway-identity -keystore gateway.jks \
+    -storepass {master-secret} -validity 360 -keysize 2048
+</code></pre><p>Keytool will prompt you for a number of elements used will comprise the distiniguished name (DN) within your certificate. </p><p><em>NOTE:</em> When it prompts you for your First and Last name be sure to type in the hostname of the machine that your gateway instance will be running on. This is used by clients during hostname verification to ensure that the presented certificate matches the hostname that was used in the URL for the connection - so they need to match.</p><p><em>NOTE:</em> When it prompts for the key password just press enter to ensure that it is the same as the keystore password. Which as was described earlier must match the master secret for the gateway instance.</p><p>See the Knox CLI section for descriptions of the command line utilties related to the management of the keystores.</p><h5><a id="Credential+Store"></a>Credential Store</h5><p>Whenever you provide your own keystore with either a self-signed cert or a real certificate signed by a trusted 
 authority, you will need to create an empty credential store. This is necessary for the current release in order for the system to utilize the same password for the keystore and the key.</p><p>The credential stores in Knox use the JCEKS keystore type as it allows for the storage of general secrets in addition to certificates.</p><p>Keytool may be used to create credential stores but the Knox CLI section details how to create aliases. These aliases are managed within credential stores which are created by the CLI as appropriate. </p><p>See the Knox CLI section for descriptions of the command line utilties related to the management of the credential stores.</p><h5><a id="Provisioning+of+Keystores"></a>Provisioning of Keystores</h5><p>Once you have created these keystores you must move them into place for the gateway to discover them and use them to represent its identity for SSL connections. This is done by copying the keystores to the <code>{GATEWAY_HOME}/conf/security/keystores</cod
 e> directory for your gateway install.</p><h4><a id="Summary+of+Secrets+to+be+Managed"></a>Summary of Secrets to be Managed</h4>
+<ol>
+  <li>Master secret - the same for all gateway instances in a cluster of gateways</li>
+  <li>All security related artifacts are protected with the master secret</li>
+  <li>Secrets used by the gateway itself are stored within the gateway credential store and are the same across all gateway instances in the cluster of gateways</li>
+  <li>Secrets used by providers within cluster topologies are stored in topology specific credential stores and are the same for the same topology across the cluster of gateway instances.  However, they are specific to the topology - so secrets for one hadoop cluster are different from those of another.  This allows for fail-over from one gateway instance to another even when encryption is being used while not allowing the compromise of one encryption key to expose the data for all clusters.</li>
+</ol><p>NOTE: the SSL certificate will need special consideration depending on the type of certificate. Wildcard certs may be able to be shared across all gateway instances in a cluster. When certs are dedicated to specific machines the gateway identity store will not be able to be blindly replicated as host name verification problems will ensue. Obviously, trust-stores will need to be taken into account as well.</p></div><div id="Knox+CLI"><h3><a id="Knox+CLI"></a>Knox CLI</h3><p>The Knox CLI is a command line utility for management of various aspects of the Knox deployment. It is primarily concerned with the management of the security artifacts for the gateway instance and each of the deployed topologies or hadoop clusters that are gated by the Knox Gateway instance.</p><p>The various security artifacts are also generated and populated automatically by the Knox Gateway runtime when they are not found at startup. The assumptions made in those cases are appropriate for a test or dev
 elopment gateway instance and assume &lsquo;localhost&rsquo; for hostname specific activities. For production deployments the use of the CLI may aid in managing some production deployments.</p><p>The knoxcli.sh script is located in the {GATEWAY_HOME}/bin directory.</p><h4><a id="Help"></a>Help</h4><h5><a id="knoxcli.sh+[--help]"></a>knoxcli.sh [&ndash;help]</h5><p>prints help for all commands</p><h4><a id="Master+secret+persistence"></a>Master secret persistence</h4><h5><a id="knoxcli.sh+create-master+[--help]"></a>knoxcli.sh create-master [&ndash;help]</h5><p>Creates and persists an encrypted master secret in a file within {GATEWAY_HOME}/data/security/master. </p><p>NOTE: This command fails when there is an existing master file in the expected location.</p><h4><a id="Alias+creation"></a>Alias creation</h4><h5><a id="knoxcli.sh+create-alias+n+[--cluster+c]+[--value+v]+[--generate]+[--help]"></a>knoxcli.sh create-alias n [&ndash;cluster c] [&ndash;value v] [&ndash;generate] [&ndash;h
 elp]</h5><p>Creates a password alias and stores it in a credential store within the {GATEWAY_HOME}/data/security/keystores dir. </p>
+<table>
+  <thead>
+    <tr>
+      <th>argument </th>
+      <th>description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>&ndash;name</td>
+      <td>name of the alias to create</td>
+    </tr>
+    <tr>
+      <td>&ndash;cluster</td>
+      <td>name of Hadoop cluster for the cluster specific credential store otherwise assumes that it is for the gateway itself</td>
+    </tr>
+    <tr>
+      <td>&ndash;value</td>
+      <td>parameter for specifying the actual password otherwise prompted<br/></td>
+    </tr>
+    <tr>
+      <td>&ndash;generate</td>
+      <td>boolean flag to indicate whether the tool should just generate the value. This assumes that &ndash;value is not set - will result in error otherwise. User will not be prompted for the value when &ndash;generate is set.</td>
+    </tr>
+  </tbody>
+</table><h4><a id="Alias+deletion"></a>Alias deletion</h4><h5><a id="knoxcli.sh+delete-alias+n+[--cluster+c]+[--help]"></a>knoxcli.sh delete-alias n [&ndash;cluster c] [&ndash;help]</h5><p>Deletes a password and alias mapping from a credential store within {GATEWAY_HOME}/data/security/keystores. </p>
+<table>
+  <thead>
+    <tr>
+      <th>argument </th>
+      <th>description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>&ndash;name </td>
+      <td>name of the alias to delete</td>
+    </tr>
+    <tr>
+      <td>&ndash;cluster </td>
+      <td>name of Hadoop cluster for the cluster specific credential store otherwise assumes __gateway</td>
+    </tr>
+  </tbody>
+</table><h4><a id="Alias+listing"></a>Alias listing</h4><h5><a id="knoxcli.sh+list-alias+[--cluster+c]+[--help]"></a>knoxcli.sh list-alias [&ndash;cluster c] [&ndash;help]</h5><p>Lists the alias names for the credential store within {GATEWAY_HOME}/data/security/keystores. </p>
+<table>
+  <thead>
+    <tr>
+      <th>argument </th>
+      <th>description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td>&ndash;cluster </td>
+      <td>name of Hadoop cluster for the cluster specific credential store otherwise assumes __gateway</td>
+    </tr>
+  </tbody>
+</table><h4><a id="Self-signed+cert+creation"></a>Self-signed cert creation</h4><h5><a id="knoxcli.sh+create-cert+[--hostname+n]+[--help]"></a>knoxcli.sh create-cert [&ndash;hostname n] [&ndash;help]</h5><p>Creates and stores a self-signed certificate to represent the identity of the gateway instance. This is stored within the {GATEWAY_HOME}/data/security/keystores/gateway.jks keystore. </p>
+<table>
+  <thead>
+    <tr>
+      <th align="left">argument </th>
+      <th>description</th>
+    </tr>
+  </thead>
+  <tbody>
+    <tr>
+      <td align="left">&ndash;hostname </td>
+      <td>name of the host to be used in the self-signed certificate. This allows multi-host deployments to specify the proper hostnames for hostname verification to succeed on the client side of the SSL connection. The default is “localhost”.</td>
+    </tr>
+  </tbody>
+</table></div><div id="Authentication"><h3><a id="Authentication"></a>Authentication</h3><p>There are two types of providers supported in Knox for establishing a user&rsquo;s identity:</p>
+<ol>
+  <li>Authentication Providers</li>
+  <li>Federation Providers</li>
+</ol><p>Authentication providers directly accept a user&rsquo;s credentials and validates them against some particular user store. Federation providers, on the other hand, validate a token that has been issued for the user by a trusted Identity Provider (IdP).</p><p>The current release of Knox ships with an authentication provider based on the Apache Shiro project and is initially configured for BASIC authentication against an LDAP store. This has been specifically tested against Apache Directory Server and Active Directory.</p><p>This section will cover the general approach to leveraging Shiro within the bundled provider including:</p>
+<ol>
+  <li>General mapping of provider config to shiro.ini config</li>
+  <li>Specific configuration for the bundled BASIC/LDAP configuration</li>
+  <li>Some tips into what may need to be customized for your environment</li>
+  <li>How to setup the use of LDAP over SSL or LDAPS</li>
+</ol><h4><a id="General+Configuration+for+Shiro+Provider"></a>General Configuration for Shiro Provider</h4><p>As is described in the configuration section of this document, providers have a name-value based configuration - as is the common pattern in the rest of Hadoop.</p><p>The following example shows the format of the configuration for a given provider:</p>
+<pre><code>&lt;provider&gt;
+    &lt;role&gt;authentication&lt;/role&gt;
+    &lt;name&gt;ShiroProvider&lt;/name&gt;
+    &lt;enabled&gt;true&lt;/enabled&gt;
+    &lt;param&gt;
+        &lt;name&gt;{name}&lt;/name&gt;
+        &lt;value&gt;{value}&lt;/value&gt;
+    &lt;/param&gt;
+&lt;/provider&gt;
+</code></pre><p>Conversely, the Shiro provider currently expects a shiro.ini file in the web-inf directory of the cluster specific web application.</p><p>The following example illustrates a configuration of the bundled BASIC/LDAP authentication config in a shiro.ini file:</p>
+<pre><code>[urls]
+/**=authcBasic
+[main]
+ldapRealm=org.apache.shiro.realm.ldap.JndiLdapRealm
+ldapRealm.contextFactory.authenticationMechanism=simple
+ldapRealm.contextFactory.url=ldap://localhost:33389
+ldapRealm.userDnTemplate=uid={0},ou=people,dc=hadoop,dc=apache,dc=org
+</code></pre><p>In order to fit into the context of an INI file format, at deployment time we interrogate the paramaters provided in the provider configuration and parse the INI section out of the paramter names. The following provider config illustrates this approach. Notice that the section names in the above shiro.ini match the beginning of the param names that are in the following config:</p>
+<pre><code>&lt;gateway&gt;
+    &lt;provider&gt;
+        &lt;role&gt;authentication&lt;/role&gt;
+        &lt;name&gt;ShiroProvider&lt;/name&gt;
+        &lt;enabled&gt;true&lt;/enabled&gt;
+        &lt;param&gt;
+            &lt;name&gt;main.ldapRealm&lt;/name&gt;
+            &lt;value&gt;org.apache.shiro.realm.ldap.JndiLdapRealm&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+            &lt;name&gt;main.ldapRealm.userDnTemplate&lt;/name&gt;
+            &lt;value&gt;uid={0},ou=people,dc=hadoop,dc=apache,dc=org&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+            &lt;name&gt;main.ldapRealm.contextFactory.url&lt;/name&gt;
+            &lt;value&gt;ldap://localhost:33389&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+            &lt;name&gt;main.ldapRealm.contextFactory.authenticationMechanism&lt;/name&gt;
+            &lt;value&gt;simple&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+            &lt;name&gt;urls./**&lt;/name&gt;
+            &lt;value&gt;authcBasic&lt;/value&gt;
+        &lt;/param&gt;
+    &lt;/provider&gt;
+</code></pre><p>This happens to be the way that we are currently configuring Shiro for BASIC/LDAP authentication. This same config approach may be used to achieve other authentication mechanisms or variations on this one. We however have not tested additional uses for it for this release.</p><h4><a id="LDAP+Configuration"></a>LDAP Configuration</h4><p>This section discusses the LDAP configuration used above for the Shiro Provider. Some of these configuration elements will need to be customized to reflect your deployment environment.</p><p><strong>main.ldapRealm</strong> - this element indicates the fully qualified classname of the Shiro realm to be used in authenticating the user. The classname provided by default in the sample is the <code>org.apache.shiro.realm.ldap.JndiLdapRealm</code> this implementation provides us with the ability to authenticate but by default has authorization disabled. In order to provide authorization - which is seen by Shiro as dependent on an LDAP schema
  that is specific to each organization - an extension of JndiLdapRealm is generally used to override and implement the doGetAuhtorizationInfo method. In this particular release we are providing a simple authorization provider that can be used along with the Shiro authentication provider.</p><p><strong>main.ldapRealm.userDnTemplate</strong> - in order to bind a simple username to an LDAP server that generally requires a full distinguished name (DN), we must provide the template into which the simple username will be inserted. This template allows for the creation of a DN by injecting the simple username into the common name (CN) portion of the DN. <strong>This element will need to be customized to reflect your deployment environment.</strong> The template provided in the sample is only an example and is valid only within the LDAP schema distributed with Knox and is represented by the users.ldif file in the {GATEWAY_HOME}conf directory.</p><p><strong>main.ldapRealm.contextFactory.url<
 /strong> - this element is the URL that represents the host and port of LDAP server. It also includes the scheme of the protocol to use. This may be either ldap or ldaps depending on whether you are communicating with the LDAP over SSL (higly recommended). <strong>This element will need to be cusomized to reflect your deployment environment.</strong>.</p><p><strong>main.ldapRealm.contextFactory.authenticationMechanism</strong> - this element indicates the type of authentication that should be performed against the LDAP server. The current default value is <code>simple</code> which indicates a simple bind operation. This element should not need to be modified and no mechanism other than a simple bind has been tested for this particular release.</p><p><strong>urls./</strong>** - this element represents a single URL_Ant_Path_Expression and the value the Shiro filter chain to apply to it. This particular sample indicates that all paths into the application have the same Shiro filter cha
 in applied. The paths are relative to the application context path. The use of the value <code>authcBasic</code> here indicates that BASIC authentication is expected for every path into the application. Adding an additional Shiro filter to that chain for validating that the request isSecure() and over SSL can be achieved by changing the value to <code>ssl, authcBasic</code>. It is not likely that you need to change this element for your environment.</p><h4><a id="Active+Directory+-+Special+Note"></a>Active Directory - Special Note</h4><p>You would use LDAP configuration as documented above to authenticate against Active Directory as well.</p><p>Some Active Directory specifc things to keep in mind:</p><p>Typical AD main.ldapRealm.userDnTemplate value looks slightly different, such as  cn={0},cn=users,DC=lab,DC=sample,dc=com</p><p>Please compare this with a typical Apache DS main.ldapRealm.userDnTemplate value and make note of the difference.  uid={0},ou=people,dc=hadoop,dc=apache,dc=
 org</p><p>If your AD is configured to authenticate based on just the cn and password and does not require user DN, you do not have to specify value for main.ldapRealm.userDnTemplate.</p><h4><a id="LDAP+over+SSL+(LDAPS)+Configuration"></a>LDAP over SSL (LDAPS) Configuration</h4><p>In order to communicate with your LDAP server over SSL (again, highly recommended), you will need to modify the topology file in a couple ways and possibly provision some keying material.</p>
+<ol>
+  <li><strong>main.ldapRealm.contextFactory.url</strong> must be changed to have the <code>ldaps</code> protocol scheme and the port must be the SSL listener port on your LDAP server.</li>
+  <li>Identity certificate (keypair) provisioned to LDAP server - your LDAP server specific documentation should indicate what is requried for providing a cert or keypair to represent the LDAP server identity to connecting clients.</li>
+  <li>Trusting the LDAP Server&rsquo;s public key - if the LDAP Server&rsquo;s identity certificate is issued by a well known and trusted certificate authority and is already represented in the JRE&rsquo;s cacerts truststore then you don&rsquo;t need to do anything for trusting the LDAP server&rsquo;s cert. If, however, the cert is selfsigned or issued by an untrusted authority you will need to either add it to the cacerts keystore or to another truststore that you may direct Knox to utilize through a system property.</li>
+</ol><h4><a id="Session+Configuration"></a>Session Configuration</h4><p>Knox maps each cluster topology to a web application and leverages standard JavaEE session management.</p><p>To configure session idle timeout for the topology, please specify value of parameter sessionTimeout for ShiroProvider in your topology file. If you do not specify the value for this parameter, it defaults to 30minutes.</p><p>The definition would look like the following in the topoloogy file:</p>
+<pre><code>...
+&lt;provider&gt;
+    &lt;role&gt;authentication&lt;/role&gt;
+    &lt;name&gt;ShiroProvider&lt;/name&gt;
+    &lt;enabled&gt;true&lt;/enabled&gt;
+    &lt;param&gt;
+        &lt;!--
+        Session timeout in minutes. This is really idle timeout.
+        Defaults to 30 minutes, if the property value is not defined.
+        Current client authentication will expire if client idles
+        continuously for more than this value
+        --&gt;
+        &lt;name&gt;sessionTimeout&lt;/name&gt;
+        &lt;value&gt;30&lt;/value&gt;
+    &lt;/param&gt;
+&lt;provider&gt;
+...
+</code></pre><p>At present, ShiroProvider in Knox leverages JavaEE session to maintain authentication state for a user across requests using JSESSIONID cookie. So, a clieent that authenticated with Knox could pass the JSESSIONID cookie with repeated requests as long as the session has not timed out instead of submitting userid/password with every request. Presenting a valid session cookie in place of userid/password would also perform better as additional credential store lookups are avoided.</p></div><div id="LDAPGroupLookup"><h3><a id="LDAPGroupLookup"></a>LDAPGroupLookup</h3><p>Knox can be configured to look up LDAP groups that the authenticated user belong to. Knox can look up both Static LDAP Groups and Dynamic LDAP Groups. The looked up groups are populated as Principal(s) in the Java Subject of authenticated user. Therefore service authorization rules can be defined in terms of LDAPGroups looked up from LDAP directory.</p><p>To look up LDAPGroups of autheticated user from LDA
 P, you have to use org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm in Shiro configuration.</p><p>Please see below a sample Shiro configuration snippet from a topology file that was tested looking LDAPGroups.</p>
+<pre><code>    &lt;provider&gt;
+        &lt;role&gt;authentication&lt;/role&gt;
+        &lt;name&gt;ShiroProvider&lt;/name&gt;
+        &lt;enabled&gt;true&lt;/enabled&gt;
+        &lt;!-- 
+        session timeout in minutes,  this is really idle timeout,
+        defaults to 30mins, if the property value is not defined,, 
+        current client authentication would expire if client idles contiuosly for more than this value
+        --&gt;
+        &lt;!-- defaults to: 30 minutes
+        &lt;param&gt;
+            &lt;name&gt;sessionTimeout&lt;/name&gt;
+            &lt;value&gt;30&lt;/value&gt;
+        &lt;/param&gt;
+        --&gt;
+
+        &lt;!--
+          Use single KnoxLdapRealm to do authentication and ldap group look up
+        --&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm&lt;/name&gt;
+          &lt;value&gt;org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapGroupContextFactory&lt;/name&gt;
+          &lt;value&gt;org.apache.hadoop.gateway.shirorealm.KnoxLdapContextFactory&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.contextFactory&lt;/name&gt;
+          &lt;value&gt;$ldapGroupContextFactory&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;!-- defaults to: simple
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.contextFactory.authenticationMechanism&lt;/name&gt;
+          &lt;value&gt;simple&lt;/value&gt;
+        &lt;/param&gt;
+        --&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.contextFactory.url&lt;/name&gt;
+          &lt;value&gt;ldap://localhost:33389&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.userDnTemplate&lt;/name&gt;
+          &lt;value&gt;uid={0},ou=people,dc=hadoop,dc=apache,dc=org&lt;/value&gt;
+        &lt;/param&gt;
+
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.authorizationEnabled&lt;/name&gt;
+          &lt;!-- defaults to: false --&gt;
+          &lt;value&gt;true&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;!-- defaults to: simple
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.contextFactory.systemAuthenticationMechanism&lt;/name&gt;
+          &lt;value&gt;simple&lt;/value&gt;
+        &lt;/param&gt;
+        --&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.searchBase&lt;/name&gt;
+          &lt;value&gt;ou=groups,dc=hadoop,dc=apache,dc=org&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;!-- defaults to: groupOfNames
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.groupObjectClass&lt;/name&gt;
+          &lt;value&gt;groupOfNames&lt;/value&gt;
+        &lt;/param&gt;
+        --&gt;
+        &lt;!-- defaults to: member
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.memberAttribute&lt;/name&gt;
+          &lt;value&gt;member&lt;/value&gt;
+        &lt;/param&gt;
+        --&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.memberAttributeValueTemplate&lt;/name&gt;
+          &lt;value&gt;cn={0},ou=people,dc=hadoop,dc=apache,dc=org&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.contextFactory.systemUsername&lt;/name&gt;
+          &lt;value&gt;uid=guest,ou=people,dc=hadoop,dc=apache,dc=org&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.contextFactory.systemPassword&lt;/name&gt;
+          &lt;value&gt;${ALIAS=ldcSystemPassword}&lt;/value&gt;
+        &lt;/param&gt;
+
+        &lt;param&gt;
+          &lt;name&gt;urls./**&lt;/name&gt; 
+          &lt;value&gt;authcBasic&lt;/value&gt;
+        &lt;/param&gt;
+
+    &lt;/provider&gt;
+</code></pre><p>The configuration shown above would look up Static LDAP groups of authenticated user and populate the group principals in the Java Subject corresponding to authenticated user.</p><p>If you want to look up Dynamic LDAP Groups instead of Static LDAP Groups, you would have to speciify groupObjectClass and memberAttribute params as shown below:</p>
+<pre><code>       &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.groupObjectClass&lt;/name&gt;
+          &lt;value&gt;groupOfUrls&lt;/value&gt;
+        &lt;/param&gt;
+        &lt;param&gt;
+          &lt;name&gt;main.ldapRealm.memberAttribute&lt;/name&gt;
+          &lt;value&gt;memberUrl&lt;/value&gt;
+        &lt;/param&gt;
+</code></pre><h3><a id="Template+topology+files+and+LDIF+files+to+try+out+LDAP+Group+Look+up"></a>Template topology files and LDIF files to try out LDAP Group Look up</h3><p>Knox bundles some template topology files and ldif files that you can use to try and test LDAP Group Lookup and associated authorization acls. All these template files are located under {GATEWAY_HOME}/templates.</p><h4><a id="LDAP+Static+Group+Lookup+Templates,+authentication+and+group+lookup+from+the+same+directory"></a>LDAP Static Group Lookup Templates, authentication and group lookup from the same directory</h4><p>topology file: sandbox.knoxrealm1.xml ldif file : users.ldapgroups.ldif</p><p>To try this out</p><p>cd {GATEWAY_HOME} cp templates/sandbox.knoxrealm1.xml deployments/sandbox.xml cp templates/users.ldapgroups.ldif conf/users.ldif java -jar bin/ldap.jar conf java -Dsandbox.ldcSystemPassword=guest-password -jar bin/gateway.jar -persist-master</p><p>Following call to WebHDFS should report HTTP/1.1 401 
 Unauthorized As guest is not a member of group &ldquo;analyst&rdquo;, authorization prvoider states user should be member of group &ldquo;analyst&rdquo;</p><p>curl -i -v -k -u guest:guest-password -X GET <a href="https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY">https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY</a></p><p>Following call to WebHDFS should report: {&ldquo;Path&rdquo;:&ldquo;/user/sam&rdquo;} As sam is a member of group &ldquo;analyst&rdquo;, authorization prvoider states user should be member of group &ldquo;analyst&rdquo;</p><p>curl -i -v -k -u sam:sam-password -X GET <a href="https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY">https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY</a></p><h4><a id="LDAP+Static+Group+Lookup+Templates,+authentication+and+group+lookup+from+different++directories"></a>LDAP Static Group Lookup Templates, authentication and group lookup from different directories</h
 4><p>topology file: sandbox.knoxrealm2.xml ldif file : users.ldapgroups.ldif</p><p>To try this out</p><p>cd {GATEWAY_HOME} cp templates/sandbox.knoxrealm2.xml deployments/sandbox.xml cp templates/users.ldapgroups.ldif conf/users.ldif java -jar bin/ldap.jar conf java -Dsandbox.ldcSystemPassword=guest-password -jar bin/gateway.jar -persist-master</p><p>Following call to WebHDFS should report HTTP/1.1 401 Unauthorized As guest is not a member of group &ldquo;analyst&rdquo;, authorization prvoider states user should be member of group &ldquo;analyst&rdquo;</p><p>curl -i -v -k -u guest:guest-password -X GET <a href="https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY">https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY</a></p><p>Following call to WebHDFS should report: {&ldquo;Path&rdquo;:&ldquo;/user/sam&rdquo;} As sam is a member of group &ldquo;analyst&rdquo;, authorization prvoider states user should be member of group &ldquo;analyst&rdquo;</p><p>c
 url -i -v -k -u sam:sam-password -X GET <a href="https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY">https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY</a></p><h4><a id="LDAP+Dynamic+Group+Lookup+Templates,+authentication+and+dynamic+group+lookup+from+same++directory"></a>LDAP Dynamic Group Lookup Templates, authentication and dynamic group lookup from same directory</h4><p>topology file: sandbox.knoxrealmdg.xml ldif file : users.ldapdynamicgroups.ldif</p><p>To try this out</p><p>cd {GATEWAY_HOME} cp templates/sandbox.knoxrealmdg.xml deployments/sandbox.xml cp templates/users.ldapdynamicgroups.ldif conf/users.ldif java -jar bin/ldap.jar conf java -Dsandbox.ldcSystemPassword=guest-password -jar bin/gateway.jar -persist-master</p><p>Please note that user.ldapdynamicgroups.ldif also loads ncessary schema to create dynamic groups in Apache DS.</p><p>Following call to WebHDFS should report HTTP/1.1 401 Unauthorized As guest is not a member of dynamic
  group &ldquo;directors&rdquo;, authorization prvoider states user should be member of group &ldquo;directors&rdquo;</p><p>curl -i -v -k -u guest:guest-password -X GET <a href="https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY">https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY</a></p><p>Following call to WebHDFS should report: {&ldquo;Path&rdquo;:&ldquo;/user/bob&rdquo;} As bob is a member of dynamic group &ldquo;directors&rdquo;, authorization prvoider states user should be member of group &ldquo;directors&rdquo;</p><p>curl -i -v -k -u sam:sam-password -X GET <a href="https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY">https://localhost:8443/gateway/sandbox/webhdfs/v1?op=GETHOMEDIRECTORY</a></p></div><div id="Identity+Assertion"><h3><a id="Identity+Assertion"></a>Identity Assertion</h3><p>The identity assertion provider within Knox plays the critical role of communicating the identity principal to be used within the Hadoop 
 cluster to represent the identity that has been authenticated at the gateway.</p><p>The general responsibilities of the identity assertion provider is to interrogate the current Java Subject that has been established by the authentication or federation provider and:</p>
+<ol>
+  <li>determine whether it matches any principal mapping rules and apply them appropriately</li>
+  <li>determine whether it matches any group principal mapping rules and apply them</li>
+  <li>if it is determined that the principal will be impersonating another through a principal mapping rule then a Subject.doAS is required in order for providers farther downstream can determine the appropriate effective principal name and groups for the user</li>
+</ol><p>The following configuration is required for asserting the users identity to the Hadoop cluster using Pseudo or Simple &ldquo;authentication&rdquo;.</p>
+<pre><code>&lt;provider&gt;
+    &lt;role&gt;identity-assertion&lt;/role&gt;
+    &lt;name&gt;Pseudo&lt;/name&gt;
+    &lt;enabled&gt;true&lt;/enabled&gt;
+&lt;/provider&gt;
+</code></pre><p>This particular configuration indicates that the Pseudo identity assertion provider is enabled and that there are no principal mapping rules to apply to identities flowing from the authentication in the gateway to the backend Hadoop cluster services. The primary principal of the current subject will therefore be asserted via a query paramter or as a form parameter - ie. ?user.name={primaryPrincipal}</p>
+<pre><code>&lt;provider&gt;
+    &lt;role&gt;identity-assertion&lt;/role&gt;
+    &lt;name&gt;Pseudo&lt;/name&gt;
+    &lt;enabled&gt;true&lt;/enabled&gt;
+    &lt;param&gt;
+        &lt;name&gt;principal.mapping&lt;/name&gt;
+        &lt;value&gt;guest=hdfs;&lt;/value&gt;
+    &lt;/param&gt;
+    &lt;param&gt;
+        &lt;name&gt;group.principal.mapping&lt;/name&gt;
+        &lt;value&gt;*=users;hdfs=admin&lt;/value&gt;
+    &lt;/param&gt;
+&lt;/provider&gt;
+</code></pre><p>This configuration identifies the same identity assertion provider but does provide principal and group mapping rules. In this case, when a user is authenticated as &ldquo;guest&rdquo; his identity is actually asserted to the Hadoop cluster as &ldquo;hdfs&rdquo;. In addition, since there are group principal mappings defined, he will also be considered as a member of the groups &ldquo;users&rdquo; and &ldquo;admin&rdquo;. In this particular example the wildcard &quot;*&ldquo; is used to indicate that all authenticated users need to be considered members of the &rdquo;users&ldquo; group and that only the user &rdquo;hdfs&ldquo; is mapped to be a member of the &rdquo;admin&quot; group.</p><p><strong>NOTE: These group memberships are currently only meaningful for Service Level Authorization using the AclsAuthorization provider. The groups are not currently asserted to the Hadoop cluster at this time. See the Authorization section within this guide to see how this is used
 .</strong></p><p>The principal mapping aspect of the identity assertion provider is important to understand in order to fully utilize the authorization features of this provider.</p><p>This feature allows us to map the authenticated principal to a runas or impersonated principal to be asserted to the Hadoop services in the backend.</p><p>When a principal mapping is defined that results in an impersonated principal being created the impersonated principal is then the effective principal.</p><p>If there is no mapping to another principal then the authenticated or primary principal is then the effective principal.</p><h4><a id="Principal+Mapping"></a>Principal Mapping</h4>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;principal.mapping&lt;/name&gt;
+    &lt;value&gt;{primaryPrincipal}[,...]={impersonatedPrincipal}[;...]&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;principal.mapping&lt;/name&gt;
+    &lt;value&gt;guest=hdfs&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>For multiple mappings:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;principal.mapping&lt;/name&gt;
+    &lt;value&gt;guest,alice=hdfs;mary=alice2&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h4><a id="Group+Principal+Mapping"></a>Group Principal Mapping</h4>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;group.principal.mapping&lt;/name&gt;
+    &lt;value&gt;{userName[,*|userName...]}={groupName[,groupName...]}[,...]&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;group.principal.mapping&lt;/name&gt;
+    &lt;value&gt;*=users;hdfs=admin&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>this configuration indicates that all (*) authenticated users are members of the &ldquo;users&rdquo; group and that user &ldquo;hdfs&rdquo; is a member of the admin group. Group principal mapping has been added along with the authorization provider described in this document.</p></div><div id="Authorization"><h3><a id="Authorization"></a>Authorization</h3><h4><a id="Service+Level+Authorization"></a>Service Level Authorization</h4><p>The Knox Gateway has an out-of-the-box authorization provider that allows administrators to restrict access to the individual services within a Hadoop cluster.</p><p>This provider utilizes a simple and familiar pattern of using ACLs to protect Hadoop resources by specifying users, groups and ip addresses that are permitted access.</p><p>Note: In the examples below {serviceName} represents a real service name (e.g. WEBHDFS) and would be replaced with these values in an actual configuration.</p><h5><a id="Usecases"></a>Usecases</h5><h6><a i
 d="USECASE-1:+Restrict+access+to+specific+Hadoop+services+to+specific+Users"></a>USECASE-1: Restrict access to specific Hadoop services to specific Users</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;*;*&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-2:+Restrict+access+to+specific+Hadoop+services+to+specific+Groups"></a>USECASE-2: Restrict access to specific Hadoop services to specific Groups</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acls&lt;/name&gt;
+    &lt;value&gt;*;admins;*&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-3:+Restrict+access+to+specific+Hadoop+services+to+specific+Remote+IPs"></a>USECASE-3: Restrict access to specific Hadoop services to specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;*;*;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-4:+Restrict+access+to+specific+Hadoop+services+to+specific+Users+OR+users+within+specific+Groups"></a>USECASE-4: Restrict access to specific Hadoop services to specific Users OR users within specific Groups</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl.mode&lt;/name&gt;
+    &lt;value&gt;OR&lt;/value&gt;
+&lt;/param&gt;
+&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;admin;*&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-5:+Restrict+access+to+specific+Hadoop+services+to+specific+Users+OR+users+from+specific+Remote+IPs"></a>USECASE-5: Restrict access to specific Hadoop services to specific Users OR users from specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl.mode&lt;/name&gt;
+    &lt;value&gt;OR&lt;/value&gt;
+&lt;/param&gt;
+&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;*;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-6:+Restrict+access+to+specific+Hadoop+services+to+users+within+specific+Groups+OR+from+specific+Remote+IPs"></a>USECASE-6: Restrict access to specific Hadoop services to users within specific Groups OR from specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl.mode&lt;/name&gt;
+    &lt;value&gt;OR&lt;/value&gt;
+&lt;/param&gt;
+&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;*;admin;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-7:+Restrict+access+to+specific+Hadoop+services+to+specific+Users+OR+users+within+specific+Groups+OR+from+specific+Remote+IPs"></a>USECASE-7: Restrict access to specific Hadoop services to specific Users OR users within specific Groups OR from specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl.mode&lt;/name&gt;
+    &lt;value&gt;OR&lt;/value&gt;
+&lt;/param&gt;
+&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;admin;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-8:+Restrict+access+to+specific+Hadoop+services+to+specific+Users+AND+users+within+specific+Groups"></a>USECASE-8: Restrict access to specific Hadoop services to specific Users AND users within specific Groups</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;admin;*&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-9:+Restrict+access+to+specific+Hadoop+services+to+specific+Users+AND+users+from+specific+Remote+IPs"></a>USECASE-9: Restrict access to specific Hadoop services to specific Users AND users from specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;*;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-10:+Restrict+access+to+specific+Hadoop+services+to+users+within+specific+Groups+AND+from+specific+Remote+IPs"></a>USECASE-10: Restrict access to specific Hadoop services to users within specific Groups AND from specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;*;admins;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h6><a id="USECASE-11:+Restrict+access+to+specific+Hadoop+services+to+specific+Users+AND+users+within+specific+Groups+AND+from+specific+Remote+IPs"></a>USECASE-11: Restrict access to specific Hadoop services to specific Users AND users within specific Groups AND from specific Remote IPs</h6>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;guest;admins;127.0.0.1&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><h4><a id="Configuration"></a>Configuration</h4><p>ACLs are bound to services within the topology descriptors by introducing the authorization provider with configuration like:</p>
+<pre><code>&lt;provider&gt;
+    &lt;role&gt;authorization&lt;/role&gt;
+    &lt;name&gt;AclsAuthz&lt;/name&gt;
+    &lt;enabled&gt;true&lt;/enabled&gt;
+&lt;/provider&gt;
+</code></pre><p>The above configuration enables the authorization provider but does not indicate any ACLs yet and therefore there is no restriction to accessing the Hadoop services. In order to indicate the resources to be protected and the specific users, groups or ip&rsquo;s to grant access, we need to provide parameters like the following:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;username[,*|username...];group[,*|group...];ipaddr[,*|ipaddr...]&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>where <code>{serviceName}</code> would need to be the name of a configured Hadoop service within the topology.</p><p>NOTE: ipaddr is unique among the parts of the ACL in that you are able to specify a wildcard within an ipaddr to indicate that the remote address must being with the String prior to the asterisk within the ipaddr acl. For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;*;*;192.168.*&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>This indicates that the request must come from an IP address that begins with &lsquo;192.168.&rsquo; in order to be granted access.</p><p>Note also that configuration without any ACLs defined is equivalent to:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl&lt;/name&gt;
+    &lt;value&gt;*;*;*&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>meaning: all users, groups and IPs have access. Each of the elements of the acl param support multiple values via comma separated list and the <code>*</code> wildcard to match any.</p><p>For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;webhdfs.acl&lt;/name&gt;
+    &lt;value&gt;hdfs;admin;127.0.0.2,127.0.0.3&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>this configuration indicates that ALL of the following are satisfied:</p>
+<ol>
+  <li>the user &ldquo;hdfs&rdquo; has access AND</li>
+  <li>users in the group &ldquo;admin&rdquo; have access AND</li>
+  <li>any authenticated user from either 127.0.0.2 or 127.0.0.3 will have access</li>
+</ol><p>This allows us to craft policy that restricts the members of a large group to a subset that should have access. The user being removed from the group will allow access to be denied even though their username may have been in the ACL.</p><p>An additional configuration element may be used to alter the processing of the ACL to be OR instead of the default AND behavior:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;{serviceName}.acl.mode&lt;/name&gt;
+    &lt;value&gt;OR&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>this processing behavior requires that the effective user satisfy one of the parts of the ACL definition in order to be granted access. For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;webhdfs.acl&lt;/name&gt;
+    &lt;value&gt;hdfs,guest;admin;127.0.0.2,127.0.0.3&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>You may also set the ACL processing mode at the top level for the topology. This essentially sets the default for the managed cluster. It may then be overridden at the service level as well.</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;acl.mode&lt;/name&gt;
+    &lt;value&gt;OR&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>this configuration indicates that ONE of the following must be satisfied to be granted access:</p>
+<ol>
+  <li>the user is &ldquo;hdfs&rdquo; or &ldquo;guest&rdquo; OR</li>
+  <li>the user is in &ldquo;admin&rdquo; group OR</li>
+  <li>the request is coming from 127.0.0.2 or 127.0.0.3</li>
+</ol><h4><a id="Other+Related+Configuration"></a>Other Related Configuration</h4><p>The principal mapping aspect of the identity assertion provider is important to understand in order to fully utilize the authorization features of this provider.</p><p>This feature allows us to map the authenticated principal to a runas or impersonated principal to be asserted to the Hadoop services in the backend. When a principal mapping is defined that results in an impersonated principal being created the impersonated principal is then the effective principal. If there is no mapping to another principal then the authenticated or primary principal is then the effective principal. Principal mapping has actually been available in the identity assertion provider from the beginning of Knox and is documented fully in the Identity Assertion section of this guide.</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;principal.mapping&lt;/name&gt;
+    &lt;value&gt;{primaryPrincipal}[,...]={impersonatedPrincipal}[;...]&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;principal.mapping&lt;/name&gt;
+    &lt;value&gt;guest=hdfs&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>In addition, we allow the administrator to map groups to effective principals. This is done through another param within the identity assertion provider:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;group.principal.mapping&lt;/name&gt;
+    &lt;value&gt;{userName[,*|userName...]}={groupName[,groupName...]}[,...]&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>For instance:</p>
+<pre><code>&lt;param&gt;
+    &lt;name&gt;group.principal.mapping&lt;/name&gt;
+    &lt;value&gt;*=users;hdfs=admin&lt;/value&gt;
+&lt;/param&gt;
+</code></pre><p>this configuration indicates that all (*) authenticated users are members of the &ldquo;users&rdquo; group and that user &ldquo;hdfs&rdquo; is a member of the admin group. Group principal mapping has been added along with the authorization provider described in this document.</p><p>For more information on principal and group principal mapping see the Identity Assertion section of this guide.</p><p>These additional mapping capabilities are used together with the authorization ACL policy. An example of a full topology that illustrates these together is below.</p>
+<pre><code>&lt;topology&gt;
+    &lt;gateway&gt;
+        &lt;provider&gt;
+            &lt;role&gt;authentication&lt;/role&gt;
+            &lt;name&gt;ShiroProvider&lt;/name&gt;
+            &lt;enabled&gt;true&lt;/enabled&gt;
+            &lt;param&gt;
+                &lt;name&gt;main.ldapRealm&lt;/name&gt;
+                &lt;value&gt;org.apache.shiro.realm.ldap.JndiLdapRealm&lt;/value&gt;
+            &lt;/param&gt;
+            &lt;param&gt;
+                &lt;name&gt;main.ldapRealm.userDnTemplate&lt;/name&gt;
+                &lt;value&gt;uid={0},ou=people,dc=hadoop,dc=apache,dc=org&lt;/value&gt;
+            &lt;/param&gt;
+            &lt;param&gt;
+                &lt;name&gt;main.ldapRealm.contextFactory.url&lt;/name&gt;
+                &lt;value&gt;ldap://localhost:33389&lt;/value&gt;
+            &lt;/param&gt;
+            &lt;param&gt;
+                &lt;name&gt;main.ldapRealm.contextFactory.authenticationMechanism&lt;/name&gt;
+                &lt;value&gt;simple&lt;/value&gt;
+            &lt;/param&gt;
+            &lt;param&gt;
+                &lt;name&gt;urls./**&lt;/name&gt;
+                &lt;value&gt;authcBasic&lt;/value&gt;
+            &lt;/param&gt;
+        &lt;/provider&gt;
+        &lt;provider&gt;
+            &lt;role&gt;identity-assertion&lt;/role&gt;

[... 1936 lines stripped ...]


Mime
View raw message