mirror of
https://github.com/lxstinthesky/matrix.git
synced 2025-12-18 07:22:44 +00:00
Compare commits
2 Commits
27f18dc6ec
...
c31f778ac2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c31f778ac2 | ||
|
|
f224a79f30 |
@@ -8,6 +8,7 @@
|
|||||||
PermitRootLogin = "no"; # Disable root login
|
PermitRootLogin = "no"; # Disable root login
|
||||||
PasswordAuthentication = false; # Force SSH key auth only
|
PasswordAuthentication = false; # Force SSH key auth only
|
||||||
PubkeyAuthentication = true; # Enable SSH keys
|
PubkeyAuthentication = true; # Enable SSH keys
|
||||||
|
LogLevel = "VERBOSE"; # More detailed logging, for fail2ban
|
||||||
};
|
};
|
||||||
ports = [ 22 ];
|
ports = [ 22 ];
|
||||||
# using the same key as for initrd
|
# using the same key as for initrd
|
||||||
@@ -16,6 +17,27 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.fail2ban = {
|
||||||
|
enable = true;
|
||||||
|
maxretry = 5; # Ban IP after 5 failures
|
||||||
|
ignoreIP = [
|
||||||
|
|
||||||
|
];
|
||||||
|
bantime = "24h"; # Ban IPs for one day on the first ban
|
||||||
|
bantime-increment = {
|
||||||
|
enable = true; # Enable increment of bantime after each violation
|
||||||
|
multipliers = "1 2 3 4 5 6 7"; # everytime one day more
|
||||||
|
maxtime = "168h"; # Do not ban for more than 1 week
|
||||||
|
overalljails = true; # Calculate the bantime based on all the violations
|
||||||
|
};
|
||||||
|
|
||||||
|
# fail2ban ships with a default sshd jail, we override it here, to be explicit
|
||||||
|
jails.sshd.settings = {
|
||||||
|
port = 22; # explicit
|
||||||
|
maxretry = 5;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# remote unlock for luks via ssh
|
# remote unlock for luks via ssh
|
||||||
boot.kernelParams = [ "ip=dhcp" ];
|
boot.kernelParams = [ "ip=dhcp" ];
|
||||||
boot.initrd = {
|
boot.initrd = {
|
||||||
@@ -27,6 +49,7 @@
|
|||||||
port = 22;
|
port = 22;
|
||||||
authorizedKeys = [
|
authorizedKeys = [
|
||||||
(builtins.readFile ../users/keys/neo.pub)
|
(builtins.readFile ../users/keys/neo.pub)
|
||||||
|
(builtins.readFile ../users/keys/morpheus.pub)
|
||||||
];
|
];
|
||||||
hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ];
|
hostKeys = [ "/etc/secrets/initrd/ssh_host_ed25519_key" ];
|
||||||
shell = "/bin/cryptsetup-askpass";
|
shell = "/bin/cryptsetup-askpass";
|
||||||
|
|||||||
Reference in New Issue
Block a user