403Webshell
Server IP : 66.29.132.122  /  Your IP : 3.145.95.107
Web Server : LiteSpeed
System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : admazpex ( 531)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/self/root/proc/thread-self/root/lib64/nagios/plugins/nccustom/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/self/root/proc/thread-self/root/lib64/nagios/plugins/nccustom/check_kernelcare.sh
#!/bin/sh

## check Kernel Care updates and if patches were applied
## Copyright (c) 2017, Namecheap.com
## Written by Yuri Muravyov  <y.muravyov@gmail.com>
## Updated by Bogdan Kukharskiy <bogdan.kukharskiy@namecheap.com>

PROGNAME=check_kernel_care
REVISION=0.3
PROGNAME=`basename $0`

CHECK_UPDATES_STR="The latest patch is applied."
CHECK_UPDATES_STR2="This kernel doesn't require any patches."
CHECK_PATCHES_STR="kpatch-state: patch is applied"

print_revision() {
        echo $PROGNAME $REVISION
}

print_usage() {
        echo "Usage: $PROGNAME [options]"
        echo "  e.g. $PROGNAME"
        echo
        echo "Options:"
        echo -e "\t --help | -h          print help"
        echo -e "\t --version | -V       print version"
}

print_help() {
        print_revision $PROGNAME $REVISION
        echo 
        echo "This script checks kernel care state (updates and patches)"
        echo 
        print_usage
        echo 
        exit 3
}


# parse cmd arguments
if [ "$#" -gt 0 ]; then
        while [ "$#" -gt 0 ]; do
                case "$1" in
                        '--help'|'-h')
                                print_help
                                exit 3
                                ;;
                        '--version'|'-V')
                                print_revision $PROGNAME $REVISION
                                exit 3
                                ;;
                        *)
                                echo "Unknown option!"
                                print_usage
                                exit 3
                                ;;
                esac
        done
fi

KCARE_UPDATES_CHECK=`sudo /usr/bin/kcarectl --check 2>&1`;
KCARE_PATCHES_CHECK=`sudo /usr/bin/kcarectl -i | grep kpatch-state 2>&1`;

if [ "$KCARE_UPDATES_CHECK" != "$CHECK_UPDATES_STR" ] && [ "$KCARE_UPDATES_CHECK" != "$CHECK_UPDATES_STR2" ]; then
        echo "CRITICAL: $KCARE_UPDATES_CHECK"
        exit 2
elif [ "$KCARE_PATCHES_CHECK" != "$CHECK_PATCHES_STR" ] && [ ${#KCARE_PATCHES_CHECK} != 0 ]; then
        echo "CRITICAL: $KCARE_PATCHES_CHECK"
        exit 2
fi

echo "OK: $KCARE_UPDATES_CHECK $KCARE_PATCHES_CHECK"
exit 0

Youez - 2016 - github.com/yon3zu
LinuXploit