Compare commits

..

26 Commits

Author SHA1 Message Date
Yves Dubromelle
11c624da59 option pour afficher le détail des erreurs 2016-07-27 11:50:27 +02:00
Yves Dubromelle
e88711df13 désactivation de nix-serve-client pour dubronetwork (déjà dans desktop) 2016-07-27 11:44:53 +02:00
Yves Dubromelle
8881df0d4a option de configuration pour murmur + activation pour rollo 2016-07-27 11:44:10 +02:00
System administrator
206430165a ajout de rollo.dubronetwokr.fr 2016-07-27 09:28:28 +02:00
35c49c2fcd Merge remote-tracking branch 'origin/master' 2016-07-25 14:26:28 +02:00
95c7fc7a14 ajout de paquets utilisé sur les desktop & serveur -> base 2016-07-25 14:25:49 +02:00
Yves Dubromelle
908be0c5e8 option pour que les rebuild cherchent une solution au lieu de planter 2016-07-23 17:37:32 +02:00
Yves Dubromelle
12fe6f2b94 implémentation de la typo "gti" :) 2016-07-23 17:36:22 +02:00
dbd58cabc0 désactivation de nix serve pour ocean
* nix serve permet de récupérer toute la config de la machine ce qui ne
  me plait pas pour un serveur.
2016-07-23 13:55:11 +02:00
5fa77bda2e le résolveur DNS local est activé si la machine n'est pas un serveur 2016-07-22 16:43:56 +02:00
363b2f56e4 ajout de variables pour le DNS 2016-07-22 16:34:02 +02:00
5380bb76b0 ajout du monitoring local (déplacement depuis server) 2016-07-22 16:16:25 +02:00
ef3778dd54 ajout de variable pour rabbitmq 2016-07-22 16:10:25 +02:00
b50aa1ad0e ajout option pour lancer un serveur postgres 2016-07-22 16:02:31 +02:00
326da0f7e8 ajout header + utilisation 2016-07-22 14:16:20 +02:00
c5b7c16946 xmonad est activé pour toutes les stations de travail dubronetwork 2016-07-22 13:48:22 +02:00
af15068c29 utilisation de blocs pour éviter de répeter le préfixe 2016-07-22 13:46:46 +02:00
d503b8f0f4 ajout de commentaires 2016-07-22 13:40:39 +02:00
7bd6eb37e3 fix: erreur sur la logique. oubli d'un ! 2016-07-22 13:40:13 +02:00
592e5664be ajout clef mbp 2016-07-22 03:13:45 +02:00
20e8e8beaa renforcement serveur SSH en forcant les algos récents (selon mozilla) 2016-07-21 23:38:59 +02:00
66252cb498 renforcement de la sécurité pour les clients SSH 2016-07-21 23:16:27 +02:00
906ae9b7d1 ajout de python 2016-07-21 23:00:57 +02:00
2195033ee5 ajout de variable pour l'impression 2016-07-21 22:25:21 +02:00
becd37ba28 ajustment config nix serve client 2016-07-21 22:21:52 +02:00
f55ae85a66 ajout de groupes 2016-07-21 22:12:00 +02:00
15 changed files with 230 additions and 65 deletions

View File

@@ -23,7 +23,7 @@ push: submodules-push
git push --tags
rebuild-switch:
nixos-rebuild switch
nixos-rebuild switch --fallback --show-trace
store-repair:
nix-store --verify --check-contents --repair
@@ -44,5 +44,5 @@ tag: submodules-tag
git tag -f "$$(date +%F)-$$(hostname -s)"
upgrade:
nixos-rebuild switch --upgrade
nixos-rebuild switch --upgrade --fallback --show-trace

View File

@@ -1,8 +1,12 @@
{ config, pkgs, ... }:
{
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
# Automatic update & automatic clean
system.autoUpgrade.enable = config.r6d.config-generator.auto-upgrade;
nix.gc.automatic = config.r6d.config-generator.auto-upgrade;
system.autoUpgrade.enable = cfg.auto-upgrade;
nix.gc.automatic = cfg.auto-upgrade;
}

View File

@@ -1,9 +1,13 @@
{ config, pkgs, ... }:
{
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
# Gestion de fail2ban
services = pkgs.lib.mkIf config.r6d.config-generator.fail2ban {
services = mkIf cfg.fail2ban {
fail2ban = {
enable = true;
jails = {

View File

@@ -1,6 +1,10 @@
{ config, pkgs, ... }:
{
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
# Gestion spécifique pour PC portable
powerManagement.cpuFreqGovernor = pkgs.lib.mkIf config.r6d.config-generator.laptop "powersave";
powerManagement.cpuFreqGovernor = mkIf cfg.laptop "powersave";
}

View File

@@ -1,11 +1,15 @@
{ config, pkgs, ... }:
{
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
imports = [
];
services.locate = {
enable = config.r6d.config-generator.locate;
enable = cfg.locate;
interval = "hourly";
};
}

View File

@@ -1,7 +1,9 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkMerge;
profiles = config.r6d.profiles;
cfg = config.r6d.config-generator;
computers = config.r6d.computers;
in {
nix = mkIf config.r6d.config-generator.nix-serve-client {

View File

@@ -1,8 +1,12 @@
{ config, pkgs, ... }:
{
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
# Cache http pour le store
services.nix-serve.enable = config.r6d.config-generator.nix-serve-server;
networking.firewall.allowedTCPPorts = pkgs.lib.mkIf config.r6d.config-generator.nix-serve-server [ 5000 ];
services.nix-serve.enable = cfg.nix-serve-server;
networking.firewall.allowedTCPPorts = mkIf cfg.nix-serve-server [ 5000 ];
}

View File

@@ -0,0 +1,15 @@
{ config, pkgs, ... }:
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
# Enable CUPS to print documents.
services.printing = mkIf cfg.print {
enable = true;
drivers = [
pkgs.samsung-unified-linux-driver
];
};
}

View File

@@ -1,10 +1,14 @@
{ config, pkgs, ... }:
{
with pkgs.lib;
let
cfg = config.r6d.config-generator;
in {
# Gestion du swap
# https://en.wikipedia.org/wiki/Swappiness
boot.kernel.sysctl = pkgs.lib.mkIf config.r6d.config-generator.swap {
boot.kernel.sysctl = mkIf cfg.swap {
# le swap est activé (!= 0)
# le swap est utilisé lorsque (100 - x) % de la mémoire est déja allouée
"vm.swappiness" = 10;

File diff suppressed because one or more lines are too long

View File

@@ -4,6 +4,7 @@
imports = [
./environment.nix
./localisation.nix
./monitoring.nix
./networking.nix
./services.nix

View File

@@ -17,6 +17,7 @@ in
./activation-manuelle/fail2ban.nix
./activation-manuelle/nix-serve-client.nix
./activation-manuelle/nix-serve-server.nix
./activation-manuelle/print.nix
./activation-manuelle/swap.nix
./activation-manuelle/users.nix
];
@@ -42,13 +43,19 @@ in
enable = mkEnableOption "Génération de la configuration d'une machine.";
awesome = mkEnableOption "Profil pour activer le gestionnaire de fenêtre awesome.";
auto-upgrade = mkEnableOption "Profil pour activer les mises à jour automatiques.";
database_postgres=mkEnableOption "Profil pour activer le SGBD PostgreSQL.";
docker = mkEnableOption "Profil pour l'utilisation de Docker.";
dns_autorite = mkEnableOption "Profil pour servir les fichiers de zone DNS.";
dns_resolveur = mkEnableOption "Profil pour activer un résolveur DNS local.";
fail2ban = mkEnableOption "Profil pour activer Fail2ban.";
jeux = mkEnableOption "Profil pour les jeux vidéos.";
laptop = mkEnableOption "Profil pour les outils spécifiques aux ordinateurs portables..";
locate = mkEnableOption "Profil pour activer la fonction locate.";
nix-serve-client= mkEnableOption "Profil pour que la machine soit un serveur de cache nix.";
murmur = mkEnableOption "Profil pour activer un serveur Mumble (murmur)";
nix-serve-client= mkEnableOption "Profil pour que la machine soit un client de cache nix.";
nix-serve-server= mkEnableOption "Profil pour que la machine soit un serveur de cache nix.";
print = mkEnableOption "Profil pour activer cups & pouvoir imprimer.";
rabbitmq = mkEnableOption "Profil pour activer le service de messagerie AMQP.";
swap = mkEnableOption "Profil pour que le swap soit activé.";
virtualbox = mkEnableOption "Profil pour l'utilisation de VirtualBox.";
xmonad = mkEnableOption "Profil pour activer le gestionnaire de fenêtres xmonad.";
@@ -62,6 +69,7 @@ in
isOcean = mkEnableOption "Identification du nom de machine.";
isPhenom = mkEnableOption "Identification du nom de machine.";
isRadx = mkEnableOption "Identification du nom de machine.";
isRollo = mkEnableOption "Identification du nom de machine.";
isXray = mkEnableOption "Identification du nom de machine.";
};
};
@@ -81,6 +89,7 @@ in
isOcean = host == "ocean.prunetwork.fr";
isPhenom = host == "phenom.dubronetwork.fr";
isRadx = host == "radx.prunetwork.fr";
isRollo = host == "rollo.dubronetwork.fr";
isXray = host == "xray.prunetwork.fr";
};
}
@@ -89,22 +98,45 @@ in
## Définition des profils génériques
(mkIf pfl.isDesktop {
r6d.config-generator.awesome = true;
r6d.config-generator = {
awesome = true;
nix-serve-client = true;
};
})
(mkIf pfl.isHome {
r6d.profiles.isDesktop = true;
})
(mkIf pfl.isServer {
r6d.config-generator.nix-serve-server = true;
r6d.config-generator = {
#database_postgres = true;
dns_autorite = true;
#dns_resolveur = true;
# inutile d'exposer la conf complète du serveur par le store tant qu'il n'y a pas de protection complémentaire - utilisation SSH ?
#nix-serve-server = true;
#rabbitmq = true;
};
})
# /!\ PAS un serveur
(mkIf (!pfl.isServer) {
r6d.config-generator = {
dns_resolveur = true;
};
})
(mkIf pfl.isWorkstation {
r6d.profiles.isDesktop = true;
r6d.config-generator.docker = true;
r6d.config-generator = {
docker = true;
};
})
## Profils liés à Dubronetwork
(mkIf pfl.isDubronetwork {
r6d.config-generator.auto-upgrade = true;
r6d.config-generator.nix-serve-client = true;
r6d.config-generator = {
auto-upgrade = true;
print = true;
};
})
(mkIf (pfl.isDubronetwork && pfl.isHome) {
r6d.config-generator.jeux = true;
@@ -113,55 +145,73 @@ in
r6d.config-generator.nix-serve-server = true;
})
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
r6d.config-generator.virtualbox = true;
r6d.config-generator = {
virtualbox = true;
xmonad = true;
};
})
## Profils liés à Prunetwork
(mkIf pfl.isPrunetwork {
r6d.config-generator.auto-upgrade = true;
r6d.config-generator.fail2ban = true;
r6d.config-generator.nix-serve-client = true;
r6d.config-generator.swap = true;
r6d.config-generator = {
auto-upgrade = true;
fail2ban = true;
swap = true;
};
})
## Affectation des profils aux machines
(mkIf comp.isOcean {
r6d.profiles.isPrunetwork = true;
r6d.profiles.isServer = true;
r6d.profiles = {
isPrunetwork = true;
isServer = true;
};
})
(mkIf comp.isRadx {
r6d.profiles.isHome = true;
r6d.profiles.isPrunetwork = true;
r6d.profiles.isServer = true;
r6d.profiles.isWorkstation = true;
r6d.profiles = {
isHome = true;
isPrunetwork = true;
isServer = true;
isWorkstation = true;
};
r6d.config-generator = {
nix-serve-server = true;
virtualbox = true;
};
})
(mkIf comp.isXray {
r6d.profiles.isPrunetwork = true;
r6d.profiles.isServer = true;
r6d.profiles = {
isPrunetwork = true;
isServer = true;
};
})
(mkIf comp.isLatitude {
r6d.profiles.isDubronetwork = true;
r6d.profiles.isHome = true;
r6d.profiles.isWorkstation = true;
r6d.profiles = {
isDubronetwork = true;
isHome = true;
isWorkstation = true;
};
r6d.config-generator = {
laptop = true;
xmonad = true;
};
})
(mkIf comp.isMonstre {
r6d.profiles.isDubronetwork = true;
r6d.profiles.isServer = true;
r6d.profiles = {
isDubronetwork = true;
isServer = true;
};
r6d.config-generator.fail2ban = true;
})
(mkIf comp.isNeoNomade{
r6d.profiles.isDubronetwork = true;
r6d.profiles.isHome = true;
r6d.profiles = {
isDubronetwork = true;
isHome = true;
};
r6d.config-generator = {
laptop = true;
@@ -175,12 +225,26 @@ in
};
})
(mkIf comp.isPhenom {
r6d.profiles.isDubronetwork = true;
r6d.profiles.isHome = true;
r6d.profiles.isWorkstation = true;
r6d.profiles = {
isDubronetwork = true;
isHome = true;
isWorkstation = true;
};
r6d.config-generator.nix-serve-server = true;
r6d.config-generator.xmonad = true;
r6d.config-generator = {
nix-serve-server = true;
};
})
(mkIf comp.isRollo {
r6d.profiles = {
isDubronetwork = true;
isServer = true;
};
r6d.config-generator = {
fail2ban = true;
murmur = true;
};
})
];
}

View File

@@ -17,19 +17,23 @@
bind # utilisé pour les utilitaires comme dig
byobu # permet de se déconnecter d'un terminal sans l'aréter
exfat # Pour monter les FAT avec Fuse
git gitAndTools.gitSVN gitAndTools.tig # outil de gestion de version
git gitAndTools.gitSVN gitAndTools.tig gti # outil de gestion de version
gnumake # pour décrire les recettes de compilation
gnupg # GPG
gpm # prise en charge de la souris en console
htop # monitoring
#libressl # librairie pour faire du TLS et les algorithmes de crypto par OpenBSD
ncdu # outil pour voir l'espace utilisé
nmap # outil de scan de port réseau
mtr # outil de diagnostic réseau
par2cmdline # outil de récupération de fichiers corrompus - .par2
p7zip # compression de fichier
parted # partitionnement de disque
pciutils
python # python -- python -m SimpleHTTPServer 8000
python34Packages.glances # monitoring
pwgen # générateur de mot de passe
rtorrent # outil de téléchargement de torrent & magnet
tmux # nécessaire pour byobu
tree # affiche une arborescence de fichiers et dossiers
usbutils
@@ -53,4 +57,16 @@
promptInit = builtins.readFile ./bash-prompt.sh;
interactiveShellInit = builtins.readFile ./bash-interactive-init.sh;
};
# https://wiki.mozilla.org/Security/Guidelines/OpenSSH#Modern
programs.ssh.extraConfig = ''
# Ensure KnownHosts are unreadable if leaked - it is otherwise easier to know which hosts your keys have access to.
HashKnownHosts yes
# Host keys the client accepts - order here is honored by OpenSSH
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp256,ecdh-sha2-nistp384,diffie-hellman-group-exchange-sha256
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
'';
}

27
monitoring.nix Normal file
View File

@@ -0,0 +1,27 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
## Munin server -- generate /var/www/munin
services.munin-cron = {
enable = true;
hosts = ''
[${config.networking.hostName}]
address localhost
'';
extraGlobalConfig = ''
contact.email.command mail -s "Munin notification for ''${var:host}" hostmaster@prunetwork.fr
'';
};
networking.firewall.allowedTCPPorts = [
# TODO configurer les bon ports lors de l'ouverture du service
];
## Documentation
# * https://nixos.org/wiki/Create_and_debug_nix_packages
# * http://chriswarbo.net/essays/nixos/developing_on_nixos.html
}

View File

@@ -13,14 +13,19 @@
## OpenSSH daemon
services.openssh = {
enable = true;
};
# https://wiki.mozilla.org/Security/Guidelines/OpenSSH#Modern_.28OpenSSH_6.7.2B.29
extraConfig = ''
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
# Enable CUPS to print documents.
services.printing = {
enable = true;
drivers = [
pkgs.samsung-unified-linux-driver
];
# LogLevel VERBOSE logs user's key fingerprint on login. Needed to have a clear audit track of which key was using to log in.
LogLevel VERBOSE
# Use kernel sandbox mechanisms where possible in unprivilegied processes
# Systrace on OpenBSD, Seccomp on Linux, seatbelt on MacOSX/Darwin, rlimit elsewhere.
UsePrivilegeSeparation sandbox
'';
};
# Monitoring