Make minimum UID/GID configurable via multiuser.minuid/mingid#69
Open
djw8605 wants to merge 2 commits into
Open
Make minimum UID/GID configurable via multiuser.minuid/mingid#69djw8605 wants to merge 2 commits into
djw8605 wants to merge 2 commits into
Conversation
The UID/GID thresholds below which a mapped username is rejected as a system account were hard-coded to 500 (g_minimum_uid / g_minimum_gid). Sites that mount shared file systems (e.g. Lustre) may have legitimate groups with IDs below 500, which were being denied access. Convert the thresholds to static members of UserSentry (single definition with external linkage, mirroring m_is_cmsd) so a value set at config time is seen across all translation units, and parse two new optional config directives, multiuser.minuid and multiuser.mingid, in MultiuserFileSystem::Config(). Both default to 500, preserving existing behavior. The effective thresholds are logged at startup. Closes #68 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UFwX4qfurnnEvbPtzL46ZL
There was a problem hiding this comment.
Pull request overview
This PR makes the minimum allowed UID/GID for mapped usernames configurable at runtime via new config directives, addressing sites where legitimate users/groups may have IDs below the previously hard-coded threshold (500).
Changes:
- Replaces hard-coded
g_minimum_uid/g_minimum_gidwithUserSentrystatic members (single definition with external linkage). - Adds
multiuser.minuidandmultiuser.mingidparsing inMultiuserFileSystem::Config()and logs the effective thresholds at startup. - Documents the new directives in
README.mdand the example OSG config snippet.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/UserSentry.hh | Introduces configurable min UID/GID thresholds and applies them during user lookup validation. |
| src/MultiuserFileSystem.cc | Parses multiuser.minuid / multiuser.mingid from config and logs the configured thresholds. |
| src/multiuser.cpp | Defines the new UserSentry static threshold members with defaults (500). |
| README.md | Documents new optional configuration directives and provides an example. |
| configs/60-osg-multiuser.cfg | Updates sample config comments to describe the new directives. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+88
to
+93
| if (id_val < 0) { | ||
| m_log.Emsg("Config", directive, "must not be negative"); | ||
| return false; | ||
| } | ||
| out = static_cast<int>(id_val); | ||
| return true; |
Comment on lines
+174
to
+178
| if (static_cast<int>(pwd.pw_uid) < m_min_uid) { | ||
| m_log.Emsg("UserSentry", "Multiuser denying access: Username", username.c_str(), "maps to a system UID; rejecting lookup"); | ||
| return; | ||
| } | ||
| if (pwd.pw_gid < g_minimum_gid) { | ||
| if (static_cast<int>(pwd.pw_gid) < m_min_gid) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The UID/GID thresholds below which a mapped username is rejected as a
system account were hard-coded to 500 (g_minimum_uid / g_minimum_gid).
Sites that mount shared file systems (e.g. Lustre) may have legitimate
groups with IDs below 500, which were being denied access.
Convert the thresholds to static members of UserSentry (single definition
with external linkage, mirroring m_is_cmsd) so a value set at config time
is seen across all translation units, and parse two new optional config
directives, multiuser.minuid and multiuser.mingid, in
MultiuserFileSystem::Config(). Both default to 500, preserving existing
behavior. The effective thresholds are logged at startup.
Closes #68
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01UFwX4qfurnnEvbPtzL46ZL