2013-05-11 05:41:36 +00:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
let
|
|
|
|
cfg = config.security.apparmor;
|
|
|
|
in
|
|
|
|
with pkgs.lib;
|
|
|
|
{
|
|
|
|
|
|
|
|
options.security.apparmor.confineSUIDApplications = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Install AppArmor profiles for commonly-used SUID application
|
|
|
|
to mitigate potential privilege escalation attacks due to bugs
|
|
|
|
in such applications.
|
|
|
|
|
|
|
|
Currently available profiles: ping
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf (cfg.confineSUIDApplications) {
|
|
|
|
security.apparmor.profiles = [ (pkgs.writeText "ping" ''
|
|
|
|
#include <tunables/global>
|
|
|
|
/var/setuid-wrappers/ping {
|
2013-05-13 13:13:06 +00:00
|
|
|
#include <abstractions/base>
|
|
|
|
#include <abstractions/consoles>
|
|
|
|
#include <abstractions/nameservice>
|
2013-05-11 05:41:36 +00:00
|
|
|
|
2013-05-13 13:13:06 +00:00
|
|
|
capability net_raw,
|
|
|
|
capability setuid,
|
|
|
|
network inet raw,
|
2013-05-11 05:41:36 +00:00
|
|
|
|
2013-05-13 13:13:06 +00:00
|
|
|
${pkgs.glibc}/lib/*.so mr,
|
|
|
|
/var/setuid-wrappers/ping.real mixr,
|
|
|
|
${pkgs.iputils}/sbin/ping mixr,
|
|
|
|
#/etc/modules.conf r,
|
2013-05-11 05:41:36 +00:00
|
|
|
|
2013-05-13 13:13:06 +00:00
|
|
|
## Site-specific additions and overrides. See local/README for details.
|
|
|
|
##include <local/bin.ping>
|
2013-05-11 05:41:36 +00:00
|
|
|
}
|
|
|
|
'') ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|