Skip to content

Commit

Permalink
Merge pull request #16444 from BonnierNews/bug/port-list-when-proxy-p…
Browse files Browse the repository at this point in the history
…rotocol

Automatic merge from submit-queue (batch tested with PRs 16454, 16444, 16522)

Router: Do not include accept-proxy in port list when using proxy protocol and syn eater

When enabling both proxy protocol (ROUTER_USE_PROXY_PROTOCOL) and DROP_SYN_DURING_RESTART, the ports variable in reload-haproxy is set to: 
```
80 accept-proxy,443 accept-proxy
``` 

This makes the reload script fail with:

```
Bad argument `accept-proxy,445'
Try `iptables -h' or 'iptables --help' for more information.
``` 

This PR fixes that by adding `-o` to grep, which makes grep only return the match from the reqex
  • Loading branch information
openshift-merge-robot committed Sep 26, 2017
2 parents 51d62aa + 5bc3155 commit 8031512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion images/router/haproxy/reload-haproxy
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ if [ -n "$old_pids" ]; then
if $(set | grep DROP_SYN_DURING_RESTART= > /dev/null) && [[ "$DROP_SYN_DURING_RESTART" == 'true' || "$DROP_SYN_DURING_RESTART" == '1' ]]; then
# We install the syn eater so that connections that come in during the restart don't
# go onto the wrong socket, which is then closed.
ports=$(grep -E '^\s*bind\s+:[[:digit:]]+\w' "$config_file" | cut -f2 -d: | paste -d, -s)
ports=$(grep -E -o '^\s*bind\s+:[[:digit:]]+\w' "$config_file" | cut -f2 -d: | paste -d, -s)
if [ -n "$ports" ]; then
# If this doesn't insert, we don't care, we still want to reload
/usr/sbin/iptables -I INPUT -p tcp -m multiport --dports $ports --syn -j DROP \
Expand Down

0 comments on commit 8031512

Please sign in to comment.