Compare commits

..

12 Commits

7 changed files with 80 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
all: rebuild-switch
date
##--------- Commandes spécifiques pour NixOS
clean:
nix-collect-garbage -d --delete-older-than 15d
@@ -15,22 +16,24 @@ clean-log:
full-auto: submodules-update upgrade clean optimise
munin:
pushd /var/www/munin/ ; python -m SimpleHTTPServer 8000
optimise:
nix-store --optimise
push: submodules-push
git push --all
git push --tags
rebuild-switch:
nixos-rebuild switch --fallback --show-trace
store-repair:
nix-store --verify --check-contents --repair
upgrade:
nixos-rebuild switch --upgrade --fallback --show-trace
##--------- Commandes spécifiques pour GIT
push: submodules-push
git push --all
git push --tags
submodules-update:
#git submodule update --remote
git submodule foreach git co master
@@ -49,6 +52,21 @@ template:
tag: submodules-tag
git tag -f "$$(date +%F)-$$(hostname -s)"
upgrade:
nixos-rebuild switch --upgrade --fallback --show-trace
##--------- Munin
munin:
pushd /var/www/munin/ ; python -m SimpleHTTPServer 8000
##--------- Gestion d'un système de fichier monté en mémoire
tmpfs-create:
mkdir -p /mnt/tmpfs
tmpfs-mount: tmpfs-create
mount -t tmpfs -o size=10G tmpfs /mnt/tmpfs
tmpfs-umount:
umount /mnt/tmpfs
tmpfs-destroy: tmpfs-umount
rmdir /mnt/tmpfs

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

@@ -55,4 +55,6 @@ in
clawsMail = pkgs.clawsMail.override { enablePluginFancy = true; };
mumble = pkgs.mumble.override { pulseSupport = true; };
};
security.setuidPrograms = [ "udevil" ];
}

View File

@@ -15,5 +15,13 @@ mkIf cfg.virtualbox {
linuxPackages.virtualboxGuestAdditions
];
# À décommenter pour activer le pack d'extension
#boot.kernelPackages = pkgs.linuxPackages // {
# virtualbox = pkgs.linuxPackages.virtualbox.override {
# enableExtensionPack = true;
# pulseSupport = true;
# };
#};
virtualisation.virtualbox.host.enable = 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
'';
}