Dear Maintainer,
With the transition from init script to systemd service, the ALLOWEDNETS
setting no longer works for multiple IP ranges due to bad argument
expansion in the service file.
In /etc/default/distcc, I have:
ALLOWEDNETS="10.0.0.0/24 172.16.0.0/24"
Then in /usr/lib/systemd/system/distcc.service, it is expanded:
EnvironmentFile=-/etc/default/distcc
ExecStart=/bin/sh -c 'if [ "$ZEROCONF" = "true" ]; then /usr/bin/distccd --daemon --no-detach --allow $ALLOWEDNETS --zeroconf; \
else /usr/bin/distccd --daemon --no-detach --allow $ALLOWEDNETS --listen $LISTENER --jobs $JOBS --nice $NICE; fi'
But this expands to `--allow 10.0.0.0/24 172.16.0.0/24`. The --allow
option only takes one argument so the 172.16.0.0 is silently dropped
without warning. The command should be `--allow 10... --allow 172...`.
One possible solution would be to use a subshell to expand it:
ExecStart=/bin/sh -c 'if [ "$ZEROCONF" = "true" ]; then \
/usr/bin/distccd --daemon --no-detach \
$(for net in $ALLOWEDNETS; do echo --allow $net; done) \
--zeroconf; \
else /usr/bin/distccd --daemon --no-detach \
$(for net in $ALLOWEDNETS; do echo --allow $net; done) \
--listen $LISTENER --jobs $JOBS --nice $NICE; fi'
There may be other better solutions too.
Thanks for your time and help,
Alex