remove kernel bool option, just use list

This commit is contained in:
m0duspwnens
2024-10-17 09:29:03 -04:00
parent 73ce526467
commit 5fb660bc9a
7 changed files with 19 additions and 16 deletions

View File

@@ -12,6 +12,7 @@ base:
'*': '*':
- cron.running - cron.running
- repo.client - repo.client
- versionlock
- ntp - ntp
- schedule - schedule
- logrotate - logrotate

View File

@@ -1,3 +1,2 @@
versionlock: versionlock:
kernel: False
hold: [] hold: []

View File

@@ -1,3 +1,8 @@
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
# https://securityonion.net/license; you may not use this file except in compliance with the
# Elastic License 2.0.
{% from 'versionlock/map.jinja' import VERSIONLOCKMERGED %} {% from 'versionlock/map.jinja' import VERSIONLOCKMERGED %}
{% for pkg in VERSIONLOCKMERGED.hold %} {% for pkg in VERSIONLOCKMERGED.hold %}

View File

@@ -1,7 +1,13 @@
{# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
https://securityonion.net/license; you may not use this file except in compliance with the
Elastic License 2.0. #}
{% import_yaml 'versionlock/defaults.yaml' as VERSIONLOCKDEFAULTS %} {% import_yaml 'versionlock/defaults.yaml' as VERSIONLOCKDEFAULTS %}
{% set VERSIONLOCKMERGED = salt['pillar.get']('versionlock', VERSIONLOCKDEFAULTS.versionlock, merge=True) %} {% set VERSIONLOCKMERGED = salt['pillar.get']('versionlock', VERSIONLOCKDEFAULTS.versionlock, merge=True) %}
{% set HELD = salt['pkg.list_holds']() %} {% set HELD = salt['pkg.list_holds']() %}
{# these are packages held / versionlock in other states #}
{% set PACKAGES_HELD_IN_OTHER_STATES = [ {% set PACKAGES_HELD_IN_OTHER_STATES = [
'salt', 'salt',
'salt-master', 'salt-master',
@@ -12,21 +18,16 @@
'docker-ce-rootless-extras' 'docker-ce-rootless-extras'
] %} ] %}
{% if VERSIONLOCKMERGED.kernel %}
{% do VERSIONLOCKMERGED['hold'].append('kernel') %}
{% endif %}
{# remove packages held in other states from hold list #} {# remove packages held in other states from hold list #}
{% do VERSIONLOCKMERGED.update({'hold': VERSIONLOCKMERGED['hold'] | unique | reject('in', PACKAGES_HELD_IN_OTHER_STATES) | list }) %} {% do VERSIONLOCKMERGED.update({'hold': VERSIONLOCKMERGED['hold'] | unique | reject('in', PACKAGES_HELD_IN_OTHER_STATES) | list }) %}
{# initiate VERSIONLOCKMERGED.UNHOLD #}
{% do VERSIONLOCKMERGED.update({'UNHOLD': []}) %} {% do VERSIONLOCKMERGED.update({'UNHOLD': []}) %}
{# if a package is currently held but not set to be held, unhold it #} {# if a package is currently held but not set to be held, unhold it #}
{% for item in HELD %} {% for item in HELD %}
{% set base_name = item.rsplit('-', 2)[0] %} {% set base_name = item.rsplit('-', 2)[0] %}
{% if base_name not in VERSIONLOCKMERGED['hold'] {% if base_name not in VERSIONLOCKMERGED['hold'] and base_name not in PACKAGES_HELD_IN_OTHER_STATES and base_name not in VERSIONLOCKMERGED['UNHOLD'] %}
and base_name not in PACKAGES_HELD_IN_OTHER_STATES
and base_name not in VERSIONLOCKMERGED['UNHOLD'] %}
{% do VERSIONLOCKMERGED['UNHOLD'].append(base_name) %} {% do VERSIONLOCKMERGED['UNHOLD'].append(base_name) %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@@ -1,10 +1,7 @@
versionlock: versionlock:
kernel:
description: Lock the kernel to prevent upgrade.
global: True
forcedType: bool
hold: hold:
description: List of packages to hold description: List of packages to hold. To reduce the frequency of required reboots, add 'kernel' to this list.
global: True global: True
forcedType: "[]string" forcedType: "[]string"
multiline: True multiline: True
helpLink: versionlock.html

View File

@@ -1404,7 +1404,7 @@ make_some_dirs() {
mkdir -p $local_salt_dir/salt/firewall/portgroups mkdir -p $local_salt_dir/salt/firewall/portgroups
mkdir -p $local_salt_dir/salt/firewall/ports mkdir -p $local_salt_dir/salt/firewall/ports
for THEDIR in bpf pcap elasticsearch ntp firewall redis backup influxdb strelka sensoroni soc docker zeek suricata nginx telegraf logstash soc manager kratos idstools idh elastalert stig global kafka;do for THEDIR in bpf pcap elasticsearch ntp firewall redis backup influxdb strelka sensoroni soc docker zeek suricata nginx telegraf logstash soc manager kratos idstools idh elastalert stig global kafka versionlock; do
mkdir -p $local_salt_dir/pillar/$THEDIR mkdir -p $local_salt_dir/pillar/$THEDIR
touch $local_salt_dir/pillar/$THEDIR/adv_$THEDIR.sls touch $local_salt_dir/pillar/$THEDIR/adv_$THEDIR.sls
touch $local_salt_dir/pillar/$THEDIR/soc_$THEDIR.sls touch $local_salt_dir/pillar/$THEDIR/soc_$THEDIR.sls