mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-18 15:02:50 +01:00
Merge pull request #138 from m0duspwnens/master
Fixed bugs with motd update from OS patch updates
This commit is contained in:
@@ -4,20 +4,19 @@ import subprocess
|
|||||||
def check():
|
def check():
|
||||||
|
|
||||||
os = __grains__['os']
|
os = __grains__['os']
|
||||||
|
retval = 'False'
|
||||||
|
|
||||||
if os == 'Ubuntu':
|
if os == 'Ubuntu':
|
||||||
if path.exists('/var/run/reboot-required'):
|
if path.exists('/var/run/reboot-required'):
|
||||||
retval = 'True'
|
retval = 'True'
|
||||||
else:
|
|
||||||
retval = 'False'
|
|
||||||
|
|
||||||
elif os == 'CentOS':
|
elif os == 'CentOS':
|
||||||
cmd = 'needs-restarting -r > /dev/null 2>&1'
|
cmd = 'needs-restarting -r > /dev/null 2>&1'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
needs_restarting = subprocess.check_call(cmd.split(), shell=True)
|
needs_restarting = subprocess.check_call(cmd, shell=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
retval = 'True'
|
retval = 'True'
|
||||||
retval = 'False'
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
retval = 'Unsupported OS: %s' % os
|
retval = 'Unsupported OS: %s' % os
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
package_update_reboot_required_motd:
|
package_update_reboot_required_motd:
|
||||||
file.append:
|
file.managed:
|
||||||
- name: /etc/motd
|
- name: /etc/motd
|
||||||
- source: salt://motd/files/package_update_reboot_required.jinja
|
- source: salt://motd/files/package_update_reboot_required.jinja
|
||||||
- template: jinja
|
- template: jinja
|
||||||
|
|||||||
5
salt/patch/needs_restarting.sls
Normal file
5
salt/patch/needs_restarting.sls
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
needs_restarting:
|
||||||
|
module.run:
|
||||||
|
- mine.send:
|
||||||
|
- func: needs_restarting.check
|
||||||
|
- order: last
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
{% if grains.os == "CentOS" %}
|
|
||||||
include:
|
include:
|
||||||
|
- patch.needs_restarting
|
||||||
|
{% if grains.os == "CentOS" %}
|
||||||
- yum.packages
|
- yum.packages
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -7,8 +8,3 @@ patch_os:
|
|||||||
pkg.uptodate:
|
pkg.uptodate:
|
||||||
- name: patch_os
|
- name: patch_os
|
||||||
- refresh: True
|
- refresh: True
|
||||||
|
|
||||||
needs_restarting:
|
|
||||||
module.run:
|
|
||||||
- mine.send:
|
|
||||||
- func: needs_restarting.check
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
base:
|
base:
|
||||||
'*':
|
'*':
|
||||||
- patch.os.schedule
|
- patch.os.schedule
|
||||||
|
- patch.needs_restarting
|
||||||
- motd
|
- motd
|
||||||
|
|
||||||
'G@role:so-sensor':
|
'G@role:so-sensor':
|
||||||
|
|||||||
Reference in New Issue
Block a user