The content of the invention
In view of the foregoing deficiencies of prior art, it is an object of the invention to provide one kind based on the Secure Shell association that increases income
The login method and login system of view, for solving the problems, such as to realize that SSH user's login feature cost is higher in the prior art.
In order to achieve the above objects and other related objects, the present invention provides a kind of login based on safety shell protocol of increasing income
Method, the login method based on safety shell protocol of increasing income comprise the following steps:To safety shell protocol application mould of increasing income
Block sends system user information;Linux kernel module verifies the system user information;When linux kernel is to described
After system user information is verified, performs re-direction applications module and logged in realizing.
In one embodiment of the invention, it is described execution re-direction applications module to realize login the step of include:Institute
It states to establish between re-direction applications module and linux kernel and redirects SSH connections;In the re-direction applications module and prefabricated life
It makes and establishes TCP connection between row interface and logged in realizing.
In one embodiment of the invention, length is established between the re-direction applications module and prefabricated Command Line Interface
TCP connection.
In one embodiment of the invention, the login method based on safety shell protocol of increasing income further includes:It is logging in
After linux system, the add-on system user information into linux kernel, the system user information includes:Username and password.
It is described to include into linux kernel the step of add-on system user information in one embodiment of the invention:
The system user information is stored in by linux kernel/etc/shadow and/etc/passwd files in.
In one embodiment of the invention, the system user information is stored in/etc/passwd files by linux kernel
When in folder, the execution program after specified system user information is verified in described/etc/passwd files is described heavy
Orient application module.
The present invention provides a kind of login system based on safety shell protocol of increasing income, described based on safety shell protocol of increasing income
Login system include:It increases income safety shell protocol application module, for reception system user information;Linux kernel, for pair
The system user information is verified;Re-direction applications module verifies the system user information for working as linux system
By rear, perform the re-direction applications module and logged in realizing.
In one embodiment of the invention, the re-direction applications module includes:First redirects unit, for described
It is established between re-direction applications module and linux system kernel and redirects SSH connections;Second redirects unit, for described
TCP connection is established between re-direction applications module and prefabricated Command Line Interface and is logged in realizing.
In one embodiment of the invention, it is described second redirect unit the re-direction applications module with it is prefabricated
Long TCP connection is established between Command Line Interface.
In one embodiment of the invention, the login system based on safety shell protocol of increasing income further includes:User believes
Add module is ceased, for after linux system is logged in, the add-on system user information into linux kernel, the system user to be believed
Breath includes:Username and password.
As described above, the login method and login system based on safety shell protocol of increasing income of the present invention, has with following
Beneficial effect:
The login method based on safety shell protocol of increasing income of the present invention verifies system user information in linux kernel
It by rear, realized and logged in by re-direction applications module, the source code of open source software need not be changed, therefore, after greatly reducing
Grade of continuing rising or the cost of system maintenance.
Specific embodiment
Illustrate embodiments of the present invention below by way of specific specific example, those skilled in the art can be by this specification
Disclosed content understands other advantages and effect of the present invention easily.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also be based on different viewpoints with application, without departing from
Various modifications or alterations are carried out under the spirit of the present invention.It should be noted that in the case where there is no conflict, following embodiment and implementation
Feature in example can be mutually combined.
It should be noted that the diagram provided in following embodiment only illustrates the basic structure of the present invention in a schematic way
Think, then only the display component related with the present invention rather than component count, shape and size during according to actual implementation in schema
It draws, kenel, quantity and the ratio of each component can be a kind of random change during actual implementation, and its assembly layout kenel
It is likely more complexity.
As described in the background art, when being logged at present by SSH or oneself develops SSH agreements or profit
Realized with SSH softwares are increased income, but no matter which kind of mode, the cost of exploitation is all very high, and the scope of application is very limited.
Referring to Fig. 1, the present invention provides a kind of login method based on safety shell protocol of increasing income, it is described based on peace of increasing income
The login method of full shell protocol comprises the following steps:
S11, to increasing income, safety shell protocol application module sends system user information;
S12, Linux kernel module verify the system user information;
S13 after linux kernel is verified the system user information, performs re-direction applications module to realize
It logs in.
Specifically, user establishes SSH with OpenSSH by ssh client software (such as SecureCRT) request and is connected,
During this SSH username and passwords are sent to OpenSSH.
OpenSSH whether there is to linux inquiries user name and whether the password of user name is correct, if incorrect, refuses
The connection request of exhausted user, is otherwise further processed.Specifically, Linux system kernel (linux kernel) is to user
Name and password are verified.
OpenSSH is learning user authentication by rear, and performing RdirectIO application programs, (application program is pre- exploitation
Re-direction applications module).OpenSSH is redirected when performing RdirectIO, so as to fulfill the login of SSH user.
RdirectIO is that realize application program is needed in the present embodiment, and function is with reference to description below.
In the present embodiment, it is described execution re-direction applications module to realize login the step of include:In the redirection
It is established between application module and linux kernel and redirects SSH connections;In the re-direction applications module and prefabricated Command Line Interface
Between establish TCP connection with realize log in.Specifically, established between the re-direction applications module and prefabricated Command Line Interface
Long TCP connection.
In practical applications, OpenSSH creates a pipeline (pipe) when performing RdirectIO.Pass through this pipe
Road, the standard IO of RdirectIO can be redirected to ssh connections.Meanwhile RdirectIO and system customization CLI establishes a tcp
The standard IO of RdirectIO, is redirected to this tcp connection by connection.
That is, the function of RdirectIO is that the input of system customization CLI is redirected to RdirectIO standards is defeated
Go out;Equally, the standard input of RdirectIO is redirected to the output of system customization CLI, it thus can be by determining in system
TCP long connections are established between CLI and RdirectIO processed to realize IO redirection functions here.
Specifically, the realization code of the RdirectIO is:
(Input&Output) processing is redirected by above-mentioned two steps IO, after SSH user is by SSH certification login systems,
The data inputted on ssh client (such as SecureCRT) are by being redirected to twice up to system CLI interfaces;Conversely, system is determined
The data of CLI inputs processed, which also pass through, to be redirected to twice up to ssh client.
Although the data that actually user inputs in SSH connections are to first pass through OpenSSH decryption, the data warp after decryption
System customization CLI is just reached after redirecting twice.But using user perceptually in system, user is to be directly entered to be
System customization CLI interfaces.In system user perceptually, user is to be directly logged onto system customization CLI interfaces.
In order to realize the verification of system user information, in the present embodiment, the stepping on based on safety shell protocol of increasing income
Recording method further includes:After linux system is logged in, the add-on system user information into linux kernel, the system user information
Including:Username and password.
Specifically, it is described to include into linux kernel the step of add-on system user information:Linux kernel is by the system
System user information be stored in/etc/shadow and/etc/passwd files in.Meanwhile linux kernel is by the system user
Information is stored in/etc/passwd files in when, system user information verification is specified in described/etc/passwd files
Execution program after is the re-direction applications module.
In practical applications, increase income OpenSSH user authentication be to linux kernel (linux kernel) verify user
The correctness of name and its password.User is by serial ports login system, when adding SSH user to system simultaneously to linux
Kernel adds the system user of same subscriber name and password.System user and its password are stored in "/etc/ by linux system
In shadow " and "/etc/passwd " two files.
For example, user adds the user of entitled admin for interchanger, switch system is adding the user to itself
When in configuration file, increase the system user of an entitled admin to linux kernel.System user increase successfully after "/
A record is respectively added in etc/shadow " and "/etc/passwd " two files.Add toward "/etc/passwd " file
When adding the record of admin user, the last one ":" content filled in below is being OpenSSH in definite user name and password all just
The application program to be performed after really, what is filled in here is RdirectIO application programs.
Specifically, the realization code of shadow files is:
#cat/etc/shadow
Root:5Gg.mRfhg Iz4g:10925:0:99999:7:::
Sshd:kVsqISda3pms.:0:0:99999:7:::
Admin:IjU5ugwlS2HnY:15357:0:99999:7:::
#
The realization code of passwd files is:
#cat/etc/passwd
Root:x:0:0:root:/root/bin/sh
Sshd:x:1000:1000:sshd privsep:/var/empty:/bin/ssh
Admin:x:1001:1001:Linux User,,,:/home:/mnt/app/RdirectIO
#
OpenSSH can create a pipe when performing RdirectIO application programs between OpenSSH and RdirectIO
Road (pipe).The data that user inputs on ssh client (such as SecureCRT) are managed after OpenSSH is decrypted by this
Road directly reaches RdirectIO.In turn, the standard output of RdirectIO is defeated after OpenSSH is encrypted also by this pipeline
Go out to ssh client.Here processing is completed by OpenSSH open source softwares, need not change OpenSSH source codes.
The login method based on safety shell protocol of increasing income of the present embodiment is completed by prefabricated re-direction applications module
It redirects twice, so as to fulfill the login of SSH user, and the SSH source codes that need not increase income, therefore, greatly reduce rear of continuing rising
Grade or the cost of operation maintenance.
The present invention provides a kind of login system based on safety shell protocol of increasing income, described based on safety of increasing income with reference to figure 2
The login system of shell protocol includes:
It increases income safety shell protocol application module 21, for reception system user information;
Linux kernel 22, for being verified to the system user information;
Re-direction applications module 23, for working as after linux system is verified the system user information, described in execution
Re-direction applications module is logged in realizing.
In the present embodiment, the re-direction applications module 23 includes:First, which redirects unit and second, redirects unit (figure
Not shown in), described first, which redirects unit, is used to establish weight between the re-direction applications module and linux system kernel
Orient SSH connections;The second redirection unit is used to build between the re-direction applications module and prefabricated Command Line Interface
Vertical TCP connection is logged in realizing.Specifically, described second unit is redirected in the re-direction applications module and prefabricated life
It makes and establishes long TCP connection between row interface.
In the present embodiment, the login system based on safety shell protocol of increasing income further includes:User information add module,
For after linux system is logged in, the add-on system user information into linux kernel, the system user information to include:User
Name and password.
The specific implementation process of the login system based on safety shell protocol of increasing income of the present embodiment can refer to previously with regard to
The detailed description of login method based on safety shell protocol of increasing income, details are not described herein.
In conclusion the login method and login system based on safety shell protocol of increasing income of the present invention, using prefabricated
Redirection module realization redirects twice, so as to fulfill the login of SSH user, and need not change SSH source codes of increasing income, so as to
Greatly reduce the cost of subsequent upgrading and operation maintenance.So the present invention effectively overcome it is of the prior art it is a variety of lack
It puts and has high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
Know the personage of this technology all can carry out modifications and changes under the spirit and scope without prejudice to the present invention to above-described embodiment.Cause
This, those of ordinary skill in the art is complete without departing from disclosed spirit and institute under technological thought such as
Into all equivalent modifications or change, should by the present invention claim be covered.