Skip to content

Commit b3096ba

Browse files
authored
Merge pull request #2507 from monoidic/priv
ENH: utils: acquire groups of intelmq user in drop_privileges
2 parents a8b2a64 + d04e055 commit b3096ba

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
### Configuration
1313

1414
### Core
15+
- `intelmq.lib.utils.drop_privileges`: When IntelMQ is called as `root` and dropping the privileges to user `intelmq`, also set the non-primary groups associated with the `intelmq` user. Makes the behaviour of running intelmqctl as `root` closer to the behaviour of `sudo -u intelmq ...` (PR#2507 by Mikk Margus Möll).
1516

1617
### Development
1718

intelmq/lib/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ def drop_privileges() -> bool:
692692
"""
693693
if os.geteuid() == 0:
694694
try:
695+
os.setgroups([group.gr_gid for group in grp.getgrall() if 'intelmq' in group.gr_mem])
695696
os.setgid(grp.getgrnam('intelmq').gr_gid)
696697
os.setuid(pwd.getpwnam('intelmq').pw_uid)
697698
except (OSError, KeyError):

0 commit comments

Comments
 (0)