cosmopolitan/libc/dns
Justine Tunney 7cf66bc161 Prevent Make from talking to public Internet
This change introduces the nointernet() function which may be called to
prevent a process and its descendants from communicating with publicly
routable Internet addresses. GNU Make has been modified to always call
this function. In the future Landlock Make will have a way to whitelist
subnets to override this behavior, or disable it entirely. Support is
available for Linux only. Our firewall does not require root access.

Calling nointernet() will return control to the caller inside a new
process that has a SECCOMP BPF filter installed, which traps network
related system calls. Your original process then becomes a permanent
ptrace() supervisor that monitors all processes and threads descending
from the returned child. Whenever a networking system call happens the
kernel will stop the process and wakes up the monitor, which then peeks
into the child memory to read the sockaddr_in to determine if it's ok.

The downside to doing this is that there can be only one supervisor at a
time using ptrace() on a process. So this firewall won't be enabled if
you run make under strace or inside gdb. It also makes testing tricky.
2022-08-12 21:51:39 -07:00
..
comparednsnames.c Make minor improvements 2021-05-15 21:53:26 -07:00
consts.h Merge HTTP request / response parsing code 2021-06-27 17:04:32 -07:00
dns.h Prove that Makefile is fully defined 2022-08-06 04:05:08 -07:00
dns.mk Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
dns.png Initial import 2020-06-15 07:18:57 -07:00
dnsheader.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
dnsheader.h Make minor improvements 2021-05-15 21:53:26 -07:00
dnsquestion.h Make minor improvements 2021-05-15 21:53:26 -07:00
ent.h Improve system calls 2022-07-08 06:42:03 -07:00
freeaddrinfo.c Add some more necessary locks 2022-06-12 22:20:59 -07:00
freehoststxt.c Make minor improvements 2021-05-15 21:53:26 -07:00
freeresolvconf.c Make minor improvements 2021-05-15 21:53:26 -07:00
gai_strerror.c Rename eai2str to gai_strerror (#131) 2021-03-20 20:48:40 -07:00
getaddrinfo.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
gethostbyaddr.c Make whitespace changes 2021-08-13 03:20:45 -07:00
gethostbyname.c Make whitespace changes 2021-08-13 03:20:45 -07:00
gethoststxt.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
getnameinfo.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
getntnameservers.c Reduce Makefile dependencies by 4% 2022-05-23 15:07:01 -07:00
getntprotocolstxtpath.c Unbloat the build 2022-08-11 00:15:29 -07:00
getntservicestxtpath.c Unbloat the build 2022-08-11 00:15:29 -07:00
getprotobyname.c Unbloat the build 2022-08-11 00:15:29 -07:00
getprotobynumber.c Unbloat the build 2022-08-11 00:15:29 -07:00
getresolvconf.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
getservbyname.c Make whitespace changes 2021-08-13 03:20:45 -07:00
getservbyport.c Make whitespace changes 2021-08-13 03:20:45 -07:00
h_errno.c Improve system calls 2022-07-08 06:42:03 -07:00
herror.c Improve system calls 2022-07-08 06:42:03 -07:00
hostent.c Make whitespace changes 2021-08-13 03:20:45 -07:00
hoststxt.h Prove that Makefile is fully defined 2022-08-06 04:05:08 -07:00
hstrerror.c Improve system calls 2022-07-08 06:42:03 -07:00
lookupprotobyname.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
lookupprotobynumber.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
lookupservicesbyname.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
lookupservicesbyport.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
netent.c Make whitespace changes 2021-08-13 03:20:45 -07:00
newaddrinfo.c Remove more nonstandard stuff from cosmopolitan.h 2021-03-01 00:18:23 -08:00
parsehoststxt.c Make minor improvements 2021-05-15 21:53:26 -07:00
parseresolvconf.c Make minor improvements 2021-05-15 21:53:26 -07:00
pascalifydnsname.c Make minor improvements 2021-05-15 21:53:26 -07:00
protoent.c Make whitespace changes 2021-08-13 03:20:45 -07:00
prototxt.h Make whitespace changes 2021-08-13 03:20:45 -07:00
resolvconf.h Make minor improvements 2021-05-15 21:53:26 -07:00
resolvedns.c Prevent Make from talking to public Internet 2022-08-12 21:51:39 -07:00
resolvednsreverse.c Fold LIBC_RAND into LIBC_STDIO/TINYMATH/INTRIN 2022-08-11 12:32:00 -07:00
resolvehostsreverse.c Fold LIBC_BITS into LIBC_INTRIN 2022-08-11 12:13:18 -07:00
resolvehoststxt.c Add SSL to redbean 2021-06-24 13:20:50 -07:00
rfc0226.txt Initial import 2020-06-15 07:18:57 -07:00
rfc0247.txt Initial import 2020-06-15 07:18:57 -07:00
rfc1035.txt Initial import 2020-06-15 07:18:57 -07:00
serializednsquestion.c Make minor improvements 2021-05-15 21:53:26 -07:00
servent.c Make whitespace changes 2021-08-13 03:20:45 -07:00
servicestxt.h Make whitespace changes 2021-08-13 03:20:45 -07:00