Contained WithinFind More DocumentationFeatured Support Resources | Download this book in PDF (1891 KB)
11.3 Fine-Grained SecurityYou can implement a more fine-grained level of security in your connectors by managing user access through the Java Authentication and Authorization Service (JAAS) and Java 2 platform Standard Edition (J2SE) Security Architecture. JAAS and J2SE security is based on the use of security managers and policy files to allocate different levels of access to different users. Consequently, you can decide more precisely which users are allowed to perform which operations. The two examples in this section are very similar to those shown in 11.1 Simple Security, with the difference being that, in addition to SSL encryption, the simple, file-based access control has been replaced by policy-based access control. 11.3.1 RMI Connector With Fine-Grained SecurityYou can find an example of an RMI connector with fine-grained security in the directory examplesDir/current/Security/rmi/fine_grained. The Server class used in this example is very similar to the one used in the RMI connector example with simple security. The only difference is that there is no access.properties file to map into the environment map in the fine-grained example. This was omitted so as not to make the example overly complicated. Otherwise, all the other classes and files used in this example are the same as those used in 11.1.1 RMI Connectors With Simple Security, with the exception of the java.policy file, which is shown below. Example 11–7 A java.policy File for an RMI Connector With Fine-Grained Securitygrant codeBase "file:installDir/lib/jmx.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:installDir/lib/jmxremote.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:server" {
permission java.security.AllPermission;
};
grant codeBase "file:mbeans" {
permission javax.management.MBeanTrustPermission "register";
};
grant principal javax.management.remote.JMXPrincipal "username" {
permission javax.management.MBeanPermission "*", "getDomains";
permission javax.management.MBeanPermission
"SimpleStandard#-[-]", "instantiate";
permission javax.management.MBeanPermission
"SimpleStandard#-[MBeans:type=SimpleStandard]",
"registerMBean";
permission javax.management.MBeanPermission
"SimpleStandard#State[MBeans:type=SimpleStandard]",
"getAttribute";
permission javax.management.MBeanPermission
"SimpleStandard#State[MBeans:type=SimpleStandard]",
"setAttribute";
permission javax.management.MBeanPermission
"SimpleStandard#-[MBeans:type=SimpleStandard]",
"addNotificationListener";
permission javax.management.MBeanPermission
"SimpleStandard#reset[MBeans:type=SimpleStandard]",
"invoke";
permission javax.management.MBeanPermission
"SimpleStandard#-[MBeans:type=SimpleStandard]",
"removeNotificationListener";
permission javax.management.MBeanPermission
"SimpleStandard#-[MBeans:type=SimpleStandard]",
"unregisterMBean";
permission javax.management.MBeanPermission
"javax.management.MBeanServerDelegate#
-[JMImplementation:type=MBeanServerDelegate]",
"addNotificationListener";
permission javax.management.MBeanPermission
"javax.management.MBeanServerDelegate#
-[JMImplementation:type=MBeanServerDelegate]",
"removeNotificationListener";
};
The java.policy file shown in Example 11–7 grants the following permissions:
To Run the RMI Connector Example With Fine-Grained SecurityRun this example from within the examplesDir/current/Security/rmi/fine_grained directory.
11.3.2 JMXMP Connectors With Fine-Grained SecurityThe example of JMXMP connectors with fine-grained security is mostly identical to the example of a simple secure JMXMP connector. The only difference is in the java.policy file used to grant permissions. The java.policy file is in turn mostly identical to the one used in 11.3.1 RMI Connector With Fine-Grained Security, except for the addition of a codebase for SASL, as shown below. Example 11–8 A java.policy File for a JMXMP Connector With Fine-Grained Securitygrant codeBase "file:installDir/lib/jmx.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:installDir/lib/jmxremote.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:installDir/lib/jmxremote_optional.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:installDir/lib/sasl.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:installDir/lib/sunsasl.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:installDir/lib/jdmkrt.jar" {
permission java.security.AllPermission;
};
grant codeBase "file:server" {
permission java.security.AllPermission;
};
[...]
This java.policy file grants the following permissions:
To Run the JMXMP Connector Example With Fine-Grained SecurityRun this example from within the examplesDir/current/Security/jmxmp/fine_grained directory.
|
|||||||