Commit 52b789c9 authored by Peter Möller's avatar Peter Möller
parents 4b0b06bc 24ca1307
......@@ -37,10 +37,10 @@ CPUModel="$(egrep "^model name" /proc/cpuinfo | sort -u | cut -d: -f2 | sed -e '
# Number of CPU:s (NbrCPUs=2):
NbrCPUs=$(egrep "^processor" /proc/cpuinfo | wc -l)
# Size of memory [kB]
RAM=$(/usr/sbin/dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s * 1024}') # Ex: RAM=4194304
if [ $RAM -eq 0 ]; then
RAM=$(egrep "^MemTotal" /proc/meminfo | awk '{print $2}')
fi
##RAM=$(/usr/sbin/dmidecode -t 17 | grep "Size.*MB" | awk '{s+=$2} END {print s * 1024}') # Ex: RAM=4194304
##if [ $RAM -eq 0 ]; then
RAM=$(egrep -i "^MemTotal" /proc/meminfo | awk '{print $2}')
##fi
# Kind of memory (ECC='No ECC' or ECC='Multi-bit ECC'):
ECC="$(/usr/sbin/dmidecode -t memory | egrep "Error Correction Type" | sort -u | cut -d: -f2 | sed -e 's/^ //' -e 's/None/No ECC/')"
# What kind of authentication? Ex: Authentication=Lucat
......@@ -68,6 +68,7 @@ CPUBugs="$(egrep "^bugs" /proc/cpuinfo | cut -d: -f2 | cut -c2- | uniq)"
# Ex: CPUBugs='cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit'
Kernel="$(uname -r 2>/dev/null)" # Ex: Kernel=5.4.0-62-generic
Architecture="$(uname -m 2>/dev/null)" # Ex: Architecture=x86_64
Uptime="$(awk '{print int($1/86400)}' /proc/uptime)"
# Are we in a Virtual environment? This one is a bit tricky since there are many ways to cover this.
# Read this for more info: http://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology
VMenv="$(dmesg 2>/dev/null | grep -i " Hypervisor detected: " 2>/dev/null | cut -d: -f2 | sed 's/^ *//')"
......@@ -153,7 +154,7 @@ FWrules="$(ufw status verbose 2>/dev/null | egrep "(ALLOW|DENY) IN" | awk '{prin
# Create a string for the CPU Bugs (to make the final assemble shorter)
CPUBugsStr="$(if [ -n "$CPUBugs" ]; then echo ", \"cpu-bugs:${CPUBugs// /\", \"cpu-bugs:}\""; fi)"
# Assemble the Flags string
Flags="\"selinux:$SELinux\", \"kernel:${Kernel}\"$CPUBugsStr, \"arch:${Architecture:---}\", \"fail2ban:$Fail2Ban\""
Flags="\"selinux:$SELinux\", \"kernel:${Kernel}\"$CPUBugsStr, \"arch:${Architecture:---}\", \"fail2ban:$Fail2Ban\", \"Uptime-days:$Uptime\""
# partitions
OUTPUT=""
......@@ -223,7 +224,7 @@ if [ -n "$ListeningPorts" ]; then
fi
fi
#OUTPUT+="{ \"binding\": \"${Binding:--}\", \"port\": ${Port:--}, \"process-owner\": \"${Application:--}\", \"process-user\": \"${User:--}\", \"IPver\": \"${IPver:--}\", \"protocol\": \"${Proto:--}\" },"
OUTPUT+="{ \"binding\": \"${Binding:--}\", \"port\": ${Port:--}, \"process-owner\": \"${Application:--}\", \"process-user\": \"${User:--}\", \"protocol\": \"${Proto:--}\", \"firewall-rule\": $FWrule },"
OUTPUT+="{ \"binding\": \"${Binding:--}\", \"port\": ${Port:--}, \"process-owner\": \"${Application:--}\", \"process-user\": \"${User:--}\", \"protocol\": \"${IPver}:${Proto:--}\", \"firewall-rule\": $FWrule },"
done <<< "$ListeningPorts"
# Assemble the complete string (minus the final comma)
ListenStr=", \"listen-ports\": [ ${OUTPUT%%,} ]"
......@@ -246,7 +247,7 @@ if [ -n "$SecurityPatches" ]; then
# Assemble the complete string (minus the final comma)
SecurityPatchStr=", \"security-patches\": [ ${OUTPUT%%,} ]"
else
SecurityPatchStr=""
SecurityPatchStr=", \"security-patches\": [ ]"
fi
# Ex:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment