1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Lightweight tier on Linux: the sockets the agent may create, for the
//! seccomp filter `moat run` applies after the Landlock rules ([`super::landlock`]),
//! which restrict files and TCP only.
//!
//! The agent may create TCP sockets over IPv4 or IPv6, whose connections
//! Landlock limits to the proxy's port. Every other `socket()` call fails with
//! `EPERM`: Unix sockets (the user's D-Bus session bus, nscd,
//! systemd-resolved), netlink, packet, raw, UDP, SCTP and MPTCP. So name
//! resolution works only through the proxy, as on macOS: a tool that ignores
//! `HTTP(S)_PROXY` cannot resolve names. `socketpair()` stays allowed: its Unix
//! sockets are connected only to each other, and Node uses them for the pipes
//! of the processes it starts.
/// Linux's values, the same on every architecture `moat run` supports.
const AF_INET: u32 = 2;
const AF_INET6: u32 = 10;
const SOCK_STREAM: u32 = 1;
const SOCK_NONBLOCK: u32 = 0o4000;
const SOCK_CLOEXEC: u32 = 0o2_000_000;
const IPPROTO_TCP: u32 = 6;
/// The values the agent may pass to `socket(domain, type, protocol)`, argument
/// by argument. A call with any other value in any argument fails.
pub const SOCKET_ARGS: = ;