[fix] Correct order of setup salt states

This commit is contained in:
William Wernert
2020-04-28 22:40:21 -04:00
parent 31f9f31ff2
commit bf41fe838c
3 changed files with 39 additions and 41 deletions

View File

@@ -26,7 +26,6 @@ eval:
- so-redis - so-redis
{% endif %} {% endif %}
- so-elasticsearch - so-elasticsearch
- so-logstash
- so-kibana - so-kibana
- so-steno - so-steno
- so-suricata - so-suricata

View File

@@ -333,111 +333,111 @@ export percentage=0
docker_seed_registry 2>> "$setup_log" # ~ 60% when finished docker_seed_registry 2>> "$setup_log" # ~ 60% when finished
fi fi
set_progress_str 59 'Configuring firewall' set_progress_str 61 'Configuring firewall'
set_initial_firewall_policy 2>> "$setup_log" set_initial_firewall_policy 2>> "$setup_log"
set_progress_str 60 "$(print_salt_state_apply 'firewall')" set_progress_str 62 "$(print_salt_state_apply 'firewall')"
salt-call state.apply -l info firewall >> $setup_log 2>&1 salt-call state.apply -l info firewall >> $setup_log 2>&1
set_progress_str 61 "$(print_salt_state_apply 'common')" set_progress_str 63 "$(print_salt_state_apply 'common')"
salt-call state.apply -l info common >> $setup_log 2>&1 salt-call state.apply -l info common >> $setup_log 2>&1
if [[ $is_master || $is_node ]]; then if [[ $is_master || $is_node ]]; then
set_progress_str 62 "$(print_salt_state_apply 'elasticsearch')" set_progress_str 64 "$(print_salt_state_apply 'elasticsearch')"
salt-call state.apply -l info elasticsearch >> $setup_log 2>&1 salt-call state.apply -l info elasticsearch >> $setup_log 2>&1
fi fi
if [[ $is_sensor ]]; then if [[ $is_sensor ]]; then
set_progress_str 63 "$(print_salt_state_apply 'pcap')" set_progress_str 65 "$(print_salt_state_apply 'pcap')"
salt-call state.apply -l info pcap >> $setup_log 2>&1 salt-call state.apply -l info pcap >> $setup_log 2>&1
set_progress_str 64 "$(print_salt_state_apply 'suricata')" set_progress_str 66 "$(print_salt_state_apply 'suricata')"
salt-call state.apply -l info suricata >> $setup_log 2>&1 salt-call state.apply -l info suricata >> $setup_log 2>&1
set_progress_str 65 "$(print_salt_state_apply 'zeek')" set_progress_str 67 "$(print_salt_state_apply 'zeek')"
salt-call state.apply -l info zeek >> $setup_log 2>&1 salt-call state.apply -l info zeek >> $setup_log 2>&1
fi fi
if [[ $is_node ]]; then if [[ $is_node ]]; then
set_progress_str 66 "$(print_salt_state_apply 'curator')" set_progress_str 68 "$(print_salt_state_apply 'curator')"
salt-call state.apply -l info curator >> $setup_log 2>&1 salt-call state.apply -l info curator >> $setup_log 2>&1
fi fi
if [[ $is_master ]]; then
set_progress_str 69 "$(print_salt_state_apply 'soc')"
salt-call state.apply -l info soc >> "$setup_log" 2>&1
set_progress_str 70 "$(print_salt_state_apply 'kibana')"
salt-call state.apply -l info kibana >> $setup_log 2>&1
set_progress_str 71 "$(print_salt_state_apply 'elastalert')"
salt-call state.apply -l info elastalert >> $setup_log 2>&1
set_progress_str 72 "$(print_salt_state_apply 'soctopus')"
salt-call state.apply -l info soctopus >> $setup_log 2>&1
fi
if [[ "$OSQUERY" = 1 ]]; then if [[ "$OSQUERY" = 1 ]]; then
set_progress_str 67 "$(print_salt_state_apply 'fleet')" set_progress_str 73 "$(print_salt_state_apply 'fleet')"
salt-call state.apply -l info fleet >> $setup_log 2>&1 salt-call state.apply -l info fleet >> $setup_log 2>&1
set_progress_str 68 "$(print_salt_state_apply 'redis')" set_progress_str 74 "$(print_salt_state_apply 'redis')"
salt-call state.apply -l info redis >> $setup_log 2>&1 salt-call state.apply -l info redis >> $setup_log 2>&1
fi fi
if [[ "$WAZUH" = 1 ]]; then if [[ "$WAZUH" = 1 ]]; then
set_progress_str 69 "$(print_salt_state_apply 'wazuh')" set_progress_str 75 "$(print_salt_state_apply 'wazuh')"
salt-call state.apply -l info wazuh >> $setup_log 2>&1 salt-call state.apply -l info wazuh >> $setup_log 2>&1
fi fi
if [[ "$THEHIVE" = 1 ]]; then if [[ "$THEHIVE" = 1 ]]; then
set_progress_str 6970 "$(print_salt_state_apply 'hive')" set_progress_str 76 "$(print_salt_state_apply 'hive')"
salt-call state.apply -l info hive >> $setup_log 2>&1 salt-call state.apply -l info hive >> $setup_log 2>&1
fi fi
if [[ "$STRELKA" = 1 ]]; then if [[ "$STRELKA" = 1 ]]; then
set_progress_str 71 "$(print_salt_state_apply 'strelka')" set_progress_str 77 "$(print_salt_state_apply 'strelka')"
salt-call state.apply -l info strelka >> $setup_log 2>&1 salt-call state.apply -l info strelka >> $setup_log 2>&1
fi fi
if [[ "$PLAYBOOK" = 1 ]]; then if [[ "$PLAYBOOK" = 1 ]]; then
set_progress_str 72 "$(print_salt_state_apply 'playbook')" set_progress_str 78 "$(print_salt_state_apply 'playbook')"
salt-call state.apply -l info playbook >> $setup_log 2>&1 salt-call state.apply -l info playbook >> $setup_log 2>&1
fi fi
if [[ $is_master || $is_helix ]]; then if [[ $is_master || $is_helix ]]; then
set_progress_str 73 "$(print_salt_state_apply 'master')" set_progress_str 79 "$(print_salt_state_apply 'master')"
salt-call state.apply -l info master >> $setup_log 2>&1 salt-call state.apply -l info master >> $setup_log 2>&1
set_progress_str 74 "$(print_salt_state_apply 'idstools')" set_progress_str 80 "$(print_salt_state_apply 'idstools')"
salt-call state.apply -l info idstools >> $setup_log 2>&1 salt-call state.apply -l info idstools >> $setup_log 2>&1
set_progress_str 75 "$(print_salt_state_apply 'utility')" set_progress_str 81 "$(print_salt_state_apply 'utility')"
salt-call state.apply -l info utility >> $setup_log 2>&1 salt-call state.apply -l info utility >> $setup_log 2>&1
fi fi
if [[ ( $is_helix || $is_master || $is_node ) && ! $is_eval ]]; then if [[ ( $is_helix || $is_master || $is_node ) && ! $is_eval ]]; then
set_progress_str 76 "$(print_salt_state_apply 'logstash')" set_progress_str 82 "$(print_salt_state_apply 'logstash')"
salt-call state.apply -l info logstash >> $setup_log 2>&1 salt-call state.apply -l info logstash >> $setup_log 2>&1
set_progress_str 77 "$(print_salt_state_apply 'filebeat')" set_progress_str 83 "$(print_salt_state_apply 'filebeat')"
salt-call state.apply -l info filebeat >> $setup_log 2>&1 salt-call state.apply -l info filebeat >> $setup_log 2>&1
fi fi
if [[ $is_master ]]; then set_progress_str 84 "$(print_salt_state_apply 'schedule')"
set_progress_str 78 "$(print_salt_state_apply 'soc')"
salt-call state.apply -l info soc >> "$setup_log" 2>&1
set_progress_str 79 "$(print_salt_state_apply 'kibana')"
salt-call state.apply -l info kibana >> $setup_log 2>&1
set_progress_str 80 "$(print_salt_state_apply 'elastalert')"
salt-call state.apply -l info elastalert >> $setup_log 2>&1
set_progress_str 81 "$(print_salt_state_apply 'soctopus')"
salt-call state.apply -l info soctopus >> $setup_log 2>&1
fi
set_progress_str 85 "$(print_salt_state_apply 'schedule')"
salt-call state.apply -l info schedule >> $setup_log 2>&1 salt-call state.apply -l info schedule >> $setup_log 2>&1
set_progress_str 90 'Applying finishing touches' set_progress_str 85 'Applying finishing touches'
filter_unused_nics 2>> "$setup_log" filter_unused_nics 2>> "$setup_log"
network_setup 2>> "$setup_log" network_setup 2>> "$setup_log"
set_progress_str 91 'Enabling checkin at boot' set_progress_str 86 'Enabling checkin at boot'
checkin_at_boot 2>> "$setup_log" checkin_at_boot 2>> "$setup_log"
set_progress_str 92 'Updating packages' set_progress_str 90 'Updating packages'
update_packages 2>> "$setup_log" update_packages 2>> "$setup_log"
set_progress_str 93 'Verifying setup' set_progress_str 95 'Verifying setup'
salt-call -l info state.highstate >> $setup_log 2>&1 salt-call -l info state.highstate >> $setup_log 2>&1
} | whiptail --title "Hybrid Hunter Install" --gauge "Please wait while installing" 6 60 0 } | whiptail --title "Hybrid Hunter Install" --gauge "Please wait while installing" 6 60 0

View File

@@ -699,11 +699,10 @@ whiptail_node_ls_input_batch_count() {
#TODO: helper function to display error message or exit if batch mode #TODO: helper function to display error message or exit if batch mode
# exit_if_batch <"Error string"> <Error code (int)>
whiptail_passwords_dont_match() { whiptail_passwords_dont_match() {
# exit_if_batch "Error string" Error code (int)
whiptail --title "Security Onion Setup" --msgbox "Passwords don't match. Please re-enter." 8 75 whiptail --title "Security Onion Setup" --msgbox "Passwords don't match. Please re-enter." 8 75
} }