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

RHEL-07-040350 not applying on RHEL7 Workstations #405

Closed
JosephHoffman opened this issue Apr 22, 2022 · 2 comments
Closed

RHEL-07-040350 not applying on RHEL7 Workstations #405

JosephHoffman opened this issue Apr 22, 2022 · 2 comments
Assignees
Labels

Comments

@JosephHoffman
Copy link

JosephHoffman commented Apr 22, 2022

Describe the Issue
RHEL-07-040350 is not properly applying on RHEL7 Workstations by not uncommenting the #IgnoreRhosts yes in /etc/ssh/sshd_config

Expected Behavior
Post running this playbook the line #IgnoreRhosts yes should change to IgnoreRhosts yes

Actual Behavior
Regex does not seem to be finding the syntax for #IgnoreRhosts yes

Control(s) Affected
RHEL-07-040350

Environment (please complete the following information):

  • Ansible Version: 2.9.27
  • Host Python Version: 3.6.8
  • Ansible Server Python Version: N/A
  • Additional Details:

Additional Notes
This is configured in fix-cat2.yml line 3420

- name: "MEDIUM | RHEL-07-040350 | PATCH | The Red Hat Enterprise Linux operating system must be configured so that the SSH daemon does not allow authentication using rhosts authentication."
  lineinfile:
      dest: /etc/ssh/sshd_config
      regexp: "(?i)^#?IgnoreRhosts"
      line: IgnoreRhosts yes
      validate: /usr/sbin/sshd -t -f %s
  notify: restart sshd
  when:
      - rhel_07_040350
      - rhel7stig_ssh_required
  tags:
      - RHEL-07-040350
      - CAT2
      - CCI-000366
      - SRG-OS-000480-GPOS-00227
      - SV-204590r603261_rule
      - V-204590
      - ssh

Possible Solution
The regex seems to be invalid and needs modification on line 3420 of cat-fix2.yml

Currently:
"(?i)^#?IgnoreRhosts"
Change to:
"^#IgnoreRhosts"

This regex seems to function properly.

@bordenit
Copy link

bordenit commented Jun 19, 2022

(?i)^#?.?IgnoreRhosts

Would match:

IgnoreRhosts
#IgnoreRhosts
# IgnoreRhosts

Might want to lock it in more though so it wouldn't match something like IgnoreRhosts22 or IIgnoreRhosts:

(?i)^#?\ ?w*IgnoreRhosts\b

@uk-bolly uk-bolly self-assigned this Feb 7, 2023
uk-bolly added a commit that referenced this issue Feb 7, 2023
Signed-off-by: Mark Bolwell <mark.bollyuk@gmail.com>
This was referenced Feb 28, 2023
@uk-bolly
Copy link
Member

uk-bolly commented Mar 3, 2023

hi @bordenit

Thank you again for raising this issue. This has now been merged into the devel branch. Aiming to put this into main if all is well in the next couple of weeks.

many thanks again

uk-bolly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants