403Webshell
Server IP : 172.64.80.1  /  Your IP : 216.73.216.175
Web Server : LiteSpeed
System : Linux srv13.swhc.ca 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64
User : hongluck ( 2522)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib64/nagios/plugins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib64/nagios/plugins/check_firewall.sh
#!/bin/bash

export PATH="/usr/sbin:/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin"
input_count=13
input_rules=$(iptables -L INPUT -nv 2>/dev/null|wc -l)
service_count=38
service_rules=$(iptables -L in_services -nv 2>/dev/null|wc -l)
restart=0

#if [[ ! -h /usr/sbin/csf ]]; then
#	exit 0
#fi

if [[ $input_rules != $input_count ]]; then
	restart=1
fi
if [[ $service_rules != $service_count ]]; then
	restart=1
fi

# Get the status of the iptables service
status=$(systemctl status iptables | awk '/Active: active/ {gsub(":", "", $1); print $1}')

# Check the status and output the appropriate Icinga result
if [[ $input_rules != $input_count ]]; then
        echo "WARNING - INPUT rules count invalid(found $input_rules, expected $input_count)."
        exit 1
elif [[ $service_rules != $service_count ]]; then
	echo "WARNING - in_services rules count invalid(found $service_rules, expected $service_count)."
	exit 1
elif [[ "$status" != "Active" ]]; then
	echo "CRITICAL - Service is running"
	exit 2
else
	echo "OK - Service is running"
	exit 0
fi

Youez - 2016 - github.com/yon3zu
LinuXploit