ircu2/fix_stealth_operator.sh

92 lines
2.1 KiB
Bash

#!/bin/bash
# Script de fix automat pentru stealth oper - setează display=no în Operator block
CONFIG_FILE="/home/ircd/ircd/lib/ircd.conf"
echo "=== FIX STEALTH OPER - display = no în Operator block ==="
echo ""
# Backup
cp "$CONFIG_FILE" "${CONFIG_FILE}.backup.$(date +%Y%m%d_%H%M%S)"
echo "✅ Backup creat: ${CONFIG_FILE}.backup.$(date +%Y%m%d_%H%M%S)"
# Găsește și modifică Operator block-urile
# Adaugă display = no; după admin = yes; dacă nu există deja
awk '
/^Operator \{/ {
in_operator = 1
has_display = 0
buffer = $0 "\n"
next
}
in_operator {
buffer = buffer $0 "\n"
# Verifică dacă există deja display
if ($0 ~ /display = /) {
has_display = 1
}
# Dacă găsim admin = yes; și nu avem display, adaugă-l
if ($0 ~ /admin = yes;/ && !has_display) {
buffer = buffer " display = no; # Stealth mode - NU apare în WHOIS\n"
has_display = 1
}
# Sfârșit de block
if ($0 ~ /^\};/) {
print buffer
in_operator = 0
buffer = ""
next
}
next
}
!in_operator {
print
}
' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp"
mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
echo "✅ Operator block modificat - display = no; adăugat"
echo ""
# Verifică configurația
echo "=== Verificare configurație ==="
/home/ircd/ircd/bin/ircd -k "$CONFIG_FILE"
if [ $? -eq 0 ]; then
echo ""
echo "✅ Configurație OK!"
echo ""
echo "=== Restart IRCd ==="
killall -9 ircd 2>/dev/null
sleep 2
/home/ircd/ircd/bin/ircd -f "$CONFIG_FILE"
sleep 2
if pgrep -x ircd > /dev/null; then
echo "✅ IRCd pornit cu succes!"
echo ""
echo "=== Test WHOIS ==="
echo "Conectează-te cu IRC client și fă:"
echo "/oper YourOper password"
echo "/whois YourNick"
echo ""
echo "NU ar trebui să apară 'is an IRC Administrator'!"
else
echo "❌ IRCd nu a pornit! Verifică logs:"
echo "tail -50 /home/ircd/ircd/log/ircd.log"
fi
else
echo ""
echo "❌ Eroare în configurație!"
echo "Restaurează backup:"
echo "cp ${CONFIG_FILE}.backup.* $CONFIG_FILE"
fi