Kali Linux useful configurations – SSH security, APT proxy, Laptops

This is kind of general holding place for commands that I run into and need to keep track of in Linux. I mainly play with Ubuntu and Kali but these should work with almost any distro.


If you run a ssh server on the internet, you want to minimize the risk of brute forcing. Its best to not allow root logins via anywhere, so that removes the easy job of guessing a username. This little trick will allow new connections to ssh from the same IP, only three times. So basically if someone keeps trying to connect to your ssh server, it will track the SYN packets and block them for 5 minutes after the 3rd new connection.  This also gets logged.

Warning: You can easily block yourself, so don’t create a bunch of new connections in 5 minutes. You can lower the timeout to 60 seconds if you often connect within that time frame.

1) Add the following line to /etc/ssh/sshd_config. This will only allow you to try a password once and it disconnect you.

2) Add the following firewall rules

3) See log entries of possible  in /var/log/syslog

 


 

If you have a laptop and don’t want it to go into standby mode when you close the lid, run these commands once:


 

Proxy at the office or home? Here is how to setup apt-get so you can update the installation with a proxy. Note: you do have to put your password in here.