Skip to content

Issue 6155 - ldap-agent fails to start because of permission error #6179

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

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

progier389
Copy link
Contributor

@progier389 progier389 commented May 28, 2024

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

  • Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
  • Setting read permission on the group for the dse.ldif file
  • Setting r/w permissions on the group for the snmp semaphore and mmap file
    For that one special care is needed because ns-slapd umask overrides the file creation permission
    as is better to avoid changing the umask (changing umask within the code is not thread safe,
    and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
    if the needed permission are not set.

Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

@progier389 progier389 added the work in progress Work in Progress - can be reviewed, but not ready for merge. label May 28, 2024
@progier389 progier389 added this to the 2.5 milestone May 28, 2024
@progier389 progier389 linked an issue May 28, 2024 that may be closed by this pull request
@progier389 progier389 self-assigned this May 28, 2024
@progier389
Copy link
Contributor Author

Note:
The test also show that two rules are missing in the ldap SELinux policy to allow the use of mmap on the snmp semaphore file and on the snmp mmap file:
allow dirsrv_snmp_t dirsrv_tmpfs_t:file map;
allow dirsrv_snmp_t dirsrv_var_run_t:file map;

@progier389 progier389 removed work in progress Work in Progress - can be reviewed, but not ready for merge. labels May 28, 2024
@progier389
Copy link
Contributor Author

Split the test in two and skip AVC test if SELinux is not enabled.
Fixed a few errors about missing packages handling
Fixed a problem with the curtime generation
FYI: Both testcases are PASS on Fedora40 1minutetip VMs after installing required packages and fixing SELinux policy ldap-agent rule ("2 map permissions are missing"

@progier389 progier389 force-pushed the i6155 branch 3 times, most recently from 5bc7225 to daee45d Compare June 10, 2024 11:14
Copy link
Member

@droideck droideck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@progier389 progier389 merged commit eb7e57d into 389ds:main Jul 8, 2024
195 checks passed
progier389 added a commit that referenced this pull request Jul 8, 2024
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
progier389 added a commit that referenced this pull request Jul 8, 2024
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
@progier389
Copy link
Contributor Author

3fe5661..eb7e57d main -> main
0fb7496..c3ff6e8 389-ds-base-3.0 -> 389-ds-base-3.0
cf6cdd0..7cb34ed 389-ds-base-2.5 -> 389-ds-base-2.5

progier389 added a commit that referenced this pull request Mar 12, 2025
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
progier389 added a commit that referenced this pull request Mar 12, 2025
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
progier389 added a commit that referenced this pull request Mar 12, 2025
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
progier389 added a commit that referenced this pull request Mar 12, 2025
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
progier389 added a commit that referenced this pull request Mar 12, 2025
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
progier389 added a commit that referenced this pull request Mar 12, 2025
…6179)

Issue: dirsrv-snmp service fails to starts when SELinux is enforced because of AVC preventing to open some files
One workaround is to use the dac_override capability but it is a bad practice.
Fix: Setting proper permissions:

Running ldap-agent with uid=root and gid=dirsrv to be able to access both snmp and dirsrv resources.
Setting read permission on the group for the dse.ldif file
Setting r/w permissions on the group for the snmp semaphore and mmap file
For that one special care is needed because ns-slapd umask overrides the file creation permission
as is better to avoid changing the umask (changing umask within the code is not thread safe,
and the current 0022 umask value is correct for most of the files) so the safest way is to chmod the snmp file
if the needed permission are not set.
Issue: #6155

Reviewed by: @droideck , @vashirov (Thanks ! )

(cherry picked from commit eb7e57d)
@progier389 progier389 deleted the i6155 branch May 20, 2025 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ldap-agent fails to start because of permission error
3 participants