Skip to contentSkip to conversation

rpcbind: drop supplemental groups

PATCH In review Steve Dickson 1 participant 2 messages Mar 8, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpcbind: drop supplemental groups

Drop out of the 'root' group to ensure the process does not have any access to writable or readable files to that group.

---
 src/rpcbind.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
src/rpcbind.c +4 -0
index 24e069b..9a0504d 100644
@@ -236,6 +236,10 @@ main(int argc, char *argv[])
                         syslog(LOG_ERR, "setgid to '%s' (%d) failed: %m", id, p->pw_gid);
                         exit(1);
                 }
+		if (setgroups(0, NULL) == -1) {
+			syslog(LOG_ERR, "dropping supplemental groups failed: %m");
+			exit(1);
+		}
 		if (setuid(p->pw_uid) == -1) {
 			syslog(LOG_ERR, "setuid to '%s' (%d) failed: %m", id, p->pw_uid);
 			exit(1);
Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 5 lines · Steve Dickson

Drop out of the 'root' group to ensure the process does not have any access to writable or readable files to that group.

Committed....

steved.

Quoted 19 lines
---
 src/rpcbind.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
src/rpcbind.c +4 -0
index 24e069b..9a0504d 100644
@@ -236,6 +236,10 @@ main(int argc, char *argv[])
                         syslog(LOG_ERR, "setgid to '%s' (%d) failed: %m", id, p->pw_gid);
                         exit(1);
                 }
+		if (setgroups(0, NULL) == -1) {
+			syslog(LOG_ERR, "dropping supplemental groups failed: %m");
+			exit(1);
+		}
 		if (setuid(p->pw_uid) == -1) {
 			syslog(LOG_ERR, "setuid to '%s' (%d) failed: %m", id, p->pw_uid);
 			exit(1);