A kind of method of the cluster management system authentication and authorization based on JAAS and AspectJ
1, technical field
The present invention relates to a kind of Computer Applied Technology, the safe practice in the cluster management specifically, or relate to a kind of method of the cluster management system authentication and authorization based on JAAS and AspectJ.
2, background technology
A group of planes is exactly by high performance network or local area network that one sets of computer system (node) is interconnected, the computer cluster system of the high-performance with single system mapping of formation, high available, enhanced scalability, high performance price ratio.Because it is with respect to the high availability of traditional large-scale computer and the advantage of low price, become a kind of popular trend with group of planes structure supercomputer or superserver.But Network of Workstation is loosely organized, node independence is strong, network connect complicated, and, along with the increase of nodal point number, to a group of planes administer and maintain the more and more difficult of change, increased the TCO of system.
In order to administer and maintain Network of Workstation, popular mode is to build one deck operating system software again to manage a whole group of planes on the operating system of each node computer at present, is referred to as PC cluster or is called cluster management system.Cluster management system is the part of Network of Workstation software, almost is in the top layer of systems soft ware, and it plays managerial role to soft, the hardware of a whole group of planes, for the system manager and the end user of a group of planes provides service.Basic characteristics of Network of Workstation are " whole systems present to the user be the reflection of triangular web ", the control support of management system overall processes such as the planning that cluster management comprises on the single control desk a group of planes for the realization of this target should be provided at, installation, configuration, monitoring, regular maintenance, start and close.Cluster management system should provide multi-functional, the easy use of a cover, extendible practicability management tool, helps the keeper to monitor the operating state of a whole group of planes, guarantees efficient, the stable operation of Network of Workstation.
Because management system can be managed soft, the hardware resource of a whole group of planes, when the management system convenience is provided, also increased the risk of system safety aspect, if there is not the administrative mechanism of user's authentication and authorization, the user of management system is the resource of operating system arbitrarily, brings infringement for the safety of system.The management function of a group of planes is abundant unusually, administration order reaches up to a hundred, while is according to user's requirement, may add new management function at any time, new authentication method, change the authority of different user on different node, these flexibilities that require for management system authentication and mandate are very large challenges.
3, summary of the invention
For the method and the closely-coupled problem of management function that exist in the present cluster management about authentication and authorization, Function Coupling problem together for the exploitation and the authentication and authorization of Functions of Management System, the personnel of development management function need embed the logic of authentication and authorization in the code of oneself, and because the node of group of planes particularity independently, each administration order has different authority problems on different nodes.At the problems referred to above, the present invention proposes a kind of method based on authentication and authorization in the cluster management system of JAAS and AspectJ with the java language development, this method can be utilized the technical characteristic of JAAS and AspectJ, need in common administration order, not embed the authentication and authorization code, just can implementation method rank and other authentication of node level and access control, realized the service logic of management system and the loose couplings of security logic, simplified the development of Management System complexity, demand for security more flexibly is provided.
Purpose of the present invention is put forward a kind of method based on authentication and authorization in the cluster management system of JAAS (Java Authentication AuthorizationService) and AspectJ, this method can be utilized JAAS and AspectJ characteristic, need in common administration order, not embed the authentication and authorization code, just can implementation method rank and other authentication of node level and access control, realized the service logic of management system and the loose couplings of security logic.
Cooperatively interact by JAAS program and AspectJ program the logic of authentication and authorization is separated from system program, and utilize the configuration file configure user authentication and authorization information of JAAS program, and utilize the AspectJ compiler that the generic logic of authorization logic and cluster management system is coupled the user is carried out authentication and authorization, this method may further comprise the steps:
A, JAAS program are that each node in the Network of Workstation is provided with different identifiers respectively, are that accessed system resource is distinguished by unit with node in the Network of Workstation then;
B, JAAS program are that cluster management system setting user is by name unique by the entity of distinguishing authentication with the user, by the software that calls cluster management system the user are carried out distinguishing authentication;
C, the user authentication information that utilizes the JAAS program and authorization message configurability are separated user's authentication and authorization logic variation from the logic of general management system;
D, utilize the technique of compiling of AspectJ program that authorization check is coupled in the general service logic, utilize node sign, user name and incision method name information to finish execution scope check incision method.
It is that the resource units sign is distinguished resource that the JAAS program is also utilized the node group of forming with some nodes in the Network of Workstation.
Utilize the configuration file configure user of JAAS program the user to be carried out authentication and authorization in the different management function of different node execution, such as: means such as interpolation/deletion user, start/shutdown, network configuration are carried out authentication and authorization to the user.
Context, node title, method name that the JAAS program utilizes the user to login, inspection different user are carried out the authority of different operating the user are carried out authentication and authorization on different node.
Utilize the user authentication information and the authorization message configurability of JAAS program, user's authentication and authorization logic variation is separated from the logic of general management system;
Utilize the configuration file of JAAS program to realize multiple authentication method and delegated strategy separating from the general-purpose system programmed logic, promptly not in the logic writing system program of authentication and authorization, but the logic of authentication and authorization is write in the configuration file, read configuration file by system program, according to the authentication and authorization that the requirement of configuration file is correlated with, the coupling of deactivation system management logic and multiple authentication and authorization logic.
The AspectJ program is utilized the Aspect-oriented programming technology, separate concrete general-purpose system management logic and security logic, the authentication and authorization logic is separated from concrete system management function, removed the coupling of each concrete system management function and Certificate Authority.
Embodiment
In the method for the invention, utilize the configuration file of JAAS program to realize multiple authentication method and delegated strategy separating from the general-purpose system programmed logic, promptly not in the logic writing system program of authentication and authorization, but the logic of authentication and authorization is write in the configuration file, read configuration file by system program, according to the authentication and authorization that the requirement of configuration file is correlated with, the coupling of deactivation system management logic and multiple authentication and authorization logic.
In the method for the invention, the AspectJ program is utilized the Aspect-oriented programming technology, separate concrete general-purpose system management logic and security logic, the authentication and authorization logic is separated from concrete system management function, remove the coupling of each concrete system management function and Certificate Authority.
Embodiment
1) in advance for each node in the group of planes is provided with different identifiers respectively, can be machine name, IP address etc., note be nodeName;
2) user of management system is with the unique differentiation of user name in the group of planes, and note is userName;
3) utilize the user authentication information and the authorization message configurability of JAAS program, user's authentication and authorization logic is changed from the logic of general management system, separate;
Utilize JAAS, realize the flexible configuration of authentication and authorization, authentication is confirmed whether validated user of user by checking user password; Authorize, confirm whether the user can carry out associative operation; Concrete configuration is as follows:
A, configure user authentication document, the LoginModule class name that the bright login of document is used, such is used to finish user's certification work, and the configuration of this document meets the policy definition file format of JAAS;
As:
MySecurity{
MyLoginModule?required;
};
This configuration file has defined with MyLoginModule and has been responsible for the authenticated user identity, and such can use the method for various authenticated user, goes to check whether the user can be certified.
B, configure user operating right file, form is as follows:
grant?MyPrincipal″User1″
{
permission?NodePermission″nodeName1″;
permission?NodePermission″nodeName2″;
permission MethodPermission ″void shutDown(String,
LoginContext)″;
permission?MethodPermission″void?addUser(String,LoginContext)″;
};
This document has been realized at different user (as User1) by the strategy file that JAAS provides, on different node (as nodeName1), has been carried out the purpose of different operating (as shutDown).Defined user User1 from strategy file and can carry out shutDwon (shutdown command) as above at nodeName1 and nodeName2.ShutDown (String, LoginContext) parameter of the String type in is the title of node, as nodeName1, the parameter place of LoginContext type is the login context of login user, is used to preserve user's identity information.
4) utilize definition of AspectJ aspect and AspectJ compiler, the authentication and authorization logic is come out from common management system logical separation, concrete steps are as follows:
A, definition cutting point MyAuthorization, this MyAuthorization is defined as
public?aspect?MyAuthorization
{
// definition cutting point; Node is the title of the node of operation, and lc is the context ring of user's login
The border is used to distinguish the user
pointcut Authorization (String node, LoginContext
lc)(args(node,lc)&&execution(**(..));
// following the program segment of execution before the method for incision is carried out:
before(String?node,LoginContext?lc):Authorization(node,lc)
{
The name of the method that // acquisition is cut
String methodName
thisJoinPointStaticPart.getSignature().toString();
// login environment, node name and method name according to the user, carry out scope check:
String?methodName=
thisJoin
StaticPart.getSignature().toString();
Subject.doAsPrivileged(lc.getSubject(),new
AuthPrivilegedAction(node,methodName));
}
}
Above code sample, pointcut Authorization place code has been realized the definition of incision method, before (String node, LoginContext lc) locates to have defined and before the method for carrying out incision, carry out the Subject.doAsPrivileged action, whether can carry out this method according to user, node and the checking of method name.
B, this MyAuthorization and relevant general service logic class are utilized the compiling of AspectJ compiler, authentication logic is coupled in the general service logic goes.
Utilize the crosscut technology of AspectJ, by a and two steps of b, we needn't be as embedding Subject.doAsPrivileged (lc.getSubject () in concrete service logic in the shutDown method, newAuthPrivilegedAction (node, methodName)) such authorization code, can indicate the title of the method that we will cut by definition aspect MyAuthorization, utilize authorization logic the AspectJ compiler to be coupled to and to carry out in the method for authorization logic.
Precondition is, is coupled the title that will comprise the node of String type in the parameter of method, is used for importing into the node title, checks the authority whether manner of execution on this node is arranged; The parameter of LoginContext type is used for passing to the context environmental that the authorization check function provides user's login.
By technical scheme of the present invention as seen, the present invention utilizes JAAS and AspectJ technology to realize a kind of authentication and authorization method at cluster management system.This method utilizes JAAS to realize the flexible configuration in method rank and node level security of authentication and authorization.Utilize AspectJ to realize general management logic and security logic loose couplings, can be implemented in the convenient authorization check that adds in the general management method, solved the authentication and authorization problem of cluster management system self well.