⚝
One Hat Cyber Team
⚝
Your IP:
160.79.109.16
Server IP:
162.254.39.145
Server:
Linux premium289.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
proc
/
self
/
root
/
lib64
/
nagios
/
plugins
/
nccustom
/
View File Name :
check-mail-filter-avlb.sh
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin #variable #test_email="/usr/lib64/nagios/plugins/nccustom/test.eml" my_dir=$(dirname "${0}") test_email=$my_dir/test.eml ip=prod-sharedhostinglb-phx.jellyfish.systems port=11330 #cust_parm #input option PROGNAME=${0##*/} print_usage() { echo "" echo "Usage: $PROGNAME [-f Diff path or test_email] [-p Port]" echo "Usage: $PROGNAME [-i Ip] [-c running a ping_only check and custom parameters to CURL]" echo "Usage: $PROGNAME --help" } print_help() { print_usage echo "" echo "This script for rspamd accessability monitoring from shared hosting servers (see TOP-841)" echo "" echo "-f Different path and file." echo "-i Different Host/IP" echo "-p Different Port" echo "-c Additional parameters for cURL (add keyword ping_only w/out spaces for request /ping at endpoint)" echo "--help Print this help screen" echo "" exit 3 } while [ $# -gt 0 ]; do case "$1" in -f) test_email=$2; shift ;; -i) ip=$2; shift ;; -p) port=$2; shift ;; -c) cust_parm=$2; shift ;; --help) print_help ;; -h) print_help ;; *) echo >&2 "Unknown argument: $1" print_usage exit 3 ;; esac shift done #main if [[ "${cust_parm}" == *"ping_only"* ]]; then result=$(curl https://"${ip}":"${port}"/ping -s "${cust_parm//ping_only}") if [[ "${result}" == *"pong"* ]]; then echo "OK, mail filtration endpoint ${ip}:${port} is reachable" exit 0 else echo "CRITICAL, mail filtration endpoint ${ip}:${port} is NOT available" exit 2 fi else mapfile -t result < <(curl https://"${ip}":"${port}"/checkv2 -X POST --data-binary @- < "${test_email}" -s "${cust_parm}" | jq '"action=\(.action) score=\(.score)"') if printf "%s\n" "${result[@]}" |grep action |grep score > /dev/null;then echo "OK: ${result[*]}" exit 0 else echo "CRITICAL:action/score can't be retrieved from ${ip}:${port} for some reason" exit 2 fi fi