Compare commits

..

12 Commits

7 changed files with 83 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
all: rebuild-switch all: rebuild-switch
date date
##--------- Commandes spécifiques pour NixOS
clean: clean:
nix-collect-garbage -d --delete-older-than 15d nix-collect-garbage -d --delete-older-than 15d
@@ -15,22 +16,24 @@ clean-log:
full-auto: submodules-update upgrade clean optimise full-auto: submodules-update upgrade clean optimise
munin:
pushd /var/www/munin/ ; python -m SimpleHTTPServer 8000
optimise: optimise:
nix-store --optimise nix-store --optimise
push: submodules-push
git push --all
git push --tags
rebuild-switch: rebuild-switch:
nixos-rebuild switch --fallback --show-trace nixos-rebuild switch --fallback --show-trace
store-repair: store-repair:
nix-store --verify --check-contents --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: submodules-update:
#git submodule update --remote #git submodule update --remote
git submodule foreach git co master git submodule foreach git co master
@@ -49,6 +52,21 @@ template:
tag: submodules-tag tag: submodules-tag
git tag -f "$$(date +%F)-$$(hostname -s)" git tag -f "$$(date +%F)-$$(hostname -s)"
upgrade: ##--------- Munin
nixos-rebuild switch --upgrade --fallback --show-trace
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 { mkIf cfg.fail2ban {
# Gestion de fail2ban # Gestion de fail2ban
# Paquets
environment.systemPackages = with pkgs; [
mailutils
whois
];
# Services # Services
services = { services = {
fail2ban = { fail2ban = {
@@ -30,13 +38,27 @@ mkIf cfg.fail2ban {
maxretry = 3 maxretry = 3
destemail = ${destemail} 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 = '' ssh-route = ''
filter = sshd filter = sshd
action = route[blocktype=blackhole] 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 { (mkIf pfl.isHome {
r6d.profiles.isDesktop = true; r6d.profiles.isDesktop = true;
}) })
(mkIf pfl.isServer { (mkIf (pfl.isServer && !comp.isMonstre) {
r6d.config-generator = { r6d.config-generator = {
#database_postgres = true; #database_postgres = true;
dns_autorite = true; dns_autorite = true;
@@ -118,7 +118,7 @@ in
}; };
}) })
# /!\ PAS un serveur # /!\ PAS un serveur
(mkIf (!pfl.isServer) { (mkIf (!pfl.isServer || comp.isMonstre) {
r6d.config-generator = { r6d.config-generator = {
dns_resolveur = true; dns_resolveur = true;
}; };

View File

@@ -39,15 +39,13 @@ mkIf true {
## Exploitation FS ## Exploitation FS
inotify-tools # être notifié lorsque le contenu d'un répertoire change inotify-tools # être notifié lorsque le contenu d'un répertoire change
rdfind # recherche de fichiers doublons pour remplacement par hard/soft link rdfind # recherche de fichiers doublons pour remplacement par hard/soft link
]; (mkIf profiles.isDesktop
} // mkIf profiles.isDesktop { ## Gestion de FS
gparted # Gestion graphique de partitions
# Paquets )
environment.systemPackages = with pkgs; [ (mkIf profiles.isDesktop
## Gestion de FS unetbootin # création de clefs USB bootables
gparted # Gestion graphique de partitions )
#
#
unetbootin # création de clefs USB bootables
]; ];
} }

View File

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

View File

@@ -9,6 +9,11 @@ in
mkIf true { mkIf true {
# Paquets
environment.systemPackages = with pkgs; [
mailutils
];
# Services # Services
## Noeud de supervision munin = pas de stockage des données locales ## Noeud de supervision munin = pas de stockage des données locales

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
'';
}