mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Merge pull request #7011 from Security-Onion-Solutions/fix/reinstall
https://github.com/Security-Onion-Solutions/securityonion/issues/7010
This commit is contained in:
7
salt/ca/remove.sls
Normal file
7
salt/ca/remove.sls
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
pki_private_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/ca.key
|
||||||
|
|
||||||
|
pki_public_ca_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/ca.crt
|
||||||
@@ -84,6 +84,8 @@ wait_for_influxdb:
|
|||||||
- retry:
|
- retry:
|
||||||
attempts: 5
|
attempts: 5
|
||||||
interval: 60
|
interval: 60
|
||||||
|
- require:
|
||||||
|
- docker_container: so-influxdb
|
||||||
|
|
||||||
telegraf_database:
|
telegraf_database:
|
||||||
influxdb_database.present:
|
influxdb_database.present:
|
||||||
|
|||||||
@@ -56,17 +56,17 @@ m2cryptopkgs:
|
|||||||
removefbcertdir:
|
removefbcertdir:
|
||||||
file.absent:
|
file.absent:
|
||||||
- name: /etc/pki/filebeat.crt
|
- name: /etc/pki/filebeat.crt
|
||||||
- onlyif: "[ -d /etc/pki/filebeat.crt ]"
|
- onlyif: "test -d /etc/pki/filebeat.crt"
|
||||||
|
|
||||||
removefbp8dir:
|
removefbp8dir:
|
||||||
file.absent:
|
file.absent:
|
||||||
- name: /etc/pki/filebeat.p8
|
- name: /etc/pki/filebeat.p8
|
||||||
- onlyif: "[ -d /etc/pki/filebeat.p8 ]"
|
- onlyif: "test -d /etc/pki/filebeat.p8"
|
||||||
|
|
||||||
removeesp12dir:
|
removeesp12dir:
|
||||||
file.absent:
|
file.absent:
|
||||||
- name: /etc/pki/elasticsearch.p12
|
- name: /etc/pki/elasticsearch.p12
|
||||||
- onlyif: "[ -d /etc/pki/elasticsearch.p12 ]"
|
- onlyif: "test -d /etc/pki/elasticsearch.p12"
|
||||||
|
|
||||||
influxdb_key:
|
influxdb_key:
|
||||||
x509.private_key_managed:
|
x509.private_key_managed:
|
||||||
|
|||||||
69
salt/ssl/remove.sls
Normal file
69
salt/ssl/remove.sls
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
trusttheca:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/ssl/certs/intca.crt
|
||||||
|
|
||||||
|
influxdb_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/influxdb.key
|
||||||
|
|
||||||
|
influxdb_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/influxdb.crt
|
||||||
|
|
||||||
|
redis_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/redis.key
|
||||||
|
|
||||||
|
redis_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/redis.crt
|
||||||
|
|
||||||
|
etc_filebeat_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/filebeat.key
|
||||||
|
|
||||||
|
etc_filebeat_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/filebeat.crt
|
||||||
|
|
||||||
|
filebeatdir:
|
||||||
|
file.absent:
|
||||||
|
- name: /opt/so/saltstack/local/salt/filebeat/files
|
||||||
|
|
||||||
|
registry_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/registry.key
|
||||||
|
|
||||||
|
registry_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/registry.crt
|
||||||
|
|
||||||
|
/etc/pki/elasticsearch.key:
|
||||||
|
file.absent: []
|
||||||
|
|
||||||
|
/etc/pki/elasticsearch.crt:
|
||||||
|
file.absent: []
|
||||||
|
|
||||||
|
remove_elasticsearch.p12:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/elasticsearch.p12
|
||||||
|
|
||||||
|
managerssl_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/managerssl.key
|
||||||
|
|
||||||
|
managerssl_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/managerssl.crt
|
||||||
|
|
||||||
|
fleet_key:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/fleet.key
|
||||||
|
|
||||||
|
fleet_crt:
|
||||||
|
file.absent:
|
||||||
|
- name: /etc/pki/fleet.crt
|
||||||
|
|
||||||
|
fbcertdir:
|
||||||
|
file.absent:
|
||||||
|
- name: /opt/so/conf/filebeat/etc/pki
|
||||||
@@ -2049,9 +2049,6 @@ reserve_ports() {
|
|||||||
|
|
||||||
reinstall_init() {
|
reinstall_init() {
|
||||||
info "Putting system in state to run setup again"
|
info "Putting system in state to run setup again"
|
||||||
|
|
||||||
# remove all of root's cronjobs
|
|
||||||
crontab -r -u root
|
|
||||||
|
|
||||||
if [[ $install_type =~ ^(MANAGER|EVAL|HELIXSENSOR|MANAGERSEARCH|STANDALONE|FLEET|IMPORT)$ ]]; then
|
if [[ $install_type =~ ^(MANAGER|EVAL|HELIXSENSOR|MANAGERSEARCH|STANDALONE|FLEET|IMPORT)$ ]]; then
|
||||||
local salt_services=( "salt-master" "salt-minion" )
|
local salt_services=( "salt-master" "salt-minion" )
|
||||||
@@ -2062,6 +2059,9 @@ reinstall_init() {
|
|||||||
local service_retry_count=20
|
local service_retry_count=20
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# remove all of root's cronjobs
|
||||||
|
logCmd "crontab -r -u root"
|
||||||
|
|
||||||
if command -v salt-call &> /dev/null && grep -q "master:" /etc/salt/minion 2> /dev/null; then
|
if command -v salt-call &> /dev/null && grep -q "master:" /etc/salt/minion 2> /dev/null; then
|
||||||
# Disable schedule so highstate doesn't start running during the install
|
# Disable schedule so highstate doesn't start running during the install
|
||||||
salt-call -l info schedule.disable --local
|
salt-call -l info schedule.disable --local
|
||||||
@@ -2091,6 +2091,9 @@ reinstall_init() {
|
|||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
logCmd "salt-call state.apply ca.remove -linfo --local --file-root=../salt"
|
||||||
|
logCmd "salt-call state.apply ssl.remove -linfo --local --file-root=../salt"
|
||||||
|
|
||||||
# Remove all salt configs
|
# Remove all salt configs
|
||||||
rm -rf /etc/salt/engines/* /etc/salt/grains /etc/salt/master /etc/salt/master.d/* /etc/salt/minion /etc/salt/minion.d/* /etc/salt/pki/* /etc/salt/proxy /etc/salt/proxy.d/* /var/cache/salt/
|
rm -rf /etc/salt/engines/* /etc/salt/grains /etc/salt/master /etc/salt/master.d/* /etc/salt/minion /etc/salt/minion.d/* /etc/salt/pki/* /etc/salt/proxy /etc/salt/proxy.d/* /var/cache/salt/
|
||||||
|
|
||||||
@@ -2122,10 +2125,13 @@ reinstall_init() {
|
|||||||
remove_package launcher-final
|
remove_package launcher-final
|
||||||
|
|
||||||
if [[ $OS == 'ubuntu' ]]; then
|
if [[ $OS == 'ubuntu' ]]; then
|
||||||
|
info "Unholding previously held packages."
|
||||||
apt-mark unhold $(apt-mark showhold)
|
apt-mark unhold $(apt-mark showhold)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
} >> "$setup_log" 2>&1
|
} >> "$setup_log" 2>&1
|
||||||
|
|
||||||
|
info "System reinstall init has been completed."
|
||||||
}
|
}
|
||||||
|
|
||||||
reset_proxy() {
|
reset_proxy() {
|
||||||
|
|||||||
@@ -968,10 +968,11 @@ if [[ $success != 0 ]]; then SO_ERROR=1; fi
|
|||||||
|
|
||||||
# Check entire setup log for errors or unexpected salt states and ensure cron jobs are not reporting errors to root's mailbox
|
# Check entire setup log for errors or unexpected salt states and ensure cron jobs are not reporting errors to root's mailbox
|
||||||
# Ignore "Status .* was not found" due to output from salt http.query or http.wait_for_successful_query states used with retry
|
# Ignore "Status .* was not found" due to output from salt http.query or http.wait_for_successful_query states used with retry
|
||||||
if grep -E "ERROR|Result: False" $setup_log | grep -qvE "Status .* was not found" || [[ -s /var/spool/mail/root && "$setup_type" == "iso" ]]; then
|
# Uncaught exception, closing connection|Exception in callback None - this is seen during influxdb / http.wait_for_successful_query state for ubuntu reinstall
|
||||||
|
if grep -E "ERROR|Result: False" $setup_log | grep -qvE "Status .* was not found|An exception occurred in this state|Uncaught exception, closing connection|Exception in callback None" || [[ -s /var/spool/mail/root && "$setup_type" == "iso" ]]; then
|
||||||
SO_ERROR=1
|
SO_ERROR=1
|
||||||
|
|
||||||
grep --color=never "ERROR" "$setup_log" | grep -qvE "Status .* was not found" > "$error_log"
|
grep --color=never "ERROR" "$setup_log" | grep -qvE "Status .* was not found|An exception occurred in this state|Uncaught exception, closing connection|Exception in callback None" > "$error_log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $SO_ERROR ]]; then
|
if [[ -n $SO_ERROR ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user