aboutsummaryrefslogtreecommitdiff
path: root/sbin/rtsol
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2019-01-05 16:05:39 +0000
committerMark Johnston <markj@FreeBSD.org>2019-01-05 16:05:39 +0000
commit04e9edb5442826a14616157962361ff81e4a38fe (patch)
tree0647c722bb3a99c24de3af780ce339f000ca58b1 /sbin/rtsol
parentcb56711d68b21fbc890ddd586604e7f3bdedca4d (diff)
downloadsrc-04e9edb5442826a14616157962361ff81e4a38fe.tar.gz
src-04e9edb5442826a14616157962361ff81e4a38fe.zip
Capsicumize rtsol(8) and rtsold(8).
These programs parse ND6 Router Advertisement messages; rtsold(8) has required an SA, SA-14:20.rtsold, for a bug in this code. Thus, they are good candidates for sandboxing. The approach taken is to run the main executable in capability mode and use Casper services to provide functionality that cannot be implemented within the sandbox. In particular, several custom services were required. - A Casper service is used to send Router Solicitation messages on a raw ICMP6 socket. Initially I took the approach of creating a socket for each interface upon startup, and connect(2)ing it to the all-routers multicast group for the interface. This permits the use of sendmsg(2) in capability mode, but only works if the interface's link is up when rtsol(d) starts. So, instead, the rtsold.sendmsg service is used to transmit RS messages on behalf of the main process. One could alternately define a service which simply creates and connects a socket for each destination address, and returns the socket to the sandboxed process. However, to implement rtsold's -m option we also need to read the ND6 default router list, and this cannot be done in capability mode. - rtsold may execute resolvconf(8) in response to RDNSS and DNSSL options in received RA messages. A Casper service is used to fork and exec resolvconf(8), and to reap the child process. - A service is used to determine whether a given interface's link-local address is useable (i.e., not duplicated or undergoing DAD). This information is supplied by getifaddrs(3), which reads a sysctl not available in capability mode. The SIOCGIFCONF socket ioctl provides equivalent information and can be used in capability mode, but I decided against it for now because of some limitations of that interface. In addition to these new services, cap_syslog(3) is used to send messages to syslogd. Reviewed by: oshogbo Tested by: bz (previous versions) MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17572
Notes
Notes: svn path=/head/; revision=342788
Diffstat (limited to 'sbin/rtsol')
-rw-r--r--sbin/rtsol/Makefile20
1 files changed, 17 insertions, 3 deletions
diff --git a/sbin/rtsol/Makefile b/sbin/rtsol/Makefile
index 80b38a6af77a..ee22f5756b64 100644
--- a/sbin/rtsol/Makefile
+++ b/sbin/rtsol/Makefile
@@ -18,10 +18,24 @@
PACKAGE=runtime
PROG= rtsol
-SRCS= rtsold.c rtsol.c if.c probe.c dump.c rtsock.c
+SRCS= cap_llflags.c \
+ cap_script.c \
+ cap_sendmsg.c \
+ dump.c \
+ if.c \
+ rtsol.c \
+ rtsold.c \
+ rtsock.c
MAN=
+LIBADD= util
-WARNS?= 3
-CFLAGS+= -DSMALL
+.include <src.opts.mk>
+
+.if ${MK_DYNAMICROOT} == "no"
+.warning ${PROG} built without libcasper support
+.elif ${MK_CASPER} != "no" && !defined(RESCUE)
+CFLAGS+= -DWITH_CASPER
+LIBADD+= cap_syslog casper nv
+.endif
.include <bsd.prog.mk>