Merge pull request #2630 from alexbelgium/copilot/fix-openvpn-connection-issue-again

Fix OpenVPN AUTH_FAILED: credential file corruption and config cleanup
This commit is contained in:
Alexandre
2026-04-06 10:33:36 +02:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -113,7 +113,7 @@ RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_auto
# && chmod a+x /etc/s6-overlay/s6-rc.d/$SCRIPTSNAME/* ; done; fi
# Manual apps
ARG PACKAGES="ipcalc wireguard-tools libnatpmp iptables ip6tables"
ARG PACKAGES="openvpn ipcalc wireguard-tools libnatpmp iptables ip6tables"
# Automatic apps & bashio
COPY ha_autoapps.sh /ha_autoapps.sh

View File

@@ -42,7 +42,7 @@ else
bashio::addon.stop
fi
echo -e "${openvpn_username}\n${openvpn_password}" > "${OPENVPN_STATE_DIR}/credentials.conf"
printf '%s\n%s\n' "${openvpn_username}" "${openvpn_password}" > "${OPENVPN_STATE_DIR}/credentials.conf"
chmod 600 "${OPENVPN_STATE_DIR}/credentials.conf"
if bashio::config.has_value "openvpn_config"; then
@@ -99,7 +99,7 @@ sed -i '/^[[:blank:]]*$/d' "${openvpn_runtime_config}"
sed -i '/^up/d' "${openvpn_runtime_config}"
sed -i '/^down/d' "${openvpn_runtime_config}"
sed -i '/^route/d' "${openvpn_runtime_config}"
sed -i '/^auth-user-pass /d' "${openvpn_runtime_config}"
sed -i '/^auth-user-pass/d' "${openvpn_runtime_config}"
sed -i '/^cd /d' "${openvpn_runtime_config}"
sed -i '/^chroot /d' "${openvpn_runtime_config}"
sed -i '$q' "${openvpn_runtime_config}"