Merge pull request #1180 from Security-Onion-Solutions/fix/thehive_global

Only copy TheHive details to global pillar if enabled
This commit is contained in:
weslambert
2020-08-14 11:23:16 -04:00
committed by GitHub

View File

@@ -879,11 +879,13 @@ generate_passwords(){
PLAYBOOKPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) PLAYBOOKPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
FLEETPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) FLEETPASS=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
FLEETJWT=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) FLEETJWT=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
HIVEKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) if [[ "$THEHIVE" == "1" ]]; then
HIVEPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) HIVEKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
CORTEXKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) HIVEPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
CORTEXORGUSERKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) CORTEXKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
CORTEXPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) CORTEXORGUSERKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
CORTEXPLAYSECRET=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
fi
SENSORONIKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) SENSORONIKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
KRATOSKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1) KRATOSKEY=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 20 | head -n 1)
} }
@@ -1022,26 +1024,34 @@ manager_global() {
fi fi
# Create a global file for global values # Create a global file for global values
printf '%s\n'\
"global:"\
" soversion: $SOVERSION"\
" hnmanager: $HNMANAGER"\
" ntpserver: $NTPSERVER"\
" proxy: $PROXY"\
" zeekversion: $ZEEKVERSION"\
" ids: $NIDS"\
" managerip: $MAINIP" > "$global_pillar"
# Check if TheHive is enabled. If so, add creds and other details
if [[ "$THEHIVE" == "1" ]]; then
printf '%s\n'\
" hiveuser: $WEBUSER"\
" hivepassword: '$WEBPASSWD1'"\
" hivekey: $HIVEKEY"\
" hiveplaysecret: $HIVEPLAYSECRET"\
" cortexuser: $WEBUSER"\
" cortexpassword: '$WEBPASSWD1'"\
" cortexkey: $CORTEXKEY"\
" cortexorgname: SecurityOnion"\
" cortexorguser: soadmin"\
" cortexorguserkey: $CORTEXORGUSERKEY"\
" cortexplaysecret: $CORTEXPLAYSECRET" >> "$global_pillar"
fi
# Continue adding other details
printf '%s\n'\ printf '%s\n'\
"global:"\
" soversion: $SOVERSION"\
" hnmanager: $HNMANAGER"\
" ntpserver: $NTPSERVER"\
" proxy: $PROXY"\
" zeekversion: $ZEEKVERSION"\
" ids: $NIDS"\
" managerip: $MAINIP"\
" hiveuser: $WEBUSER"\
" hivepassword: '$WEBPASSWD1'"\
" hivekey: $HIVEKEY"\
" hiveplaysecret: $HIVEPLAYSECRET"\
" cortexuser: $WEBUSER"\
" cortexpassword: '$WEBPASSWD1'"\
" cortexkey: $CORTEXKEY"\
" cortexorgname: SecurityOnion"\
" cortexorguser: soadmin"\
" cortexorguserkey: $CORTEXORGUSERKEY"\
" cortexplaysecret: $CORTEXPLAYSECRET"\
" fleet_custom_hostname: "\ " fleet_custom_hostname: "\
" fleet_manager: False"\ " fleet_manager: False"\
" fleet_node: False"\ " fleet_node: False"\
@@ -1132,7 +1142,7 @@ manager_global() {
" time_file: 1"\ " time_file: 1"\
" upload_queue_size: 4"\ " upload_queue_size: 4"\
" encoding: gzip"\ " encoding: gzip"\
" interval: 5" > "$global_pillar" " interval: 5" >> "$global_pillar"
printf '%s\n' '----' >> "$setup_log" 2>&1 printf '%s\n' '----' >> "$setup_log" 2>&1
cat "$global_pillar" >> "$setup_log" 2>&1 cat "$global_pillar" >> "$setup_log" 2>&1
@@ -1872,4 +1882,4 @@ zeek_logs_enabled() {
printf '%s\n' '----' >> "$setup_log" 2>&1 printf '%s\n' '----' >> "$setup_log" 2>&1
cat "$zeeklogs_pillar" >> "$setup_log" 2>&1 cat "$zeeklogs_pillar" >> "$setup_log" 2>&1
} }