mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-10 03:02:58 +01:00
Add system information at beginning of installation; provide logging functions to be used instead of echo commands
This commit is contained in:
@@ -21,6 +21,40 @@ source ./so-common-functions
|
|||||||
|
|
||||||
SOVERSION=$(cat ../VERSION)
|
SOVERSION=$(cat ../VERSION)
|
||||||
|
|
||||||
|
log() {
|
||||||
|
msg=$1
|
||||||
|
level=${2:-I}
|
||||||
|
now=$(TZ=GMT date +"%Y-%m-%dT%H:%M:%SZ")
|
||||||
|
echo -e "$now | $level | $msg" >> "$setup_log" 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
error() {
|
||||||
|
log "$1" "E"
|
||||||
|
}
|
||||||
|
|
||||||
|
info() {
|
||||||
|
log "$1" "I"
|
||||||
|
}
|
||||||
|
|
||||||
|
header() {
|
||||||
|
echo -e "-----------------------------\n $1\n-----------------------------\n" >> "$setup_log" 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
logCmd() {
|
||||||
|
cmd=$1
|
||||||
|
info "Executing command: $cmd\n$($cmd)\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
analyze_system() {
|
||||||
|
header "System Characteristics"
|
||||||
|
logCmd "uptime"
|
||||||
|
logCmd "uname -a"
|
||||||
|
logCmd "free -h"
|
||||||
|
logCmd "lscpu"
|
||||||
|
logCmd "df -h"
|
||||||
|
logCmd "ip a"
|
||||||
|
}
|
||||||
|
|
||||||
accept_salt_key_remote() {
|
accept_salt_key_remote() {
|
||||||
systemctl restart salt-minion
|
systemctl restart salt-minion
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,11 @@ done
|
|||||||
|
|
||||||
# Begin Installation pre-processing
|
# Begin Installation pre-processing
|
||||||
parse_install_username
|
parse_install_username
|
||||||
echo "Installing as the $INSTALLUSERNAME user." >> $setup_log 2>&1
|
|
||||||
|
|
||||||
echo "---- Starting setup at $(date -u) ----" >> $setup_log 2>&1
|
header "Initializing Setup"
|
||||||
|
info "Installing as the $INSTALLUSERNAME user"
|
||||||
|
|
||||||
|
analyze_system
|
||||||
|
|
||||||
automated=no
|
automated=no
|
||||||
function progress() {
|
function progress() {
|
||||||
@@ -76,9 +78,6 @@ if [[ -f automation/$automation && $(basename $automation) == $automation ]]; th
|
|||||||
source automation/$automation
|
source automation/$automation
|
||||||
automated=yes
|
automated=yes
|
||||||
|
|
||||||
echo "Checking network configuration" >> $setup_log 2>&1
|
|
||||||
ip a >> $setup_log 2>&1
|
|
||||||
|
|
||||||
attempt=1
|
attempt=1
|
||||||
attempts=60
|
attempts=60
|
||||||
ip a | grep "$MNIC:" | grep "state UP" >> $setup_log 2>&1
|
ip a | grep "$MNIC:" | grep "state UP" >> $setup_log 2>&1
|
||||||
|
|||||||
Reference in New Issue
Block a user