z/TPF security manager for Java
By default, IBM® Semeru Runtime Certified Edition for z/TPF is configured with a customized version of the Java security manager enabled. The z/TPF security manager enforces the class loading restriction, which is set up to prevent unauthorized Java classes from creating a Java™ class loader.
Introduction to the class loading restriction
Java class and archive files (.class and .jar files) are composed of Java bytecode instructions that define Java classes. These classes are loaded to the Java virtual machine (JVM) by using a class loader. In general, the z/TPF loader is used to load Java class and archive files to the z/TPF file system and the class loaders read the class and archive files from the file system. By using the z/TPF loader, you can enforce audit procedures, such as controlling what files are loaded to your z/TPF system and requiring the approval of a system operator.
Java applications can create their own class loaders. The applications can use the class loaders to dynamically load classes from any location including network connections. The class loading restriction of the z/TPF security manager is used to prevent an application from creating new class loaders and dynamically loading Java classes to a running Java application. By restricting the capability to dynamically load Java classes to a JVM, the z/TPF system is less exposed to vulnerabilities that might be introduced by this functionality.
Bypass the restriction
Some applications might create class loaders as part of their normal function. For example, some Java packages, such as the Spring Framework and WebSphere® Liberty create class loaders to dynamically load and manage classes as part of their frameworks. In addition, you might need to build your own class loaders to manage loading components.
In these cases, you can use the z/TPF security manager configuration file to bypass the restriction and allow specific classes to create class loaders. The z/TPF security manager contains some predefined classes that can create a class loader. These classes are used by the z/TPF application manager for Java (JAM) and can be used in applications.
Create a configuration file
# 2/14/2017 java install - authorized class loaders for JAMs
java.util.ResourceBundle$RBClassLoader$1
sun.reflect.ClassDefiner$1
java.lang.ThreadCustomize the configuration file
Exception in thread "main" java/lang/SecurityException:
Unauthorized class loader creation from java.lang.Thread
at com/ibm/tpf/TPFSecurityManager.checkCreateClassLoader (TPFSecurityManager.java:79)
at java/lang/ClassLoader.<init> (ClassLoader.java:216)
at java/lang/ClassLoader.<init> (ClassLoader.java:197)
at java/lang/ClassLoader.initializeClassLoaders (ClassLoader.java:176)
at java/lang/Thread.initialize (Thread.java:370)
at java/lang/Thread.<init>(Thread.java:133)Customize the Java security manager settings
- Specify the
-Djava.security.manager=usersecurityclassoption in the options.default configuration file, where usersecurityclass is the class name that you want to use as the Java security manager. - Enter the ZFILE java command
with the
-Djava.security.manager=usersecurityclassoption specified when you start the JVM.
To globally disable the z/TPF security manager, you must remove the
-Djava.security.manager=com.ibm.tpf.TPFSecurityManager option from the
options.default configuration file, which is in the
/sys/tpf_pbfiles/opt/ibm/ibm-semeru-certified-11-jdk/lib
directory.
- Enter the ZFILE java command with the
-Djava.security.manager=com.ibm.tpf.TPFSecurityManageroption specified for your JVMs. - Add the
-Djava.security.manager=com.ibm.tpf.TPFSecurityManageroption to the <JVMCommandLineOption> element for your JAM descriptors.