Skip to content

Commit 6d3af80

Browse files
authored
Merge pull request #118 from buildplan/ipv6_fix
fix: resolve IPv6 connectivity issues with Secure DNS and Docker
2 parents f72d90f + 73948f3 commit 6d3af80

3 files changed

Lines changed: 43 additions & 13 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
-----
99

10-
**Version:** v0.81.0
10+
**Version:** v0.81.1
1111

12-
**Last Updated:** 2026-06-22
12+
**Last Updated:** 2026-07-05
1313

1414
**Compatible With:**
1515

@@ -88,12 +88,12 @@ sha256sum du_setup.sh
8888

8989
Compare the output hash to the one below. They must match exactly.
9090

91-
`e00875833c298fb48ede07c9454693b4e4c5f33903939455d149568d4c9506a0`
91+
`4f8bfcba752ff65423f45b7dd020b4a2b21080ff916c68e276e4d9f3a1f82e9a`
9292

9393
Or echo the hash to check, it should output: `du_setup.sh: OK`
9494

9595
```bash
96-
echo e00875833c298fb48ede07c9454693b4e4c5f33903939455d149568d4c9506a0 du_setup.sh | sha256sum --check
96+
echo 4f8bfcba752ff65423f45b7dd020b4a2b21080ff916c68e276e4d9f3a1f82e9a du_setup.sh | sha256sum --check
9797
```
9898

9999
### 3. Run the Script

du_setup.sh

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash
22

33
# Debian and Ubuntu Server Hardening Interactive Script
4-
# Version: 0.81.0 | 2026-06-21
4+
# Version: 0.81.1 | 2026-07-05
55
# Changelog:
6+
# - v0.81.1: Fix IPv6 connectivity issues with Secure DNS.
7+
# Implement Docker-compatible IPv6 SLAAC sysctl configuration and enable native IPv6 networking in Docker daemon.
68
# - v0.81.0: Added optional encrypted DNS (DoT) setup using Quad9 and Cloudflare.
79
# Includes automatic installation of systemd-resolved if needed and configuration to block tracking protocols.
810
# - v0.80.8: Tested and verified compatibility with Ubuntu 26.04 LTS.
@@ -114,7 +116,7 @@
114116
set -euo pipefail
115117

116118
# --- Update Configuration ---
117-
CURRENT_VERSION="0.81.0"
119+
CURRENT_VERSION="0.81.1"
118120
SCRIPT_URL="https://raw.githubusercontent.com/buildplan/du_setup/refs/heads/main/du_setup.sh"
119121
CHECKSUM_URL="${SCRIPT_URL}.sha256"
120122

@@ -278,7 +280,7 @@ print_header() {
278280
printf '%s\n' "${CYAN}╔═════════════════════════════════════════════════════════════════╗${NC}"
279281
printf '%s\n' "${CYAN}║ ║${NC}"
280282
printf '%s\n' "${CYAN}║ DEBIAN/UBUNTU SERVER SETUP AND HARDENING SCRIPT ║${NC}"
281-
printf '%s\n' "${CYAN}║ v0.81.0 | 2026-06-21${NC}"
283+
printf '%s\n' "${CYAN}║ v0.81.1 | 2026-07-05${NC}"
282284
printf '%s\n' "${CYAN}║ ║${NC}"
283285
printf '%s\n' "${CYAN}╚═════════════════════════════════════════════════════════════════╝${NC}"
284286
printf '\n'
@@ -4451,7 +4453,7 @@ configure_secure_dns() {
44514453
print_info "Applying secure DNS settings (Quad9 with Cloudflare Fallback)..."
44524454
# Using Domains=~. forces global DNS to override DHCP interface-specific DNS safely
44534455
mkdir -p /etc/systemd/resolved.conf.d
4454-
tee /etc/systemd/resolved.conf.d/99-secure-dns.conf > /dev/null <<EOF
4456+
tee /etc/systemd/resolved.conf.d/99-secure-dns.conf > /dev/null <<SECURE_DNS_CONFIG
44554457
[Resolve]
44564458
DNS=9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
44574459
FallbackDNS=1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
@@ -4460,7 +4462,7 @@ DNSSEC=allow-downgrade
44604462
DNSOverTLS=opportunistic
44614463
MulticastDNS=no
44624464
LLMNR=no
4463-
EOF
4465+
SECURE_DNS_CONFIG
44644466

44654467
print_info "Enabling and restarting systemd-resolved..."
44664468
systemctl enable --now systemd-resolved
@@ -4485,10 +4487,24 @@ configure_kernel_hardening() {
44854487
return 0
44864488
fi
44874489

4490+
# Detect the main network interface
4491+
local MAIN_IFACE
4492+
MAIN_IFACE=$(ip route show default | awk '/default/ {print $5}' | head -1)
4493+
4494+
# Fallback to IPv6 default route if IPv4 is missing
4495+
if [[ -z "$MAIN_IFACE" ]]; then
4496+
MAIN_IFACE=$(ip -6 route show default | awk '/default/ {print $5}' | head -1)
4497+
fi
4498+
4499+
# Fallback just in case
4500+
MAIN_IFACE=${MAIN_IFACE:-eth0}
4501+
4502+
log "Detected main interface for sysctl SLAAC fix: $MAIN_IFACE"
4503+
44884504
local KERNEL_HARDENING_CONFIG
44894505
KERNEL_HARDENING_CONFIG=$(mktemp)
44904506
# create the config in a temporary file
4491-
tee "$KERNEL_HARDENING_CONFIG" > /dev/null <<'EOF'
4507+
tee "$KERNEL_HARDENING_CONFIG" > /dev/null <<KERNEL_HARDENING_CONFIG
44924508
# Recommended Security Settings managed by du_setup.sh
44934509
# For details, see: https://www.kernel.org/doc/Documentation/sysctl/
44944510
@@ -4516,6 +4532,12 @@ net.ipv6.conf.default.accept_redirects=0
45164532
net.ipv6.conf.all.accept_source_route=0
45174533
net.ipv6.conf.default.accept_source_route=0
45184534
4535+
# --- IPv6 SLAAC Fix for Docker ---
4536+
# Allow IPv6 SLAAC to function while Docker forwarding is enabled
4537+
net.ipv6.conf.all.accept_ra=2
4538+
net.ipv6.conf.default.accept_ra=2
4539+
net.ipv6.conf.${MAIN_IFACE}.accept_ra=2
4540+
45194541
# --- Kernel Security ---
45204542
# Enable ASLR (Address Space Layout Randomization) for better security
45214543
kernel.randomize_va_space=2
@@ -4530,7 +4552,7 @@ kernel.yama.ptrace_scope=1
45304552
# Protect against TOCTOU (Time-of-Check to Time-of-Use) race conditions
45314553
fs.protected_hardlinks=1
45324554
fs.protected_symlinks=1
4533-
EOF
4555+
KERNEL_HARDENING_CONFIG
45344556

45354557
local SYSCTL_CONF_FILE="/etc/sysctl.d/99-du-hardening.conf"
45364558

@@ -4601,15 +4623,23 @@ install_docker() {
46014623
"compress": "true"
46024624
},
46034625
"live-restore": true,
4626+
"ipv6": true,
4627+
"ip6tables": true,
4628+
"experimental": true,
46044629
"dns": [
46054630
"9.9.9.9",
46064631
"1.1.1.1",
4607-
"208.67.222.222"
4632+
"2620:fe::fe",
4633+
"2606:4700:4700::1111"
46084634
],
46094635
"default-address-pools": [
46104636
{
46114637
"base": "172.20.0.0/16",
46124638
"size": 24
4639+
},
4640+
{
4641+
"base": "fd00::/80",
4642+
"size": 96
46134643
}
46144644
],
46154645
"userland-proxy": false,

du_setup.sh.sha256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e00875833c298fb48ede07c9454693b4e4c5f33903939455d149568d4c9506a0 du_setup.sh
1+
4f8bfcba752ff65423f45b7dd020b4a2b21080ff916c68e276e4d9f3a1f82e9a du_setup.sh

0 commit comments

Comments
 (0)