summary refs log tree commit diff
diff options
context:
space:
mode:
authorrnhmjoj <micheleguerinirocco@me.com>2016-11-21 21:04:46 +0100
committerrnhmjoj <micheleguerinirocco@me.com>2016-11-23 15:23:10 +0100
commit7eb9a03221be0e210d934acc38c281a94122f5b4 (patch)
tree88c83da556f9360913a89bf87fee447850820060
parentd753527bd4bc1b88c8145f847367e79856407b26 (diff)
downloadnixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.tar
nixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.tar.gz
nixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.tar.bz2
nixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.tar.lz
nixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.tar.xz
nixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.tar.zst
nixpkgs-7eb9a03221be0e210d934acc38c281a94122f5b4.zip
fakeroute: add service
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/networking/fakeroute.nix63
2 files changed, 64 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 0c930eb2eb0..e74e60f00ad 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -354,6 +354,7 @@
   ./services/networking/dnsmasq.nix
   ./services/networking/ejabberd.nix
   ./services/networking/fan.nix
+  ./services/networking/fakeroute.nix
   ./services/networking/ferm.nix
   ./services/networking/firefox/sync-server.nix
   ./services/networking/firewall.nix
diff --git a/nixos/modules/services/networking/fakeroute.nix b/nixos/modules/services/networking/fakeroute.nix
new file mode 100644
index 00000000000..82a9fb729d8
--- /dev/null
+++ b/nixos/modules/services/networking/fakeroute.nix
@@ -0,0 +1,63 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+  cfg = config.services.fakeroute;
+  routeConf = pkgs.writeText "route.conf" (concatStringsSep "\n" cfg.route);
+
+in
+
+{
+
+  ###### interface
+
+  options = {
+
+    services.fakeroute = {
+
+      enable = mkOption {
+        type = types.bool;
+        default = false;
+        description = ''
+          Whether to enable the fakeroute service.
+        '';
+      };
+
+      route = mkOption {
+        type = types.listOf types.str;
+        default = [];
+        example = [
+          "216.102.187.130"
+          "4.0.1.122"
+          "198.116.142.34"
+          "63.199.8.242"
+        ];
+        description = ''
+         Fake route that will appear after the real
+         one to any host running a traceroute.
+        '';
+      };
+
+    };
+
+  };
+
+
+  ###### implementation
+
+  config = mkIf cfg.enable {
+    systemd.services.fakeroute = {
+      description = "Fakeroute Daemon";
+      after = [ "network.target" ];
+      wantedBy = [ "multi-user.target" ];
+      serviceConfig = {
+        Type = "forking";
+        User = "root";
+        ExecStart = "${pkgs.fakeroute}/bin/fakeroute -f ${routeConf}";
+      };
+    };
+
+  };
+
+}