-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define HOME_BASEDIR node variable #772
Merged
Merged
Conversation
This file contains 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
- Customize the base directory where user's home is created by useradd. - The directory must exist, otherwise the custom setting is ignored. - On SELinux the directory must be equivalent of /home.
DavidePrincipi
force-pushed
the
feat-basedir
branch
from
January 9, 2025 11:33
d57f787
to
6d931f5
Compare
DavidePrincipi
requested review from
gsanchietti
and removed request for
Amygos and
gsanchietti
January 13, 2025 14:28
As @gsanchietti suggests, besides the docs, a helper script is handy in this case. |
gsanchietti
reviewed
Jan 15, 2025
gsanchietti
approved these changes
Jan 15, 2025
Amygos
approved these changes
Jan 16, 2025
Comment on lines
35
to
42
if args.DIR == "" and not args.check_only: | ||
agent.unset_env('HOME_BASEDIR') | ||
print("The base path for home directories has been reset to OS default.") | ||
else: | ||
home_basedir = validate_home_basedir(args.DIR) | ||
if not args.check_only: | ||
store_configuration(home_basedir) | ||
print("The base path for home directories has been updated.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, it is safer if we add an extra flag to reset the configuration of the path to the system one, eg. -r
.
Amygos
approved these changes
Jan 17, 2025
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.
Customize the base directory where user's home is created by useradd with a node agent helper command:
configure-home-basedir
On SELinux the directory must be equivalent of /home, the helper command takes care of SELinux configurations.
The HOME_BASEDIR directory must exist, otherwise the
add-module
action fails.The helper command validates the DIR argument before configuring HOME_BASEDIR node environment variable with it. The checks are:
If all checks are successful, and the system has SELinux, the SELinux configuration is updated, as documented in selinux-fcontext manpage (update_selinux_customization).
['semanage', 'fcontext', '-a', '-e', '/home', path]
make "path" an equivalent of/home
.Furthermore, if the configured path has a parent with type
default_t
, configure it too (update_parentdir_selinux_type), as required by semanage docs.Tested with:
/home1
/var/lib/nethserver/home
Refs NethServer/dev#7249