Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 362535 - net-misc/dhcp-4.2.1-r1 init script is not suitable for chroot usage
Summary: net-misc/dhcp-4.2.1-r1 init script is not suitable for chroot usage
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: CVE-2011-2748
  Show dependency tree
 
Reported: 2011-04-07 22:00 UTC by Andrew Savchenko
Modified: 2011-09-18 19:18 UTC (History)
6 users (show)

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


Attachments
dhcpd.init.diff (dhcpd.init.diff,1.06 KB, patch)
2011-04-07 22:04 UTC, Andrew Savchenko
Details | Diff
dhcpd.init4 (dhcpd.init4,2.58 KB, text/plain)
2011-04-07 23:26 UTC, Andrew Savchenko
Details
dhcp-4.2.1-r1.ebuild.patch (dhcp-4.2.1-r1.ebuild.patch,905 bytes, patch)
2011-04-07 23:27 UTC, Andrew Savchenko
Details | Diff
dhcpd.init4 (dhcpd.init4,2.82 KB, text/plain)
2011-08-29 04:57 UTC, SpanKY
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2011-04-07 22:00:23 UTC
Hello,

net-misc/dhcp init script is not suitable for usage with chroot and 4.2.x branch of dhcp.

It has the following issues:

1) /proc needs to be mounted inside of chroot, otherwise dhcpd will fail to start with the following error:

Apr  7 22:48:12 localhost dhcpd: Error opening '/proc/net/dev' to list interfaces                                                              
Apr  7 22:48:12 localhost dhcpd: Can't get list of interfaces.

2) dhcpd.conf is read by the daemon from /etc/dhcp/ *before* it is actually chrooted, so configure script must check for /etc/dhcp/dhcpd.conf existence instead of chrooted variant. That is, dhcpd.conf from chrooted directory is useless and is not read by the daemon at all (you can check this by modifying some parameter in the config file, restarting the daemon and checking from some client).

3) It spite of the following two issues ebuild's config function must be changed to create /proc inside of chroot and to *not* copy /etc/dhcp/dhcpd.conf there.
Comment 1 Andrew Savchenko gentoo-dev 2011-04-07 22:04:52 UTC
Created attachment 268933 [details, diff]
dhcpd.init.diff

This patch fixes first two issues, but it will broke older dhcp releases (3.x branch), so it must be extended for further checks.

It uses bind mount for /proc inside of chroot if chroot is used and checks for dhcpd.conf in normal /etc, instead of chrooted version, because the first one is used instead of the latter.
Comment 2 Andrew Savchenko gentoo-dev 2011-04-07 23:26:24 UTC
Created attachment 268937 [details]
dhcpd.init4

New dhcpd init script.
Comment 3 Andrew Savchenko gentoo-dev 2011-04-07 23:27:25 UTC
Created attachment 268939 [details, diff]
dhcp-4.2.1-r1.ebuild.patch

Ebuild update with for new init script and fixes proposed earlier.
Comment 4 Stefan Briesenick (RETIRED) gentoo-dev 2011-07-10 17:54:01 UTC
any news?
Comment 5 SpanKY gentoo-dev 2011-08-29 04:57:36 UTC
Created attachment 284957 [details]
dhcpd.init4

your init script doesn't catch all cases.  try this instead.
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2011-09-06 21:36:45 UTC
*** Bug 382039 has been marked as a duplicate of this bug. ***
Comment 7 Arnaud Launay 2011-09-07 18:04:05 UTC
I confirm SpanKY's init seems to work.
Comment 8 SpanKY gentoo-dev 2011-09-17 05:29:10 UTC
should be all set now in the tree; thanks for the report!

Commit message: Rewrite chroot usage to work with newer versions
http://sources.gentoo.org/net-misc/dhcp/dhcp-4.2.2-r2.ebuild?rev=1.1
http://sources.gentoo.org/net-misc/dhcp/files/dhcpd.conf2?rev=1.1
http://sources.gentoo.org/net-misc/dhcp/files/dhcpd.init4?rev=1.1
Comment 9 Petr Pisar 2011-09-18 17:07:55 UTC
Why has pkg_config() disappeared from ebuild? `emerge dhcp --config' as advised in /etc/conf.d/dhcpd does not work anymore.
Comment 10 SpanKY gentoo-dev 2011-09-18 19:18:24 UTC
should be all set now in the tree; thanks for the report!

Commit message: Drop old `emerge --config` comment
http://sources.gentoo.org/net-misc/dhcp/dhcp-4.2.2-r2.ebuild?r1=1.1&r2=1.2
http://sources.gentoo.org/net-misc/dhcp/files/dhcpd.conf2?r1=1.1&r2=1.2