2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-05-11 07:41:36 +02:00
|
|
|
let
|
|
|
|
cfg = config.security.apparmor;
|
|
|
|
in
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2013-05-11 07:41:36 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
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 15:13:06 +02:00
|
|
|
#include <abstractions/base>
|
|
|
|
#include <abstractions/consoles>
|
|
|
|
#include <abstractions/nameservice>
|
2013-05-11 07:41:36 +02:00
|
|
|
|
2013-05-13 15:13:06 +02:00
|
|
|
capability net_raw,
|
|
|
|
capability setuid,
|
|
|
|
network inet raw,
|
2013-05-11 07:41:36 +02:00
|
|
|
|
2015-04-26 19:54:51 +02:00
|
|
|
${pkgs.glibc.out}/lib/*.so mr,
|
2016-01-24 08:29:25 +01:00
|
|
|
${pkgs.libcap.out}/lib/libcap.so* mr,
|
2016-01-24 08:28:56 +01:00
|
|
|
${pkgs.attr.out}/lib/libattr.so* mr,
|
2013-05-28 16:15:10 +02:00
|
|
|
|
|
|
|
${pkgs.iputils}/bin/ping mixr,
|
|
|
|
/var/setuid-wrappers/ping.real r,
|
|
|
|
|
2013-05-13 15:13:06 +02:00
|
|
|
#/etc/modules.conf r,
|
2013-05-11 07:41:36 +02:00
|
|
|
|
2013-05-13 15:13:06 +02:00
|
|
|
## Site-specific additions and overrides. See local/README for details.
|
|
|
|
##include <local/bin.ping>
|
2013-05-11 07:41:36 +02:00
|
|
|
}
|
|
|
|
'') ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|