Skip to content

Instantly share code, notes, and snippets.

@chofstede
Created July 2, 2024 18:16
Show Gist options
  • Select an option

  • Save chofstede/67641b45f7b2379bab5832b70c0b8351 to your computer and use it in GitHub Desktop.

Select an option

Save chofstede/67641b45f7b2379bab5832b70c0b8351 to your computer and use it in GitHub Desktop.
---
- name: Enable temporary mitigation for CVE-2024-6387 "regreSSHion"
hosts: foreman_rhel9hosts
become: true
gather_facts: true
tasks:
- name: Change LoginGraceTime to 0 in sshd_config
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config
regex: "^(#)?LoginGraceTime"
line: "LoginGraceTime 0"
state: present
notify: Restart sshd
when: ansible_facts['distribution'] == "RedHat" and ansible_facts['distribution_major_version'] == "9"
handlers:
- name: Restart sshd
ansible.builtin.systemd_service:
name: sshd
state: restarted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment