[PATCH v2 05/10] sandbox/seunshare: document that -C has long been a no-op

Stephen Smalley <[email protected]>
Newsgroups org.kernel.vger.selinux
Message-ID <[email protected]>
Originally seunshare cleared both effective and boundings set by
default, with -C as an option to only clear the effective
set. However, commit 1f0b5bd920c8 ("policycoreutils: seunshare: Only
drop caps not the Bounding Set from seunshare") switched the default
to only clear the effective set, making -C a no-op. Document it as
such in the man page and a comment in the code to avoid confusion.

Signed-off-by: Stephen Smalley <[email protected]>
---
 sandbox/seunshare.8 | 5 ++++-
 sandbox/seunshare.c | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/sandbox/seunshare.8 b/sandbox/seunshare.8
index 5339a3b1..bad7e1dc 100644
--- a/sandbox/seunshare.8
+++ b/sandbox/seunshare.8
@@ -22,7 +22,10 @@ Use alternate temporary directory to mount on /tmp. tmpdir must be owned by the
 Use alternate temporary directory to mount on XDG_RUNTIME_DIR (/run/user/$UID). runuserdir must be owned by the user
 .TP
 \fB\-C --capabilities\fR
-Allow apps executed within the namespace to use capabilities. Default is no capabilities
+Retained for compatibility; has no effect. seunshare always drops all
+capabilities and sets the no-root seecurebits so setuid-root programs
+run without capabilities, but leaves the bounding set intact so
+programs with file capabilities continue to work.
 .TP
 \fB\-k --kill\fR
 Kill all processes with matching MCS level
diff --git a/sandbox/seunshare.c b/sandbox/seunshare.c
index 37a24c57..7c6154e1 100644
--- a/sandbox/seunshare.c
+++ b/sandbox/seunshare.c
@@ -864,6 +864,12 @@ int main(int argc, char **argv)
 			verbose++;
 			break;
 		case 'C':
+			/*
+			 * This is a no-op ever since
+			 * commit 1f0b5bd920c8 switched
+			 * the default to support
+			 * use of file-cap binaries.
+			 */
 			cap_set = CAPNG_SELECT_CAPS;
 			break;
 		case 'P':
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.