2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.wireshark;
|
|
|
|
wireshark = cfg.package;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
programs.wireshark = {
|
2024-05-15 15:35:15 +00:00
|
|
|
enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2020-04-24 23:36:52 +00:00
|
|
|
default = false;
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
Whether to add Wireshark to the global environment and configure a
|
|
|
|
setcap wrapper for 'dumpcap' for users in the 'wireshark' group.
|
|
|
|
'';
|
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
package = lib.mkPackageOption pkgs "wireshark-cli" {
|
2024-01-02 11:29:13 +00:00
|
|
|
example = "wireshark";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2020-04-24 23:36:52 +00:00
|
|
|
environment.systemPackages = [ wireshark ];
|
|
|
|
users.groups.wireshark = {};
|
|
|
|
|
|
|
|
security.wrappers.dumpcap = {
|
|
|
|
source = "${wireshark}/bin/dumpcap";
|
2023-03-27 19:17:25 +00:00
|
|
|
capabilities = "cap_net_raw,cap_net_admin+eip";
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "root";
|
|
|
|
group = "wireshark";
|
|
|
|
permissions = "u+rx,g+x";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|