===variables_kernel.sh=== mem_bytes=$(awk '/MemTotal:/ { printf "%0.f",$2 * 1024}' /proc/meminfo) shmmax=$(echo "$mem_bytes * 0.90" | bc | cut -f 1 -d '.') shmall=$(expr $mem_bytes / $(getconf PAGE_SIZE)) max_orphan=$(echo "$mem_bytes * 0.10 / 65536" | /usr/bin/bc | awk '{print int( $1 )}') file_max=$(echo "$mem_bytes / 4194304 * 256" | /usr/bin/bc | awk '{print int( $1 )}') max_tw=$(($file_max*2)) min_free=$(echo "($mem_bytes / 1024) * 0.01" | /usr/bin/bc | awk '{print int( $1 )}') case "$1" in shmmax) expr $shmmax ;; shmall) echo $shmall ;; max_orphan) echo $max_orphan ;; file_max) echo $file_max ;; max_tw) echo $max_tw ;; min_free) echo $min_free ;; *) echo 0 esac ===check_maldet.sh=== #!/bin/bash SESSION_FILE="/usr/local/maldetect/sess/session.last" if [ -f $SESSION_FILE ]; then LAST_SESSION=$(cat /usr/local/maldetect/sess/session.last) LOG=$(grep "TOTAL HITS" /usr/local/maldetect/sess/session.$LAST_SESSION|awk {"print \$3"}) if [ -z "$LOG" ]; then echo 0 else echo $LOG fi else echo 0 fi ===quarantine_maldet.sh=== #!/bin/bash LAST_SESSION=$(cat /usr/local/maldetect/sess/session.last) /usr/local/maldetect/maldet -q $LAST_SESSION ===check-kernelcare.sh=== #!/bin/bash OUTPUT=$(sudo kcarectl --check) echo $OUTPUT ===check-yum-updates.sh=== #!/bin/bash PACKAGES=$(yum check-update --quiet | wc -l) PACKAGES_COUNT=$((PACKAGES - 1)) echo $PACKAGES_COUNT ===passwd_diff.sh=== #!/bin/bash echo `diff /etc/passwd /etc/passwd-` ===KCARECTL=== #!/bin/bash set -euo pipefail export PYTHONPATH="/usr/libexec/kcare/python:${PYTHONPATH:-}" python= # try different python versions, python3 is preferred for try_python in python3 /usr/libexec/platform-python python2; do python="$(command -v "$try_python" || true)" if [ -z "$python" ]; then # this version was not found continue fi py_version_output=$("$python" --version 2>&1) # remove "Python " prefix and split into array like (3 10 12) IFS='.' read -ra py_version_array <<<"${py_version_output/* /}" py_version_major=${py_version_array[0]} py_version_minor=${py_version_array[1]} if [[ "$py_version_major" -eq 3 ]] && [[ "$py_version_minor" -le 5 ]]; then # python 3.5 and older is not supported # in this case we try to use python2 python= continue fi # take first python which works for us break done if [ -z "$python" ]; then >&2 echo error: supported versions of python3 or python2 executables were not found exit 1 fi cmd=("$python" "-m" "kcarectl.__main__") env_path="/etc/sysconfig/kcare/kcarectl.env" if [ -f "$env_path" ]; then set -a # shellcheck disable=SC1090 . "$env_path" set +a fi exec "${cmd[@]}" "$@" ===KCARE_BINS=== -rwxr-xr-x 1 root root 6100 Jun 24 16:05 /usr/bin/kcare-scanner-interface -rwxr-xr-x 1 root root 582 Jun 24 16:05 /usr/bin/kcare-uname -rwxr-xr-x 1 root root 1237 Jun 24 16:05 /usr/bin/kcarectl /usr/lib/kcare: total 500 drwxr-xr-x 2 root root 4096 Jul 3 02:41 . dr-xr-xr-x. 37 root root 4096 Jul 29 20:00 .. -rwxr-xr-x 1 root root 496656 Jun 24 16:05 libcare-plugin.so -rw-r--r-- 1 root root 13 Jun 24 16:05 libcare-plugin.version /var/cache/kcare: total 52 drwxr-xr-x 6 root root 4096 Aug 13 06:05 . drwxr-xr-x. 13 root root 4096 Nov 11 2024 ..