]> git.ipfire.org Git - thirdparty/dhcpcd.git/log
thirdparty/dhcpcd.git
5 years agoFor systems without open_memstream(3) warn that /tmp needs to exit
Roy Marples [Wed, 27 May 2020 15:52:01 +0000 (15:52 +0000)] 
For systems without open_memstream(3) warn that /tmp needs to exit

Inside the privsep users home directory.

5 years agoCheck AF_PACKET is defined
Roy Marples [Wed, 27 May 2020 15:49:40 +0000 (15:49 +0000)] 
Check AF_PACKET is defined

5 years agodhcpcd: Fix a memory error dumping leases.
Roy Marples [Sun, 24 May 2020 14:57:18 +0000 (14:57 +0000)] 
dhcpcd: Fix a memory error dumping leases.

5 years agoprivsep: root and inet don't need arc4random
Roy Marples [Sun, 24 May 2020 14:38:06 +0000 (14:38 +0000)] 
privsep: root and inet don't need arc4random

Saves a fd or two.

5 years agoprivsep: Avoid the /proc/../ escape
Roy Marples [Sun, 24 May 2020 13:49:41 +0000 (14:49 +0100)] 
privsep: Avoid the /proc/../ escape

5 years agodhcpcd: Fix releasing addresses
Roy Marples [Sun, 24 May 2020 13:32:15 +0000 (14:32 +0100)] 
dhcpcd: Fix releasing addresses

5 years agoprivsep: Init the arc4random seed before chrooting
Roy Marples [Sun, 24 May 2020 12:23:20 +0000 (12:23 +0000)] 
privsep: Init the arc4random seed before chrooting

/dev/urandom isn't available in the chroot.
So keep a fd open to it.

5 years agoFix some memory issues with prior
Roy Marples [Sun, 24 May 2020 12:02:15 +0000 (12:02 +0000)] 
Fix some memory issues with prior

5 years agoFix prior for BSD
Roy Marples [Sun, 24 May 2020 11:30:13 +0000 (12:30 +0100)] 
Fix prior for BSD

5 years agoprivsep: Fix compile for prior without dev plugins
Roy Marples [Sun, 24 May 2020 10:49:58 +0000 (11:49 +0100)] 
privsep: Fix compile for prior without dev plugins

5 years agoprivsep: Pass BPF flags via ps_flags
Roy Marples [Sun, 24 May 2020 10:36:14 +0000 (10:36 +0000)] 
privsep: Pass BPF flags via ps_flags

5 years agoprivsep: Allow dev plugins to work
Roy Marples [Sun, 24 May 2020 10:30:23 +0000 (10:30 +0000)] 
privsep: Allow dev plugins to work

For udev at least, it requires a /var/run to be available in the chroot
which is poor. As such, give it a full IPC.

5 years agoprivsep: No need for a CHROOT reason now
Roy Marples [Sun, 24 May 2020 05:54:40 +0000 (05:54 +0000)] 
privsep: No need for a CHROOT reason now

5 years agoprivsep: Allow Linux to work without needing any mounts
Roy Marples [Sun, 24 May 2020 05:47:14 +0000 (05:47 +0000)] 
privsep: Allow Linux to work without needing any mounts

5 years agoMove get_line to common to re-use outside of options
Roy Marples [Sun, 24 May 2020 05:24:52 +0000 (05:24 +0000)] 
Move get_line to common to re-use outside of options

5 years agoAvoid putting an extra space here.
Roy Marples [Fri, 22 May 2020 09:12:55 +0000 (10:12 +0100)] 
Avoid putting an extra space here.

5 years agodhcpcd: Move the script file from per interface to global context
Roy Marples [Thu, 21 May 2020 17:28:27 +0000 (18:28 +0100)] 
dhcpcd: Move the script file from per interface to global context

This *should* affect no-one, but you never know.
The primary motivation for this is to ensure that nothing arbitary
can be executed by the root process if anyone breaks into the
chrooted unprivileged master process.

It also makes for smaller code.

5 years agoprivsep: Validate ICMP messages we send as well
Roy Marples [Thu, 21 May 2020 16:03:54 +0000 (17:03 +0100)] 
privsep: Validate ICMP messages we send as well

5 years agoprivsep: Validate UDP ports
Roy Marples [Thu, 21 May 2020 15:53:54 +0000 (16:53 +0100)] 
privsep: Validate UDP ports

Just like we filter the ioctls.

5 years agoApparently case is important.
Roy Marples [Thu, 21 May 2020 15:30:08 +0000 (16:30 +0100)] 
Apparently case is important.

5 years agodhcpcd: Silence console output entirely with more -q
Roy Marples [Thu, 21 May 2020 15:12:25 +0000 (16:12 +0100)] 
dhcpcd: Silence console output entirely with more -q

SystemD logs console ouput and syslog to the same place.
Pretty daft if you ask me, but heh.
-qq disables console output entirely to make SystemD logs easier to read.

5 years agoNote RFC6926 fields even though we don't perform a bulk lease query
Roy Marples [Thu, 21 May 2020 14:35:06 +0000 (15:35 +0100)] 
Note RFC6926 fields even though we don't perform a bulk lease query

5 years agoprivsep: Only allow file IO to specific paths
Roy Marples [Thu, 21 May 2020 11:54:58 +0000 (12:54 +0100)] 
privsep: Only allow file IO to specific paths

In the same vein as filtering ioctls.

5 years agoprivsep: Log the user chrooting as
Roy Marples [Wed, 20 May 2020 20:43:20 +0000 (21:43 +0100)] 
privsep: Log the user chrooting as

5 years agoRemove some old FORKED logic.
Roy Marples [Wed, 20 May 2020 20:36:00 +0000 (21:36 +0100)] 
Remove some old FORKED logic.

No longer needed now the main process forks from the get go.

5 years agoprivsep: Filter ioctls to a known list.
Roy Marples [Wed, 20 May 2020 17:14:38 +0000 (18:14 +0100)] 
privsep: Filter ioctls to a known list.

In-case the master process is broken into.

5 years agoARP: reduce conflicts from errors to warnings
Roy Marples [Wed, 20 May 2020 16:37:21 +0000 (17:37 +0100)] 
ARP: reduce conflicts from errors to warnings

It's only an error on DAD failure and you're warned about this
already.

5 years agoprivsep: inet processes no longer need inet pledge
Roy Marples [Wed, 20 May 2020 16:27:07 +0000 (17:27 +0100)] 
privsep: inet processes no longer need inet pledge

5 years agoOpenBSD: Avoid a pledge segfault when exiting
Roy Marples [Wed, 20 May 2020 16:14:12 +0000 (17:14 +0100)] 
OpenBSD: Avoid a pledge segfault when exiting

No cpath permission anymore, so we can't unlink the pidfile.
If compiled for pledge then don't bother.

5 years agoprivsep: Ensure we don't scribble garbage to BPF
Roy Marples [Wed, 20 May 2020 15:44:19 +0000 (15:44 +0000)] 
privsep: Ensure we don't scribble garbage to BPF

Well, it's not garbage, it's a privsep IPC message telling us to
start BPF which the BPF process should not have recieved!
Add code to ensure this cannot happen.

5 years agoARP: A few minor fixes for prior
Roy Marples [Wed, 20 May 2020 15:43:44 +0000 (15:43 +0000)] 
ARP: A few minor fixes for prior

5 years agoprivsep: Add comment about BPF returing EPERM on OpenBSD.
Roy Marples [Wed, 20 May 2020 13:15:30 +0000 (14:15 +0100)] 
privsep: Add comment about BPF returing EPERM on OpenBSD.

Looks like an OpenBSD bug.

5 years agoIPv4LL: Fix for non NetBSD
Roy Marples [Wed, 20 May 2020 13:07:36 +0000 (14:07 +0100)] 
IPv4LL: Fix for non NetBSD

5 years agoOpenBSD: Fix non privsep builds.
Roy Marples [Wed, 20 May 2020 11:23:25 +0000 (12:23 +0100)] 
OpenBSD: Fix non privsep builds.

5 years agoIPv4LL: Fix for prior on NetBSD at least.
Roy Marples [Wed, 20 May 2020 11:17:00 +0000 (12:17 +0100)] 
IPv4LL: Fix for prior on NetBSD at least.

5 years agoLinux: workaround a kernel bug when sending DHCPv6 over SOCK_RAW
Roy Marples [Tue, 19 May 2020 16:44:49 +0000 (16:44 +0000)] 
Linux: workaround a kernel bug when sending DHCPv6 over SOCK_RAW

The equivalent works fine for DHCP messages, so hum ho.

5 years agoprivsep: No need for ipv4state
Roy Marples [Tue, 19 May 2020 16:13:06 +0000 (16:13 +0000)] 
privsep: No need for ipv4state

5 years agoFix compile on Linux
Roy Marples [Tue, 19 May 2020 16:09:35 +0000 (16:09 +0000)] 
Fix compile on Linux

5 years agoRemove some debug
Roy Marples [Tue, 19 May 2020 15:43:50 +0000 (16:43 +0100)] 
Remove some debug

5 years agoFix compile for prior on NetBSD
Roy Marples [Tue, 19 May 2020 15:37:10 +0000 (16:37 +0100)] 
Fix compile for prior on NetBSD

5 years agoprivsep: Enable Capsicum for all processes.
Roy Marples [Tue, 19 May 2020 15:19:05 +0000 (16:19 +0100)] 
privsep: Enable Capsicum for all processes.

Except for the priviledged process.
This is quite an in-depth change:
 * ARP is now one process per address
 * BPF flags are now returned via privsep
 * BPF write filters are locked when supported
 * The root process sends to the network

The last step is done by opening RAW sockets and then sending a UDP
header (where applicable) to avoid binding to an address
which is already in use by the reader sockets.

This is slightly wasteful for OS's without sandboxing but does
have the very nice side effect of not needing a source address
to unicast DHCPs replies from which makes the code smaller.

5 years agoLinux: Lock the BPF filter from future changes
Roy Marples [Sat, 16 May 2020 11:28:56 +0000 (12:28 +0100)] 
Linux: Lock the BPF filter from future changes

5 years agoARP: Remove ability to filter specific addresses
Roy Marples [Fri, 15 May 2020 21:29:30 +0000 (22:29 +0100)] 
ARP: Remove ability to filter specific addresses

This is only really needed for long lasting ARP, which is only
used for IPv4 address defence.
Modern NetBSD does not need this and it fails to work with
OpenBSD Pledge. FreeBSD Capsicum is more secure without this
as the BPF fd can then be locked for other changes [1].
That just leaves Linux and Solaris.

If anyone feels dhcpcd is processing to much ARP then please
implement RFC 5227 in the kernel like NetBSD.

[1] Locking the BPF fd is questionable because the inet proxy
using sendmsg can send any packet to any destination.

5 years agoBPF: Set write filters where supported
Roy Marples [Fri, 15 May 2020 19:23:55 +0000 (20:23 +0100)] 
BPF: Set write filters where supported

While here make Capsicum and Pledge more granular so we can
easily Pledge the BPF BOOTP process but not the ARP one.

5 years agodhcpcd: allow sigpipe in scripts.
Roy Marples [Fri, 15 May 2020 14:56:47 +0000 (15:56 +0100)] 
dhcpcd: allow sigpipe in scripts.

5 years agoDHCP: always log inform when not renewing
Roy Marples [Fri, 15 May 2020 14:34:16 +0000 (15:34 +0100)] 
DHCP: always log inform when not renewing

So that we log a new lease on rebind from a renew failure.

5 years agoprivsep: sockaddr len should be socklen_t
Roy Marples [Thu, 14 May 2020 00:15:39 +0000 (01:15 +0100)] 
privsep: sockaddr len should be socklen_t

While ps_root_getifaddrs is only for capsicum, it's highly portable
and thus in the privsep-root rather than privsep-bsd.
As such, store the sockaddr len as socklen_t because that's what
POSIX demands.

It's only a few more bytes and I'd rather make this change now
than it potentially bite me later.

5 years agoRemove debug.
Roy Marples [Wed, 13 May 2020 19:58:58 +0000 (20:58 +0100)] 
Remove debug.

5 years agoprivsep: Add a generic wrapper for getifaddrs(3)
Roy Marples [Wed, 13 May 2020 19:52:24 +0000 (20:52 +0100)] 
privsep: Add a generic wrapper for getifaddrs(3)

Although this is only for Capsicum, the getifaddrs interface is
quite portable although not POSIX.

With this final change, the Master process can now enter Capsicum
Capabilites Mode and this completes the Capsicum integration.

5 years agoprivsep: Move defines around
Roy Marples [Wed, 13 May 2020 19:50:45 +0000 (20:50 +0100)] 
privsep: Move defines around

5 years agoBump date for prior
Roy Marples [Tue, 12 May 2020 21:10:08 +0000 (22:10 +0100)] 
Bump date for prior

5 years agoFix neighbor discovery option parsing (#16)
Andrew Childs [Tue, 12 May 2020 21:08:33 +0000 (06:08 +0900)] 
Fix neighbor discovery option parsing (#16)

* make_option_mask: use `nd_` prefix for nd options

The prefix for neighbor discovery options was partially changed to
`nd6_` in d5700a48edf7006369f766d225e70bbca3d8055c. However
set_option_space continued to use `nd_`. This prevented either
`nd6_prefix_information` or `nd_prefix_information` from being parsed
since the former was in the wrong option space, and the latter did not
have the prefix removed.

* manual: fix nd_ and dhcp6_ option prefixes

5 years agoNote that capsicum does allow gethostname
Roy Marples [Tue, 12 May 2020 18:00:36 +0000 (19:00 +0100)] 
Note that capsicum does allow gethostname

5 years agoFix an uninitialised memory access
Roy Marples [Tue, 12 May 2020 13:59:48 +0000 (13:59 +0000)] 
Fix an uninitialised memory access

5 years agoFix compile on Linux and Solaris
Roy Marples [Tue, 12 May 2020 13:54:19 +0000 (13:54 +0000)] 
Fix compile on Linux and Solaris

5 years agoUpdate comment for capsicum
Roy Marples [Tue, 12 May 2020 10:46:19 +0000 (11:46 +0100)] 
Update comment for capsicum

5 years agoRemove chroot file location reference
Roy Marples [Tue, 12 May 2020 10:35:28 +0000 (11:35 +0100)] 
Remove chroot file location reference

5 years agoprivsep: Just ensure default user has a home directory
Roy Marples [Tue, 12 May 2020 10:32:22 +0000 (11:32 +0100)] 
privsep: Just ensure default user has a home directory

5 years agoRemove unused variable.
Roy Marples [Tue, 12 May 2020 10:29:13 +0000 (11:29 +0100)] 
Remove unused variable.

5 years agoWe nolonger use getline.
Roy Marples [Tue, 12 May 2020 10:24:42 +0000 (11:24 +0100)] 
We nolonger use getline.

5 years agoprivsep: No longer need the chrootdir configure option.
Roy Marples [Tue, 12 May 2020 10:23:03 +0000 (11:23 +0100)] 
privsep: No longer need the chrootdir configure option.

As we work with an empty chroot directory.

5 years agoFix compile warnings with prior.
Roy Marples [Tue, 12 May 2020 09:58:31 +0000 (10:58 +0100)] 
Fix compile warnings with prior.

5 years agoprivsep: Handle all file IO in the Priviledged Actioneer
Roy Marples [Tue, 12 May 2020 09:26:35 +0000 (10:26 +0100)] 
privsep: Handle all file IO in the Priviledged Actioneer

This allows us to move the database directory back into the
root of the filesystem.
While here, harden the files by denying any user read access to them.

As part of this change, init the DUID from any machine data and
cache the default DHCP vendor field before dropping priviledges as we
may lose access to this later.

5 years agoFix warning for prior
Roy Marples [Sun, 10 May 2020 16:32:15 +0000 (17:32 +0100)] 
Fix warning for prior

5 years agoprivsep: Fix prior for non pledge systems
Roy Marples [Sun, 10 May 2020 15:19:09 +0000 (16:19 +0100)] 
privsep: Fix prior for non pledge systems

5 years agoprivsep: Implement pledge(2) support as found on OpenBSD
Roy Marples [Sun, 10 May 2020 15:09:54 +0000 (16:09 +0100)] 
privsep: Implement pledge(2) support as found on OpenBSD

5 years agoprivsep: Add function for indirect ioctl
Roy Marples [Sun, 10 May 2020 11:19:59 +0000 (12:19 +0100)] 
privsep: Add function for indirect ioctl

5 years agoprivsep: Copy back ioctl data
Roy Marples [Sun, 10 May 2020 10:05:23 +0000 (11:05 +0100)] 
privsep: Copy back ioctl data

5 years agoFix compile error for non capsicum
Roy Marples [Sun, 10 May 2020 09:11:46 +0000 (10:11 +0100)] 
Fix compile error for non capsicum

5 years agoMerge branch 'master' of github.com:rsmarples/dhcpcd
Roy Marples [Sun, 10 May 2020 09:07:34 +0000 (10:07 +0100)] 
Merge branch 'master' of github.com:rsmarples/dhcpcd

5 years agoMerge pull request #15 from mpu/controlgroup
Roy Marples [Sat, 9 May 2020 09:46:25 +0000 (10:46 +0100)] 
Merge pull request #15 from mpu/controlgroup

Do not report an error if control_group is already set

5 years agoMerge pull request #14 from mpu/master
Roy Marples [Fri, 8 May 2020 10:37:50 +0000 (11:37 +0100)] 
Merge pull request #14 from mpu/master

fix buffer size in getgrnam_r

5 years agoprivsep: Enable capsicum for network facing processes
Roy Marples [Thu, 7 May 2020 19:57:22 +0000 (20:57 +0100)] 
privsep: Enable capsicum for network facing processes

All fd's in network facing processes are fully limited.
Capability mode is only enabled for BPF processes because
it's too restrictive otherwise - the reasons are noted
in the commit.

5 years agoif: Be more descriptive on error for getifaddrs
Roy Marples [Thu, 7 May 2020 14:02:26 +0000 (15:02 +0100)] 
if: Be more descriptive on error for getifaddrs

5 years agoinet6: Move BSD get/set scope function to ipv6 for general use
Roy Marples [Thu, 7 May 2020 13:29:44 +0000 (14:29 +0100)] 
inet6: Move BSD get/set scope function to ipv6 for general use

It seems that FreeBSD doesn't allow binding to scoped addresses,
so let's use our functions everwhere rather than directly
setting scope.

5 years agoprivsep: Remove unsued function.
Roy Marples [Wed, 6 May 2020 23:08:41 +0000 (00:08 +0100)] 
privsep: Remove unsued function.

5 years agoFix buffer size in getgrnam_r
Quentin Carbonneaux [Tue, 5 May 2020 15:21:04 +0000 (17:21 +0200)] 
Fix buffer size in getgrnam_r

5 years agoDo not report an error if control_group is already set
Quentin Carbonneaux [Tue, 5 May 2020 15:43:04 +0000 (17:43 +0200)] 
Do not report an error if control_group is already set

5 years agoDHCP: Use correct buffer for receiving UDP
Roy Marples [Tue, 5 May 2020 19:03:49 +0000 (19:03 +0000)] 
DHCP: Use correct buffer for receiving UDP

Big wup!
While here, ensure buffer is aligned to the structure we want
to read.

5 years agoprivsep: Allow a blank string to force privsep users home directory
Roy Marples [Tue, 5 May 2020 16:55:10 +0000 (17:55 +0100)] 
privsep: Allow a blank string to force privsep users home directory

So FreeBSD users can set it like other OS's if they so choose.

5 years agoprivsep: Document any overridden chroot directory.
Roy Marples [Tue, 5 May 2020 16:34:54 +0000 (17:34 +0100)] 
privsep: Document any overridden chroot directory.

5 years agoLog chrootdir set.
Roy Marples [Mon, 4 May 2020 15:32:37 +0000 (16:32 +0100)] 
Log chrootdir set.

5 years agodhcpcd: Discard the freopen result.
Roy Marples [Fri, 1 May 2020 10:19:49 +0000 (11:19 +0100)] 
dhcpcd: Discard the freopen result.

5 years agoprivsep: Discard the freopen result.
Roy Marples [Fri, 1 May 2020 10:18:05 +0000 (11:18 +0100)] 
privsep: Discard the freopen result.

5 years agoAlign whitespace
Roy Marples [Thu, 30 Apr 2020 20:30:01 +0000 (21:30 +0100)] 
Align whitespace

5 years agoprivsep: allow --chrootdir= to configure a default chroot directory
Roy Marples [Thu, 30 Apr 2020 20:26:16 +0000 (21:26 +0100)] 
privsep: allow --chrootdir= to configure a default chroot directory

5 years agoprivsep: Add --chroot configurable
Roy Marples [Thu, 30 Apr 2020 20:13:45 +0000 (21:13 +0100)] 
privsep: Add --chroot configurable

Overrides the directory to chroot to away from the privilege separation
users home directory.

5 years agoinet6: Mark temp addrs for regen
Roy Marples [Wed, 29 Apr 2020 21:41:35 +0000 (22:41 +0100)] 
inet6: Mark temp addrs for regen

This solves an infinite loop where new temp addrs regened are
added at the tail and we loop endlessly.

5 years agoinet6: Set default ND timers before a RA arrives after preservation
Roy Marples [Wed, 29 Apr 2020 15:33:57 +0000 (16:33 +0100)] 
inet6: Set default ND timers before a RA arrives after preservation

Other OS will just remove the RA's on carrier down and thus set
default values, but not so on NetBSD.
As such as need to set default values just before settings any values
from the incoming RA.
This allows us to change networks sensibly.

5 years agoinet6: Expire ND on the second, not after it
Roy Marples [Wed, 29 Apr 2020 15:06:04 +0000 (15:06 +0000)] 
inet6: Expire ND on the second, not after it

Otherwise the timing is slightly confused.

5 years agoinet6: Apply the best RA which is still valid.
Roy Marples [Wed, 29 Apr 2020 14:32:15 +0000 (15:32 +0100)] 
inet6: Apply the best RA which is still valid.

If there is no such RA, then apply some defaults.

5 years agoLinux: Only set positive reachable timers
Roy Marples [Wed, 29 Apr 2020 14:31:49 +0000 (15:31 +0100)] 
Linux: Only set positive reachable timers

5 years agoNetBSD: Gear up for kernel RA removal.
Roy Marples [Wed, 29 Apr 2020 13:55:23 +0000 (14:55 +0100)] 
NetBSD: Gear up for kernel RA removal.

linkmtu will vanish from nd_ifinfo along with other things.
Also, there is not need to pre-fetch ifinfo because flags are no
longer updated when setting ifinfo back again.

5 years agoDHCP: Close sockets on carrier down
Roy Marples [Tue, 28 Apr 2020 16:39:48 +0000 (16:39 +0000)] 
DHCP: Close sockets on carrier down

This allows any BPF filter to reset family on carrier up.

5 years agoBump dates for prior.
Roy Marples [Tue, 28 Apr 2020 16:00:29 +0000 (17:00 +0100)] 
Bump dates for prior.

5 years agoGrammar nits
Sascha Wildner [Tue, 28 Apr 2020 15:56:26 +0000 (16:56 +0100)] 
Grammar nits

5 years agoWhitespace
Roy Marples [Tue, 28 Apr 2020 15:37:44 +0000 (16:37 +0100)] 
Whitespace

5 years agoAlign more CMSG foo.
Roy Marples [Sun, 26 Apr 2020 20:05:06 +0000 (21:05 +0100)] 
Align more CMSG foo.

5 years agoDHCP6: Implement DECLINE support for duplicated addresses
Roy Marples [Sun, 26 Apr 2020 16:22:42 +0000 (17:22 +0100)] 
DHCP6: Implement DECLINE support for duplicated addresses

This is the final piece of DHCP6 to implement!
Part of this change drops the use of the IPV6_AF_DUPLICATED flag
and we just use IN6_IFF_DUPLICATED now.

5 years agoThis should really be sa_family_t.
Roy Marples [Fri, 24 Apr 2020 11:23:05 +0000 (12:23 +0100)] 
This should really be sa_family_t.