Use DenyHosts to perform automatic screen ip function. It is necessary to master the installation of DenyHosts in Linux system. How to install DenyHosts tool in Linux system? How to configure after installation? This is what users need to learn.
denyhosts is a security tool, written in Python for server access logs to monitor, prevent virtual dedicated server brute force attacks. The project works by prohibiting IP addresses that fail more than a certain number of failed login attempts.
Step one, install denyhosts
Yes, denyhosts are easy to install on Ubuntu
sudo apt-get install denyhosts
Once the program is downloaded, Denyhosts will be automatically installed and configured on your VPS.
Step 2: Whitelist IP Address
In your installed denyhosts, be sure to whitelist your own IP address. Skip this step will put you at risk of locking yourself out of your own machine.
Open the list of hosts allowed in your VPS:
sudo nano /etc/hosts.allow
According to the description, no IP address can be added from the server. You can write on each separate line using this format:
sshd: yourip
After making any changes, be sure to restart denyhosts to make the new settings take your virtual Effects on a dedicated server:
sudo /etc/init.d/denyhosts restart
Step 3 (Optional) Configured denyhosts
Yes, denyhosts are always available, As long as the installation is over.
However, if you want to customize the behavior of your VPS's denyhosts, you can make changes in the DenyHost configuration file:
sudo nano /etc/denyhosts.conf
DenyHosts parameter configuration
# cd /usr/share/denyhosts/#DenyHosts default installation directory
# cp denyhosts.cfg-dist denyhosts.cfg
# vi denyhosts.cfg #DenyHostsConfiguration File
SECURE_LOG = /var/log/secure #sshLog File
# format is: i[dhwmy]
# Where i is an integer (eg 7)
#m = minutes
#h = hours
#d = days
# w = weeks
# y = years
#
# never purge:
PURGE_DENY = 50m #Clean up blocked IP
HOSTS_DENY = /etc/hosts. Deny # will block IP writes to hosts.deny
BLOCK_SERVICE = sshd #block service name
DENY_THRESHOLD_INVALID = 1 #allow invalid user login failures
DENY_THRESHOLD_VALID = 10 #Number of failed login attempts for ordinary users
DENY_THRESHOLD_ROOT = 5 #Number of failed login attempts allowed
WORK_DIR = /usr/local/share/denyhosts/data #登登的host or ip记录To Work_dir
DENY_THRESHOLD_RESTRICTED = 1 #Set deny host Write to this folder
LOCK_FILE = /var/lock/subsys/denyhosts #Write the pid record started by DenyHOts to LOCK_FILE, It has been ensured that the service starts correctly and prevents multiple services from being started at the same time.
HOSTNAME_LOOKUP=NO #Do you want to do domain name resolving
ADMIN_EMAIL = #Set administrator email address
DAEMON_LOG = /var/log/denyhosts #自己的日志文件
DAEMON_PURGE = 10m #This is the same as PURGE_DENY and also the time to clear the hosts.deniedssh user.
DenyHosts startup file configuration
# cp daemon-control-dist daemon-control
# chown root daemon-control
# chmod 700 daemon-control
# . /daemon-control start #Start DenyHosts
#ln -s /usr/share/denyhosts/daemon-control /etc/init.d #software connection to daemon-control for easy management
Installation to this step is complete.
#/etc/init.d/daemon-control start #Start denyhosts
#chkconfig daemon-control on #设置denghosts is set to boot
Add to auto restart
# vi /etc/rc.local
Add the following command
/usr/share/denyhosts/daemon-control start
View Attacks Ip record
# vi /etc/hosts.deny
The above is the introduction of the Linux installation and configuration of DenyHosts. After configuring the DenyHosts tool, you can use DenyHosts to analyze the log files. .
If the Linux system crashes, the data inside will be lost. Serious damage to the database, learn how
Ubuntu 12.04 has a lot of problems when installing Xen, in order to avoid the same mistakes in the i
On Linux systems, both cal and ncal commands use the calendar to display the calendar. Because these
In Linux, there are many ways to back up the system. In addition to using the backup tool, you can a
How to use the tar command correctly under Linux system
The Linux find command combined with xargs method
How to use regular expressions in Linux system
How to use the command line to change the date and time of the Linux system
How does Ubuntu automatically switch between the mouse and the shared clipboard under VirtualBox?
Detailed steps for mounting Windows shared files in Linux
Steps to back up Ubuntu system
RPM Software Package Operation Guide
How to use AWK regular expressions under Linux system
What should I do if the error occurs when CentOS 5.4 adds or removes an application?
Do we really need anti-virus software?
How to migrate the win10 system to a solid state drive?
How does the Win8 system use the file record function to recover accidentally deleted files?
What kind of game can I play with computer memory 256mb (after sharing)
Windows XP Six Tips Latest Application Tips
Cleverly solve the problem that IE can't be used normally in Win8
Reloading a rookie with a 360 computer can also be loaded with Win 7
Win7 firewall prohibits other hosts from accessing the local port