54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
echo "[*] STOPPING SERVICES..."
|
|
|
|
systemctl stop cockpit.socket cockpit.service 2>/dev/null || true
|
|
systemctl disable cockpit.socket cockpit.service 2>/dev/null || true
|
|
|
|
systemctl stop fail2ban 2>/dev/null || true
|
|
|
|
echo "[*] REMOVING PACKAGES..."
|
|
|
|
apt purge -y cockpit cockpit-bridge cockpit-ws cockpit-system || true
|
|
apt autoremove -y --purge
|
|
|
|
echo "[*] REMOVING COCKPIT FILES..."
|
|
|
|
rm -rf /etc/cockpit
|
|
rm -rf /etc/systemd/system/cockpit.socket.d
|
|
rm -rf /etc/systemd/system/cockpit.service.d
|
|
rm -rf /var/lib/cockpit
|
|
rm -rf /var/cache/cockpit
|
|
|
|
echo "[*] REMOVING SELF-SIGNED CERTIFICATE SYSTEM..."
|
|
|
|
rm -rf /etc/ssl/selfcert
|
|
rm -f /usr/local/bin/selfcert-renew.sh
|
|
rm -f /etc/cron.d/selfcert-renew
|
|
rm -f /var/log/selfcert-renew.log
|
|
|
|
echo "[*] CLEANING COCKPIT SPECIFIC FAIL2BAN CONFIG..."
|
|
|
|
rm -f /etc/fail2ban/filter.d/cockpit.conf
|
|
|
|
echo "[*] RESETTING SYSTEMD..."
|
|
|
|
systemctl daemon-reload
|
|
systemctl daemon-reexec
|
|
|
|
echo "[*] OPTIONAL: remove created user?"
|
|
|
|
echo "Type username to delete (or press Enter to skip):"
|
|
read USER_TO_DELETE
|
|
|
|
if [ -n "$USER_TO_DELETE" ]; then
|
|
if id "$USER_TO_DELETE" &>/dev/null; then
|
|
deluser --remove-home "$USER_TO_DELETE" || true
|
|
echo "[+] User $USER_TO_DELETE removed"
|
|
else
|
|
echo "[!] User does not exist"
|
|
fi
|
|
fi
|
|
|
|
echo "[*] DONE CLEAN. SYSTEM IS RESET FROM YOUR SETUP." |