[Backport release-24.11] nixos/arp-scan: init, nixos/tcpdump: init (#357214)

This commit is contained in:
Sandro 2024-11-21 15:56:54 +01:00 committed by GitHub
commit f5e19b9e24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 89 additions and 7 deletions

View File

@ -148,6 +148,7 @@
./programs/alvr.nix
./programs/appgate-sdp.nix
./programs/appimage.nix
./programs/arp-scan.nix
./programs/atop.nix
./programs/ausweisapp.nix
./programs/autojump.nix
@ -296,6 +297,7 @@
./programs/sysdig.nix
./programs/system-config-printer.nix
./programs/systemtap.nix
./programs/tcpdump.nix
./programs/thefuck.nix
./programs/thunar.nix
./programs/thunderbird.nix

View File

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.arp-scan;
in
{
options = {
programs.arp-scan = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to configure a setcap wrapper for arp-scan.
'';
};
};
};
config = lib.mkIf cfg.enable {
security.wrappers.arp-scan = {
owner = "root";
group = "root";
capabilities = "cap_net_raw+p";
source = lib.getExe pkgs.arp-scan;
};
};
}

View File

@ -1,10 +1,16 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.iftop;
in {
in
{
options = {
programs.iftop.enable = lib.mkEnableOption "iftop + setcap wrapper";
programs.iftop.enable = lib.mkEnableOption "iftop and setcap wrapper for it";
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.iftop ];
@ -12,7 +18,7 @@ in {
owner = "root";
group = "root";
capabilities = "cap_net_raw+p";
source = "${pkgs.iftop}/bin/iftop";
source = lib.getExe pkgs.iftop;
};
};
}

View File

@ -0,0 +1,36 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.tcpdump;
in
{
options = {
programs.tcpdump = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to configure a setcap wrapper for tcpdump.
To use it, add your user to the `pcap` group.
'';
};
};
};
config = lib.mkIf cfg.enable {
security.wrappers.tcpdump = {
owner = "root";
group = "pcap";
capabilities = "cap_net_raw+p";
permissions = "u+rx,g+x";
source = lib.getExe pkgs.tcpdump;
};
users.groups.pcap = { };
};
}

View File

@ -1,8 +1,14 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.traceroute;
in {
in
{
options = {
programs.traceroute = {
enable = lib.mkOption {
@ -20,7 +26,7 @@ in {
owner = "root";
group = "root";
capabilities = "cap_net_raw+p";
source = "${pkgs.traceroute}/bin/traceroute";
source = lib.getExe pkgs.traceroute;
};
};
}