diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2016-11-28 03:01:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-28 03:01:15 +0100 |
commit | e394c305a8ef97c39dd10578d0c2e76d7f04bc2d (patch) | |
tree | 2b05ab55a31415389a8cc4ceb1add21043c940d4 /nixos | |
parent | 7b5619506b69ff60c73cb6e1b5eb0e49a149e1cb (diff) | |
parent | 7eb9a03221be0e210d934acc38c281a94122f5b4 (diff) | |
download | nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.tar nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.tar.gz nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.tar.bz2 nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.tar.lz nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.tar.xz nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.tar.zst nixlib-e394c305a8ef97c39dd10578d0c2e76d7f04bc2d.zip |
Merge pull request #20620 from rnhmjoj/fakeroute
fakeroute: init at 0.3
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/networking/fakeroute.nix | 63 |
2 files changed, 64 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 12ff1cac4f4f..16d723bf5649 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -358,6 +358,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 000000000000..82a9fb729d84 --- /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}"; + }; + }; + + }; + +} |