Enabling and disabling Java 2 security using scripting

You can enable or disable Java™ 2 security with scripting and the wsadmin tool.

About this task

There are two ways to enable or disable Java 2 security. You can use the commands for the AdminConfig object, or you can use the setAdminActiveSecuritySettings command for the AdminTask object.

Procedure

  1. Use the setAdminActiveSecuritySettings command for the AdminTask object to enable or disable Java 2 security.
    1. Launch the wsadmin scripting tool using the Jython scripting language. See the Starting the wsadmin scripting client article for more information.
    2. Use the getActiveSecuritySettings command to display the current security settings, including custom properties for global security, as the following example demonstrates:
      • Using Jacl:
        $AdminTask getActiveSecuritySettings
      • Using Jython:
        AdminTask.getActiveSecuritySettings()
    3. Use the setAdminActiveSecuritySettings command to enable or disable Java 2 security.
      The following examples enable Java 2 security:
      • Using Jacl:
        $AdminTask setAdminActiveSecuritySettings {-enforceJava2Security true}
      • Using Jython:
        AdminTask.setAdminActiveSecuritySettings('-enforceJava2Security true')
      The following examples disable Java 2 security:
      • Using Jacl:
        $AdminTask setAdminActiveSecuritySettings {-enforceJava2Security false}
      • Using Jython:
        AdminTask.setAdminActiveSecuritySettings('-enforceJava2Security false')
    4. Save the configuration changes.
      請利用下列指令範例來儲存您的配置變更:
      AdminConfig.save()
    5. Synchronize the node.
      請利用 AdminNodeManagement Script 程式庫中的 syncActiveNode 或 syncNode Script,將配置變更傳播給節點。
      • 利用 syncActiveNodes Script,依照下列範例所示,將變更傳播給 Cell 中的每個節點:
        AdminNodeManagement.syncActiveNodes()
      • 利用 syncNode Script,依照下列範例所示,將變更傳播給特定的節點:
        AdminNodeManagement.syncNode("myNode")
  2. Use the AdminConfig object to enable Java 2 security.
    1. 啟動 wsadmin Scripting 工具。
    2. Identify the security configuration object and assign it to the security variable, as the following example demonstrates:
      • Using Jacl:

        set security [$AdminConfig list Security]
      • Using Jython:
        security = AdminConfig.list('Security')
        print security
        Example output:
        (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:

        • Using Jacl:

          $AdminConfig modify $security {{enforceJava2Security true}}
        • Using Jython:
          AdminConfig.modify(security, [['enforceJava2Security', 'true']])
      • To disable Java 2 security:

        • Using Jacl:

          $AdminConfig modify $security {{enforceJava2Security false}}
        • Using Jython:
          AdminConfig.modify(security, [['enforceJava2Security', 'false']])
    4. Save the configuration changes.
      請利用下列指令範例來儲存您的配置變更:
      AdminConfig.save()
    5. Synchronize the node.
      請利用 AdminNodeManagement Script 程式庫中的 syncActiveNode 或 syncNode Script,將配置變更傳播給節點。
      • 利用 syncActiveNodes Script,依照下列範例所示,將變更傳播給 Cell 中的每個節點:
        AdminNodeManagement.syncActiveNodes()
      • 利用 syncNode Script,依照下列範例所示,將變更傳播給特定的節點:
        AdminNodeManagement.syncNode("myNode")

指出主題類型的圖示 作業主題



時間戳記圖示 前次更新: July 9, 2016 11:19
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=txml_javasecurity
檔名:txml_javasecurity.html