geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Geronimo v2.1 > Using Spengo in geronimo
Date Fri, 05 Feb 2010 12:10:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1519/1/1/_/styles/combined.css?spaceKey=GMOxDOC21&amp;forWysiwyg=true"
<body style="background-color: white" bgcolor="white">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
     <h2><a href="">Using
Spengo in geronimo</a></h2>
     <h4>Page <b>edited</b> by             <a href="">Ashish
     <div class="notificationGreySide">
         <style type='text/css'>/*<![CDATA[*/
table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color:
table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}
table.ScrollbarTable td.ScrollbarParent {text-align: center;border: none;}
table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}

/*]]>*/</style><div class="Scrollbar"><table class='ScrollbarTable'><tr><td
class='ScrollbarPrevIcon'><a href="/confluence/display/GMOxDOC21/LDAP+Realm"><img
border='0' align='middle' src='/confluence/images/icons/back_16.gif' width='16' height='16'></a></td><td
width='33%' class='ScrollbarPrevName'><a href="/confluence/display/GMOxDOC21/LDAP+Realm">LDAP
Realm</a>&nbsp;</td><td width='33%' class='ScrollbarParent'><sup><a
href="/confluence/display/GMOxDOC21/Configuring+security"><img border='0' align='middle'
src='/confluence/images/icons/up_16.gif' width='8' height='8'></a></sup><a
href="/confluence/display/GMOxDOC21/Configuring+security">Configuring security</a></td><td
width='33%' class='ScrollbarNextName'>&nbsp;</td></tr></table></div>

<p>Spnego with geronimo requires 3 machines namely a Client machine, a server machine
and a  Microsoft active directory domain controller. Client and server machine should be part
of the active directory domain.</p>

    <li><a href='#UsingSpengoingeronimo-SettinguptheActiveDirectoryDomainController'>Setting
up the Active Directory Domain Controller</a></li>
    <li><a href='#UsingSpengoingeronimo-Settinguptheclientmachine'>Setting up
the client machine</a></li>
    <li><a href='#UsingSpengoingeronimo-Settingupyourgeronoimoservermachine'>Setting
up your geronoimo server machine</a></li>
    <li><a href='#UsingSpengoingeronimo-Fewveryimportantpointstonote%3A'>Few very
important points to note:</a></li>
<h1><a name="UsingSpengoingeronimo-SettinguptheActiveDirectoryDomainController"></a>Setting
up the Active Directory Domain Controller</h1>
	<li>Create a user in the active directory. Make sure that user you create is unique
and not listed in Computers or domain controllers. In our case we have created a user called
testuser with the password testuser123.</li>
	<li>Map the service principal name to the user account you created in the previous
step. A service principal name(SPN) is HTTP/&lt;Fully_Qualified_Host_Name&gt;.  In
our case SPN is HTTP/ You can run the following command to map the SPN to user
C:\Program Files\Support Tools&gt;setspn -A HTTP/ testuser.</li>
	<li>Next step is to create a keytab file. Run the following command<br/>
C:\Program Files\Support Tools&gt;ktpass -out c:\winnt\krb5.keytab -princ HTTP/
-mapUser testuser-mapOp set -pass testuser123 -crypto RC4-HMAC-NT -pType KRB5_NT_PRINCIPAL</li>

<p>With this step we are done with setting up the Active Directory domain controller

<h1><a name="UsingSpengoingeronimo-Settinguptheclientmachine"></a>Setting
up the client machine</h1>

<p>On the client machine we need to configure the browser for spnego. Internet Explorer
can be configured as follows:</p>

	<li>Go to Tools-&gt;Internet Options-&gt; Security-&gt; Local Intranet-&gt;Sites.
Check all the 3 boxes.</li>
	<li>Go to Tools-&gt;Internet Options-&gt; Security-&gt; Local Intranet-&gt;Sites-&gt;
Advanced. Add the name of the server host machine. In our case we have added it as follows
<a href="" rel="nofollow"></a>. Select Ok.</li>
	<li>Go to Tools-&gt;Internet Options-&gt; Security-&gt; Local Intranet.
Select Custom Level. Browse down to the bottom to see if Logon is set as "Automatic Logon
in Intranet zone".</li>
	<li>Tools-&gt;Internet Options-&gt;Advanced. Check that "Enable Integrated
Windows Authentication(requires restart) is selected.</li>

<p>Mozilla Firefox can be configured as follows:</p>

	<li>In the url address bar type about:config and press enter.</li>
	<li>In the filter enter network.nego. This lists 5 properties. Modify<br/>
network.negotiate-auth.delegation-uris and add <a href="http://,https://" rel="nofollow">http://,https://</a><br/>
network.negotiate-auth.trusted-uris and add <a href="http://,https://" rel="nofollow">http://,https://</a></li>
	<li>Once done restart the browser.</li>

<p>This sets up your client machine make sure you login to the client machine within
the active directory domain.</p>

<h1><a name="UsingSpengoingeronimo-Settingupyourgeronoimoservermachine"></a>Setting
up your geronoimo server machine</h1>
	<li>Make sure you login to this machine within the active directory domain.</li>
	<li>Install geronimo on the server machine.</li>
	<li>Copy the krb5.keytab created in #3 of "Setting up the Active Directory Domain Controller"
to C:/winnt of server machine.</li>
	<li>Copy the krb5.ini file to C:/winnt of server machine. A sample krb5.ini for your
<div class="code panel" style="border-style: solid;border-width: 1px;"><div class="codeHeader
panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><b>krb5.ini</b></div><div
class="codeContent panelContent">
<pre class="code-java">
default_realm = XYZ.COM
default_keytab_name = FILE:c:\winnt\krb5.keytab
default_tkt_enctypes = rc4-hmac,des-cbc-md4,des-cbc-crc
default_tgs_enctypes = rc4-hmac,des-cbc-md4,des-cbc-crc
forwardable=<span class="code-keyword">true</span>

 		kdc =

[domain_realm] XYZ.COM = XYZ.COM

	<li>Set up the following parameters before starting the server.<br/>
set\winnt\krb5.ini -Dorg.apache.tomcat.config.NEGOTIATE=true<br/>
Make sure you set the "org.apache.tomcat.config.NEGOTIATE=true" otherwise you will not be
able to use spnego.</li>
	<li>Start the server with "geronimo.bat run" command.</li>
	<li>Create a realm for spnego. You can create a realm for fallback once spnego fails.
For reference here is a sample spnego realm. This<br/>
realm is a combination of spnego and properties realm. In case your spnego authentication
fails the authentication will fallback on <br/>
properties realm.<br/>
&lt;module xmlns=""&gt;<br/>
    &lt;gbean name="SpnegoTest" class=""
xsi:type="dep:gbeanType" xmlns:dep="" xmlns:xsi=""&gt;<br/>
        &lt;attribute name="realmName"&gt;SpnegoTest&lt;/attribute&gt;<br/>
        &lt;reference name="ServerInfo"&gt;<br/>
        &lt;xml-reference name="LoginModuleConfiguration"&gt;<br/>
            &lt;log:login-config xmlns:log=""&gt;<br/>
                &lt;log:login-module control-flag="SUFFICIENT" wrap-principals="false"&gt;<br/>
                    &lt;log:option name="targetName"&gt;http/;/log:option&gt;<br/>
                &lt;log:login-module control-flag="SUFFICIENT" wrap-principals="false"&gt;<br/>
                    &lt;log:option name="usersURI"&gt;var/security/;/log:option&gt;<br/>
                    &lt;log:option name="groupsURI"&gt;var/security/;/log:option&gt;<br/>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java"></pre>

	<li>Develop an application and make sure you use BASIC as the authentication mechanism
in your web.xml.</li>
	<li>Access the protected resource of the application from the Client Machine. You should
be able to access the resource without any prompt for username and password.</li>
	<li>Now access the protected resource from a machine which is not part of active directory
domain. In this case spnego login will fail and it will fallback on the properties file login.
Input the credentials and you will be able to access the resources.</li>

<h1><a name="UsingSpengoingeronimo-Fewveryimportantpointstonote%3A"></a>Few
very important points to note:</h1>

	<li>Make sure that you use Basic as the authentication mechanism in your web application
if you want to configure Spnego with geronimo.</li>
	<li>The realm provided is a combination of 2 login modules which can be easily created
through geronimo administrative console.</li>
	<li>While you are creating a security realm for Spnego loginmodule you need to just
specify one option that will be of the form "targetName=http/&lt;fully_qualified_host_name&gt;".
Have a look at the sample realm. This will give you an idea of the option to be used.</li>
	<li>Make sure you choose sufficient as the control-flag while creating the 2 login
	<li>Make sure you map only one user to SPN as defined in #2 of  "Setting up the Active
Directory Domain Controller".</li>

     <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>

       <a href="">View
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message