Compare commits

..
Author SHA1 Message Date
CanbiZ (MickLesk) a73bd472cf Improve nginx patch fetching method
Updated the patch fetching method for nginx to prioritize the GitHub API to avoid 503 errors.
2026-11-20 16:48:41 +01:00
MickLesk 0fa31b30b6 Nginx Proxy Manager: fetch the nginx HTTP/2 patches from the GitHub API
github.com's commit .patch pages answer 503 under load, the empty patch
went unnoticed in the pipe and every install since 2026-11-19 stopped
with exit 7. The patches now come from api.github.com, with the commit
page as fallback, into a file before they are applied.
2026-11-20 16:46:42 +01:00
3 changed files with 22 additions and 34 deletions

No files matched your search

+4 -1
View File
@@ -68,7 +68,10 @@ function update_script() {
msg_info "Patching nginx HTTP/2 (CVE-2026-123007, CVE-2026-123633)"
for commit in 61031503dc8087c2c17cd2142c9b4b19062f90c4 2df48a501d0fb8212b7d39dffeeff5876332ba59 e27f5fa84fe6e98505e70bc543b748747dad0a3b; do
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "-" | patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s
curl_with_retry "https://api.github.com/repos/nginx/nginx/commits/${commit}" "/tmp/nginx-${commit}.patch" "-HAccept:application/vnd.github.patch" ||
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "/tmp/nginx-${commit}.patch"
patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s <"/tmp/nginx-${commit}.patch"
rm -f "/tmp/nginx-${commit}.patch"
done
msg_ok "Patched nginx HTTP/2"
+4 -1
View File
@@ -42,7 +42,10 @@ fetch_and_deploy_from_url "https://openresty.org/download/openresty-${OPENRESTY_
msg_info "Patching nginx HTTP/2 (CVE-2026-123007, CVE-2026-123633)"
for commit in 61031503dc8087c2c17cd2142c9b4b19062f90c4 2df48a501d0fb8212b7d39dffeeff5876332ba59 e27f5fa84fe6e98505e70bc543b748747dad0a3b; do
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "-" | patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s
curl_with_retry "https://api.github.com/repos/nginx/nginx/commits/${commit}" "/tmp/nginx-${commit}.patch" "-HAccept:application/vnd.github.patch" ||
curl_with_retry "https://github.com/nginx/nginx/commit/${commit}.patch" "/tmp/nginx-${commit}.patch"
patch -d /opt/openresty/bundle/nginx-1.31.8 -p1 --forward -s <"/tmp/nginx-${commit}.patch"
rm -f "/tmp/nginx-${commit}.patch"
done
msg_ok "Patched nginx HTTP/2"
+14 -32
View File
@@ -89,22 +89,13 @@ esac
CTID_CONFIG_PATH="/etc/pve/lxc/${CTID}.conf"
# Snapshots follow the container's own settings as [name] sections, so a line
# appended to the file ends up in the last snapshot instead of the container.
CONF_MAIN=$(awk '/^\[/ {exit} {print}' "$CTID_CONFIG_PATH")
CONF_SNAPSHOTS=$(awk '/^\[/ {s=1} s' "$CTID_CONFIG_PATH")
CONF_ADD=""
grep -q "^lxc.cgroup2.devices.allow: c 10:200 rwm" <<<"$CONF_MAIN" || CONF_ADD+=$'\n'"lxc.cgroup2.devices.allow: c 10:200 rwm"
grep -q "^lxc.mount.entry: /dev/net/tun" <<<"$CONF_MAIN" || CONF_ADD+=$'\n'"lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file"
if [[ -n "$CONF_ADD" && -n "$CONF_SNAPSHOTS" ]]; then
printf '%s%s\n\n%s\n' "$CONF_MAIN" "$CONF_ADD" "$CONF_SNAPSHOTS" >"$CTID_CONFIG_PATH"
elif [[ -n "$CONF_ADD" ]]; then
printf '%s\n' "${CONF_ADD#$'\n'}" >>"$CTID_CONFIG_PATH"
fi
# Skip if already configured
grep -q "lxc.cgroup2.devices.allow: c 10:200 rwm" "$CTID_CONFIG_PATH" || echo "lxc.cgroup2.devices.allow: c 10:200 rwm" >>"$CTID_CONFIG_PATH"
grep -q "lxc.mount.entry: /dev/net/tun" "$CTID_CONFIG_PATH" || echo "lxc.mount.entry: /dev/net/tun dev/net/tun none bind,create=file" >>"$CTID_CONFIG_PATH"
msg_info "Installing Tailscale in CT $CTID"
$STD pct exec "$CTID" -- bash -c '
pct exec "$CTID" -- bash -c '
set -e
# Detect OS inside container
@@ -128,8 +119,6 @@ if [ -f /etc/alpine-release ]; then
else
# ── Debian / Ubuntu ──
export DEBIAN_FRONTEND=noninteractive
# The helpers then print apt output instead of logging it inside the container.
export VERBOSE=yes
# Source os-release properly (handles quoted values)
. /etc/os-release
@@ -141,8 +130,7 @@ else
# Check DNS resolution using multiple methods (dig may not be installed)
dns_check_failed=true
if command -v dig >/dev/null 2>&1; then
# dig prints its own errors (";; no servers could be reached") on stdout
if dig +short pkgs.tailscale.com 2>/dev/null | grep -E "^[0-9.]+$" | grep -qvE "^127\.|^0\.0\.0\.0$"; then
if dig +short pkgs.tailscale.com 2>/dev/null | grep -qvE "^127\.|^0\.0\.0\.0$|^$"; then
dns_check_failed=false
fi
elif command -v host >/dev/null 2>&1; then
@@ -168,8 +156,6 @@ else
cp "$ORIG_RESOLV" "$BACKUP_RESOLV"
echo "nameserver 1.1.1.1" >"$ORIG_RESOLV"
fi
RESTORE_RESOLV="[ ! -f $BACKUP_RESOLV ] || mv -f $BACKUP_RESOLV $ORIG_RESOLV"
trap "$RESTORE_RESOLV" EXIT
if ! command -v curl >/dev/null 2>&1; then
echo "[INFO] curl not found, installing..."
@@ -180,13 +166,6 @@ else
# Reuse the shared repository helper instead of hand-rolling the sources entry
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/core.func")
source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/lib/tools.func")
# core.func sets its own EXIT trap
trap "$RESTORE_RESOLV" EXIT
# A failed download is sourced as an empty file
if ! declare -f load_functions setup_deb822_repo >/dev/null; then
echo "[ERROR] Could not download the community-scripts helpers inside the container. Check its network and DNS." >&2
exit 7
fi
load_functions
# Drop the legacy keyring from the pre-deb822 layout
@@ -199,15 +178,18 @@ else
"${VERSION_CODENAME}" \
"main"
apt-get install -y tailscale
apt-get install -y tailscale >/dev/null
if [ -f /tmp/resolv.conf.backup ]; then
echo "[INFO] Restoring original /etc/resolv.conf"
mv /tmp/resolv.conf.backup /etc/resolv.conf
fi
fi
'
# The tag is cosmetic; Tailscale is installed by now.
TAGS=$(pct config "$CTID" | awk -F': ' '/^tags:/ {print $2}')
if [[ ";${TAGS};" != *";tailscale;"* ]] && ! TAG_OUTPUT=$(pct set "$CTID" -tags "${TAGS:+$TAGS;}tailscale" 2>&1); then
msg_warn "Could not add the tailscale tag to CT $CTID: ${TAG_OUTPUT}"
fi
TAGS=$(awk -F': ' '/^tags:/ {print $2}' "$CTID_CONFIG_PATH")
TAGS="${TAGS:+$TAGS; }tailscale"
pct set "$CTID" -tags "$TAGS"
msg_ok "Tailscale installed on CT $CTID"
echo -e "${YW}Reboot the container${CL}, then run 'tailscale up' inside the container to activate."