summary refs log tree commit diff stats
path: root/modules/ssh.nix
diff options
context:
space:
mode:
authorChristian Krinitsin <code@krinitsin.xyz>2025-04-02 09:01:59 +0200
committerChristian Krinitsin <code@krinitsin.xyz>2025-04-02 09:01:59 +0200
commitfb6c96099b917e5e1956aac54a107caddb9b845e (patch)
treea6957aab534082d7b7fc3645422195c2a056b665 /modules/ssh.nix
parent3794179508d9ee5d5535d3d62bc94c6416988988 (diff)
downloadnosix-fb6c96099b917e5e1956aac54a107caddb9b845e.tar.gz
nosix-fb6c96099b917e5e1956aac54a107caddb9b845e.zip
add monit, a monitoring service
Diffstat (limited to 'modules/ssh.nix')
-rw-r--r--modules/ssh.nix7
1 files changed, 7 insertions, 0 deletions
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
+  '';
 }