adding dns override
All checks were successful
Check scripts syntax / check-scripts-syntax (push) Successful in 41s

This commit is contained in:
2026-05-16 11:09:03 -03:00
parent 253c8abee3
commit c800ec1888
2 changed files with 717 additions and 0 deletions

View File

@@ -12,6 +12,32 @@ This script is used to clean some of the files, docker dangling images, and dock
This PowerShell script is used to backup files from a Windows machine to a remote Samba server. It uses `7zip` to create the zip file, and then sends over the network using SMB protocol.
### `dns-override.sh`
Aggressive, best-effort DNS override script for Linux hosts with support for multiple resolver stacks (`systemd-resolved`, `NetworkManager`, `resolvconf/openresolv`, `dhclient`, `systemd-networkd`, and `ifupdown`) plus direct `/etc/resolv.conf` writes.
It prompts for:
- 2 required DNS servers
- 1 optional third DNS server
Validation/features:
- Accepts IPv4 and IPv6 literals
- Rejects invalid or duplicate entries
- Performs reachability checks (warn-only, does not block execution)
- Can optionally lock `/etc/resolv.conf` with `chattr +i`
Run with `curl | bash`:
```bash
curl -sSL https://git.ivanch.me/ivanch/server-scripts/raw/branch/main/dns-override.sh | bash
```
Important notes:
- Requires interactive TTY input (prompts are read from `/dev/tty`)
- Requires root privileges (`sudo` is used/re-execed when possible)
- Script is intentionally aggressive and may restart/reload network services
- On heavily managed systems (custom agents, immutable images, enterprise policy), behavior is still best-effort
## Haven Notify
It's a small internal service designed to send notifications to a specified Discord channel via webhooks. It's written in Go and can be easily deployed.