nixpkgs/nixos/modules/services/networking/fakeroute.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.2 KiB
Nix
Raw Normal View History

2016-11-21 20:04:46 +00:00
{ config, lib, pkgs, ... }:
let
cfg = config.services.fakeroute;
routeConf = pkgs.writeText "route.conf" (lib.concatStringsSep "\n" cfg.route);
2016-11-21 20:04:46 +00:00
in
{
###### interface
options = {
services.fakeroute = {
enable = lib.mkEnableOption "the fakeroute service";
2016-11-21 20:04:46 +00:00
route = lib.mkOption {
type = with lib.types; listOf str;
2016-11-21 20:04:46 +00:00
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 = lib.mkIf cfg.enable {
2016-11-21 20:04:46 +00:00
systemd.services.fakeroute = {
description = "Fakeroute Daemon";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "forking";
User = "fakeroute";
DynamicUser = true;
AmbientCapabilities = [ "CAP_NET_RAW" ];
2016-11-21 20:04:46 +00:00
ExecStart = "${pkgs.fakeroute}/bin/fakeroute -f ${routeConf}";
};
};
};
2019-12-04 16:07:45 +00:00
meta.maintainers = with lib.maintainers; [ rnhmjoj ];
2016-11-21 20:04:46 +00:00
}