Compare commits
11 Commits
2016-07-10
...
2016-07-15
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6b939ffa9 | ||
|
|
aa48575f58 | ||
| a920200904 | |||
| 9cce1410a0 | |||
| 9499034120 | |||
| 2c715f9e14 | |||
| cd18fb2792 | |||
| 522131a517 | |||
| cfc55fa479 | |||
| 81ad043adb | |||
| a475a88ac4 |
33
activation-manuelle/fail2ban.nix
Normal file
33
activation-manuelle/fail2ban.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Gestion de fail2ban
|
||||
|
||||
services = pkgs.lib.mkIf config.r6d.config-generator.fail2ban {
|
||||
fail2ban = {
|
||||
enable = true;
|
||||
jails = {
|
||||
DEFAULT = ''
|
||||
# "ignoreip" can be an IP address, a CIDR mask or a DNS host
|
||||
ignoreip = 127.0.0.1/8 pedro.dubronetwork.fr cube.dubronetwork.fr voyage.prunetwork.fr xray.prunetwork.fr 192.168.0.0/16 172.16.0.0/16
|
||||
|
||||
# 1 jour
|
||||
# bantime = 86400
|
||||
# 5 jours
|
||||
bantime = 432000
|
||||
maxretry = 3
|
||||
|
||||
#
|
||||
# Destination email address used solely for the interpolations in
|
||||
# jail.{conf,local} configuration files.
|
||||
destemail = admins@dubronetwork.fr
|
||||
'';
|
||||
ssh-route = ''
|
||||
filter = sshd
|
||||
action = route[blocktype=blackhole]
|
||||
maxretry = 3
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
6
activation-manuelle/laptop.nix
Normal file
6
activation-manuelle/laptop.nix
Normal file
@@ -0,0 +1,6 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Gestion spécifique pour PC portable
|
||||
powerManagement.cpuFreqGovernor = pkgs.lib.mkIf config.r6d.config-generator.laptop "powersave";
|
||||
}
|
||||
@@ -2,12 +2,16 @@
|
||||
let
|
||||
inherit (lib) mkIf mkMerge;
|
||||
profiles = config.r6d.profiles;
|
||||
computers = config.r6d.computers;
|
||||
in {
|
||||
nix = mkIf config.r6d.config-generator.nix-serve-client {
|
||||
# Cache http pour le store
|
||||
requireSignedBinaryCaches = false;
|
||||
binaryCaches = [
|
||||
(mkIf profiles.isDubronetwork "http://192.168.10.169:5000")
|
||||
("https://cache.nixos.org/")
|
||||
(mkIf (profiles.isDubronetwork && (! computers.isMonstre)) "http://192.168.10.169:5000")
|
||||
(mkIf profiles.isDubronetwork "http://192.168.10.252:5000")
|
||||
|
||||
(mkIf profiles.isPrunetwork "http://192.168.1.20:5000")
|
||||
];
|
||||
};
|
||||
|
||||
@@ -5,13 +5,16 @@ let
|
||||
inherit (lib) mkEnableOption mkIf mkMerge mkOption singleton types;
|
||||
cfg = config.r6d.config-generator;
|
||||
pfl = config.r6d.profiles;
|
||||
comp = config.r6d.computers;
|
||||
host = config.networking.hostName;
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
./activation-manuelle/auto-upgrade.nix
|
||||
./activation-manuelle/laptop.nix
|
||||
./activation-manuelle/locate.nix
|
||||
./activation-manuelle/fail2ban.nix
|
||||
./activation-manuelle/nix-serve-client.nix
|
||||
./activation-manuelle/nix-serve-server.nix
|
||||
./activation-manuelle/swap.nix
|
||||
@@ -38,6 +41,7 @@ in
|
||||
enable = mkEnableOption "Génération de la configuration d'une machine.";
|
||||
auto-upgrade = mkEnableOption "Profil pour activer les mises à jour automatiques.";
|
||||
docker = mkEnableOption "Profil pour l'utilisation de Docker.";
|
||||
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.";
|
||||
@@ -46,6 +50,15 @@ in
|
||||
swap = mkEnableOption "Profil pour que le swap soit activé.";
|
||||
virtualbox = mkEnableOption "Profil pour l'utilisation de VirtualBox.";
|
||||
};
|
||||
#* Utilisé pour avoir des raccourcis de machine
|
||||
r6d.computers = {
|
||||
isLatitude = mkEnableOption "Identification du nom de machine.";
|
||||
isMonstre = mkEnableOption "Identification du nom de machine.";
|
||||
isNeoNomade = mkEnableOption "Identification du nom de machine.";
|
||||
isPhenom = mkEnableOption "Identification du nom de machine.";
|
||||
isRadx = mkEnableOption "Identification du nom de machine.";
|
||||
isXray = mkEnableOption "Identification du nom de machine.";
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
@@ -54,8 +67,15 @@ in
|
||||
config = mkMerge
|
||||
[ # Unconditional stuff.
|
||||
{
|
||||
#environment.systemPackages = [ ... ];
|
||||
r6d.config-generator.enable = true;
|
||||
r6d.computers = {
|
||||
isLatitude = host == "latitude.dubronetwork.fr";
|
||||
isMonstre = host == "monstre.dubronetwork.fr";
|
||||
isNeoNomade = host == "neo-nomade.dubronetwork.fr";
|
||||
isPhenom = host == "phenom.dubronetwork.fr";
|
||||
isRadx = host == "radx.prunetwork.fr";
|
||||
isXray = host == "xray.prunetwork.fr";
|
||||
};
|
||||
}
|
||||
|
||||
# Conditional stuff
|
||||
@@ -85,18 +105,18 @@ in
|
||||
r6d.config-generator.nix-serve-server = true;
|
||||
})
|
||||
(mkIf (pfl.isDubronetwork && pfl.isWorkstation) {
|
||||
r6d.config-generator.nix-serve-server = true;
|
||||
r6d.config-generator.virtualbox = true;
|
||||
})
|
||||
(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;
|
||||
})
|
||||
|
||||
|
||||
## Affectation des profils aux machines
|
||||
(mkIf (host == "radx.prunetwork.fr") {
|
||||
(mkIf comp.isRadx {
|
||||
r6d.profiles.isHome = true;
|
||||
r6d.profiles.isPrunetwork = true;
|
||||
r6d.profiles.isServer = true;
|
||||
@@ -106,21 +126,27 @@ in
|
||||
virtualbox = true;
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf (host == "latitude.dubronetwork.fr") {
|
||||
r6d.profiles.isDubronetwork = true;
|
||||
r6d.profiles.isHome = true;
|
||||
r6d.profiles.isWorkstation = true;
|
||||
|
||||
r6d.config-generator = {
|
||||
laptop = true;
|
||||
};
|
||||
})
|
||||
(mkIf (host == "monstre.dubronetwork.fr") {
|
||||
r6d.profiles.isDubronetwork = true;
|
||||
(mkIf comp.isXray {
|
||||
r6d.profiles.isPrunetwork = true;
|
||||
r6d.profiles.isServer = true;
|
||||
})
|
||||
(mkIf (host == "neo-nomade.dubronetwork.fr") {
|
||||
|
||||
(mkIf comp.isLatitude {
|
||||
r6d.profiles.isDubronetwork = true;
|
||||
r6d.profiles.isHome = true;
|
||||
r6d.profiles.isWorkstation = true;
|
||||
|
||||
r6d.config-generator = {
|
||||
laptop = true;
|
||||
};
|
||||
})
|
||||
(mkIf comp.isMonstre {
|
||||
r6d.profiles.isDubronetwork = true;
|
||||
r6d.profiles.isServer = true;
|
||||
|
||||
r6d.config-generator.fail2ban = true;
|
||||
})
|
||||
(mkIf comp.isNeoNomade{
|
||||
r6d.profiles.isDubronetwork = true;
|
||||
r6d.profiles.isHome = true;
|
||||
|
||||
@@ -128,10 +154,12 @@ in
|
||||
laptop = true;
|
||||
};
|
||||
})
|
||||
(mkIf (host == "phenom.dubronetwork.fr") {
|
||||
(mkIf comp.isPhenom {
|
||||
r6d.profiles.isDubronetwork = true;
|
||||
r6d.profiles.isHome = true;
|
||||
r6d.profiles.isWorkstation = true;
|
||||
|
||||
r6d.config-generator.nix-serve-server = true;
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# http://www.git-attitude.fr/2014/09/15/30-options-git-qui-gagnent-a-etre-connues/
|
||||
[color]
|
||||
diff = auto
|
||||
branch = auto
|
||||
@@ -10,6 +11,7 @@
|
||||
ci = commit
|
||||
co = checkout
|
||||
ff = pull --ff-only
|
||||
oops = commit --amend --no-edit
|
||||
# Show files ignored by git
|
||||
ignored = ls-files -o -i --exclude-standard
|
||||
ls = ls-files
|
||||
|
||||
Reference in New Issue
Block a user