Compare commits

..

8 Commits

4 changed files with 43 additions and 3 deletions

View File

@@ -13,6 +13,14 @@ in
mkIf cfg.fail2ban {
# Gestion de fail2ban
# Paquets
environment.systemPackages = with pkgs; [
mailutils
whois
];
# Services
services = {
fail2ban = {
@@ -30,13 +38,27 @@ mkIf cfg.fail2ban {
maxretry = 3
destemail = ${destemail}
# https://github.com/Baughn/nixpkgs/blob/master/nixos/modules/services/security/fail2ban.nix
findtime = 600
maxretry = 3
backend = systemd
enabled = true
'';
ssh-route = ''
filter = sshd
action = route[blocktype=blackhole]
maxretry = 3
'';
# désactivation car souci de PATH avec les commandes mail ou sendmail. Nécessite un path motifiable
# ticket à ouvrir
#ssh-mail = ''
# filter = sshd
# action = sendmail[sendername=Fail2ban @${config.networking.hostName}]
#'';
};
};
};
# https://github.com/NixOS/nixpkgs/issues/8437
services.fail2ban.jails.ssh-iptables = "enabled = true";
}

View File

@@ -106,7 +106,7 @@ in
(mkIf pfl.isHome {
r6d.profiles.isDesktop = true;
})
(mkIf pfl.isServer {
(mkIf (pfl.isServer && !comp.isMonstre) {
r6d.config-generator = {
#database_postgres = true;
dns_autorite = true;
@@ -118,7 +118,7 @@ in
};
})
# /!\ PAS un serveur
(mkIf (!pfl.isServer) {
(mkIf (!pfl.isServer || comp.isMonstre) {
r6d.config-generator = {
dns_resolveur = true;
};

View File

@@ -13,6 +13,7 @@ in
./environment.nix
./localisation.nix
#./network-ipv6.nix
./sudo.nix
./service-haveged.nix
./service-monitoring.nix
./service-ssh.nix

17
public/sudo.nix Normal file
View File

@@ -0,0 +1,17 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkMerge mkThenElse;
cfg = config.r6d.config-generator;
computers = config.r6d.computers;
profiles = config.r6d.profiles;
in
mkIf true {
# Authorisation de certaines applications par sudo sans mot de passe
security.sudo.extraConfig = ''
%users ALL = NOPASSWD: ${pkgs.mtr}/bin/mtr
'';
}