diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-10-14 15:25:34 +1100 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-10-15 02:10:36 +0200 |
commit | c22ebccba8a09065e59d080ac7a2969a267974ce (patch) | |
tree | 4a490e5a9ccaff784ef67182eba0715579d15715 /conf.c | |
parent | ceb2061587b5113f58afc6944969ff79512a8767 (diff) | |
download | passt-c22ebccba8a09065e59d080ac7a2969a267974ce.tar passt-c22ebccba8a09065e59d080ac7a2969a267974ce.tar.gz passt-c22ebccba8a09065e59d080ac7a2969a267974ce.tar.bz2 passt-c22ebccba8a09065e59d080ac7a2969a267974ce.tar.lz passt-c22ebccba8a09065e59d080ac7a2969a267974ce.tar.xz passt-c22ebccba8a09065e59d080ac7a2969a267974ce.tar.zst passt-c22ebccba8a09065e59d080ac7a2969a267974ce.zip |
isolation: Replace drop_caps() with a version that actually does something
The current implementation of drop_caps() doesn't really work because it
attempts to drop capabilities from the bounding set. That's not the set
that really matters, it's about limiting the abilities of things we might
later exec() rather than our own capabilities. It also requires
CAP_SETPCAP which we won't usually have.
Replace it with a new version which uses setcap(2) to drop capabilities
from the effective and permitted sets. For now we leave the inheritable
set as is, since we don't want to preclude the user from passing
inheritable capabilities to the command spawed by pasta.
Correctly dropping caps reveals that we were relying on some capabilities
we'd supposedly dropped. Re-divide the dropping of capabilities between
isolate_initial(), isolate_user() and isolate_prefork() to make this work.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1547,7 +1547,7 @@ void conf(struct ctx *c, int argc, char **argv) usage(argv[0]); } - isolate_user(uid, gid, !netns_only, userns); + isolate_user(uid, gid, !netns_only, userns, c->mode); if (c->pasta_conf_ns) c->no_ra = 1; |