Attack Methods
Brute force cracking
After obtaining an SSH port number, an attacker attempts to access a device using the SSH port. When the device requests authentication information, the attacker may crack the password, pass the authentication, and obtain the access permission.
DoS attack
An SSH server supports only a limited number of users. If the number of login users reaches a specified upper limit, subsequent users cannot access the server. This situation may occur when the server is attacked.
Security Hardening Policy
Authentication
The SSH server supports password authentication and public-key authentication. Only authenticated users can log in to a device and enter the CLI.
Disabling services
When the SSH service is enabled, the socket service is also automatically enabled. This means that the device is prone to scanning by attackers. To prevent such a risk, disable the SSH service and its port when the SSH service is not required.
Changing the port number
By default, the SSH server uses port 22, which is a well-known port number and is prone to scanning and attacks. You can modify the SSH server port number to an unknown port number, reducing the probability of being scanned.
ACL
ACLs can be configured for VTY user interfaces to control the login of clients with a specified IP address or in a specified IP address segment.
None
Password authentication: Set the authentication mode of a user named testuser to password authentication.
system-view
ssh user testuser
ssh user testuser authentication-type password
RSA authentication: Set the authentication mode of a user named testuser to RSA authentication (using keys each of 2048 bits or more).
system-view
ssh user testuser
ssh user testuser authentication-type rsa
ssh user testuser service-type stelnet
stelnet server enable
ssh server port 53555
acl [ number ] acl-number
rule [ rule-id ] { deny | permit } [ logging | source { source-ip-address { 0 | source-wildcard } | address-setaddress-set-name | any } | time-rangetime-name ] * [ descriptiondescription ]
quit
user-interface vty first-ui-number [ last-ui-number ]
All VTY user interfaces involved in SSH login must be covered in the user-interface vty first-ui-number [ last-ui-number ] command.
acl acl-number | { inbound | outbound }
To control the permission to log in to the device from a specified IP address or from a specified IP address segment, specify inbound in the command.
To prevent users who have already logged in to a device from logging in to other devices, specify outbound in the command.