Skip to content

Commit e032cf2

Browse files
committed
Use PAM for sshd Motd
This change switches the method we use to display the motd. Previously, we used PrintMotd in the sshd config. RHEL9 configures pam_motd.so in PAM, and as such the motd will be duplicated when using PrintMotd. To avoid this, we can configure the motd via PAM. Related: https://bugzilla.redhat.com/show_bug.cgi?id=2329414 Signed-off-by: Brendan Shephard <[email protected]>
1 parent bee8d8c commit e032cf2

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

roles/edpm_sshd/tasks/configure.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@
7474
{% if edpm_sshd_banner_enabled %}
7575
{% set _ = edpm_sshd_server_options.__setitem__('Banner', '/etc/issue') %}
7676
{% endif %}
77-
{% if edpm_sshd_motd_enabled %}
78-
{% set _ = edpm_sshd_server_options.__setitem__('PrintMotd', 'yes') %}
79-
{% endif %}
8077
{{ edpm_sshd_server_options }}
8178
79+
- name: Set sshd motd when enabled
80+
ansible.builtin.lineinfile:
81+
path: /etc/pam.d/sshd
82+
regexp: "^session.*optional.*pam_motd.so"
83+
line: "session optional pam_motd.so motd=/etc/motd"
84+
state: present
85+
when: edpm_sshd_motd_enabled
86+
8287
- name: Adjust ssh server configuration
8388
become: true
8489
ansible.builtin.template:

0 commit comments

Comments
 (0)