From fb6c96099b917e5e1956aac54a107caddb9b845e Mon Sep 17 00:00:00 2001 From: Christian Krinitsin Date: Wed, 2 Apr 2025 09:01:59 +0200 Subject: add monit, a monitoring service --- modules/ssh.nix | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/ssh.nix') diff --git a/modules/ssh.nix b/modules/ssh.nix index a23dacd..30a79ad 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -7,6 +7,13 @@ enable = true; settings.PasswordAuthentication = false; }; + networking.firewall.allowedTCPPorts = [ 22 ]; + services.monit.config = '' + check process sshd with pidfile /var/run/sshd.pid + start program "${pkgs.systemd}/bin/systemctl start sshd" + stop program "${pkgs.systemd}/bin/systemctl stop sshd" + if failed port 22 protocol ssh for 2 cycles then restart + ''; } -- cgit 1.4.1