-
Notifications
You must be signed in to change notification settings - Fork 710
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
RedHatOfficial.rhel7_stig Ansible role inserts settings in the wrong location when multiple "Match User" entries exist in /etc/ssh/sshd_config #5118
Comments
Can you check with latest versions of the ansible role to see if the problem still persists? |
The relevant rule is |
I researched about this and didn't find any ordering restriction for the |
@vhaispdeaded could you provide more context on why the |
All options following a "Match" keyword only apply to the conditional block defined by the "Match" expression. (see sshd_config) Inserting before the first occurrence of "Match", is safe, but ideally all global options should be placed before the @marcusburghardt, Thank you for investigating this issue. |
@marcusburghardt It looks like this was added via: #4807 |
Thank you! |
From man:
So, Match conditionals are always expected at the end of the file. Consequently, global parameters must be defined before any |
Description of problem:
Ansible Tasks for RedHatOfficial.RHEL7_stig of the form:
insert their lines before the last occurrence of the pattern, but if multiple patterns exist, then the lines are placed in the incorrect position. Even if no "Match User" directives have been added to /etc/ssh/sshd_config, the role inserts the lines inside an example comment block describing the "Match User" directive. If two or more "Match User" directives exist, the role will create a a configuration that does not meet the requirements, and may not even work .
An additional parameter "firstmatch: yes" will correct this issue for Ansible 2.5 and later.
SCAP Security Guide Version:
Unsure of SCAP Security Guide Version used to generate this project.
DISA STIG for Red Hat Enterprise Linux 7 - release 0.1.47
Operating System Version:
Red Hat Enterprise Linux 7.7 built from Red Hat Satellite 6.6.1 and Ansible 2.8.7 (embedded in Satellite)
Steps to Reproduce:
Actual Results:
With no "Match User" directives:
With one "Match User" directive:
With two "Match User" directives:
Expected Results:
Addition Information/Debugging Steps:
The issue occurs for the following tasks:
The text was updated successfully, but these errors were encountered: