Enable and disable Java 2 security using scripting



Overview

We can enable or disable Java 2 security with scripting and wsadmin.

There are two ways to enable or disable Java 2 security.


Use setAdminActiveSecuritySettings to enable Java 2 security

  1. Launch wsadmin using Jython.

  2. Use the getActiveSecuritySettings command to display the current security settings, including custom properties for global security, as the following example demonstrates:

  3. Use the setActiveSecuritySettings command to enable or disable Java 2 security.

    The following examples enable Java 2 security:

    The following examples disable Java 2 security:

  4. Save the configuration changes...

    AdminConfig.save()

  5. Synchronize the node. Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.

    • Use the syncActiveNodes script to propagate the changes to each node in the cell...

      AdminNodeManagement.syncActiveNodes()

    • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:

      AdminNodeManagement.syncNode("myNode")


Use the AdminConfig object to enable Java 2 security

  1. Launch the wsadmin scripting tool using the Jython scripting language.

  2. Identify the security configuration object and assign it to the security variable...

    • Jacl...

      set security [$AdminConfig list Security]

    • Jython...

      security = AdminConfig.list('Security') print security

      For example...

      (cells/mycell|security.xml#Security_1)

  3. Modify the enforceJava2Security attribute to enable or disable Java 2 security, as the following examples demonstrates:

    • To enable Java 2 security:

      • Jacl...

        $AdminConfig modify $security {{enforceJava2Security true}}

      • Jython...

        AdminConfig.modify(security, [['enforceJava2Security', 'true']])

    • To disable Java 2 security:

      • Jacl...

        $AdminConfig modify $security {{enforceJava2Security false}}

      • Jython...

        AdminConfig.modify(security, [['enforceJava2Security', 'false']])

  4. Save the configuration changes...

    AdminConfig.save()

  5. Synchronize the node. Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.

    • Use the syncActiveNodes script to propagate the changes to each node in the cell...

      AdminNodeManagement.syncActiveNodes()

    • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:

      AdminNodeManagement.syncNode("myNode")

 

Related tasks

Use the AdminConfig object for scripted administration

 

Related

Commands for the AdminConfig object
SecurityConfigurationCommands