Skip to content

Commit

Permalink
fix grep issue with endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Feb 3, 2025
1 parent 3b0cce8 commit 5304aad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build/root/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if [[ "${VPN_ENABLED}" == "yes" ]]; then
/usr/local/bin/dos2unix.sh "${VPN_CONFIG}"
# get endpoint line from wireguard config file
export VPN_REMOTE_SERVER=$(cat "${VPN_CONFIG}" | grep -P -o '(?<=^Endpoint(\s+)?=(\s+)?)[^:]+' || true)
export VPN_REMOTE_SERVER=$(cat "${VPN_CONFIG}" | grep -P -o '(?<=^Endpoint(\s)?=(\s)?)[^:]+' || true)
if [[ -z "${VPN_REMOTE_SERVER}" ]]; then
echo "[crit] VPN configuration file ${VPN_CONFIG} does not contain 'Endpoint' line, showing contents of file before exit..." | ts '%Y-%m-%d %H:%M:%.S'
cat "${VPN_CONFIG}" && exit 1
Expand All @@ -179,15 +179,15 @@ if [[ "${VPN_ENABLED}" == "yes" ]]; then
if [[ "${VPN_PROV}" == "pia" ]]; then
export VPN_REMOTE_PORT=$(cat "${VPN_CONFIG}" | grep -P -o '(?<=^Endpoint(\s+)?=(\s+)?).*' | grep -P -o '[\d]+$' || true)
export VPN_REMOTE_PORT=$(cat "${VPN_CONFIG}" | grep -P -o '(?<=^Endpoint(\s)?=(\s)?).*' | grep -P -o '[\d]+$' || true)
if [[ -z "${VPN_REMOTE_PORT}" ]]; then
echo "[warn] VPN configuration file ${VPN_CONFIG} does not contain port on 'Endpoint' line, defaulting to '1337'" | ts '%Y-%m-%d %H:%M:%.S'
export VPN_REMOTE_PORT="1337"
fi
else
export VPN_REMOTE_PORT=$(cat "${VPN_CONFIG}" | grep -P -o '(?<=^Endpoint(\s+)?=(\s+)?).*' | grep -P -o '[\d]+$' || true)
export VPN_REMOTE_PORT=$(cat "${VPN_CONFIG}" | grep -P -o '(?<=^Endpoint(\s)?=(\s)?).*' | grep -P -o '[\d]+$' || true)
if [[ -z "${VPN_REMOTE_PORT}" ]]; then
echo "[crit] VPN configuration file ${VPN_CONFIG} does not contain port on 'Endpoint' line, showing contents of file before exit..." | ts '%Y-%m-%d %H:%M:%.S'
cat "${VPN_CONFIG}" && exit 1
Expand Down Expand Up @@ -344,7 +344,7 @@ if [[ "${VPN_ENABLED}" == "yes" ]]; then
echo "[info] NAME_SERVERS defined as '${NAME_SERVERS}'" | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[warn] NAME_SERVERS not defined (via -e NAME_SERVERS), defaulting to name servers defined in readme.md" | ts '%Y-%m-%d %H:%M:%.S'
export NAME_SERVERS="84.200.69.80,37.235.1.174,1.1.1.1,37.235.1.177,84.200.70.40,1.0.0.1"
export NAME_SERVERS="1.1.1.1,1.0.0.1"
fi
# resolve vpn endpoints, drop all, allow vpn endpoints, if client pia then also allow pia api and pia website
Expand Down

0 comments on commit 5304aad

Please sign in to comment.