SSH Security Protection notes

Source: Internet
Author: User

 

1

 

Use IPTABLES

 

The command is as follows: iptables-a input-p tcp-s 192.168.1.1-j ACCEPT allows access to 192.168.1.1 (domain name can also be used)

 

Iptables-a input-p tcp -- dport 22-j DROP

 

2

 

 

 

Use the files under/etc/hosts. *

 

/Etc/hosts. allow and/etc/hosts. deny files

 

Add a rule in/etc/hosts. allow.

 

 

 

Vim hosts. allow

 

#

 

Sshd: 192.168.1.1

 

#

 

Vim hosts. deny

 

#

 

Sshd: all

 

#

 

 

 

The above means that only 192.168.1.1 is allowed

 

 

 

Iptables-a input-p tcp-m tcp -- dport 22-m state -- state NEW-m recent -- update -- seconds 60 -- hitcount 2 -- name SSH -- rsource-j DROP

 

Iptables-a input-P tcp-m tcp -- dport 22-m state -- state NEW-m recent -- set -- name SSH -- rsource-j ACCEPT

 

 

 

The above means that after two wrong SSH passwords are entered, SSH will not be accessible within 60 seconds and an SSH file will be generated in the/proc/net/ipt_recent/directory. record your IP address. of course, the time can be changed.

 

 

 

 

From: linghunhack Space

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.