Добавить cockpit/cockpit-uninstaller.sh
This commit is contained in:
60
cockpit/cockpit-uninstaller.sh
Normal file
60
cockpit/cockpit-uninstaller.sh
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/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 fail2ban ufw || 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 FAIL2BAN CONFIGS..."
|
||||
|
||||
rm -f /etc/fail2ban/jail.local
|
||||
rm -f /etc/fail2ban/jail.d/cockpit.conf
|
||||
rm -f /etc/fail2ban/filter.d/cockpit.conf
|
||||
|
||||
echo "[*] CLEANING UFW RULES..."
|
||||
|
||||
ufw --force reset || true
|
||||
|
||||
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."
|
||||
Reference in New Issue
Block a user