SSH access logging/control

I just installed DietPI in my newly acquired Raspberry Pi 2, due to it’s amazing setup, functionalities, small size and footprint, and am loving it because it was precisely what I needed (great job!).

I was looking around for a way to log SSH connections/tries and implementing an IP blocking system and email notification, since I intend to have it accessible outside my local network, but, as far as I’ve seen, this is impossible with DropBear.
Is there a way I can do this with OpenSSH or through another method?

(I’m sorry if this was already asked/done, but the Forum search tool blocked every word I tried to use :rofl: )

Thank you in advance!

Hi Andre,

You will need to install OpenSSH server for your requirements. Also, i believe OpenSSH logs relies on syslog. So you will need to change your logging mode to “full”. Once completed, the log file should be in /var/log/auth.log

Simply use DietPi-Software to change both your SSH server and Logging mode choices.

The OpenSSH server config is located here:
/etc/ssh/sshd_config

The available commands and settings are located here:
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/sshd_config.5?query=sshd_config

As for the email notification, I’am not sure. But for blocking, you could use denyuser and allowuser in the config:
http://www.linuxquestions.org/questions/linux-security-4/how-do-i-block-ip’s-to-prevent-unauthorized-ssh-login-attempts-323154/

Kind Regards,
Dan

Thank you very much Dan, that worked perfectly!