2024-12-27 21:51:35 +01:00
|
|
|
#!/bin/bash
|
2025-06-03 22:41:00 +02:00
|
|
|
|
|
|
|
|
# Enable systemd-resolved
|
2024-12-28 14:02:23 +01:00
|
|
|
sudo systemctl enable systemd-resolved
|
2025-06-03 22:41:00 +02:00
|
|
|
|
|
|
|
|
# Remove all attributes from /etc/hosts to allow modifications
|
|
|
|
|
sudo chattr -i -a /etc/hosts 2>/dev/null || true
|
|
|
|
|
|
2025-06-03 22:48:17 +02:00
|
|
|
# Download the hosts file from StevenBlack's repository
|
|
|
|
|
echo "Downloading hosts file from StevenBlack repository..."
|
|
|
|
|
sudo curl -o /etc/hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts
|
2025-06-03 22:41:00 +02:00
|
|
|
|
2025-06-03 22:56:45 +02:00
|
|
|
# Set proper permissions (readable by all, writable only by root)
|
|
|
|
|
sudo chmod 644 /etc/hosts
|
2025-06-03 22:41:00 +02:00
|
|
|
|
|
|
|
|
# Make the file immutable (prevents deletion, renaming, and most modifications)
|
|
|
|
|
sudo chattr +i /etc/hosts
|
|
|
|
|
|
|
|
|
|
# Also set append-only attribute as additional protection
|
|
|
|
|
# Note: This requires removing immutable first, then setting both
|
|
|
|
|
sudo chattr -i /etc/hosts
|
|
|
|
|
sudo chattr +a /etc/hosts
|
|
|
|
|
|
|
|
|
|
# Flush DNS caches
|
2025-06-03 22:56:45 +02:00
|
|
|
sudo systemd-resolve --flush-caches
|
|
|
|
|
sudo systemctl restart NetworkManager.service
|