Linux SECURITY: Use fail2ban to prevent scanning attacks

Source: Internet
Author: User

Cast_blog

We always think that Linux is safer and the probability of being attacked is lower. If the machine attempts to crack your password on the Internet, even though we have made relevant security settings, however, the password is still tested every day, and it is always uncomfortable to find a tool to check whether there is anything wrong with the password to automatically disable the IP address. This is not the case. I found a small tool named fail2ban. I used the log analysis to automatically ban the hacker's IP address.

In: http://fail2ban.sourceforge.net/rpms/
Find the latest version of the rpm package to install it. After installation, you can change the configuration as needed.

Vi/etc/fail2ban. conf
# Start fail2ban in daemon mode
Background = true
# Allowed attempts
Maxfailures = 3
# The lock time (in seconds) after maxfailures is triggered. If it is set to-1, the lock will be permanently blocked.
Banktime = 3600
# Use the error records in the findtime (second) time as the reference for maxfailures count
Findtime= 600
# Exclude IP ranges and separate them with blank spaces
Ignoreip = 127.0.0.1 192.168.0.0/24
# Disable mail Notification
[MAIL]
Enabled = false
# Modified from VSFTPD. The original settings are maintained for unmentioned parts.
[PROFTPD]
Enabled = true
Logfile =/var/log/proftpd. log
Failregex = no such user | Incorrect password
# Retain the original settings For unmentioned parts
[SSH]
Enabled = true
Logfile =/var/log/secure
Service fail2ban start
After the service is started, you can see that the attacked bot is banned in/var/log/fail2ban. log every day.
09:13:33, 532 WARNING: SSH: Ban (3600 s) 205.189.197.66
12:24:41, 943 WARNING: SSH: Ban (3600 s) 121.52.209.5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.