Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Scripting for security > Configure security with scripting
Enable and disable Java 2 security using scripting
We can enable or disable Java 2 security with scripting and wsadmin.sh.
There are two ways to enable or disable Java 2 security. We can use the commands for the AdminConfig object, or you can use the setAdminActiveSecuritySettings command for the AdminTask object.
Procedure
- Use the setAdminActiveSecuritySettings command for the AdminTask object to enable or disable Java 2 security.
- Launch wsadmin.sh using the Jython scripting language. See the Starting the wsadmin scripting client article for more information.
- Use the getActiveSecuritySettings command to display the current security settings, including custom properties for global security:
### Jacl
$AdminTask getActiveSecuritySettings### Jython
AdminTask.getActiveSecuritySettings()
- Use the setAdminActiveSecuritySettings command to enable or disable Java 2 security.
The following examples enable Java 2 security:
### Jacl
$AdminTask setAdminActiveSecuritySettings {-enforceJava2Security true}### Jython
AdminTask.setAdminActiveSecuritySettings('-enforceJava2Security true')
The following examples disable Java 2 security:
### Jacl
$AdminTask setAdminActiveSecuritySettings {-enforceJava2Security false}### Jython
AdminTask.setAdminActiveSecuritySettings('-enforceJava2Security false')
- Save the configuration changes.
Save the configuration changes:
AdminConfig.save()
- 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:
AdminNodeManagement.syncNode("myNode")
- Use the AdminConfig object to enable Java 2 security.
- Start wsadmin.sh.
- Identify the security configuration object and assign it to the security variable:
### Jacl
set security [$AdminConfig list Security]### Jython
security = AdminConfig.list('Security') print securityExample output:
(cells/mycell|security.xml#Security_1)
- 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']])
- Save the configuration changes.
Save the configuration changes:
AdminConfig.save()
- 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:
AdminNodeManagement.syncNode("myNode")
Use the wsadmin scripting AdminConfig object for scripted administration
Start the wsadmin scripting client using wsadmin.sh
Related
Commands for the AdminConfig object using wsadmin.sh
SecurityConfigurationCommands command group