]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
4 years agodhcpcd: Don't create launcher process if keeping in foreground
Roy Marples [Wed, 11 Nov 2020 17:44:55 +0000 (17:44 +0000)] 
dhcpcd: Don't create launcher process if keeping in foreground

There is little point.

4 years agocontrol: create an unpriv socket for non master mode
Roy Marples [Wed, 11 Nov 2020 17:41:16 +0000 (17:41 +0000)] 
control: create an unpriv socket for non master mode

This allows `dhcpcd -U4 eth0` to work once more.

4 years agoWhen adding a route, the interface will always have options.
Roy Marples [Wed, 4 Nov 2020 14:25:00 +0000 (14:25 +0000)] 
When adding a route, the interface will always have options.

4 years agoAdd --noconfigure option
Roy Marples [Wed, 4 Nov 2020 14:18:48 +0000 (14:18 +0000)] 
Add --noconfigure option

With this set dhcpcd will not configure anything on the host.
The expectation is that a 3rd party script will instead.

4 years agofix if_getnetworknamespace matching bug. (#19)
Ted Feng [Tue, 3 Nov 2020 22:31:40 +0000 (11:31 +1300)] 
fix if_getnetworknamespace matching bug. (#19)

Co-authored-by: Ted Feng <Ted.Feng@Aviatnet.com>
4 years agoLinux: Fix detecting existing IPv4 addresses
Roy Marples [Tue, 3 Nov 2020 11:37:05 +0000 (11:37 +0000)] 
Linux: Fix detecting existing IPv4 addresses

This is important for better NetworkManager support.

4 years agooptions: Don't log unknown option errors when printing the pidfile
Roy Marples [Mon, 2 Nov 2020 17:03:31 +0000 (17:03 +0000)] 
options: Don't log unknown option errors when printing the pidfile

4 years agoRelease dhcpcd-9.3.2 v9.3.2
Roy Marples [Sun, 1 Nov 2020 14:07:38 +0000 (14:07 +0000)] 
Release dhcpcd-9.3.2

4 years agoFix compile without various defines
Roy Marples [Fri, 30 Oct 2020 22:18:57 +0000 (22:18 +0000)] 
Fix compile without various defines

4 years agoRemove debug from prior
Roy Marples [Fri, 30 Oct 2020 16:13:49 +0000 (16:13 +0000)] 
Remove debug from prior

4 years agoprivsep: don't leave a BOOTP process hanging around on SIGUSR1
Roy Marples [Fri, 30 Oct 2020 16:11:44 +0000 (16:11 +0000)] 
privsep: don't leave a BOOTP process hanging around on SIGUSR1

When not in master mode.

4 years agolog: Allow logopen to be called without logclose
Roy Marples [Fri, 30 Oct 2020 15:16:02 +0000 (15:16 +0000)] 
log: Allow logopen to be called without logclose

logclose is meant to free resources.
On Linux this means that _log_prog is also free'd and once in the
chroot we cannot work it out again.

As such allow logopen to close what it needs to so that reopening
works.

4 years agoprivsep: Allow logfile reopening in a chroot
Roy Marples [Fri, 30 Oct 2020 14:19:16 +0000 (14:19 +0000)] 
privsep: Allow logfile reopening in a chroot

Now that only the privileged actioneer does the actual logging
we can safely reopen the file we are logging to.
This also closes and re-opens the syslog connection.

4 years agoprivsep: Send all log messages to the privileged actioneer
Roy Marples [Fri, 30 Oct 2020 03:43:51 +0000 (03:43 +0000)] 
privsep: Send all log messages to the privileged actioneer

If dhcpcd starts and no syslogd implementation is running then
various syscall filters could be triggered when dhcpcd wants to syslog
and it's already in a chroot.

Not all libc openlog implementations support LOG_NDELAY and
openlog does not return an error code and can also mask errno back to 0.
So we have no way of knowing if we have a syslog connection or not.
This means we cannot cache the connection at startup because syslog itself
will try and open if no connection.

As such, all logging is now directed to the dhcpcd privileged actioneer
process which will handle all the syslog and log file writing actions.

The only downside of this approach (other than an extra fd per process)
is that we no longer know which PID raised the message. While we could
put the correct PID in the logfile as we control the API, we cannot
put it into syslog as we cannot control that API.
As all privsep errors should log which function they came from this
will hopefully not be an issue as on the happy path only the master
process will log stuff.

4 years agoDHCP: Implement IPv6-Only Preferred option, RFC 8925.
Roy Marples [Mon, 26 Oct 2020 11:19:54 +0000 (11:19 +0000)] 
DHCP: Implement IPv6-Only Preferred option, RFC 8925.

Enable it like so in dhcpcd.conf:
option ipv6_only_preferred

4 years agoprivsep: Close BPF socket on ENXIO.
Roy Marples [Sun, 25 Oct 2020 15:30:13 +0000 (15:30 +0000)] 
privsep: Close BPF socket on ENXIO.

This stops log spam if RTM_IFANNOUNCE is delayed for the departing
interface.

4 years agoBump date for prior
Roy Marples [Sun, 25 Oct 2020 08:52:38 +0000 (08:52 +0000)] 
Bump date for prior

4 years agodhcpcd.conf(5): mention fallback for the reboot option
Roy Marples [Sun, 25 Oct 2020 08:50:44 +0000 (08:50 +0000)] 
dhcpcd.conf(5): mention fallback for the reboot option

Syncs with dhcpcd(8)

4 years agoBSD: LINK_UNKNOWN is traditionally treated as LINK_UP
Roy Marples [Fri, 16 Oct 2020 13:36:34 +0000 (14:36 +0100)] 
BSD: LINK_UNKNOWN is traditionally treated as LINK_UP

4 years agoprivsep: Allow more syscalls through SECCOMP and add a debugger
Roy Marples [Thu, 15 Oct 2020 16:59:33 +0000 (17:59 +0100)] 
privsep: Allow more syscalls through SECCOMP and add a debugger

This fixes PowerPC at least.

The debugger should not be enabled by default as the attacker
could keep the processes running.
However, it is need to work out which syscall is failing due to the
way SECCOMP works.

4 years agoMake a note about solaris privileges
Roy Marples [Thu, 15 Oct 2020 12:29:26 +0000 (13:29 +0100)] 
Make a note about solaris privileges

4 years agoduid: plug a potential memory leak v9.3.1
Roy Marples [Mon, 12 Oct 2020 13:56:34 +0000 (14:56 +0100)] 
duid: plug a potential memory leak

4 years agoRelease dhcpcd-9.3.1
Roy Marples [Mon, 12 Oct 2020 13:41:06 +0000 (14:41 +0100)] 
Release dhcpcd-9.3.1

4 years agoprivsep: Minor correction to prior logic
Roy Marples [Sun, 11 Oct 2020 07:47:31 +0000 (08:47 +0100)] 
privsep: Minor correction to prior logic

4 years agoprivsep: We need to ensure stderr is valid before testing if tty
Roy Marples [Sat, 10 Oct 2020 16:54:03 +0000 (17:54 +0100)] 
privsep: We need to ensure stderr is valid before testing if tty

4 years agoprivsep: Fix stderr redirection again
Roy Marples [Sat, 10 Oct 2020 14:07:38 +0000 (15:07 +0100)] 
privsep: Fix stderr redirection again

4 years agoprivsep: allow gettimeofday for SECCOMP
Roy Marples [Sat, 10 Oct 2020 14:06:59 +0000 (15:06 +0100)] 
privsep: allow gettimeofday for SECCOMP

We need it for logging.

4 years agoBSD doesn't use envp
Roy Marples [Sat, 10 Oct 2020 13:46:25 +0000 (14:46 +0100)] 
BSD doesn't use envp

4 years agosetproctitle compat requires envp, not environ
Roy Marples [Sat, 10 Oct 2020 13:44:00 +0000 (14:44 +0100)] 
setproctitle compat requires envp, not environ

The two could be different!
envp is NOT C or POSIX standard, but does appear to be a UNIX standard.

4 years agoJust give up with setproctitle on Illumos
Roy Marples [Sat, 10 Oct 2020 10:32:23 +0000 (13:32 +0300)] 
Just give up with setproctitle on Illumos

Their ps tools go out of their way to only show how it was launched :/

4 years agoChange copyright on setproctitle.h
Roy Marples [Fri, 9 Oct 2020 19:38:48 +0000 (20:38 +0100)] 
Change copyright on setproctitle.h

4 years agocompat: Use libbsd's setproctitle(3)
Roy Marples [Fri, 9 Oct 2020 19:21:52 +0000 (20:21 +0100)] 
compat: Use libbsd's setproctitle(3)

Linux PRCTL variant, although more light weight, doesn't work on
some kernels.
This weighs in around 1k more, but always works.
It does play around with environ and args but unlike other
similar variants doesn't appear to stamp on what you actually
use in the program.

4 years agoprivsep: Always try and open syslog
Roy Marples [Fri, 9 Oct 2020 14:06:57 +0000 (15:06 +0100)] 
privsep: Always try and open syslog

Even if we don't print as otherwise we can't in a chroot.

4 years agoprivsep: Ensure command is for BPF first and interface valid second
Roy Marples [Fri, 9 Oct 2020 13:45:57 +0000 (14:45 +0100)] 
privsep: Ensure command is for BPF first and interface valid second

Otherwise we won't call inet_dispatch on a message meant for it.

4 years agoLinux: fix compile
Roy Marples [Wed, 7 Oct 2020 15:21:26 +0000 (16:21 +0100)] 
Linux: fix compile

4 years agoprivsep: Improve rights on launcher fork and stderr fds
Roy Marples [Wed, 7 Oct 2020 14:31:35 +0000 (15:31 +0100)] 
privsep: Improve rights on launcher fork and stderr fds

4 years agoprivsep: Only start network proxy if we need to
Roy Marples [Wed, 7 Oct 2020 14:28:33 +0000 (15:28 +0100)] 
privsep: Only start network proxy if we need to

Do this before starting it rather than it shutting down.

4 years agoprivsep: Only log chrooting from the launcher process
Roy Marples [Wed, 7 Oct 2020 13:37:35 +0000 (14:37 +0100)] 
privsep: Only log chrooting from the launcher process

And the sandbox tech as well.
Rework stop_interface so we can reuse an option for marking
a process as the launcher.

4 years agoif: always log about unsupported interface types in debug
Roy Marples [Wed, 7 Oct 2020 13:23:23 +0000 (14:23 +0100)] 
if: always log about unsupported interface types in debug

4 years agodhcpcd: Simplify the link handling even more
Roy Marples [Wed, 7 Oct 2020 13:11:47 +0000 (14:11 +0100)] 
dhcpcd: Simplify the link handling even more

Move the IS_LINK_UP macro to if_is_link_up function to reduce
binary size.
Rather than DHCPCD_LINK option controlling the carrier state,
use it in if_is_link_up to determine the outcome.

4 years agoWireless must be down if unknown.
Roy Marples [Tue, 6 Oct 2020 06:36:22 +0000 (07:36 +0100)] 
Wireless must be down if unknown.

4 years agodhcpcd: Simplify carrier handling more by using IS_LINK_UP macro
Roy Marples [Tue, 6 Oct 2020 06:10:41 +0000 (07:10 +0100)] 
dhcpcd: Simplify carrier handling more by using IS_LINK_UP macro

Removes the need for the LINK_DOWN_IFFUP state.
While here, remove the check for IFF_RUNNING when LINK_UNKNOWN
because that is OS specific.

4 years agoRelease dhcpcd-9.3.0 v9.3.0
Roy Marples [Mon, 5 Oct 2020 15:33:51 +0000 (16:33 +0100)] 
Release dhcpcd-9.3.0

4 years agoprivsep: Remove capsicum specific hooks from BPF
Roy Marples [Sun, 4 Oct 2020 21:04:49 +0000 (22:04 +0100)] 
privsep: Remove capsicum specific hooks from BPF

We no longer change the filter as it's locked if the OS supports.

4 years agoDon't log backticks.
Roy Marples [Sat, 3 Oct 2020 16:17:45 +0000 (17:17 +0100)] 
Don't log backticks.

4 years agoprivsep: We need getsockopt as well as setsockopt on the link socket
Roy Marples [Sat, 3 Oct 2020 16:00:56 +0000 (17:00 +0100)] 
privsep: We need getsockopt as well as setsockopt on the link socket

So we can report receive buffer size.
Important for route(4) overflow so we can try and set a bigger buffer.

4 years agoprivsep: allow CAP_SETSOCKOPT for route(4) fd.
Roy Marples [Fri, 2 Oct 2020 14:57:01 +0000 (15:57 +0100)] 
privsep: allow CAP_SETSOCKOPT for route(4) fd.

If FreeBSD ever implements RO_MISSFILTER it will need special
rights to work over Capsium.

4 years agoprivsep: We now need to carry ifa_data for BSD
Roy Marples [Wed, 30 Sep 2020 16:25:32 +0000 (17:25 +0100)] 
privsep: We now need to carry ifa_data for BSD

4 years agoBSD: Fix compile for non NetBSD
Roy Marples [Wed, 30 Sep 2020 15:14:39 +0000 (16:14 +0100)] 
BSD: Fix compile for non NetBSD

4 years agoAdd a comment to prior incase I do something dumb like removing it
Roy Marples [Tue, 29 Sep 2020 07:00:24 +0000 (08:00 +0100)] 
Add a comment to prior incase I do something dumb like removing it

in the future if I forgot why it was there.

4 years agoFix a typo in a comment
SAITOH Masanobu [Tue, 29 Sep 2020 06:30:27 +0000 (07:30 +0100)] 
Fix a typo in a comment

4 years agoprivsep: fix crash when interface departs before bpf returns for it
Roy Marples [Mon, 28 Sep 2020 20:10:21 +0000 (21:10 +0100)] 
privsep: fix crash when interface departs before bpf returns for it

4 years agoBSD: struct if_data->ifi_link_state is the single source of truth
Roy Marples [Mon, 28 Sep 2020 16:09:38 +0000 (17:09 +0100)] 
BSD: struct if_data->ifi_link_state is the single source of truth

Vastly improve and simplify link detection on BSD.
dhcpcd either examines the whole system via getifaddrs(3) or
reacts to events via route(4).
In both cases we have struct if_data which has ifi_link_state.

Armed with this knowledge, we no longer need SIOCGIFDATA or
SIOCGIFMEDIA.

To solve the issue of newly attached interfaces having
LINK_STATE_UNKNOWN or some interfaces not even changing it,
we only change the local knowledge of interface flags when
reports them by getifaddrs(3) or route(4) when we change them.
For example, if we set IFF_UP and it succeeds we don't set this
internally until reported by the kernel as above.

This keeps flags and link state in sync with each other.
The hope is that the kernel can set the real link state before
it reports IFF_UP.

As such, we no longer require the poll option or need to enter a
tight loop for old interfaces.

4 years agoBSD: Ignore vether(4) devices by default.
Roy Marples [Sun, 27 Sep 2020 10:28:03 +0000 (11:28 +0100)] 
BSD: Ignore vether(4) devices by default.

4 years agoClean up some warnings.
Sascha Wildner [Thu, 24 Sep 2020 19:53:56 +0000 (20:53 +0100)] 
Clean up some warnings.

4 years agoFreeBSD: Anticipate SIOCGIFDATA not working in Capsicum
Roy Marples [Thu, 24 Sep 2020 02:49:30 +0000 (03:49 +0100)] 
FreeBSD: Anticipate SIOCGIFDATA not working in Capsicum

4 years agoBSD: NetBSD is the odd man out with SIOCGIFDATA
Roy Marples [Thu, 24 Sep 2020 02:31:43 +0000 (03:31 +0100)] 
BSD: NetBSD is the odd man out with SIOCGIFDATA

So setup the #defines like so.
On OpenBSD, pledge blocks it and there is no escape.
Luckily we already allow indirect ioctls via privsep so it works fine.

4 years agoif: Always warn about ignored interfaces.
Roy Marples [Wed, 23 Sep 2020 12:14:06 +0000 (13:14 +0100)] 
if: Always warn about ignored interfaces.

4 years agoBSD: Of course DragonFly does SIOCGIFDATA differently..
Roy Marples [Wed, 23 Sep 2020 08:59:47 +0000 (09:59 +0100)] 
BSD: Of course DragonFly does SIOCGIFDATA differently..

4 years agoAdd a warning about prior
Roy Marples [Wed, 23 Sep 2020 08:31:24 +0000 (09:31 +0100)] 
Add a warning about prior

4 years agoRevert double variable define
Roy Marples [Wed, 23 Sep 2020 08:27:58 +0000 (09:27 +0100)] 
Revert double variable define

4 years agoFreeBSD lacks SIOCGIFDATA it seems.
Roy Marples [Wed, 23 Sep 2020 08:26:16 +0000 (09:26 +0100)] 
FreeBSD lacks SIOCGIFDATA it seems.

4 years agoBSD: Use SIOCGIFDATA if no media support and no ifa_data
Roy Marples [Tue, 22 Sep 2020 20:53:13 +0000 (21:53 +0100)] 
BSD: Use SIOCGIFDATA if no media support and no ifa_data

Hopefully this nails link state once and for all on BSD.

4 years agoBSD: Detect initial link state in ifa_data
Roy Marples [Tue, 22 Sep 2020 12:09:03 +0000 (13:09 +0100)] 
BSD: Detect initial link state in ifa_data

Not all interfaces report media state to get the link state.
However, link state is available from getifaddrs(3) ifa_data
for AF_LINK addresses.

Testing shows that link state is also sent correctly via
route(4) messages for the same interface.

This makes pppoe(4) interfaces more reliable on FreeBSD and OpenBSD.

4 years agodhcpcd: log carrier lost once more
Roy Marples [Tue, 22 Sep 2020 12:08:32 +0000 (13:08 +0100)] 
dhcpcd: log carrier lost once more

4 years agoTry and track link state better, regardless of if we're using
Roy Marples [Mon, 21 Sep 2020 21:24:18 +0000 (22:24 +0100)] 
Try and track link state better, regardless of if we're using
the interface or not.

4 years agoprivsep: Don't log sandbox type twice
Roy Marples [Mon, 21 Sep 2020 16:40:28 +0000 (17:40 +0100)] 
privsep: Don't log sandbox type twice

4 years agoprivsep: Allow __NR_mmap for seccomp
Roy Marples [Mon, 21 Sep 2020 10:20:46 +0000 (11:20 +0100)] 
privsep: Allow __NR_mmap for seccomp

Some malloc implementations might use it rather than brk.

4 years agoprivsep: Don't remove pidfile at exit
Roy Marples [Sun, 20 Sep 2020 20:22:49 +0000 (21:22 +0100)] 
privsep: Don't remove pidfile at exit

The privileged actioneer will remove it.

4 years agoprivsep: Add more platforms for seccomp
Roy Marples [Sun, 20 Sep 2020 19:22:40 +0000 (20:22 +0100)] 
privsep: Add more platforms for seccomp

Really nutty. Why cannot a system header define a default?

4 years agoprivsep: Allow more syscalls for seccomp
Roy Marples [Sun, 20 Sep 2020 18:44:23 +0000 (19:44 +0100)] 
privsep: Allow more syscalls for seccomp

dumplease now works over the control socket and stdin.

4 years agoprivsep: Send signal from launcher to master over the socket
Roy Marples [Sun, 20 Sep 2020 18:24:26 +0000 (19:24 +0100)] 
privsep: Send signal from launcher to master over the socket

rather than using kill which is not permitted in capsicum.
This also allows us to drop the proc pledge.

4 years agoprivsep: sandbox the launcher process
Roy Marples [Sun, 20 Sep 2020 18:09:08 +0000 (19:09 +0100)] 
privsep: sandbox the launcher process

4 years agoFreeBSD: Fix build
Roy Marples [Sun, 20 Sep 2020 16:43:31 +0000 (17:43 +0100)] 
FreeBSD: Fix build

4 years agoprivsep: Avoid "unconfined" seccomp warnings
Roy Marples [Sat, 19 Sep 2020 23:53:47 +0000 (00:53 +0100)] 
privsep: Avoid "unconfined" seccomp warnings

Unsure why these are needed atm....

4 years agoprivsep: Don't be noisy about the sandbox
Roy Marples [Sat, 19 Sep 2020 23:43:36 +0000 (00:43 +0100)] 
privsep: Don't be noisy about the sandbox

4 years agoprivsep: Log if the platform sandbox is unavailable or available
Roy Marples [Sat, 19 Sep 2020 23:35:08 +0000 (00:35 +0100)] 
privsep: Log if the platform sandbox is unavailable or available

This is kinda important.

4 years agoprivsep: Add the SECCOMP BPF sandbox for Linux
Roy Marples [Sat, 19 Sep 2020 19:53:23 +0000 (20:53 +0100)] 
privsep: Add the SECCOMP BPF sandbox for Linux

Now we have capsicum, pledge and the POSIX resource limited sandboxes
this was quite easy really.

4 years agoLinux: Use SIOCSIFVLAN rather than SIOCSIFVLAN
Roy Marples [Sat, 19 Sep 2020 19:36:07 +0000 (20:36 +0100)] 
Linux: Use SIOCSIFVLAN rather than SIOCSIFVLAN

4 years agoprivsep: Fold capsicum and pledge entry points into ps_entersandbox
Roy Marples [Sat, 19 Sep 2020 17:58:52 +0000 (18:58 +0100)] 
privsep: Fold capsicum and pledge entry points into ps_entersandbox

4 years agoAdjust prior so that message is logged before starting dev
Roy Marples [Sat, 19 Sep 2020 14:05:51 +0000 (15:05 +0100)] 
Adjust prior so that message is logged before starting dev

Also add os_init incase other os need similar in the future.

4 years agoLinux: detect network namespace and deny udev in one
Roy Marples [Sat, 19 Sep 2020 13:40:50 +0000 (14:40 +0100)] 
Linux: detect network namespace and deny udev in one

udev says whether an interface name is stable or not.
In a network namespace, udev claims the interface does not exist.
This makes sense because udev only operates in the root namespace.

As such disable udev in a network namespace.

While here correctly spell initialise.

4 years agoduid: Allow optional argument to specify ll or llt alongside uuid
Roy Marples [Wed, 16 Sep 2020 14:55:11 +0000 (15:55 +0100)] 
duid: Allow optional argument to specify ll or llt alongside uuid

4 years agoinstall: Create DBDIR with mode 0750 by default
Roy Marples [Tue, 15 Sep 2020 10:45:21 +0000 (11:45 +0100)] 
install: Create DBDIR with mode 0750 by default

It shouldn't be 0755 as we might not want everyone to read
DHCP leases.

4 years agodhcpcd: Only manipulate stdin, stdout and stderr when valid
Roy Marples [Sat, 12 Sep 2020 19:14:47 +0000 (20:14 +0100)] 
dhcpcd: Only manipulate stdin, stdout and stderr when valid

UNIX application expect these to exist even if pointed at /dev/null.
We cannot change which fd they use, it's always 0, 1 and 2.
But if these fd's are not open when dhcpcd is called, they could
be assigned to dhcpcd internals.

In this instance we should not use the streams in anyway or form.

4 years agologerr: Don't leak the logfile stream to scripts
Roy Marples [Sat, 12 Sep 2020 14:58:03 +0000 (15:58 +0100)] 
logerr: Don't leak the logfile stream to scripts

4 years agoREADME: Remove old reference to db dir needing user permissions
Roy Marples [Fri, 11 Sep 2020 14:07:19 +0000 (15:07 +0100)] 
README: Remove old reference to db dir needing user permissions

We've been using the original dirs since dhcpcd-9.1.

4 years agodhcpcd: avoid privsep errors if we error locking the pidfile
Roy Marples [Fri, 11 Sep 2020 11:21:07 +0000 (12:21 +0100)] 
dhcpcd: avoid privsep errors if we error locking the pidfile

Should not happen on the happy path, but if it does, tidy the
resultant errors.

4 years agoRelease dhcpcd-9.2.0 v9.2.0
Roy Marples [Sun, 6 Sep 2020 14:27:28 +0000 (15:27 +0100)] 
Release dhcpcd-9.2.0

4 years agoDHCP: Fix compile without IPv4LL
Roy Marples [Sun, 6 Sep 2020 14:26:36 +0000 (15:26 +0100)] 
DHCP: Fix compile without IPv4LL

4 years agoconfigure: Remove PPOLL from config.mk
Roy Marples [Sun, 6 Sep 2020 14:25:59 +0000 (15:25 +0100)] 
configure: Remove PPOLL from config.mk

4 years agoprivsep: dump leases in a sandbox
Roy Marples [Sun, 6 Sep 2020 12:53:08 +0000 (13:53 +0100)] 
privsep: dump leases in a sandbox

4 years agodhcpcd: stderr callback fd may the reset by peer
Roy Marples [Sun, 6 Sep 2020 12:27:31 +0000 (13:27 +0100)] 
dhcpcd: stderr callback fd may the reset by peer

When the process exits which is normal.

4 years agoprivsep: Dump leases from stdin in a limited sandbox
Roy Marples [Sun, 6 Sep 2020 11:20:40 +0000 (12:20 +0100)] 
privsep: Dump leases from stdin in a limited sandbox

4 years agoprivsep: dropprivs can be static
Roy Marples [Sun, 6 Sep 2020 10:58:29 +0000 (11:58 +0100)] 
privsep: dropprivs can be static

4 years agoprivsep: limit rights for stdout/stderr/stdin using capsicum
Roy Marples [Sun, 6 Sep 2020 10:57:19 +0000 (11:57 +0100)] 
privsep: limit rights for stdout/stderr/stdin using capsicum

4 years agoFreeBSD: Don't rights limit stderr
Roy Marples [Sun, 6 Sep 2020 02:01:49 +0000 (03:01 +0100)] 
FreeBSD: Don't rights limit stderr

Otherwise some utils in scripts will error with insufficient
capabilities.

4 years agodhcpcd: Redirect stdout/stderr to the launcher stderr descriptor
Roy Marples [Sun, 6 Sep 2020 01:41:08 +0000 (02:41 +0100)] 
dhcpcd: Redirect stdout/stderr to the launcher stderr descriptor

This actually make life really simple!
We no longer need to redirect stdout/stderr to /dev/null for privsep
and any script output is now captured again - and it all goes to stderr
as it should even if a script wants it to go to stdout.

On the happy path, only the master process will actually log anything
to stderr so we turn that off after we "fork".
On the unhappy path, logging to stderr/stdout *may* fail because
the launcher process *may* have exited.
We *could* have the master process as an intermediary but that's
just excess code to avoid errors which *should* not happen.
Regardless, any errror should still hit syslog.

4 years agoprivsep: Fix prior for FreeBSD.
Roy Marples [Sat, 5 Sep 2020 16:01:59 +0000 (17:01 +0100)] 
privsep: Fix prior for FreeBSD.

4 years agodhcpcd: Setup a socketpair in the launcher to write to stderr
Roy Marples [Sat, 5 Sep 2020 15:16:22 +0000 (16:16 +0100)] 
dhcpcd: Setup a socketpair in the launcher to write to stderr

Rather than duping stderr down to the processes.
This allows us to reopen stdout and stderr onto /dev/null right
away and means only the launcher process writes to stderr.

The downside is that any stdout from the script is now lost.
If that's needed, we could setup a stdout socketpair as well.