Create the policy XML file based on the amadmin.dtd. This file is located in the following directory:
AccessManager-base /SUNWam/dtd.
The following is an example of a policy XML file. This example contains all of the default subject and condition values. For definitions of these values, see Policy Types.
<Policy name="bigpolicy" referralPolicy="false" active="true" > <Rule name="rule1"> <ServiceName name="iPlanetAMWebAgentService" /> <ResourceName name="http://thehost.thedomain.com:80/*.html" /> <AttributeValuePair> <Attribute name="POST" /> <Value>allow</Value> </AttributeValuePair> <AttributeValuePair> <Attribute name="GET" /> <Value>allow</Value> </AttributeValuePair> </Rule> <Subjects name="subjects" description="desccription"> <Subject name="webservicescleint" type="WebServicesClients" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/><Value>CN=sun-unix, OU=SUN Java System Access Manager, O=Sun, C=US</Value> </AttributeValuePair> </Subject> <Subject name="amrole" type="IdentityServerRoles" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/><Value> cn=organization admin role,o=realm1,dc=red,dc=iplanet,dc=com</Value> </AttributeValuePair> </Subject> <Subject name="au" type="AuthenticatedUsers" includeType="inclusive"> </Subject> <Subject name="ldaporganization" type="Organization" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/> <Value>dc=red,dc=iplanet,dc=com</Value> </AttributeValuePair> </Subject> <Subject name="ldapuser" type="LDAPUsers" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/> <Value>uid=amAdmin,ou=People,dc=red,dc=iplanet,dc=com</Value> </AttributeValuePair> </Subject> <Subject name="ldaprole" type="LDAPRoles" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/> <Value>cn=Organization Admin Role,o=realm1,dc=red,dc=iplanet,dc=com</Value> </AttributeValuePair> </Subject> <Subject name="ldapgroup" type="LDAPGroups" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/> <Value>cn=g1,ou=Groups,dc=red,dc=iplanet,dc=com</Value> </AttributeValuePair> </Subject> <Subject name="amidentitysubject" type="AMIdentitySubject" includeType="inclusive"> <AttributeValuePair><Attribute name="Values"/> <Value>id=amAdmin,ou=user,dc=red,dc=iplanet,dc=com</Value> </AttributeValuePair> </Subject> </Subjects> <Conditions name="conditions" description="description"> <Condition name="ldapfilter" type="LDAPFilterCondition"> <AttributeValuePair><Attribute name="ldapFilter"/> <Value>dept=finance</Value> </AttributeValuePair> </Condition> <Condition name="authlevelge-nonrealmqualified" type="AuthLevelCondition"> <AttributeValuePair><Attribute name="AuthLevel"/> <Value>1</Value> </AttributeValuePair> </Condition> <Condition name="authlevelle-realmqaulfied" type="LEAuthLevelCondition"> <AttributeValuePair><Attribute name="AuthLevel"/> <Value>/:2</Value> </AttributeValuePair> </Condition> <Condition name="sessionproperties" type="SessionPropertyCondition"> <AttributeValuePair><Attribute name="valueCaseInsensitive"/> <Value>true</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="a"/><Value>10</Value> <Value>20</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="b"/><Value>15</Value> <Value>25</Value> </AttributeValuePair> </Condition> <Condition name="activesessiontime" type="SessionCondition"> <AttributeValuePair><Attribute name="TerminateSession"/> <Value>session_condition_false_value</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="MaxSessionTime"/> <Value>30</Value> </AttributeValuePair> </Condition> <Condition name="authelevelle-nonrealmqualfied" type="LEAuthLevelCondition"> <AttributeValuePair><Attribute name="AuthLevel"/> <Value>2</Value> </AttributeValuePair> </Condition> <Condition name="ipcondition" type="IPCondition"> <AttributeValuePair><Attribute name="DnsName"/> <Value>*.iplanet.com</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="EndIp"/> <Value>145.15.15.15</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="StartIp"/> <Value>120.10.10.10</Value> </AttributeValuePair> </Condition> <Condition name="authchain-realmqualfied" type="AuthenticateToServiceCondition"> <AttributeValuePair><Attribute name="AuthenticateToService"/> <Value>/:ldapService</Value> </AttributeValuePair> </Condition> <Condition name="auth to realm" type="AuthenticateToRealmCondition"> <AttributeValuePair><Attribute name="AuthenticateToRealm"/> <Value>/</Value> </AttributeValuePair> </Condition> <Condition name="authlevelge-realmqualified" type="AuthLevelCondition"> <AttributeValuePair><Attribute name="AuthLevel"/> <Value>/:2</Value> </AttributeValuePair> </Condition> <Condition name="authchain-nonrealmqualfied" type="AuthenticateToServiceCondition"> <AttributeValuePair><Attribute name="AuthenticateToService"/> <Value>ldapService</Value> </AttributeValuePair> </Condition> <Condition name="timecondition" type="SimpleTimeCondition"> <AttributeValuePair><Attribute name="EndTime"/> <Value>17:00</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="StartTime"/> <Value>08:00</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="EndDate"/> <Value>2006:07:28</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="EnforcementTimeZone"/> <Value>America/Los_Angeles</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="StartDay"/> <Value>mon</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="StartDate"/> <Value>2006:01:02</Value> </AttributeValuePair> <AttributeValuePair><Attribute name="EndDay"/> <Value>fri</Value> </AttributeValuePair> </Condition> </Conditions> <ResponseProviders name="responseproviders" description="description"> <ResponseProvider name="idresponseprovidere" type="IDRepoResponseProvider"> <AttributeValuePair> <Attribute name="DynamicAttribute"/> </AttributeValuePair> <AttributeValuePair> <Attribute name="StaticAttribute"/> <Value>m=10</Value> <Value>n=30</Value> </AttributeValuePair> </ResponseProvider> </ResponseProviders> </Policy>
Once the policy XML file is developed, you can use the following command to load it:
AccessManager-base/SUNWam/bin/amadmin --runasdn "uid=amAdmin,ou=People,default_org, root_suffix" --password password --data policy.xml |
To add multiple policies simultaneously, place the policies in one XML file, as opposed to having one policy in each XML file. If you load policies with multiple XML files in quick succession, the internal policy index may become corrupted and some policies may not participate in policy evaluation.
When creating policies through amadmin, ensure that the authentication module is registered with the realm while creating authentication scheme condition; that the corresponding LDAP objects realms, groups, roles and users) exist while creating realms, LDAP groups, LDAP roles and LDAP user subjects; that Access Manager roles exist while creating IdentityServerRoles subjects; and that the relevant realms exist while creating sub realm or peer realm referrals.
Please note that in the text of Value elements in SubrealmReferral, PeerRealmReferral, Realm subject, IdentityServerRoles subject, LDAPGroups subject, LDAPRoles subject and LDAPUsers subject need to be the full DN.