| Server IP : 119.195.102.159 / Your IP : 216.73.217.134 Web Server : nginx/1.18.0 System : Linux picell 5.15.0-181-generic #191-Ubuntu SMP Fri May 22 19:09:02 UTC 2026 x86_64 User : altablue ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/altablue/ |
Upload File : |
#!/bin/bash
# ============================================================
# ๐ก๏ธ ๋ณด์ ๊ฐ์ ์์คํ
- ์ค์ ์ค์ ํ์ผ
# ์๋ฒ ๋ฐฐํฌ ๊ฒฝ๋ก: /etc/security-watchdog/config
# ============================================================
# โโ ํ
๋ ๊ทธ๋จ ์ค์ (๋ณด์: ๋ณ๋ ํ์ผ์์ ๋ก๋) โโโโโโโ
# ํ ํฐ/์ฑID๋ /etc/security-watchdog/secrets ์ ์ ์ฅ
# ํ์ผ ํ์:
# BOT_TOKEN="your_bot_token"
# CHAT_ID="your_chat_id"
SECRETS_FILE="/etc/security-watchdog/secrets"
if [ -f "$SECRETS_FILE" ]; then
source "$SECRETS_FILE"
else
# secrets ํ์ผ ๋ฏธ์กด์ฌ ์ ๊ธฐ์กด ํธํ์ฉ ํด๋ฐฑ
BOT_TOKEN="${BOT_TOKEN:-}"
CHAT_ID="${CHAT_ID:-}"
fi
# โโ ๊ฐ์ ๋์ ๋๋ ํ ๋ฆฌ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# nginx ๊ฐ์ํธ์คํธ์ document root ์์ ๋๋ ํ ๋ฆฌ๋ค
WATCH_DIRS=(
"/home"
"/home2"
"/home5"
"/home6"
)
# โโ ๊ฒฉ๋ฆฌ ๋๋ ํ ๋ฆฌ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
QUARANTINE_DIR="/home/altablue/quarantine"
# โโ ๋ก๊ทธ ๋๋ ํ ๋ฆฌ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
LOG_DIR="/home/altablue/logs"
# โโ ํด์ ๋ฒ ์ด์ค๋ผ์ธ ์ ์ฅ ๊ฒฝ๋ก โโโโโโโโโโโโโโโโโโโโโโ
BASELINE_DIR="/home/altablue/baselines"
# โโ ๋์ ๋ชจ๋ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# "alert_only" : ์๋ฆผ๋ง ๋ณด๋ (๊ถ์ฅ: ์ด๊ธฐ ์ด์ฉ)
# "auto_quarantine" : ์์ฌ ํ์ผ ์๋ ๊ฒฉ๋ฆฌ + ์๋ฆผ
MODE="alert_only"
# โโ PHP-FPM ํฌ์ค์ฒดํฌ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
HEALTH_CHECK_URL="https://www.picell.biz/about-us/"
HEALTH_CHECK_TIMEOUT=5
FPM_SERVICE="php8.3-fpm"
# โโ ํ
๋ ๊ทธ๋จ ์๋ฆผ ์ ํ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๋์ผ ํ์ผ์ ๋ํด ์ด ์๊ฐ(์ด) ๋ด ์ค๋ณต ์๋ฆผ ๋ฐฉ์ง
ALERT_COOLDOWN=300
# โโ ์๋ฆผ ์ต์ ์๊ฐ๋ (์ ํ) โโโโโโโโโโโโโโโโโโโโโโโโ
# WordPress ์๋ ์
๋ฐ์ดํธ ๋ฑ์ด ์ผ์ด๋๋ ์๊ฐ๋
# ํ์: "HH:MM-HH:MM" (24์๊ฐ์ )
# SUPPRESS_HOURS="03:00-04:00"
# โโ ํ์ดํธ๋ฆฌ์คํธ ํจํด โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ์ด ํจํด์ ๋งค์นญ๋๋ ๊ฒฝ๋ก๋ ๊ฐ์์์ ์ ์ธ
WHITELIST_PATTERNS=(
"*/wp-content/cache/*"
"*/wp-content/uploads/[0-9][0-9][0-9][0-9]/*"
"*/wp-content/debug.log"
"*/error_log"
"*/wp-content/upgrade/*"
"*/wp-content/wflogs/*"
"*/wp-content/ai1wm-backups/*"
"*/wp-content/updraft/*"
"*/*.log"
"*/*.tmp"
"*/*.swp"
"*/*~"
)
# โโ inotifywait ์ ์ธ ํจํด (์ ๊ท์) โโโโโโโโโโโโโโโโโ
INOTIFY_EXCLUDE='(cache|upgrade|wflogs|updraft|ai1wm-backups|\.log$|\.tmp$|\.swp$|\.htaccess$)'
# โโ ์
์ฑ์ฝ๋ ์ค์บ๋ ์ค์ โโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๋น ๋ฅธ ์ค์บ ์ ์ต๊ทผ N๋ถ ์ด๋ด ๋ณ๊ฒฝ ํ์ผ๋ง ๊ฒ์ฌ
QUICK_SCAN_MINUTES=10
# ์ ์ฒด ์ค์บ ์ ์ต๋ ํ์ผ ํฌ๊ธฐ (๋ฐ์ดํธ) - 10MB ์ด์์ ๊ฑด๋๋
MAX_SCAN_SIZE=10485760
# ์ค์บ ๋์ ํ์ฅ์
SCAN_EXTENSIONS="php,php5,php7,phtml,pht,phps,inc,module"
# โโ ๋ฌด๊ฒฐ์ฑ ๊ฒ์ฆ ๋์ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# WordPress ์ฝ์ด ํ์ผ ํจํด (ํด์ ๋ฒ ์ด์ค๋ผ์ธ ๋์)
INTEGRITY_PATTERNS=(
"wp-admin/*.php"
"wp-includes/*.php"
"wp-login.php"
"wp-config.php"
"index.php"
"xmlrpc.php"
"wp-cron.php"
)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๐ ์๋ํ๋ ์ค ์คํ ๋ฐฉ์ง ์ค์
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# โโ ์๋ํ๋ ์ค ์ฝ์ด ๊ฒฝ๋ก (์ฒดํฌ์ฌ ๊ฒ์ฆ ๋์) โโโโโโโโ
# ์ด ๊ฒฝ๋ก์ ํ์ผ์ ์๊ทธ๋์ฒ ์ค์บ ๋์ WP ๊ณต์ ์ฒดํฌ์ฌ์ผ๋ก ๊ฒ์ฆ
# ์ฒดํฌ์ฌ ์ผ์น โ ์ค์บ ๊ฑด๋๋ (์ ์ ์ฝ์ด ํ์ผ)
# ์ฒดํฌ์ฌ ๋ถ์ผ์น โ CRITICAL ๋ฑ๊ธ์ผ๋ก ์๊ทธ๋์ฒ ์ค์บ
WP_CORE_PATHS=(
"*/wp-admin/*"
"*/wp-includes/*"
)
# โโ ์๋ ค์ง ์์ ํ๋ฌ๊ทธ์ธ (๋ฑ๊ธ ๋ค์ด๊ทธ๋ ์ด๋) โโโโโโโ
# ์ด ํ๋ฌ๊ทธ์ธ ๊ฒฝ๋ก์์ ํ์ง ์: CRITICAL โ HIGH ๋ค์ด๊ทธ๋ ์ด๋
# ์์ ๋ฌด์๊ฐ ์๋๋ผ ๋ฑ๊ธ์ ๋ฎ์ถฐ์ ์ผ์ผ ์์ฝ์ผ๋ก๋ง ์๋ฆผ
WP_TRUSTED_PLUGINS=(
"*/wp-content/plugins/woocommerce/*"
"*/wp-content/plugins/jetpack/*"
"*/wp-content/plugins/wordfence/*"
"*/wp-content/plugins/elementor/*"
"*/wp-content/plugins/updraftplus/*"
"*/wp-content/plugins/all-in-one-wp-migration/*"
"*/wp-content/plugins/contact-form-7/*"
"*/wp-content/plugins/akismet/*"
"*/wp-content/plugins/yoast-seo/*"
"*/wp-content/plugins/wp-mail-smtp/*"
"*/wp-content/plugins/really-simple-ssl/*"
)
# โโ ์๋ํ๋ ์ค ์
๋ฐ์ดํธ ์๋ฆผ ์ต์ โโโโโโโโโโโโโโโโโ
# .maintenance ํ์ผ ๊ฐ์ง ์ ์ด ์๊ฐ(๋ถ) ๋์ ์๋ฆผ ์ต์
WP_UPDATE_SUPPRESS_MINUTES=15
# โโ ํ์ง ๋ฑ๊ธ ์ฒด๊ณ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# CRITICAL (๐ด) : ํ์คํ ์
์ฑ์ฝ๋ โ ์ฆ์ ์๋ฆผ + ๊ฒฉ๋ฆฌ ๋์
# HIGH (๐ ) : ์์ฌ๋ ๋์ โ ์๋ฆผ ์ ์ก + ์๋ ํ์ธ
# WARNING (๐ก) : ์ ์ฌ์ ์ํ โ ์ผ์ผ ์์ฝ์๋ง ํฌํจ
# INFO (๐ต) : ์ฐธ๊ณ ์ ๋ณด โ ๋ก๊ทธ๋ง ๊ธฐ๋ก
#
# HIGH ์ด์๋ง ํ
๋ ๊ทธ๋จ ์ค์๊ฐ ์๋ฆผ ์ ์ก
REALTIME_ALERT_MIN_LEVEL="HIGH"
# โโ WP ์ฒดํฌ์ฌ ๊ฒ์ฆ ํ์ผ ๊ฒฝ๋ก โโโโโโโโโโโโโโโโโโโโโโ
WP_VERIFIED_FILES="${BASELINE_DIR}/wp_verified_files.txt"
# โโ ์๋ฒ ์๋ณ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SERVER_NAME="AltaBlue-Main"
SERVER_IP=$(hostname -I 2>/dev/null | awk '{print $1}' || echo "unknown")
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# ๐ WP ์ฝ์ด ๋ณต์ / ํ์ผ ์ ๊ธ ์ค์
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# โโ WP ์ฝ์ด ์๋ณธ ์์ค ๊ฒฝ๋ก โโโโโโโโโโโโโโโโโโโโโโโ
# ํด๋น ํด๋์ wp-admin/, wp-includes/ ๋ฑ WP ์ฝ์ด๊ฐ ์ง์ ์กด์ฌ๋๋ก ๊ฐ์
# ์ฐธ์กฐ: /home2/wordpress/wp-admin/, /home2/wordpress/wp-includes/ ...
WP_SOURCE_DIR="/home2/wordpress"
# โโ chattr +i ์ ๊ธ ๋์ ํต์ฌ ํ์ผ โโโโโโโโโโโโโโโโโโโ
# ์ฌ์ดํธ ๋ฃจํธ ๊ธฐ์ค ์๋ ๊ฒฝ๋ก โ ๊ทธ๋ฆผ๋ wp-config.php๋ ์ ์ธโ
# (๋ก์ปฌ DB ์ ๋ณด ํฌํจ๋์ด ์ฌ์ดํธ๋ง๋ค ๋ค๋ฆ โ ์๋ ์ ๊ธ ๊ถ์ฅ)
WP_LOCK_FILES=(
"index.php"
"wp-login.php"
"wp-blog-header.php"
"wp-cron.php"
"wp-settings.php"
"wp-config.php"
)
# โโ ์ฌ๋ก์ฐ HTTP ์ดํ ๋์ ์ค์ โโโโโโโโโโโโโโโโโโโ
# ๋๋ฆฐ ์๋ต ์๊ณ๊ฐ (์ด) โ ์ด ์๊ฐ ์ด์์ด๋ฉด ๋๋ฆฐ ์๋ต๋ก ํ๋จ
SLOW_RESPONSE_THRESHOLD="5.0"
# php-fpm ์๋ ์ฌ์์ ์๊ณ๊ฐ (์ด) โ ์ด ์๊ฐ ์ด์์ด๋ฉด ์ฆ์ ์ฌ์์
SLOW_RESTART_THRESHOLD="10.0"
# ์ฌ๋ก์ฐ HTTP ์ดํ ํ๋จ: ESTABLISHED ์ฐ๊ฒฐ ์ ์๊ณ๊ฐ
# (ESTABLISHED ์ ์ด ๊ฐ ์ด์ + ๋๋ฆฐ ์๋ต = ์ดํ์ผ๋ก ํ๋จ)
SLOW_ATTACK_CONN_THRESHOLD=300