You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a new PAM rule after a present rule and there is a comment present, pamd overwrites the comment.
I'm trying to add a module to common-session. Its original state is
#
# /etc/pam.d/common-session - session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of interactive sessions.
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
# here are the per-package modules (the "Primary" block)
session [default=1] pam_permit.so
# here's the fallback if no module succeeds
session requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump around
session required pam_permit.so
# and here are more per-package modules (the "Additional" block)
session required pam_unix.so
session optional pam_sss.so
session optional pam_systemd.so
# end of pam-auth-update config
$ ansible-galaxy collection list community.general
# /usr/lib/python3.13/site-packages/ansible_collectionsCollection Version----------------- -------community.general 10.1.0
Configuration
$ ansible-config dump --only-changed
OS / Environment
control: Arch Linux
managed: Debian 12
Steps to Reproduce
- name: autocreate user home directorycommunity.general.pamd:
name: common-sessiontype: sessioncontrol: optionalmodule_path: pam_systemd.sonew_type: sessionnew_control: optionalnew_module_path: pam_mkhomedir.somodule_arguments: "umask=0077"state: after
Expected Results
Either
[...]
session optional pam_systemd.so
# end of pam-auth-update config
session optional pam_mkhomedir.so umask=0077
or
[...]
session optional pam_systemd.so
session optional pam_mkhomedir.so umask=0077
# end of pam-auth-update config
In addition, it would be great if there was an argument to pamd to specify if the new rule is to be inserted before or after comments. In this case, I would like it to be after the comment, but there may be other usecases.
Actual Results
#
# Updated by Ansible - 2024-12-25T21:03:49.123606
# /etc/pam.d/common-session - session-related modules common to all services
#
# This file is included from other service-specific PAM config files,
# and should contain a list of modules that define tasks to be performed
# at the start and end of interactive sessions.
#
# As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
# To take advantage of this, it is recommended that you configure any
# local modules either before or after the default block, and use
# pam-auth-update to manage selection of other modules. See
# pam-auth-update(8) for details.
# here are the per-package modules (the "Primary" block)session [default=1] pam_permit.so
# here's the fallback if no module succeedssession requisite pam_deny.so
# prime the stack with a positive return value if there isn't one already;
# this avoids us returning an error just because nothing sets a success code
# since the modules above will each just jump aroundsession required pam_permit.so
# and here are more per-package modules (the "Additional" block)session required pam_unix.sosession optional pam_sss.sosession optional pam_systemd.sosession optional pam_mkhomedir.so umask=0077
Code of Conduct
I agree to follow the Ansible Code of Conduct
The text was updated successfully, but these errors were encountered:
Summary
When adding a new PAM rule after a present rule and there is a comment present, pamd overwrites the comment.
I'm trying to add a module to
common-session
. Its original state isIssue Type
Bug Report
Component Name
pamd
Ansible Version
Community.general Version
Configuration
$ ansible-config dump --only-changed
OS / Environment
control: Arch Linux
managed: Debian 12
Steps to Reproduce
Expected Results
Either
or
In addition, it would be great if there was an argument to pamd to specify if the new rule is to be inserted before or after comments. In this case, I would like it to be after the comment, but there may be other usecases.
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: