Skip to content

Commit

Permalink
Privoxy eth0 fixes, healthcheck comparison tweak and start.sh update (#…
Browse files Browse the repository at this point in the history
…2610)

* by checking for existence of default 127 address,healthcheck will never effectively run, as the non-default eth0 ip will never be matched

* the comparison was not trimming off the port, thus healthcheck was always going to fail or denote a change when there may have been none

* simplified the comparison (thanks @edgd1er )
  • Loading branch information
heavygee authored May 11, 2023
1 parent 3efaf14 commit 2169498
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion privoxy/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set_port()
# Set the port for the IPv4 interface
adr=$(ip -4 a show eth0| grep -oP "(?<=inet )([^/]+)")
adr=${adr:-"0.0.0.0"}
sed -i -E "s/^listen-address\s+127.*/listen-address ${adr}:$1/" "$2"
sed -i -E "s/^listen-address\s+.*/listen-address ${adr}:$1/" "$2"

# Remove the listen-address for IPv6 for now. IPv6 compatibility should come later
sed -i -E "s/^listen-address\s+\[\:\:1.*//" "$2"
Expand Down
2 changes: 1 addition & 1 deletion scripts/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if [[ ${WEBPROXY_ENABLED} =~ [yY][eE]?[Ss]?|[tT][Rr][Uu][eE] ]]; then
if [[ ${PROXY} -eq 0 ]]; then
echo "Privoxy warning: process was stopped, restarting."
fi
proxy_ip=$(grep -oP "(?<=^listen-address).*$" /etc/privoxy/config | sed 's/ //g')
proxy_ip=$(grep -oP "(?<=^listen-address )[0-9\.]+" /etc/privoxy/config)
cont_ip=$(ip -j a show dev eth0 | jq -r .[].addr_info[].local)
if [[ ${proxy_ip} != ${cont_ip} ]]; then
echo "Privoxy error: container ip (${cont_ip} has changed: privoxy listening to ${proxy_ip}, restarting privoxy."
Expand Down

1 comment on commit 2169498

@JeeDeWee
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried this change but it does not appear to be working correctly. I changed line 62 in your code to:

proxy_ip=$(grep -i "^listen-address" /etc/privoxy/config | awk -F ' ' '{print $2}' | awk -F ':' '{print $1}')

Please sign in to comment.