Nytro Posted September 5, 2011 Report Posted September 5, 2011 Hardening SSHDStep 1: First of all we need to make a regular user, since we are disabling direct root login:adduser admin && passwd adminStep 2: Backup your current sshd_configmv /etc/ssh/sshd_config /etc/ssh/sshd_config.bakStep 3: Create a new sshd_config filenano -w /etc/ssh/sshd_configStep 3.1: Paste this code into the new file## Change to other port is recommended, etc 2488Port 22## Sets listening address on server. default=0.0.0.0#ListenAddress 192.168.0.1## Enforcing SSH Protocol 2 onlyProtocol 2## Disable direct root login, with no you need to login with admin user, then "su -" you into rootPermitRootLogin no##UsePrivilegeSeparation yes##AllowTcpForwarding no## Disables X11ForwardingX11Forwarding no## Checks users on their home directority and rhosts, that they arent world-writableStrictModes yes## The option IgnoreRhosts specifies whether rhosts or shosts files should not be used in authenticationIgnoreRhosts yes##HostbasedAuthentication no## RhostsAuthentication specifies whether sshd can try to use rhosts based authentication. RhostsRSAAuthentication no## Adds a login banner that the user can seeBanner /etc/motd## Enable / Disable sftp server#Subsystem sftp /usr/libexec/openssh/sftp-server## Add users that are allowed to log inAllowUsers adminControl + X to saveStep 4: Verify settings in the sshd_config you creatednano -w /etc/ssh/sshd_configREMEMBER YOU SHOULD CHANGE THE PORT TO SOMETHING ELSE. ( Example Port 2488 )Step 5.1: Add text to MOTD Banner file (/etc/motd)nano -w /etc/motdStep 5.2: Add this text, or something else of your choicePrivate system, please log off.Step 6: Restart the SSHD Daemonservice sshd restartStep 7: Start a NEW client, and test that you can connect on new port. (DO NOT CLOSE CURRENT SSH CLIENT INCASE OF PROBLEMS)Sursa: Hardening SSHD | SecureCentos.com Quote
Xander Posted September 6, 2011 Report Posted September 6, 2011 inca un sfat foarte bun pui o parola kilometrica si intri mereu cu public key ( daca pk-ul e parolat ... si mai bine ) Quote