GlassFish Server Open Source Edition 3.1 Clustering Security SpecificationThis page describes how security related artificats are managed in a GlassFish V3.1 Cluster using the framework defined by the Clustering Design Spec.
1. IntroductionThere are the following primary things that need to tracked in the overall clustering design spec from a security module perspective. Some of the other critical aspects of a clustered runtime such as Session Replication and High Availability, HTTP-Loadbalancing for secure requests are handled by the WebTier and LB Modules, see Clustering Availability. The Load balancing and FailOver of Secure IIOP messages is managed by the IIOP team, but it is expected that the security module may have to restructure some of its CSIv2 handling code (more details on this below).
2. Dynamic Re-ConfigurationDynamic reconfiguration deals with how CLI commands (for example, asadmin create-file-user some-options --target some-target) from user to DAS gets reflected in the server instance (if the user specified target is a server instance) or all server instances that are part of the cluster (if user specified target is a cluster). The --target option would be supported for the following security related CLI commands supported in V3.0. change-master-password, create-audit-module, delete-audit-module, list-audit-modules, create-auth-realm, delete-auth-realm, list-auth-realms, create-file-user, delete-file-user, update-file-user, list-file-users, list-file-groups, create-message-security-provider, delete-message-security-provider, list-message-security-providers, create-password-alias, delete-password-alias, update-password-alias, list-password-aliases, change-admin-password, login. 3. Data SynchronizationThe need for data sychronization is generally the consequence of deploying an application or running any of the above commands in a cluster. 3.1 Synchronization of Security Related Server ConfigurationThe following security related configuration elements need synchronization when running inside a cluster. 1. Changes to <security-service> element in domain.xml
(1) will happen as a natural consequence of replicating admin commands to be executed on the server instances. Prior to V3 there was a single JSR-115 Provider and pluggability was not addressed. Since we now support pluggability of JACC providers and two supported providers exist by default (under the security-service), there is a need for new CLI commands to create-jacc-provider, delete-jacc-provider, update-jacc-provider. So any addition or deletion or updation of jacc-provider element would require manual synchronization of security-service element or domain.xml as a whole. We do not envision this as a very important usecase though, since it is very rare that someone will change the JACC provider or add a new one. (2) - (7) will be synchronized at server startup. If (2) - (7) are modified as a consequence of an admin command, executing the same command on the instances should result in the same updates to the files on the instance. If (2) - (7) are modified "manually", without going through the server, nothing is going to synchronize them. We might need a command to force synchronization of such files, and we do not plan to have such a command for V3.1 release, since the user can be asked to use the admin-cli command instead. However (5) and (6) are an exception here, there are no CLI commands that allow updation or modification of login.conf and server.policy files today. This means that we may require a general file sychronization facility, which can be used to propagate changes to these files. 3.1.1 Handling Changes to the ConfigurationThe next question when there is a configuration change is whether the server is prepared to handle changes to these files made by some other program without requiring a server-restart Or will we need to restart a server instance to pick up external changes in these files ?. The Security runtime cannot handle all such updates in (1)-(7) without requiring a restart. Specifically changes to the following cannot be handled without a restart :
3.2 Synchronization of Application Policy Files generated by the JACC Provider(s)3.2.1 Policy ProvidersWe have two policy-providers in GFV3, the first one is the provider which existed for a long time and which generates persistent policies onto the disk. The second provider which is new in GFV3 is an in-memory provider which does not generate any policies but would do policy-translation everytime the application is loaded on an instance. So it is desirable that the approach we take for handling generated policies be Provider Agnostic. 3.2.2 Two Approaches being discussed1. V2-Model : Synchronize the generated bits as well as the application bits and do a partial deployment on instances. Apparently the current decision made for GlassFish V3.1 is to follow option (1), the V2-Model. 3.2.3 Current Code for PolicyGeneration in V3 : Single InstanceThe code is Event Driven, based on events from Deployment system and the special event WebBundleDescriptor.AFTER_SERVLET_CONTEXT_INITIALIZED_EVENT. The reason we are using the event model as opposed to having code inside the overridden generateArtifacts() method of the SecurityDeployer is because in JavaEE 6 a ServletContextListener can inject policy once it is initialized and so the policies cannot be committed (or written to disk in case of a persistent provider) until all the ServletContext Listeners have been initialized. A Sample (demonstrating the working of the code) for a simple .war deployment is as below :
Given the current code it appears from a discussion with deployment team that none of these events would be raised during the partial deployment on the DAS (unless the DAS itself is a target). The three events above are raised while loading the application. 3.2.4 What are the implications of this ?.The net effect seems to be that even though we will follow the V2-Model, w.r.t Security Policies the system would behave as if we have the Alternate-Model.
3.2.5 Handling UndeployIt appears the model for V3.1 is reverse of V2. In v2, when an application is undeployed, the application is first unloaded/undeployed from instances, and then undeployed from DAS. With the new 3.1 command replication framework, the decision seems to be undeploy from DAS first, and then undeploy from instances. The SecurityDeployer and EJBDeployer will use the clean() methods being called on the DAS and the instances to handle the undeployment of generated security-policies. Listening to APPLICATION_CLEANED events is probably unsuitable here since it is too late to fail an undeployment after APPLICATION_CLEANED (It appears APPLICATION_CLEANED is not being sent at all from the code). 3.2.6. Handling Disable and EnableIt appears in V3.0.1 and current V3.1 codebase the Disable of an EJB App (unload()) does not destroy the corresponding the EJBSecurityManagers. This needs to be fixed as part of the larger design for Clustered V3.1. The SecurityDeployer and EJBDeployer would listen to Deployment.MODULE_UNLOADED and MODULE_LOADED events on the instances to handle Disable and Enable of modules in a clustered application. We could also just depend on unload() methods being called on the cluster instances to disable (destroy the security managers) the application and the code that exists today already makes use of MODULE_LOADED events to enable the SecurityManager's for the application. 3.2.7 ConclusionThough the General model being followed in V3.1 for generated artifacts seems to be the V2-Model, it will not work for the generated Security Policy Files of the Applications for reasons explained above. If it turns out that Cluster Deployment Performance is an issue due to this then we need to investigate other possibilities for V3.2. The fact that the Security Deployer in V3 uses Events would allow it to safely generate the policies on the individual instances and the whole thing should work (despite the V2-Model for the rest of the system). There is code in EJBDeployer where we currently do Security related Policy-Translation (not generation) during the generateArtifacts() call. This needs to be changed to follow the same model as in SecurityDeployer. The EventListener should look for MODULE_LOADED event to do policy translation for the EJB modules. In terms of what is desirable for a cluster, it appears policies should just be available in a central repository and made Highly-Available so instances can get them when needed. The servlet-context-listener in JavaEE 6 does add complexity to this, specifically can the servlet-context-listeners be executed only once on the DAS if we are using the V2-Model (This seems unlikely)?. 4. LoadBalancing and Failover of Secure IIOP MessagesThe main issue is that IIOP FOLB has never worked with CSIv2 in GlassFish V1.X/V2.X. During the Milestone Planning meetings it was indicated that since EJB's are generally not Tier-1 objects so support for CSIv2 FOLB is no longer a release driver. However the ORB team has planned on restructuring the ORB code in order to better integrate with CSIv2. Part of the restructuring would include moving some of the CSIv2 interfaces which currently lie in the Security Module into the ORB. More details on this task can be found in the IIOP FOLB OnePager for V3.1. 5. Verify the alternate In-Memory JACC Provider works properly in Clustered ModeThis is more of a testing and bug-fixing task where we try to enable the alternate "In-Memory" JACC Provider in clustered mode and ensure things are working fine. 6. New CLI CommandsThe following new Security related CLI commands can be envisioned based on what has been described above. 1. A command to force synchronization of server.policy file modified manually on the DAS to the instances.
create-jacc-provider --policyconfigfactoryclass pc_factory_class --policyproviderclass pol_provider_class [--help] [ --property (name=value)[:name=value]*] [ --target target_name] jacc_provider_name
delete-jacc-provider [--help] [ --target target_name] jacc_provider_name
list-jacc-providers [--help] [ --target target_name] While (1) and (2) seem more important, support for (3) would be considered lower priority (P3) for GFV3.1 release. The new CLI command for handling (1) and (2) could have a structure as follows (but would like to finalize based on comments from Reviewers, it appears one can levarage a command which has a much wider scope than just handling server.policy and login.conf) : synchronize-config [--help] config_name The command when executed on the DAS would copy-over the named configuration artifact from the DAS to the instances. |