Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 487454 - =sys-devel/distcc-3.1-r9 - Needs systemd service unit file improvement to allow to include multiple allow statements.
Summary: =sys-devel/distcc-3.1-r9 - Needs systemd service unit file improvement to all...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Cluster Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-09 18:05 UTC by Mehmet Giritli
Modified: 2022-05-31 07:02 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mehmet Giritli 2013-10-09 18:05:42 UTC
Currently unit file contains:

ExecStart=/usr/bin/distccd --verbose --no-detach --daemon --port 3632 -N 15 --allow $ALLOWED_SERVERS

where by default the configuration file contains

Environment="ALLOWED_SERVERS=127.0.0.1"

This is problematic for including multiple allow statements and also the log file setting should also be included in the unit file. I suggest changing the config file to something like this:

Environment="ALLOWED_SERVERS=--allow 127.0.0.1 --allow 192.168.2.0/24 --allow 192.168.1.0/24"

and the exec statement to include log file setting and remove the --allow statement whic is moved into the config file:

ExecStart=/usr/bin/distccd --no-detach --daemon --port 3632 -N 15 --log-level notice --log-file /var/log/distccd.log $ALLOWED_SERVERS

Reproducible: Always
Comment 1 Pacho Ramos gentoo-dev 2013-10-09 19:10:28 UTC
(In reply to Mehmet Giritli from comment #0)
> Currently unit file contains:
> 
> ExecStart=/usr/bin/distccd --verbose --no-detach --daemon --port 3632 -N 15
> --allow $ALLOWED_SERVERS
> 
> where by default the configuration file contains
> 
> Environment="ALLOWED_SERVERS=127.0.0.1"
> 
> This is problematic for including multiple allow statements and also the log
> file setting should also be included in the unit file. I suggest changing
> the config file to something like this:
> 
> Environment="ALLOWED_SERVERS=--allow 127.0.0.1 --allow 192.168.2.0/24
> --allow 192.168.1.0/24"

I guess we could replace ExecStart dropping "--allow" and moving it to the environment file, but wouldn't add the .2.0/24 and .1.0/24 as they depend on every setup

> 
> and the exec statement to include log file setting and remove the --allow
> statement whic is moved into the config file:
> 
> ExecStart=/usr/bin/distccd --no-detach --daemon --port 3632 -N 15
> --log-level notice --log-file /var/log/distccd.log $ALLOWED_SERVERS
> 
> Reproducible: Always

Regarding the log, when I reviewed how was this handled in other distros, looks like we can rely on getting logs handled by journald (as fedora and arch do)
Comment 2 Mehmet Giritli 2013-10-10 09:25:25 UTC
(In reply to Pacho Ramos from comment #1)
> (In reply to Mehmet Giritli from comment #0)
> > Currently unit file contains:
> > 
> > ExecStart=/usr/bin/distccd --verbose --no-detach --daemon --port 3632 -N 15
> > --allow $ALLOWED_SERVERS
> > 
> > where by default the configuration file contains
> > 
> > Environment="ALLOWED_SERVERS=127.0.0.1"
> > 
> > This is problematic for including multiple allow statements and also the log
> > file setting should also be included in the unit file. I suggest changing
> > the config file to something like this:
> > 
> > Environment="ALLOWED_SERVERS=--allow 127.0.0.1 --allow 192.168.2.0/24
> > --allow 192.168.1.0/24"
> 
> I guess we could replace ExecStart dropping "--allow" and moving it to the
> environment file, but wouldn't add the .2.0/24 and .1.0/24 as they depend on
> every setup
> 

Yeah, I just copy pasted mine for sake of an example to show what I meant.

> > 
> > and the exec statement to include log file setting and remove the --allow
> > statement whic is moved into the config file:
> > 
> > ExecStart=/usr/bin/distccd --no-detach --daemon --port 3632 -N 15
> > --log-level notice --log-file /var/log/distccd.log $ALLOWED_SERVERS
> > 
> > Reproducible: Always
> 
> Regarding the log, when I reviewed how was this handled in other distros,
> looks like we can rely on getting logs handled by journald (as fedora and
> arch do)

I preferred distcc to have its own log file directly because this is somewhat easier to handle as there could be a lot of output but I don't actually mind. I'll keep a private unit file under /etc.
Comment 3 Pacho Ramos gentoo-dev 2013-10-10 17:29:37 UTC
I have tried to run:
# distccd --verbose --no-detach --daemon --port 3632 -N 15 -a 192.168.1.1 192.168.0.1 0.0.0.0
distccd[14023] (dcc_discard_root) discarded root privileges, changed to uid=240 gid=2
^C

and it looks to (at least) run :/, are you sure you need to add a "-a" per each IP?
Comment 4 Mehmet Giritli 2013-10-10 17:43:29 UTC
(In reply to Pacho Ramos from comment #3)
> I have tried to run:
> # distccd --verbose --no-detach --daemon --port 3632 -N 15 -a 192.168.1.1
> 192.168.0.1 0.0.0.0
> distccd[14023] (dcc_discard_root) discarded root privileges, changed to
> uid=240 gid=2
> ^C
> 
> and it looks to (at least) run :/, are you sure you need to add a "-a" per
> each IP?

Yes, it will run like that without an error message but it will not accept from the ones except the first one listed after --allow. This is what I remember at least.
Comment 5 Pacho Ramos gentoo-dev 2013-10-10 17:47:31 UTC
Could you verify it? (I don't have the setup for testing that) Thanks
Comment 6 Mehmet Giritli 2013-10-10 17:58:31 UTC
(In reply to Pacho Ramos from comment #5)
> Could you verify it? (I don't have the setup for testing that) Thanks

Will do when I have time for it. No problem.
Comment 7 Sergey Popov gentoo-dev 2015-10-22 15:00:20 UTC
*** Bug 530106 has been marked as a duplicate of this bug. ***
Comment 8 Ben 2018-11-20 17:19:28 UTC
I just retested, having "--allow host host host" is a silent fail, it accepts it but does not work.

I also tried this circuitous 

Environment="ALLOWED_SERVERS=\"10.0.0.0/24 --allow 127.0.0.1\""

(hint, yeah, it *looks* like it assembled correctly.)  This also does not work.

The only way I was able to accept localhost and LAN was to rewrite the the whole ExecStart line with a custom service file...

Should this bug just be closed and expect a custom service file be written if we need more than one allow statement?

As an aside, IPV6 access control handling by distcc is atrocious, made worse by the allowance of only one hostmask in ALLOWED_SERVERS.
Comment 9 Mike Gilbert gentoo-dev 2018-11-20 20:35:58 UTC
Utilizing the an environment variable to pass command line arguments is just a bad idea to begin with.

Here are possible solutions I would suggest:

1. Override ExecStart to pass the options you need. This is obviously not ideal, but better than abusing environment vars.

2. Use a shell script to dynamically build a distccd command line, and call the shell script from the service file.

3. Patch distccd to read its configuration from a file instead of relying on command line parameters.
Comment 10 Ben 2018-11-23 17:07:42 UTC
Does the distcc.conf file need to be compatible with OpenRC
Comment 11 Ben 2018-11-23 17:08:30 UTC
Ignore that last comment... useless comment, they are different...