﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-ゞ沉默是金ゞ-随笔分类-eXtreme</title><link>http://www.blogjava.net/dashi99/category/51984.html</link><description>&lt;div align="center"&gt;
&lt;img height="50" width="200" name="welcome" src="http://www.blogjava.net/images/blogjava_net/majianan/14891/r_5858488902000cu2.gif"/&gt;
&lt;/div&gt;
&lt;br/&gt;
&lt;center&gt;&lt;font size=4 &gt;鱼离不开水,但是没有说不离开哪滴水.&lt;/font&gt;&lt;/center&gt;</description><language>zh-cn</language><lastBuildDate>Tue, 26 Jun 2012 12:12:24 GMT</lastBuildDate><pubDate>Tue, 26 Jun 2012 12:12:24 GMT</pubDate><ttl>60</ttl><item><title>Java SE security tutorial - Step 4</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381545.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:33:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381545.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381545.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381545.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381545.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381545.html</trackback:ping><description><![CDATA[<div><div taskbody"=""><p>The following step explains how you can enable a security layer for communication between your environment's endpoints.</p> <div prereq"=""><div><h2>Before you begin</h2></div>Be sure you have completed <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec3.html" title="After authenticating a client, as in the previous step, you can give security privileges through eXtreme Scale authorization mechanisms.">Java SE security tutorial - Step 3</a> prior to proceeding with this task.</div> <div context"=""><div><h2>About this task</h2></div>The eXtreme Scale topology supports both Transport Layer Security/Secure Sockets Layer (TLS/SSL) for secure communication between ObjectGrid endpoints (client, container servers, and catalog servers). This step of the tutorial builds upon the previous steps to enable transport security.</div> <div><h2>Procedure</h2></div><ol steps"=""><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Create TLS/SSL keys and key stores</strong></span><br /> <div>In order to enable transport security, you must create a key store and trust store. This exercise only creates one key and trust-store pair. These stores are used for ObjectGrid clients, container servers, and catalog servers, and are created with the JDK keytool.<ul><li><em i"="">Create a private key in the key store</em><p><samp codeph"="">keytool -genkey -alias ogsample -keystore key.jks -storetype JKS -keyalg rsa -dname "CN=ogsample, OU=Your Organizational Unit, O=Your Organization, L=Your City, S=Your State, C=Your Country" -storepass ogpass -keypass ogpass -validity 3650</samp></p> <p>Using this command, a key store key.jks is created with a key "ogsample" stored in it. This key store key.jks will be used as the SSL key store. </p> </li><li><em i"="">Export the public certificate</em><p><samp codeph"="">keytool -export -alias ogsample -keystore key.jks -file temp.key -storepass ogpass</samp>  </p> <p>Using this command, the public certificate of key "ogsample" is extracted and stored in the file temp.key.</p>  </li><li><em i"="">Import the client's public certificate to the trust store</em><p><samp codeph"="">keytool -import -noprompt -alias ogsamplepublic -keystore trust.jks -file temp.key -storepass ogpass</samp></p> <p>Using this command, the public certificate was added to key store trust.jks. This trust.jks is used as the SSL trust store.</p> </li></ul> </div> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Configuring ObjectGrid property files</strong></span><br /> <p>In this step, you must configure the ObjectGrid property files to enable transport security.</p> <p>First, copy the key.jks and trust.jks files into the objectgridRoot/security directory.</p> <p>We set the following properties in the client.properties and server.properties file.</p> <div><pre codeblock"="">transportType=SSL-Required  alias=ogsample contextProvider=IBMJSSE2 protocol=SSL keyStoreType=JKS keyStore=../security/key.jks keyStorePassword=ogpass trustStoreType=JKS trustStore=../security/trust.jks trustStorePassword=ogpass</pre> </div> <p><strong b"="">transportType:</strong> The value of transportType is set to "SSL-Required", which means the transport requires SSL. So all the ObjectGrid endpoints (clients, catalog servers, and container servers) should have SSL configuration set and all transport communication will be encrypted.</p> <p>The other properties are used to set the SSL configurations. See <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/cxssslsupt.html">Transport layer security and secure sockets layer</a> for a detailed explanation. Make sure you follow the instructions in this topic to update your orb.properties file.</p> <p>Make sure you follow this page to update your <span filepath"="">orb.properties</span> file.</p> <p>In the <span filepath"="">server.properties </span> file, you must add an additional property clientAuthentication and set it to false. On the server side, you do not need to trust the client.</p> <p><samp codeph"="">clientAuthentication=false</samp></p> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Run the application</strong></span><br /> <p>The commands are the same as the commands in the <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec3.html" title="After authenticating a client, as in the previous step, you can give security privileges through eXtreme Scale authorization mechanisms.">Java SE security tutorial - Step 3</a> topic.</p> <div>Use the following commands to start a catalog server.<ol type="a"><li>Navigate to the bin directory: <samp codeph"="">cd objectgridRoot/bin</samp></li><li>Start the catalog server:<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /> <pre codeblock"="">startOgServer.sh catalogServer -clusterSecurityFile ../security/security.xml  -serverProps ../security/server.properties -JMXServicePort 11001  -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config"</pre> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">startOgServer.bat catalogServer -clusterSecurityFile ../security/security.xml  -serverProps ../security/server.properties -JMXServicePort 11001 -jvmArgs  -Djava.security.auth.login.config="../security/og_jaas.config"</pre> </li></ul> <p>The <span filepath"="">security.xml</span> and <span filepath"="">server.properties</span> files were created in the <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec2.html" title="Building on the previous step, the following topic shows how to implement client authentication in a distributed eXtreme Scale environment.">Java SE security tutorial - Step 2</a> page.</p> <p>Use the -JMXServicePort option to explicitly specify the JMX port for the server. This option is required to use the xsadmin command.</p> <p>Run a secure ObjectGrid container server:</p> </li><li>Navigate to the bin directory again: <samp codeph"="">cd objectgridRoot/bin</samp></li><li><ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /> <div><pre codeblock"="">startOgServer.sh c0 -objectGridFile ../xml/SecureSimpleApp.xml  -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints  localhost:2809 -serverProps ../security/server.properties  -JMXServicePort 11002 -jvmArgs  -Djava.security.auth.login.config="../security/og_jaas.config"  -Djava.security.auth.policy="../security/og_auth.policy"</pre> </div> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">startOgServer.bat c0 -objectGridFile ../xml/SecureSimpleApp.xml  -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809  -serverProps ../security/server.properties -JMXServicePort 11002  -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config"  -Djava.security.auth.policy="../security/og_auth.policy"</pre> </li></ul> </li></ol> </div> <div>Notice the following differences from the previous container server start command:<ul><li>Use SecureSimpleApp.xml instead of SimpleApp.xml </li><li>Add another -Djava.security.auth.policy to set the JAAS authorization policy file to the container server process.</li></ul> </div> <p>Run the following command for client authentication:</p>   <ol type="a"><li><samp codeph"="">cd objectgridRoot/bin</samp></li><li><pre codeblock"="">javaHome/java -classpath ../lib/objectgrid.jar;../applib/secsample.jar  com.ibm.websphere.objectgrid.security.sample.guide.SecureSimpleApp  ../security/client.properties manager manager1</pre> <p>Because user "manager" has permission to all the maps in the accounting ObjectGrid, the application runs successfully.</p>  </li></ol> <div>You may also use xsadmin to show the mapsizes of the "accounting" grid.<ul><li>Navigate to the directory <samp codeph"="">objectgridRoot/bin</samp>.</li><li>Use the <span filepath"="">xsadmin</span> command with option -mapSizes as follows.<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <pre codeblock"="">xsadmin.sh -g accounting -m mapSet1 -mapsizes -p 11001 -ssl  -trustpath ..\security\trust.jks -trustpass ogpass -trusttype jks  -username manager -password manager1</pre>  </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">xsadmin.bat -g accounting -m mapSet1 -mapsizes -p 11001 -ssl  -trustpath ..\security\trust.jks -trustpass ogpass -trusttype jks  -username manager -password manager1</pre> </li></ul> <p>Notice we specify the JMX port of the catalog service using -p 11001 here.</p> <p>You see the following output.</p> <pre codeblock"="">This administrative utility is provided as a sample only and is not to  be considered a fully supported component of the WebSphere eXtreme Scale product. Connecting to Catalog service at localhost:1099 *********** Displaying Results for Grid - accounting, MapSet - mapSet1 *********** *** Listing Maps for c0 *** Map Name: customer Partition #: 0 Map Size: 1 Shard Type: Primary Server Total: 1 Total Domain Count: 1</pre> </li></ul> </div> <p><strong b"="">Running the application with an incorrect key store</strong></p> <p>If your trust store does not contain the public certificate of the private key in the key store, you will get an exception complaining that the key cannot be trusted.</p> <p>In order to show this, create another key store key2.jks.</p> <p><samp codeph"="">keytool -genkey -alias ogsample -keystore key2.jks -storetype JKS -keyalg rsa -dname "CN=ogsample, OU=Your Organizational Unit, O=Your Organization, L=Your City, S=Your State, C=Your Country" -storepass ogpass -keypass ogpass -validity 3650</samp></p> <p>Then modify the server.properties to make the keyStore point to this new key store key2.jks:</p> <p><samp codeph"="">keyStore=../security/key2.jks</samp></p> <p>Run the following command to start the catalog server:</p> <ol type="a"><li>Navigate to bin: <samp codeph"="">cd objectgridRoot/bin</samp></li><li>Start the catalog server: <div><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /> <pre codeblock"="">startOgServer.sh c0 -objectGridFile ../xml/SecureSimpleApp.xml  -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809  -serverProps ../security/server.properties -jvmArgs  -Djava.security.auth.login.config="../security/og_jaas.config"  -Djava.security.auth.policy="../security/og_auth.policy"</pre> </div> <div><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">startOgServer.bat c0 -objectGridFile ../xml/SecureSimpleApp.xml  -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809  -serverProps ../security/server.properties -jvmArgs  -Djava.security.auth.login.config="../security/og_jaas.config"  -Djava.security.auth.policy="../security/og_auth.policy"</pre> </div> <p>You see the following exception:</p> <div><pre codeblock"="">Caused by: com.ibm.websphere.objectgrid.ObjectGridRPCException:     com.ibm.websphere.objectgrid.ObjectGridRuntimeException:         SSL connection fails and plain socket cannot be used.</pre> </div> <p>Finally, change the <span filepath"="">server.properties</span> file back to use the <span filepath"="">key.jks</span> file.</p> </li></ol> </li></ol> </div></div><img src ="http://www.blogjava.net/dashi99/aggbug/381545.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:33 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381545.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java SE security tutorial - Step 3</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381544.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:32:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381544.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381544.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381544.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381544.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381544.html</trackback:ping><description><![CDATA[<div><p>After authenticating a client, as in the previous step, you can give security privileges through eXtreme Scale authorization mechanisms. </p> <div prereq"=""><div><h2>Before you begin</h2></div>Be sure to have completed <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec2.html" title="Building on the previous step, the following topic shows how to implement client authentication in a distributed eXtreme Scale environment.">Java SE security tutorial - Step 2</a> prior to proceeding with this task.</div> <div context"=""><div><h2>About this task</h2></div>The previous step of this tutorial demonstrated how to enable authentication in an eXtreme Scale grid. As a result, no unauthenticated client can connect to your server and submit requests to your system. However, every authenticated client has the same permission or privileges to the server, such as reading, writing, or deleting data that is stored in the ObjectGrid maps. Clients can also issue any type of query. This section demonstrates how to use eXtreme Scale authorization to give various authenticated users varying privileges.<p>Similar to many other systems, eXtreme Scale adopts a permission-based authorization mechanism. WebSphere&#174; eXtreme Scale has different permission categories that are represented by different permission classes. This topic features MapPermission. For complete category of permissions, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.prog.doc/cxsprgauthor.html">Client authorization reference</a>.</p> <div>In WebSphere eXtreme Scale, the com.ibm.websphere.objectgrid.security.MapPermission class represents permissions to the eXtreme Scale resources, specifically the methods of ObjectMap or JavaMap interfaces. WebSphere eXtreme Scale defines the following permission strings to access the methods of ObjectMap and JavaMap: <ul><li>read: Grants permission to read the data from the map.</li><li>write: Grants permission to update the data in the map.</li><li>insert: Grants permission to insert the data into the map.</li><li>remove: Grants permission to remove the data from the map.</li><li>invalidate: Grants permission to invalidate the data from the map.</li><li>all: Grants all permissions to read, write, insert, remote, and invalidate.</li></ul> </div> <p>The authorization occurs when a client calls a method of ObjectMap or JavaMap. The eXtreme Scale runtime checks different map permissions for different methods. If the required permissions are not granted to the client, an AccessControlException results.</p> <p>This tutorial demonstrates how to use Java Authentication and Authorization Service (JAAS) authorization to grant authorization map accesses for different users.</p> </div> <div><h2>Procedure</h2></div><ol steps"=""><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Enable eXtreme Scale authorization</strong>.</span> To enable authorization on the ObjectGrid, you need to set the securityEnabled attribute to <kbd userinput"="">true</kbd> for that particular ObjectGrid in the XML file. Enabling security on the ObjectGrid means that you are enabling authorization. Use the following commands to create a new ObjectGrid XML file with security enabled.<ol substeps"="" type="a"><li substep=""  substepexpand"=""><span cmd"="">Navigate to the <span filepath"="">xml</span> directory.</span> <pre codeblock"="">cd objectgridRoot/xml</pre> </li><li substep=""  substepexpand"=""><span cmd"="">Copy the <span filepath"="">SimpleApp.xml</span> file to the <span filepath"="">SecureSimpleApp.xml</span> file.</span> <pre codeblock"="">cp SimpleApp.xml SecureSimpleApp.xml</pre> </li><li substep=""  substepexpand"=""><span cmd"="">Open the <span filepath"="">SecureSimpleApp.xml</span> file and add <kbd userinput"="">securityEnabled="true"</kbd> on the ObjectGrid level as the following XML shows:</span> <pre codeblock"="">&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"        xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"  		 xmlns="http://ibm.com/ws/objectgrid/config"&gt;     &lt;objectGrids&gt;         &lt;objectGrid name="accounting" securityEnabled="true"&gt;             &lt;backingMap name="customer" readOnly="false" copyKey="true"/&gt;         &lt;/objectGrid&gt;     &lt;/objectGrids&gt; &lt;/objectGridConfig&gt;</pre> </li></ol> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Define the authorization policy.</strong></span><br /> In the pre-client authentication section, you created three users in the key store: cashier, manager, and administrator. In this example, the user "cashier" only has read permissions to all the maps, and the user "manager" has all permissions. JAAS authorization is used in this example. JAAS authorization uses authorization policy file to grant permissions to principals. The following  file is defined in the security directory: <pre codeblock"="">grant codebase "http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction"     principal javax.security.auth.x500.X500Principal "CN=cashier,O=acme,OU=OGSample" {     permission com.ibm.websphere.objectgrid.security.MapPermission "accounting.*", "read "; };  grant codebase "http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction"     principal javax.security.auth.x500.X500Principal "CN=manager,O=acme,OU=OGSample" {     permission com.ibm.websphere.objectgrid.security.MapPermission "accounting.*", "all"; };</pre>  Note: <ul><li>The <samp codeph"="">codebase "http://www.ibm.com/com/ibm/ws/objectgrid/security/PrivilegedAction"</samp> is a specially-reserved URL for ObjectGrid. All ObjectGrid permissions granted to principals should use this special code base.</li><li>The first grant statement grants "read" map permission to principal <samp codeph"="">"CN=cashier,O=acme,OU=OGSample"</samp>, so the cashier has only map read permission to all the maps in the ObjectGrid accounting.</li><li>The second grant statement grants "all" map permission to principal <samp codeph"="">"CN=manager,O=acme,OU=OGSample"</samp>, so the manager has all permissions to maps in the ObjectGrid accounting.</li></ul>  Now you can launch a server with an authorization policy. The JAAS authorization policy file can be set using the standard -D property: -Djava.security.auth.policy=../security/ogAuth.policy</li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Run the application.</strong></span><br /> <p>After you create the above files, you can run the application.</p> <p>Use the following commands to start the catalog server. For more information about starting the catalog service, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/txscatalogstart.html">Starting the catalog service in a stand-alone environment</a>.</p> <div><ol type="a"><li>Navigate to the bin directory: <samp codeph"="">cd objectgridRoot/bin</samp></li><li>Start the catalog server.<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">startOgServer.sh catalogServer -clusterSecurityFile ../security/security.xml -serverProps ../security/server.properties -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config"</samp></li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">startOgServer.bat catalogServer -clusterSecurityFile ../security/security.xml -serverProps ../security/server.properties -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config"</samp></li></ul> <p>The <span filepath"="">security.xml</span> and <span filepath"="">server.properties</span> files were created in the previous step of this tutorial.</p> <p>T</p> </li><li>You can then start a secure container server using the following script. Run the following script from the bin directory:<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"=""># startOgServer.sh c0 -objectGridFile ../xml/SecureSimpleApp.xml -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809 -serverProps ../security/server.properties -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config" -Djava.security.auth.policy="../security/og_auth.policy"</samp></li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">startOgServer.bat c0 -objectGridFile ../xml/SecureSimpleApp.xml -deploymentPolicyFile ../xml/SimpleDP.xml -catalogServiceEndPoints localhost:2809 -serverProps ../security/server.properties -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config" -Djava.security.auth.policy="../security/og_auth.policy"</samp></li></ul> </li></ol> </div> <div>Notice the following differences from the previous container server start command:<ul><li>Use the <span filepath"="">SecureSimpleApp.xml</span> file instead of the <span filepath"="">SimpleApp.xml</span> file.</li><li>Add another <samp codeph"="">-Djava.security.auth.policy</samp> argument to set the JAAS authorization policy file to the container server process.</li></ul> </div> <div>Use the same command as in the previous step of the tutorial:<ol type="a"><li>Navigate to the bin directory.</li><li><samp codeph"="">java -classpath ../lib/objectgrid.jar;../applib/secsample.jar com.ibm.websphere.objectgrid.security.sample.guide.SecureSimpleApp ../security/client.properties manager manager1</samp><p>Because user "manager" has all permissions to maps in the accounting ObjectGrid, the application runs properly.</p> <p>Now, instead of using user "manager", use user "cashier" to launch the client application.</p> </li><li>Navigate to the bin directory.</li><li><samp codeph"="">java -classpath ../lib/objectgrid.jar;../applib/secsample.jar com.ibm.ws.objectgrid.security.sample.guide.SecureSimpleApp ../security/client.properties cashier cashier1</samp></li></ol> </div> <p>The following exception results:</p> <pre codeblock"="">Exception in thread "P=387313:O=0:CT" com.ibm.websphere.objectgrid.TransactionException:  rolling back transaction, see caused by exception 	at com.ibm.ws.objectgrid.SessionImpl.rollbackPMapChanges(SessionImpl.java:1422)  	at com.ibm.ws.objectgrid.SessionImpl.commit(SessionImpl.java:1149)  	at com.ibm.ws.objectgrid.SessionImpl.mapPostInvoke(SessionImpl.java:2260)  	at com.ibm.ws.objectgrid.ObjectMapImpl.update(ObjectMapImpl.java:1062)  	at com.ibm.ws.objectgrid.security.sample.guide.SimpleApp.run(SimpleApp.java:42) 	at com.ibm.ws.objectgrid.security.sample.guide.SecureSimpleApp.main(SecureSimpleApp.java:27) Caused by: com.ibm.websphere.objectgrid.ClientServerTransactionCallbackException:     Client Services - received exception from remote server:      com.ibm.websphere.objectgrid.TransactionException: transaction rolled back,  			see caused by Throwable         at com.ibm.ws.objectgrid.client.RemoteTransactionCallbackImpl.processReadWriteResponse(             RemoteTransactionCallbackImpl.java:1399)         at com.ibm.ws.objectgrid.client.RemoteTransactionCallbackImpl.processReadWriteRequestAndResponse(             RemoteTransactionCallbackImpl.java:2333)         at com.ibm.ws.objectgrid.client.RemoteTransactionCallbackImpl.commit(RemoteTransactionCallbackImpl.java:557)         at com.ibm.ws.objectgrid.SessionImpl.commit(SessionImpl.java:1079)         ... 4 more Caused by: com.ibm.websphere.objectgrid.TransactionException: transaction rolled back, see caused by Throwable         at com.ibm.ws.objectgrid.ServerCoreEventProcessor.processLogSequence(ServerCoreEventProcessor.java:1133)         at com.ibm.ws.objectgrid.ServerCoreEventProcessor.processReadWriteTransactionRequest 					(ServerCoreEventProcessor.java:910)         at com.ibm.ws.objectgrid.ServerCoreEventProcessor.processClientServerRequest(ServerCoreEventProcessor.java:1285)          at com.ibm.ws.objectgrid.ShardImpl.processMessage(ShardImpl.java:515)         at com.ibm.ws.objectgrid.partition.IDLShardPOA._invoke(IDLShardPOA.java:154)         at com.ibm.CORBA.poa.POAServerDelegate.dispatchToServant(POAServerDelegate.java:396)         at com.ibm.CORBA.poa.POAServerDelegate.internalDispatch(POAServerDelegate.java:331)         at com.ibm.CORBA.poa.POAServerDelegate.dispatch(POAServerDelegate.java:253)         at com.ibm.rmi.iiop.ORB.process(ORB.java:503)         at com.ibm.CORBA.iiop.ORB.process(ORB.java:1553)         at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2680)         at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2554)         at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)         at com.ibm.rmi.iiop.WorkerThread.run(ThreadPoolImpl.java:202)         at java.lang.Thread.run(Thread.java:803) Caused by: java.security.AccessControlException: Access denied (    com.ibm.websphere.objectgrid.security.MapPermission accounting.customer write)         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:155)         at com.ibm.ws.objectgrid.security.MapPermissionCheckAction.run(MapPermissionCheckAction.java:141)         at java.security.AccessController.doPrivileged(AccessController.java:275)         at javax.security.auth.Subject.doAsPrivileged(Subject.java:727)         at com.ibm.ws.objectgrid.security.MapAuthorizer$1.run(MapAuthorizer.java:76)         at java.security.AccessController.doPrivileged(AccessController.java:242)         at com.ibm.ws.objectgrid.security.MapAuthorizer.check(MapAuthorizer.java:66)         at com.ibm.ws.objectgrid.security.SecuredObjectMapImpl.checkMapAuthorization(SecuredObjectMapImpl.java:429)         at com.ibm.ws.objectgrid.security.SecuredObjectMapImpl.update(SecuredObjectMapImpl.java:490)         at com.ibm.ws.objectgrid.SessionImpl.processLogSequence(SessionImpl.java:1913)         at com.ibm.ws.objectgrid.SessionImpl.processLogSequence(SessionImpl.java:1805)         at com.ibm.ws.objectgrid.ServerCoreEventProcessor.processLogSequence(ServerCoreEventProcessor.java:1011)         ... 14 more</pre> <p>This exception occurs because the user "cashier" does not have write permission, so it cannot update the map customer.</p> <p>Now your system supports authorization. You can define authorization policies to grant different permissions to different users. For more information about authorization, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/cxsauthorize.html">Application client authorization</a>.</p> </li></ol></div><img src ="http://www.blogjava.net/dashi99/aggbug/381544.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:32 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381544.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java SE security tutorial - Step 1</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381542.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:31:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381542.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381542.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381542.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381542.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381542.html</trackback:ping><description><![CDATA[<div><p>This topic describes a <em i"="">simple unsecured sample</em>. Additional security features are added incrementally in the steps of the tutorial to increase the amount of integrated security that is available.</p> <div prereq"=""><div><h2>Before you begin</h2></div><div note"="">Note: All of the files required for this step of the tutorial are provided in the following section.</div> </div> <div><h2>Procedure</h2></div><div step"=""><span cmd"=""><strong b"="">Running the sample</strong></span><br /> <p>Start the catalog service by using the following scripts. For more information about starting the catalog service, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/txscatalogstart.html">Starting the catalog service in a stand-alone environment</a>.</p> <ol substeps"="" type="a"><li substep=""  substepexpand"=""><span cmd"="">Navigate to the bin directory: <samp codeph"="">cd objectgridRoot/bin</samp></span></li><li substep=""  substepexpand"=""><span cmd"="">Start a catalog server named catalogServer: </span> <ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">startOgServer.sh catalogServer</samp> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">startOgServer.bat catalogServer</samp></li></ul> </li><li substep=""  substepexpand"=""><span cmd"="">Navigate to the bin directory <samp codeph"="">cd objectgridRoot/bin</samp></span></li><li substep=""  substepexpand"=""><span cmd"="">Then launch a container server named c0 with the following script:</span> <ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <pre codeblock"="">startOgServer.sh c0 -objectGridFile ../xml/SimpleApp.xml -deploymentPolicyFile ../xml/SimpleDP.xml  -catalogServiceEndPoints localhost:2809 </pre> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">startOgServer.bat c0 -objectGridFile ../xml/SimpleApp.xml - deploymentPolicyFile ../xml/SimpleDP.xml  -catalogServiceEndPoints localhost:2809</pre> </li></ul> </li></ol> </div> <div><h2>Example</h2></div><p>For more information about starting container servers, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/txsstartcontainer.html">Starting container processes</a>.</p> <div>After the catalog server and container server have been started, launch the client as follows.<ol><li>Navigate to the bin directory one more time.</li><li><samp codeph"=""> java -classpath ../lib/objectgrid.jar;../applib/secsample.jar com.ibm.websphere.objectgrid.security.sample.guide.SimpleApp</samp> </li></ol> The <span filepath"="">secsample.jar</span> file contains the <span apiname"="">SimpleApp</span> class.</div> <p>The output of this program is:</p> <p><samp codeph"="">The customer name for ID 0001 is fName lName</samp></p> <div>You may also use xsadmin to show the mapsizes of the "accounting" grid.<ul><li>Navigate to the directory <samp codeph"="">objectgridRoot/bin</samp>.</li><li>Use the <span filepath"="">xsadmin</span> command with option -mapSizes as follows.<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">xsadmin.sh -g accounting -m mapSet1 -mapSizes</samp> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">xsadmin.bat -g accounting -m mapSet1 -mapSizes</samp></li></ul> <p>You will see the following output.</p> <p><samp codeph"="">This administrative utility is provided as a sample only and is not to be considered a fully supported component of the WebSphere eXtreme Scale product.</samp></p> <p><samp codeph"="">Connecting to Catalog service at localhost:1099</samp></p> <p><samp codeph"="">*********** Displaying Results for Grid - accounting, MapSet - mapSet1 ***********</samp></p> <p><samp codeph"="">*** Listing Maps for c0 ***</samp></p> <p><samp codeph"="">Map Name: customer Partition #: 0 Map Size: 1 Shard Type: Primary</samp></p> <p><samp codeph"="">Server Total: 1</samp></p>  <p><samp codeph"="">Total Domain Count: 1</samp></p> </li></ul> </div> <p><strong b"="">Stopping servers</strong></p> <p><em i"="">Container server</em></p> <p>Use the following command to stop the container server c0.</p> <p><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">stopOgServer.sh c0 -catalogServiceEndPoints localhost:2809</samp></p> <p><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">stopOgServer.bat c0 -catalogServiceEndPoints localhost:2809</samp></p> <p>You will see the following message.</p> <p><samp codeph"="">CWOBJ2512I: ObjectGrid server c0 stopped.</samp></p> <p><em i"="">Catalog server</em></p> <p>You can stop a catalog server using the following command.</p> <p><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">stopOgServer.sh catalogServer -catalogServiceEndPoints localhost:2809</samp></p> <p><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">stopOgServer.bat catalogServer -catalogServiceEndPoints localhost:2809</samp></p> <p>If you shut down the catalog server, you will see the following message.</p> <p><samp codeph"="">CWOBJ2512I: ObjectGrid server catalogServer stopped.</samp></p> <strong b"="">Required files</strong><p>The file below is the Java class for SimpleApp.</p> <pre codeblock"=""><strong b"="">SimpleApp.java</strong> // This sample program is provided AS IS and may be used, executed, copied and modified  // without royalty payment by customer  // (a) for its own instruction and study,  // (b) in order to develop applications designed to run with an IBM WebSphere product,  // either for customer's own internal use or for redistribution by customer, as part of such an  // application, in customer's own products. // Licensed Materials - Property of IBM // 5724-J34 (C) COPYRIGHT International Business Machines Corp. 2007-2009 package com.ibm.websphere.objectgrid.security.sample.guide;  import com.ibm.websphere.objectgrid.ClientClusterContext; import com.ibm.websphere.objectgrid.ObjectGrid; import com.ibm.websphere.objectgrid.ObjectGridManager; import com.ibm.websphere.objectgrid.ObjectGridManagerFactory; import com.ibm.websphere.objectgrid.ObjectMap; import com.ibm.websphere.objectgrid.Session;  public class SimpleApp {      public static void main(String[] args) throws Exception {          SimpleApp app = new SimpleApp();         app.run(args);     }      /**      * read and write the map       * @throws Exception      */     protected void run(String[] args) throws Exception {         ObjectGrid og = getObjectGrid(args);          Session session = og.getSession();          ObjectMap customerMap = session.getMap("customer");          String customer = (String) customerMap.get("0001");          if (customer == null) {             customerMap.insert("0001", "fName lName");         } else {             customerMap.update("0001", "fName lName");         }         customer = (String) customerMap.get("0001");          System.out.println("The customer name for ID 0001 is " + customer);     }      /**      * Get the ObjectGrid      * @return an ObjectGrid instance      * @throws Exception      */     protected ObjectGrid getObjectGrid(String[] args) throws Exception {         ObjectGridManager ogManager = ObjectGridManagerFactory.getObjectGridManager();          // Create an ObjectGrid          ClientClusterContext ccContext = ogManager.connect("localhost:2809", null, null);         ObjectGrid og = ogManager.getObjectGrid(ccContext, "accounting");          return og;      }  }</pre> <p>The <span apiname"="">getObjectGrid</span> method in this class obtains an ObjectGrid, and the <span apiname"="">run</span> method reads a record from the customer map and updates the value.</p> <p>To run this sample in a distributed environment, an ObjectGrid descriptor XML file <span filepath"="">SimpleApp.xml</span>, and a deployment XML file, <span filepath"="">SimpleDP.xml</span>, are created. The files are featured in the following example:</p> <div><pre codeblock"=""><strong b"="">SimpleApp.xml</strong>  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  	xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"  	xmlns="http://ibm.com/ws/objectgrid/config"&gt;     &lt;objectGrids&gt;         &lt;objectGrid name="accounting"&gt;             &lt;backingMap name="customer" readOnly="false" copyKey="true"/&gt;         &lt;/objectGrid&gt;     &lt;/objectGrids&gt; &lt;/objectGridConfig&gt; </pre> </div> <p>The following XML file configures the deployment environment.</p> <div><pre  codeblock"=""><strong b"="">SimpleDP.xml</strong>  &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;deploymentPolicy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 	xsi:schemaLocation="http://ibm.com/ws/objectgrid/deploymentPolicy ../deploymentPolicy.xsd" 	xmlns="http://ibm.com/ws/objectgrid/deploymentPolicy"&gt;  	&lt;objectgridDeployment objectgridName="accounting"&gt; 		&lt;mapSet name="mapSet1" numberOfPartitions="1" minSyncReplicas="0" maxSyncReplicas="2"  			maxAsyncReplicas="1"&gt; 			&lt;map ref="customer"/&gt; 		&lt;/mapSet&gt; 	&lt;/objectgridDeployment&gt; &lt;/deploymentPolicy&gt;</pre> </div> <p>This is a simple ObjectGrid configuration with one ObjectGrid instance named "accounting" and one map named "customer" (within the mapSet "mapSet1"). The <span filepath"="">SimpleDP.xml</span> file features one map set that is configured with 1 partition and 0 minimum required replicas.</p></div><img src ="http://www.blogjava.net/dashi99/aggbug/381542.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:31 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381542.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java SE security tutorial - Step 2</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381543.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:31:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381543.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381543.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381543.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381543.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381543.html</trackback:ping><description><![CDATA[<div><p>Building on the previous step, the following topic shows how to implement client authentication in a distributed eXtreme Scale environment.</p> <div prereq"=""><div><h2>Before you begin</h2></div>Be sure that you have completed <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec1.html" title="This topic describes a simple unsecured sample. Additional security features are added incrementally in the steps of the tutorial to increase the amount of integrated security that is available.">Java SE security tutorial - Step 1</a>.</div> <div context"=""><div><h2>About this task</h2></div>With client authentication enabled, a client is authenticated before connecting to the eXtreme Scale server. This section demonstrates how client authentication can be done in an eXtreme Scale server environment, including sample code and scripts to demonstrate.<div>As any other authentication mechanism, the minimum authentication consists of the following steps:<ol><li>The administrator changes configurations to make authentication a requirement.</li><li>The client provides a credential to the server.</li><li>The server authenticates the credential to the registry.</li></ol> </div> </div> <div><h2>Procedure</h2></div><ol steps"=""><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Client credential</strong></span><br /> <p>A client credential is represented by a com.ibm.websphere.objectgrid.security.plugins.Credential interface. A client credential can be a user name and password pair, a Kerberos ticket, a client certificate, or data in any format that the client and server agree upon. Refer to <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.javadoc.doc/topics/com/ibm/websphere/objectgrid/security/plugins/Credential.html">Credential API documentation</a> for more details.</p> <p>This interface explicitly defines the equals(Object) and hashCode() methods. These two methods are important because the authenticated Subject objects are cached by using the Credential object as the key on the server side.</p> <p>eXtreme Scale also provides a plug-in to generate a credential. This plug-in is represented by the com.ibm.websphere.objectgrid.security.plugins.CredentialGenerator interface, and is used to generate a client credential. This is useful when the credential is expirable. In this case, the getCredential() method is called to renew a credential. Refer to CredentialGenerator API Documentation for more details.</p> <p>You can implement these two interfaces for eXtreme Scale client runtime to obtain client credentials.</p> <p>This sample uses the following two sample plug-in implementations provided by eXtreme Scale.</p> <pre codeblock"="">com.ibm.websphere.objectgrid.security.plugins.builtins.UserPasswordCredential</pre> <pre codeblock"="">com.ibm.websphere.objectgrid.security.plugins.builtins.UserPasswordCredentialGenerator </pre> <p>For more information about these plug-ins, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.prog.doc/cxsprcliauth.html">Client authentication programming</a></p> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Server authenticator</strong></span><br /> After the eXtreme Scale client retrieves the Credential object using the CredentialGenerator object, this client Credential object is sent along with the client request to the eXtreme Scale server. The eXtreme Scale server authenticates the Credential object before processing the request. If the Credential object is authenticated successfully, a Subject object is returned to represent this client. <p>This Subject object is then cached, and it expires after its lifetime reaches the session timeout value. The login session timeout value can be set by using the loginSessionExpirationTime property in the cluster XML file. For example, setting <samp codeph"="">loginSessionExpirationTime="300"</samp> makes the Subject object expire in 300 seconds.  </p> This Subject object is then used for authorizing the request, which is shown later.<p> An eXtreme Scale server uses the Authenticator plug-in to authenticate the Credential object. Refer to Authenticator API Documentation for more details.</p> <p>This example uses an eXtreme Scale built-in implementation: KeyStoreLoginAuthenticator, which is for testing and sample purposes (a key store is a simple user registry and should not be used for production). <span>For more information, see the topic on authenticator plug-in under <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.prog.doc/cxsprcliauth.html">Client authentication programming</a></span>.</p> <p>This KeyStoreLoginAuthenticator uses a KeyStoreLoginModule to authenticate the user with the key store by using the JAAS login module "KeyStoreLogin". The key store can be configured as an option to the KeyStoreLoginModule class. The following example illustrates the keyStoreLogin alias configured in the JAAS configuration file og_jaas.config:</p> <div><pre codeblock"="">KeyStoreLogin{ com.ibm.websphere.objectgrid.security.plugins.builtins.KeyStoreLoginModule required      keyStoreFile="../security/sampleKS.jks" debug = true; };</pre> </div> <div>The following commands create a key store sampleKS.jks in the %OBJECTGRID_HOME%/security directory with the password as sampleKS1. Also, three user certificates representing the administrator user, the manager user, and the cashier user are created with their own passwords.<ol type="a"><li> Navigate to the eXtreme Scale root directory.<pre codeblock"="">cd objectgridRoot</pre> </li><li> Create a directory called "security".<pre codeblock"="">mkdir security</pre> </li><li> Navigate to the newly created security directory.<pre codeblock"="">cd security</pre> </li><li> Use keytool (in the <span filepath"="">javaHOME/bin</span> directory) to create a user "administator" with password "administrator1" in the key store sampleKS.jks.<pre codeblock"="">keytool -genkey -v -keystore ./sampleKS.jks -storepass sampleKS1  -alias administrator -keypass administrator1  -dname CN=administrator,O=acme,OU=OGSample -validity 10000</pre> </li><li> Use keytool (in the <span filepath"="">javaHOME/bin</span> directory) to create a user "manager" with password "manager1" in the key store sampleKS.jks.<pre codeblock"="">keytool -genkey -v -keystore ./sampleKS.jks -storepass sampleKS1  -alias manager -keypass manager1  -dname CN=manager,O=acme,OU=OGSample -validity 10000</pre> </li><li>Use keytool (in the <span filepath"="">javaHOME/bin</span> directory) to create a user "cashier" with password "cashier1" in the key store sampleKS.jks.<pre codeblock"="">keytool -genkey -v -keystore ./sampleKS.jks -storepass sampleKS1  -alias cashier -keypass cashier1 -dname CN=cashier,O=acme,OU=OGSample  -validity 10000</pre> </li></ol> </div> <p>The client security configuration is configured in the client properties file. Use the following command to create a copy in the <span filepath"="">%OBJECTGRID_HOME%/security</span> directory:</p> <div><ol type="a"><li> Change to the security directory.<pre codeblock"="">cd objectgridRoot/security</pre> </li><li> Copy the sampleClient.properties file to the client.properties file.<pre codeblock"="">cp ../properties/sampleClient.properties client.properties</pre> </li></ol> </div> <div> The following properties are highlighted in the client.properties file in the security directory.<ol type="a"><li><strong b"="">securityEnabled:</strong> Setting securityEnabled to true (default value) enables the client security, which includes authentication.</li><li><strong b"="">credentialAuthentication:</strong> Set credentialAuthentication to Supported (default value), which means the client supports credential authentication.</li><li><strong b"="">transportType:</strong> Set transportType to TCP/IP, which means no SSL will be used.</li><li><strong b"="">singleSignOnEnabled:</strong> Set it to false (default value). Single sign-on is not available.</li></ol> </div> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Server security configuration</strong></span><br /> <p>The server security configuration is specified in the security descriptor XML file and the server security property file.</p> The security descriptor XML file describes the security properties common to all servers (including catalog servers and container servers). One property example is the authenticator configuration which represents the user registry and authentication mechanism.<p>Here is the <span filepath"="">security.xml</span> file to be used in this sample:</p> <div><pre codeblock"="">&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;securityConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"      xsi:schemaLocation="http://ibm.com/ws/objectgrid/config/security ../objectGridSecurity.xsd" 	xmlns="http://ibm.com/ws/objectgrid/config/security"&gt;  	&lt;security securityEnabled="true" loginSessionExpirationTime="300" &gt;                  &lt;authenticator className ="com.ibm.websphere.objectgrid.security.plugins.builtins.	 					KeyStoreLoginAuthenticator"&gt;         &lt;/authenticator&gt;     &lt;/security&gt; 	 &lt;/securityConfig&gt;</pre> </div> <div><ol type="a"><li><strong b"="">securityEnabled:</strong> Set to true, which enables the server security including authentication.</li><li><strong b"="">loginSessionExpirationTime:</strong> Set the value to 300 (default value).</li><li><strong b"="">authenticator:</strong> Add the authenticator class KeyStoreLoginAuthenticator to the cluster XML file as follows: <div><pre codeblock"="">&lt;authenticator className ="com.ibm.websphere.objectgrid.security.plugins.builtins.KeyStoreLoginAuthenticator"&gt;         &lt;/authenticator&gt;</pre> </div> </li><li><strong b"="">credentialAuthentication:</strong> Set credentialAuthentication attribute to Required so the server requires authentication</li></ol> </div> <p>For more detailed explanation on the <span filepath"="">security.xml</span> file, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/rxsxmlsec.html">Security descriptor XML file</a>. </p> <div>Copy the server properties file into the security directory. At this time, you do not need to modify anything in this file. <ol type="a"><li> Navigate to the security directory.<pre codeblock"="">cd objectgridRoot/security</pre> </li><li> Copy the sample objectGrid <span filepath"="">sampleServer.properties</span> file from the properties directory to the new <span filepath"="">server.properties</span> file.<pre codeblock"="">cp ../properties/containerServer.properties server.properties</pre> </li></ol> </div> <div>Make the following changes in the <span filepath"="">server.properties</span> file:<ol type="a"><li><strong b"="">securityEnabled:</strong> Set the <span parmname=""  parmname"="">securityEnabled</span> attribute to true.</li><li><strong b"="">transportType:</strong> Set <span parmname=""  parmname"="">transportType</span> attribute to TCP/IP, which means no SSL is used.</li><li> <strong b"="">secureTokenManagerType:</strong> Set <span parmname=""  parmname"="">secureTokenManagerType</span> attribute to none to not configure the secure token manager. </li></ol> </div> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Secure client</strong></span><br /> Connect the client application to the server securely as demonstrated in the following example:<div><pre codeblock"="">package com.ibm.websphere.objectgrid.security.sample.guide;  import com.ibm.websphere.objectgrid.ClientClusterContext; import com.ibm.websphere.objectgrid.ObjectGrid; import com.ibm.websphere.objectgrid.ObjectGridManager; import com.ibm.websphere.objectgrid.ObjectGridManagerFactory; import com.ibm.websphere.objectgrid.security.config.ClientSecurityConfiguration; import com.ibm.websphere.objectgrid.security.config.ClientSecurityConfigurationFactory; import com.ibm.websphere.objectgrid.security.plugins.CredentialGenerator; import com.ibm.websphere.objectgrid.security.plugins.builtins.UserPasswordCredentialGenerator;  public class SecureSimpleApp extends SimpleApp {      public static void main(String[] args) throws Exception {          SecureSimpleApp app = new SecureSimpleApp();         app.run(args);     }      /**      * Get the ObjectGrid      * @return an ObjectGrid instance      * @throws Exception      */     protected ObjectGrid getObjectGrid(String[] args) throws Exception {         ObjectGridManager ogManager = ObjectGridManagerFactory.getObjectGridManager();         ogManager.setTraceFileName("logs/client.log");         ogManager.setTraceSpecification("ObjectGrid*=all=enabled:ORBRas=all=enabled");          // Creates a ClientSecurityConfiguration object using the specified file         ClientSecurityConfiguration clientSC = ClientSecurityConfigurationFactory                 .getClientSecurityConfiguration(args[0]);                  // Creates a CredentialGenerator using the passed-in user and password.         CredentialGenerator credGen = new UserPasswordCredentialGenerator(args[1], args[2]);         clientSC.setCredentialGenerator(credGen);                  // Create an ObjectGrid by connecting to the catalog server          ClientClusterContext ccContext = ogManager.connect("localhost:2809", clientSC, null);         ObjectGrid og = ogManager.getObjectGrid(ccContext, "accounting");          return og;      }  }</pre> </div> <div>There are three things different from the non-secured application:<ol type="a"><li>Created a ClientSecurityConfiguration object by passing the configured <span filepath"="">client.properties</span> file.</li><li>Created a UserPasswordCredentialGenerator by using the passed-in user ID and password.</li><li>Connected to the catalog server to obtain an ObjectGrid from the ClientClusterContext by passing a ClientSecurityConfiguration object.</li></ol> </div> </li><li step=""  stepexpand"=""><span cmd"=""><strong b"="">Issue the application</strong></span><br /> <p>To run the application, start the catalog server. Issue the -clusterFile and -serverProps command line options to pass in the security properties:</p> <ol type="a"><li>Navigate to the bin directory: <pre codeblock"="">cd objectgridRoot/bin</pre> </li><li> Launch the catalog server:<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <pre codeblock"="">startOgServer.sh catalogServer -clusterSecurityFile ../security/security.xml  -serverProps ../security/server.properties -jvmArgs  -Djava.security.auth.login.config="../security/og_jaas.config"</pre> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">startOgServer.bat catalogServer -clusterSecurityFile ../security/security.xml  -serverProps ../security/server.properties -jvmArgs  -Djava.security.auth.login.config="../security/og_jaas.config" </pre> </li></ul> </li></ol> <p>Then, launch a secure container server by using the following script:</p> <ol type="a"><li>Navigate to the bin directory again: <pre codeblock"="">cd objectgridRoot/bin</pre> </li><li>Launch a secure container server:<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /> <pre codeblock"="">startOgServer.sh c0 -objectgridFile ../xml/SimpleApp.xml  -deploymentPolicyFile ../xml/SimpleDP.xml  -catalogServiceEndPoints localhost:2809  -serverProps ../security/server.properties  -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config"</pre> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <pre codeblock"="">startOgServer.bat c0 -objectgridFile ../xml/SimpleApp.xml  -deploymentPolicyFile ../xml/SimpleDP.xml  -catalogServiceEndPoints localhost:2809  -serverProps ../security/server.properties  -jvmArgs -Djava.security.auth.login.config="../security/og_jaas.config"</pre> </li></ul> </li></ol> The server property file is passed by issuing -serverProps.<div>After the server is started, start the client by using the following command:<ol type="a"><li><pre codeblock"="">cd objectgridRoot/bin</pre> </li><li><pre codeblock"="">java -classpath ../lib/objectgrid.jar;../applib/secsample.jar 		com.ibm.websphere.objectgrid.security.sample.guide.SecureSimpleApp 		../security/client.properties manager manager1</pre> <p><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> Use a colon (:) for the classpath separator instead of a semicolon (;) as in the previous example.</p> </li></ol> </div> <p>The <span filepath"="">secsample.jar</span> file contains the SimpleApp class.</p> <p>The SecureSimpleApp uses three parameters that are provided in the following list: </p> <div><ol type="a"><li>The <span filepath"=""> ../security/client.properties</span> file is the client security property file.</li><li><samp codeph"="">manager</samp> is the user ID.</li><li><samp codeph"="">manager1</samp> is the password.</li></ol> </div> <p>After you issue the class, the following output results: </p> <p>The customer name for <samp codeph"="">ID 0001 is fName lName</samp>.</p>  <div>You may also use xsadmin to show the mapsizes of the "accounting" grid.<ul><li>Navigate to the directory <samp codeph"="">objectgridRoot/bin</samp>.</li><li>Use the <span filepath"="">xsadmin</span> command with option -mapSizes as follows.<ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">xsadmin.sh -g accounting -m mapSet1 -username manager -password manager1 -mapSizes</samp> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">xsadmin.bat -g accounting -m mapSet1 -username manager -password manager1 -mapSizes</samp></li></ul> <p>You see the following output.</p> <p><samp codeph"="">This administrative utility is provided as a sample only and is not to be considered a fully supported component of the WebSphere eXtreme Scale product.</samp></p> <p><samp codeph"="">Connecting to Catalog service at localhost:1099</samp></p> <p><samp codeph"="">*********** Displaying Results for Grid - accounting, MapSet - mapSet1 ***********</samp></p> <p><samp codeph"="">*** Listing Maps for c0 ***</samp></p> <p><samp codeph"="">Map Name: customer Partition #: 0 Map Size: 1 Shard Type: Primary</samp></p> <p><samp codeph"="">Server Total: 1</samp></p>  <p><samp codeph"="">Total Domain Count: 1</samp></p> </li></ul> </div> <p>Now you can use stopOgServer command to stop the container server or catalog service process. However you need to provide a security configuration file. The sample client property file defines the following two properties to generate a userID/password credential (manager/manager1).</p> <pre codeblock"="">credentialGeneratorClass=com.ibm.websphere.objectgrid.security.plugins.builtins.UserPasswordCredentialGenerator </pre> <pre codeblock"="">credentialGeneratorProps=manager manager1</pre> <p>Stop the container c0 with the following command.</p> <div><ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">stopOgServer.sh c0 -catalogServiceEndPoints localhost:2809 -clientSecurityFile ..\security\client.properties</samp> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">stopOgServer.bat c0 -catalogServiceEndPoints localhost:2809 -clientSecurityFile ..\security\client.properties</samp></li></ul> </div> <p>If you do not provide the -clientSecurityFile option, you will see an exception with the following message.</p> <p><samp codeph"="">&gt;&gt; SERVER (id=39132c79, host=9.10.86.47) TRACE START:</samp></p> <p><samp codeph"="">&gt;&gt; org.omg.CORBA.NO_PERMISSION: Server requires credential authentication but there is no security context from the client. This usually happens when the client does not pass a credential the server.</samp></p> <p><samp codeph"="">vmcid: 0x0</samp></p> <p><samp codeph"="">minor code: 0</samp></p> <p><samp codeph"="">completed: No</samp></p> <p>You can also shut down the catalog server using the following command. However, if you want to continue trying the next step tutorial, you can let the catalog server stay running.</p> <div><ul><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngunix.gif" alt="[Unix]" /><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/nglinux.gif" alt="[Linux]" /> <samp codeph"="">stopOgServer.sh catalogServer -catalogServiceEndPoints localhost:2809 -clientSecurityFile ..\security\client.properties</samp> </li><li><img src="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/icons/ngwin.gif" alt="[Windows]" /> <samp codeph"="">stopOgServer.bat catalogServer -catalogServiceEndPoints localhost:2809 -clientSecurityFile ..\security\client.properties</samp></li></ul> </div> <p>If you do shutdown the catalog server, you will see the following output.</p> <p><samp codeph"="">CWOBJ2512I: ObjectGrid server catalogServer stopped</samp></p> <p>Now, you have successfully made your system partially secure by enabling authentication. You configured the server to plug in the user registry, configured the client to provide client credentials, and changed the client property file and cluster XML file to enable authentication.</p> <p>If you provide an invalidate password, you see an exception stating that the user name or password is not correct.</p> <p>For more details about client authentication, see <a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.admin.doc/cxsauthent.html">Application client authentication</a>. </p></li></ol></div><img src ="http://www.blogjava.net/dashi99/aggbug/381543.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:31 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381543.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java SE security tutorial: overview</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381541.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:29:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381541.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381541.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381541.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381541.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381541.html</trackback:ping><description><![CDATA[<div><div taskbody"=""><p>With the following tutorial, you can create a distributed eXtreme Scale environment in a <span>Java Platform, Standard Edition</span> environment.</p> <div prereq"=""><div><h2>Before you begin</h2></div>Ensure that you are familiar with the basics of a distributed eXtreme Scale configuration. </div> <div context"=""><div><h2>About this task</h2></div>In this tutorial, the catalog server, container server, and client all run in a Java SE environment.  Each step in the tutorial builds on the previous one. Follow each of the steps to secure a distributed eXtreme Scale and develop a simple Java SE application to access the secured eXtreme Scale.<p><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec1.html" title="This topic describes a simple unsecured sample. Additional security features are added incrementally in the steps of the tutorial to increase the amount of integrated security that is available.">Begin tutorial</a></p> </div> <div><h2>Procedure</h2></div><ol steps"=""><li step=""  stepexpand"=""><span cmd"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec1.html" title="This topic describes a simple unsecured sample. Additional security features are added incrementally in the steps of the tutorial to increase the amount of integrated security that is available.">Java SE security tutorial - Step 1</a></span><br /> <ul><li>Start an unsecured catalog server</li><li>Start an unsecured container server</li><li>Start a client to access the data</li><li>Use xsadmin to show map size</li><li>Stop server</li></ul> </li><li step=""  stepexpand"=""><span cmd"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec2.html" title="Building on the previous step, the following topic shows how to implement client authentication in a distributed eXtreme Scale environment.">Java SE security tutorial - Step 2</a></span><br /> <ul><li>Use of CredentialGenerator</li><li>Use of Authenticator</li><li>Start a secure catalog server</li><li>Start a secure container server</li><li>Start client to access secured ObjectGrid</li><li>Use xsadmin to show map size</li><li>Stop secure server</li></ul> </li><li step=""  stepexpand"=""><span cmd"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec3.html" title="After authenticating a client, as in the previous step, you can give security privileges through eXtreme Scale authorization mechanisms.">Java SE security tutorial - Step 3</a></span><br /> <ul><li>Use of JAAS authorization policy</li></ul> </li><li step=""  stepexpand"=""><span cmd"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec4.html" title="The following step explains how you can enable a security layer for communication between your environment's endpoints.">Java SE security tutorial - Step 4</a></span><br /> <ul><li>Create a key store and trust store</li><li>Configure SSL properties for the server</li><li>Configure SSL properties for the client</li><li>Use xsadmin to show map size</li><li>Stop secure server</li></ul> </li></ol> </div>  <ol><li olchildlink"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec1.html">Java SE security tutorial - Step 1</a><br /> This topic describes a <em i"="">simple unsecured sample</em>. Additional security features are added incrementally in the steps of the tutorial to increase the amount of integrated security that is available.</li><li olchildlink"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec2.html">Java SE security tutorial - Step 2</a><br /> Building on the previous step, the following topic shows how to implement client authentication in a distributed eXtreme Scale environment.</li><li olchildlink"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec3.html">Java SE security tutorial - Step 3</a><br /> After authenticating a client, as in the previous step, you can give security privileges through eXtreme Scale authorization mechanisms. </li><li olchildlink"=""><a href="http://publib.boulder.ibm.com/infocenter/wxsinfo/v7r1/topic/com.ibm.websphere.extremescale.over.doc/txstutsec4.html">Java SE security tutorial - Step 4</a><br /> The following step explains how you can enable a security layer for communication between your environment's endpoints.</li></ol></div><img src ="http://www.blogjava.net/dashi99/aggbug/381541.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:29 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381541.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>How to Create Client/Server Keystores using Java Keytool</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381538.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:15:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381538.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381538.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381538.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381538.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381538.html</trackback:ping><description><![CDATA[<div>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Here I have described how to create client/server keystores which can be used to secure Axsi2 webservices and invoke Axis2 secured webservices. i.e. It can be easily used with any <a href="http://wso2.com/products">WSO2 Product</a> to experience security scenarios.More detailed explanation on creating client/server keystores using openssl including Certificate Authority(CA) Requests, can be found at <a href="http://wso2.org/library/174">http://wso2.org/library/174</a>.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">&nbsp;</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Java keytool stores the keys and certificates in a keystore, protected by a keystore password. Further, it protects private key again with another password. A Java keystore contains private-public key pair and multiple trusted certificate entries. All entries in a keystore are referred by aliases. Both private key and self signed public key is referred by one alias while any other trusted certificates are referred by different individual aliases.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">&nbsp;</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">As the first step, let's create a keystore for server. In order to do it, execute following command in a terminal. "server" in the following command corresponds to the private key/self signed public key certificate alias in the keystore while "server.jks" is the name of the creating keystore file.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -genkey -alias server -keyalg RSA -keystore server.jks</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">when you execute the above command it will first prompt you to specify a password which is corresponded to the keystore password. Then it will prompt several questions. You can give answers that you wish. At the end it will ask for a password again, which will be used to secure the generated private key.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Enter keystore password:&nbsp;<br /> Re-enter new password: <br /> What is your first and last name?<br /> [Unknown]:&nbsp;Ruchira Wageesha<br /> What is the name of your organizational unit?<br /> [Unknown]:&nbsp;Mashup Server<br /> What is the name of your organization?<br /> [Unknown]:&nbsp;WSO2<br /> What is the name of your City or Locality?<br /> [Unknown]:&nbsp;Ahangama<br /> What is the name of your State or Province?<br /> [Unknown]:&nbsp;Southern<br /> What is the two-letter country code for this unit?<br /> [Unknown]:&nbsp;LK<br /> Is CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK correct?<br /> [no]: yes<br /> Enter key password for <br /> (RETURN if same as keystore password):</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Once you successfully completed this, java keytool will create a file named "server.jks". In the same way, you can create a client keystore named "client.jks" with the alias "client" using following command.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -genkey -alias client -keyalg RSA -keystore client.jks</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Now, you have two files named client.jks and server.jks. You can view the content of these keystore files using the following command. Replacess "ruchira" with the keystore password you entered while creating the keystore.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -list -v -keystore server.jks -storepass ruchira</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">This will list something like this.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Keystore type: JKS<br /> Keystore provider: SUN</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Your keystore contains 1 entry</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Alias name: server<br /> Creation date: Jul 8, 2010<br /> Entry type: PrivateKeyEntry<br /> Certificate chain length: 1<br /> Certificate[1]:<br /> Owner: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Issuer: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Serial number: 4c356225<br /> Valid from: Thu Jul 08 10:59:09 IST 2010 until: Wed Oct 06 10:59:09 IST 2010<br /> Certificate fingerprints:<br /> MD5:&nbsp;60:0B:48:0D:DB:56:8C:68:8C:2D:94:4A:D6:DA:04:B8<br /> SHA1: A7:CE:57:10:70:87:C1:2C:C0:9D:1D:90:8C:BB:69:B6:66:26:97:13<br /> Signature algorithm name: SHA1withRSA<br /> Version: 3</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">*******************************************<br /> *******************************************</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">The next step is, getting server's self signed public key certificate and storing it in client's keystore. And getting and storing client's self signed public key certificate in server's keystore. In order to do that, first we need to export both server and client public key certificates into files. Using the following command, you can export server's public key certificate into server.cert file and client's public key certificate into client.cert file.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -export -file server.cert -keystore server.jks -storepass ruchira -alias server</span><br /> <span style="font-weight:bold">keytool -export -file client.cert -keystore client.jks -storepass ruchira -alias client</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Now you have server.cert and client.cert. You can use following commands to view certificate contents.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -printcert -v -file server.cert<br /> keytool -printcert -v -file client.cert</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">As the last step, we need to import server.cert into client keystore and client.cert into server keystore. As I mentioned earlier, each entry of a Java Keystore is stored against an alias. So, we need to specify aliases here, which will be used to refer the certificates that we are going to store.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -import -file client.cert -keystore server.jks -storepass ruchira -alias client</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Above command will store client's self signed public key certificate(client.cert) in server.jks against the alias "client". So, using "client" alias on server.jks, we can refer client's certificate anytime. Likewise, following command will store server.cert within client.jks against the alias "server".</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -import -file server.cert -keystore client.jks -storepass ruchira -alias server</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">After all, please view the content of both keystore again using following commands.</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt"><span style="font-weight:bold">keytool -list -v -keystore server.jks -storepass ruchira<br /> keytool -list -v -keystore client.jks -storepass ruchira</span></p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">It will give you something like bellow for server.jks</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Keystore type: JKS<br /> Keystore provider: SUN</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Your keystore contains 2 entries</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Alias name: server<br /> Creation date: Jul 8, 2010<br /> Entry type: PrivateKeyEntry<br /> Certificate chain length: 1<br /> Certificate[1]:<br /> Owner: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Issuer: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Serial number: 4c3562a0<br /> Valid from: Thu Jul 08 11:01:12 IST 2010 until: Wed Oct 06 11:01:12 IST 2010<br /> Certificate fingerprints:<br /> MD5:&nbsp;AB:77:72:F1:0D:09:55:E3:B6:D3:DC:A6:4D:D4:39:36<br /> SHA1: D7:C1:60:5C:7E:34:40:A9:0B:E4:2C:65:6C:E0:79:7C:EE:37:A7:19<br /> Signature algorithm name: SHA1withRSA<br /> Version: 3</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">*******************************************<br /> *******************************************</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Alias name: client<br /> Creation date: Jul 8, 2010<br /> Entry type: trustedCertEntry</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Owner: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Issuer: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Serial number: 4c356225<br /> Valid from: Thu Jul 08 10:59:09 IST 2010 until: Wed Oct 06 10:59:09 IST 2010<br /> Certificate fingerprints:<br /> MD5:&nbsp;60:0B:48:0D:DB:56:8C:68:8C:2D:94:4A:D6:DA:04:B8<br /> SHA1: A7:CE:57:10:70:87:C1:2C:C0:9D:1D:90:8C:BB:69:B6:66:26:97:13<br /> Signature algorithm name: SHA1withRSA<br /> Version: 3</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">*******************************************<br /> *******************************************</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">something like below for client.jks</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Keystore type: JKS<br /> Keystore provider: SUN</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Your keystore contains 2 entries</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Alias name: server<br /> Creation date: Jul 8, 2010<br /> Entry type: trustedCertEntry</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Owner: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Issuer: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Serial number: 4c3562a0<br /> Valid from: Thu Jul 08 11:01:12 IST 2010 until: Wed Oct 06 11:01:12 IST 2010<br /> Certificate fingerprints:<br /> MD5:&nbsp;AB:77:72:F1:0D:09:55:E3:B6:D3:DC:A6:4D:D4:39:36<br /> SHA1: D7:C1:60:5C:7E:34:40:A9:0B:E4:2C:65:6C:E0:79:7C:EE:37:A7:19<br /> Signature algorithm name: SHA1withRSA<br /> Version: 3</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">*******************************************<br /> *******************************************</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">Alias name: client<br /> Creation date: Jul 8, 2010<br /> Entry type: PrivateKeyEntry<br /> Certificate chain length: 1<br /> Certificate[1]:<br /> Owner: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Issuer: CN=Ruchira Wageesha, OU=Mashup Server, O=WSO2, L=Ahangama, ST=Southern, C=LK<br /> Serial number: 4c356225<br /> Valid from: Thu Jul 08 10:59:09 IST 2010 until: Wed Oct 06 10:59:09 IST 2010<br /> Certificate fingerprints:<br /> MD5:&nbsp;60:0B:48:0D:DB:56:8C:68:8C:2D:94:4A:D6:DA:04:B8<br /> SHA1: A7:CE:57:10:70:87:C1:2C:C0:9D:1D:90:8C:BB:69:B6:66:26:97:13<br /> Signature algorithm name: SHA1withRSA<br /> Version: 3</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">*******************************************<br /> *******************************************</p>  <p style="margin:0in;font-family:Calibri;font-size:12.0pt">If everything went well, you might have successfully created server.jks and client.jks which can be used to secure Axis2 Services and access those secured services. </p>  </div><img src ="http://www.blogjava.net/dashi99/aggbug/381538.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:15 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381538.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>extreme scale util class</title><link>http://www.blogjava.net/dashi99/archive/2012/06/26/381537.html</link><dc:creator>ゞ沉默是金ゞ</dc:creator><author>ゞ沉默是金ゞ</author><pubDate>Tue, 26 Jun 2012 11:12:00 GMT</pubDate><guid>http://www.blogjava.net/dashi99/archive/2012/06/26/381537.html</guid><wfw:comment>http://www.blogjava.net/dashi99/comments/381537.html</wfw:comment><comments>http://www.blogjava.net/dashi99/archive/2012/06/26/381537.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/dashi99/comments/commentRss/381537.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/dashi99/services/trackbacks/381537.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: The util class to get the object that exists in object grid.Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->package&nbsp;org.duke.xs;import&nbsp;java....&nbsp;&nbsp;<a href='http://www.blogjava.net/dashi99/archive/2012/06/26/381537.html'>阅读全文</a><img src ="http://www.blogjava.net/dashi99/aggbug/381537.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/dashi99/" target="_blank">ゞ沉默是金ゞ</a> 2012-06-26 19:12 <a href="http://www.blogjava.net/dashi99/archive/2012/06/26/381537.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>