Source: http://www.hutuworm.org
I. Origin
A headache for Linux system administrators is that they do not know who accidentally runs a Shell program for a specific purpose on the premise that the system is not infiltrated, make the system messy. In addition, the system record shows that this person is using a public account (root or admin). You cannot know which one the person corresponds to in real life.
Ii. Opening
To address the preceding problems, the solution is as follows: first, tracking the time and ip address can track where the person came from based on the time and ip address. This solution can only identify a group of suspicious people headed by someone. If you all connect to the server through a proxy, there will be no better plans except one by one for log query. Second, record the log through authentication in the Shell program to clarify the responsibility.
Iii. Solution
This article uses the checkpassword tool compiled by Qmail author D. J. Bernstein for identity authentication.
1. Download:
Http://cr.yp.to/checkpwd/checkpassword-0.90.tar.gz
2. installation:
Tar xvfz checkpassword-0.90.tar.gz
Cd checkpassword-0.90
Make
Make setup check
3. If the checkpassword of the executable file does not appear in/bin, goto 1
In addition, the following program is complete:
--------------------------------
#! /Bin/sh
#
# Filename: auth. sh
# Author: huuworm
# @ Copyleft 2003 hutuworm.org
#
Function auth_failed (){
Echo "Are you kidding me? "
Exit 1
}
Echo "※※※※※※※※※※※"
Echo "※the pigsty is idle ※"
Echo "※※※※※※※※※※※"
Printf "Enter the account :"
Read ACCOUNT
If [$ ACCOUNT = admin-o $ ACCOUNT = root]
Then
Echo "admin & root are not welcome in this circle! "
Exit 1
Fi
Printf "enter the password :"
Stty-echo
Read PASSWORD
Stty echo
Echo ""
Printf "$ ACCOUNT $ PASSWORDY123456"/bin/checkpassword logger "$ ACCOUNT used auth. sh" 3 <& 0 auth_failed
Echo "welcome to the pig ring affiliated to the busi temple! : P"
--------------------------------
Iv. Acceptance
$ Chmod + x auth. sh
$
$./Auth. sh
※※※※※※※※※※※
※The pigsty is idle ※
※※※※※※※※※※※
Enter the account: huuworm
Enter the password:
Are you kidding me?
$
$./Auth. sh
※※※※※※※※※※※
※The pigsty is idle ※
※※※※※※※※※※※
Enter the account: admin
Enter the password:
Admin & root are not welcome in this circle!
$
$./Auth. sh
※※※※※※※※※※※
※The pigsty is idle ※
※※※※※※※※※※※
Enter the account: huuworm
Enter the password:
Welcome to the pig ring affiliated to the busi temple! : P
$
$ Tail-1/var/log/messages
May 5 13:51:45 huuworm.org May 5 13:51:45 logger: huuworm used auth. sh