Skip to content
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

Use PAM for sshd Motd #831

Merged

Conversation

bshephar
Copy link
Contributor

This change switches the method we use to display the motd. Previously, we used PrintMotd in the sshd config. RHEL9 configures mod_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

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]>
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/6bded9cfb3a948f58207a59bfe493f24

✔️ openstack-k8s-operators-content-provider SUCCESS in 43m 55s
podified-multinode-edpm-deployment-crc FAILURE in 21m 19s
cifmw-crc-podified-edpm-baremetal FAILURE in 19m 13s
edpm-ansible-tempest-multinode FAILURE in 24m 26s
edpm-ansible-molecule-edpm_bootstrap FAILURE in 4m 47s
✔️ edpm-ansible-molecule-edpm_podman SUCCESS in 6m 24s
✔️ edpm-ansible-molecule-edpm_module_load SUCCESS in 4m 54s
✔️ edpm-ansible-molecule-edpm_kernel SUCCESS in 7m 11s
✔️ edpm-ansible-molecule-edpm_libvirt SUCCESS in 7m 46s
edpm-ansible-molecule-edpm_nova FAILURE in 4m 58s
✔️ edpm-ansible-molecule-edpm_frr SUCCESS in 10m 37s
✔️ edpm-ansible-molecule-edpm_iscsid SUCCESS in 4m 48s
edpm-ansible-molecule-edpm_ovn_bgp_agent FAILURE in 4m 53s
edpm-ansible-molecule-edpm_ovs FAILURE in 9m 31s
✔️ edpm-ansible-molecule-edpm_tripleo_cleanup SUCCESS in 4m 21s
edpm-ansible-molecule-edpm_tuned FAILURE in 5m 29s
edpm-ansible-molecule-edpm_telemetry_power_monitoring FAILURE in 5m 01s
edpm-ansible-molecule-edpm_update FAILURE in 5m 12s
adoption-standalone-to-crc-ceph-provider RETRY_LIMIT in 29m 43s

@bshephar
Copy link
Contributor Author

bshephar commented Dec 2, 2024

recheck

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/c4d385480a76402190baf75cebae0d3c

✔️ openstack-k8s-operators-content-provider SUCCESS in 3h 31m 35s
podified-multinode-edpm-deployment-crc POST_FAILURE in 1h 17m 12s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 21m 51s
✔️ edpm-ansible-tempest-multinode SUCCESS in 1h 42m 09s
✔️ edpm-ansible-molecule-edpm_bootstrap SUCCESS in 5m 45s
✔️ edpm-ansible-molecule-edpm_podman SUCCESS in 6m 01s
✔️ edpm-ansible-molecule-edpm_module_load SUCCESS in 4m 48s
✔️ edpm-ansible-molecule-edpm_kernel SUCCESS in 9m 55s
✔️ edpm-ansible-molecule-edpm_libvirt SUCCESS in 9m 11s
✔️ edpm-ansible-molecule-edpm_nova SUCCESS in 10m 36s
✔️ edpm-ansible-molecule-edpm_frr SUCCESS in 6m 54s
✔️ edpm-ansible-molecule-edpm_iscsid SUCCESS in 4m 41s
✔️ edpm-ansible-molecule-edpm_ovn_bgp_agent SUCCESS in 7m 35s
✔️ edpm-ansible-molecule-edpm_ovs SUCCESS in 12m 42s
✔️ edpm-ansible-molecule-edpm_tripleo_cleanup SUCCESS in 4m 06s
✔️ edpm-ansible-molecule-edpm_tuned SUCCESS in 5m 52s
✔️ edpm-ansible-molecule-edpm_telemetry_power_monitoring SUCCESS in 6m 50s
✔️ edpm-ansible-molecule-edpm_update SUCCESS in 6m 08s
✔️ adoption-standalone-to-crc-ceph-provider SUCCESS in 3h 19m 41s

ansible.builtin.lineinfile:
path: /etc/pam.d/sshd
regexp: "^session.*optional.*pam_motd.so"
line: "session optional pam_motd.so motd=/etc/motd"
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM, i already have the line in this file in my RHEL 9.2 edpm node, but without the motd=/etc/motd, that is the default, so that part is likely not needed. But, I'm fine either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, so the issue this solves is that PrintMotd defaults to yes in sshd_config. So if we don't explicitly set it to no then the motd is duplicated.

Explicitly telling pam the exact file to use results in the single message being printed instead of the duplication. But, I did some more digging to make sure I was answering the questions on the BZ accurately, and I actually think that this might be a better solution to the problem:
#838

Copy link
Contributor

openshift-ci bot commented Dec 2, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bshephar, slagle

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@fao89
Copy link
Contributor

fao89 commented Dec 2, 2024

recheck

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/8f4d958f92504dedbc33356a59b54839

✔️ openstack-k8s-operators-content-provider SUCCESS in 3h 32m 51s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 23m 17s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 20m 36s
✔️ edpm-ansible-tempest-multinode SUCCESS in 1h 35m 56s
✔️ edpm-ansible-molecule-edpm_bootstrap SUCCESS in 6m 01s
✔️ edpm-ansible-molecule-edpm_podman SUCCESS in 6m 01s
✔️ edpm-ansible-molecule-edpm_module_load SUCCESS in 4m 47s
✔️ edpm-ansible-molecule-edpm_kernel SUCCESS in 9m 27s
✔️ edpm-ansible-molecule-edpm_libvirt SUCCESS in 10m 12s
✔️ edpm-ansible-molecule-edpm_nova SUCCESS in 8m 54s
✔️ edpm-ansible-molecule-edpm_frr SUCCESS in 7m 19s
✔️ edpm-ansible-molecule-edpm_iscsid SUCCESS in 4m 44s
✔️ edpm-ansible-molecule-edpm_ovn_bgp_agent SUCCESS in 7m 41s
✔️ edpm-ansible-molecule-edpm_ovs SUCCESS in 12m 44s
✔️ edpm-ansible-molecule-edpm_tripleo_cleanup SUCCESS in 4m 04s
✔️ edpm-ansible-molecule-edpm_tuned SUCCESS in 5m 53s
✔️ edpm-ansible-molecule-edpm_telemetry_power_monitoring SUCCESS in 7m 52s
✔️ edpm-ansible-molecule-edpm_update SUCCESS in 6m 12s
✔️ adoption-standalone-to-crc-ceph-provider SUCCESS in 3h 19m 45s

@slagle
Copy link
Contributor

slagle commented Dec 3, 2024

/override rdoproject.org/github-check

Copy link
Contributor

openshift-ci bot commented Dec 3, 2024

@slagle: Overrode contexts on behalf of slagle: rdoproject.org/github-check

In response to this:

/override rdoproject.org/github-check

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit 1c2675c into openstack-k8s-operators:main Dec 3, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants