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

ACTUALLY corrects the behavior in #297 #303

Merged
merged 7 commits into from
Mar 9, 2021
11 changes: 5 additions & 6 deletions ash-linux/el7/STIGbyID/cat2/RHEL-07-040660.sls
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ notify_{{ stig_id }}-skipSet:
- cwd: /root
- stateful: True
{%- else %}
include:
- ash-linux.el7.STIGbyID.cat2.restart_sshd

file_{{ stig_id }}-{{ cfgFile }}:
file.replace:
- name: '{{ cfgFile }}'
Expand All @@ -53,10 +56,6 @@ file_{{ stig_id }}-{{ cfgFile }}:
- not_found_content: |-
# Inserted per STIG {{ stig_id }}
{{ parmName }} {{ parmValu }}

service_{{ stig_id }}-{{ cfgFile }}:
service.running:
- name: '{{ svcName }}'
- listen:
- file: file_{{ stig_id }}-{{ cfgFile }}
- onchanges_in:
- service: service_sshd_restart
{%- endif %}
11 changes: 5 additions & 6 deletions ash-linux/el7/STIGbyID/cat2/RHEL-07-040670.sls
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ notify_{{ stig_id }}-skipSet:
- cwd: /root
- stateful: True
{%- else %}
include:
- ash-linux.el7.STIGbyID.cat2.restart_sshd

file_{{ stig_id }}-{{ cfgFile }}:
file.replace:
- name: '{{ cfgFile }}'
Expand All @@ -51,10 +54,6 @@ file_{{ stig_id }}-{{ cfgFile }}:
- not_found_content: |-
# Inserted per STIG {{ stig_id }}
{{ parmName }} {{ parmValu }}

service_{{ stig_id }}-{{ cfgFile }}:
service.running:
- name: '{{ svcName }}'
- listen:
- file: file_{{ stig_id }}-{{ cfgFile }}
- onchanges_in:
- service: service_sshd_restart
{%- endif %}
11 changes: 5 additions & 6 deletions ash-linux/el7/STIGbyID/cat2/RHEL-07-040680.sls
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ notify_{{ stig_id }}-skipSet:
- cwd: /root
- stateful: True
{%- else %}
include:
- ash-linux.el7.STIGbyID.cat2.restart_sshd

file_{{ stig_id }}-{{ cfgFile }}:
file.replace:
- name: '{{ cfgFile }}'
Expand All @@ -42,10 +45,6 @@ file_{{ stig_id }}-{{ cfgFile }}:
- not_found_content: |-
# Inserted per STIG {{ stig_id }}
{{ parmName }} {{ parmValu }}

service_{{ stig_id }}-{{ cfgFile }}:
service.running:
- name: '{{ svcName }}'
- listen:
- file: file_{{ stig_id }}-{{ cfgFile }}
- onchanges_in:
- service: service_sshd_restart
{%- endif %}
11 changes: 5 additions & 6 deletions ash-linux/el7/STIGbyID/cat2/RHEL-07-040690.sls
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ notify_{{ stig_id }}-skipSet:
- name: 'printf "\nchanged=no comment=''Handler for {{ stig_id }} has been selected for skip.''\n"'
- cwd: /root
{%- else %}
include:
- ash-linux.el7.STIGbyID.cat2.restart_sshd

file_{{ stig_id }}-{{ cfgFile }}:
file.replace:
- name: '{{ cfgFile }}'
Expand All @@ -40,10 +43,6 @@ file_{{ stig_id }}-{{ cfgFile }}:
- not_found_content: |-
# Inserted per STIG {{ stig_id }}
{{ parmName }} {{ parmValu }}

service_{{ stig_id }}-{{ cfgFile }}:
service.running:
- name: '{{ svcName }}'
- listen:
- file: file_{{ stig_id }}-{{ cfgFile }}
- onchanges_in:
- service: service_sshd_restart
{%- endif %}
11 changes: 5 additions & 6 deletions ash-linux/el7/STIGbyID/cat2/RHEL-07-040700.sls
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ notify_{{ stig_id }}-skipSet:
- cwd: /root
- stateful: True
{%- else %}
include:
- ash-linux.el7.STIGbyID.cat2.restart_sshd

file_{{ stig_id }}-{{ cfgFile }}:
file.replace:
- name: '{{ cfgFile }}'
Expand All @@ -42,10 +45,6 @@ file_{{ stig_id }}-{{ cfgFile }}:
- not_found_content: |-
# Inserted per STIG {{ stig_id }}
{{ parmName }} {{ parmValu }}

service_{{ stig_id }}-{{ cfgFile }}:
service.running:
- name: '{{ svcName }}'
- listen:
- file: file_{{ stig_id }}-{{ cfgFile }}
- onchanges_in:
- service: service_sshd_restart
{%- endif %}
21 changes: 21 additions & 0 deletions ash-linux/el7/STIGbyID/cat2/files/restart_sshd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Restart sshd service if any of:
#
# Cause changes to the /etc/ssh/sshd_config file
#
#################################################################
# Standard outputter function
diag_out() {
echo "${1}"
}

diag_out "----------------------------------------"
diag_out "Service Restart: sshd"
diag_out " Restart the sshd service if any of:"
diag_out " * file_RHEL-07-040690"
diag_out " * file_RHEL-07-040680"
diag_out " * file_RHEL-07-040660"
diag_out " * file_RHEL-07-040700"
diag_out " * file_RHEL-07-040670"
diag_out " Change the /etc/ssh/sshd_config file"
diag_out "----------------------------------------"

1 change: 1 addition & 0 deletions ash-linux/el7/STIGbyID/cat2/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,4 @@ include:
- ash-linux.el7.STIGbyID.cat2.RHEL-07-040820
- ash-linux.el7.STIGbyID.cat2.RHEL-07-040830
- ash-linux.el7.STIGbyID.cat2.RHEL-07-040860
- ash-linux.el7.STIGbyID.cat2.restart_sshd
ferricoxide marked this conversation as resolved.
Show resolved Hide resolved
23 changes: 23 additions & 0 deletions ash-linux/el7/STIGbyID/cat2/restart_sshd.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Restart sshd service if any of:
#
# Cause changes to the /etc/ssh/sshd_config file
#
#################################################################
{%- set stig_id = 'restart_sshd' %}
{%- set helperLoc = 'ash-linux/el7/STIGbyID/cat2/files' %}
{%- set svcName = 'sshd' %}

script_{{ stig_id }}-describe:
cmd.script:
- source: salt://{{ helperLoc }}/{{ stig_id }}.sh
- cwd: /root

service_sshd_restart:
service.running:
- name: '{{ svcName }}'
- onchanges:
ferricoxide marked this conversation as resolved.
Show resolved Hide resolved
- file: file_RHEL-07-040690-/etc/ssh/sshd_config
- file: file_RHEL-07-040680-/etc/ssh/sshd_config
- file: file_RHEL-07-040660-/etc/ssh/sshd_config
- file: file_RHEL-07-040700-/etc/ssh/sshd_config
- file: file_RHEL-07-040670-/etc/ssh/sshd_config