-
Notifications
You must be signed in to change notification settings - Fork 99
234 lines (231 loc) · 13.8 KB
/
main.yaml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Main
on: [push, pull_request]
jobs:
test-unit:
name: "Unit test"
runs-on: ubuntu-24.04
steps:
- name: "Check out"
uses: actions/checkout@v4
- name: "Build unit test image"
run: DOCKER_BUILDKIT=1 docker build -t rootlesskit:test-unit --target test-unit .
- name: "Unit test"
run: docker run --rm --privileged rootlesskit:test-unit
test-cross:
name: "Cross compilation test"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Build binaries"
run: DOCKER_BUILDKIT=1 docker build -o /tmp/artifact --target cross-artifact .
test-integration:
name: "Integration test"
runs-on: ubuntu-24.04
steps:
- name: "Set up AppArmor"
run: |
cat <<EOT | sudo tee "/etc/apparmor.d/home.user.bin.rootlesskit"
abi <abi/4.0>,
include <tunables/global>
/home/user/bin/rootlesskit flags=(unconfined) {
userns,
}
EOT
sudo systemctl restart apparmor.service
- name: "Check out"
uses: actions/checkout@v4
- name: "Build integration test image"
run: DOCKER_BUILDKIT=1 docker build -t rootlesskit:test-integration --target test-integration .
- name: "Integration test: exit-code"
run: docker run --rm --privileged rootlesskit:test-integration ./integration-exit-code.sh
- name: "Integration test: propagation"
run: docker run --rm --privileged rootlesskit:test-integration ./integration-propagation.sh
- name: "Integration test: propagation (with `mount --make-rshared /`)"
run: docker run --rm --privileged rootlesskit:test-integration sh -exc "sudo mount --make-rshared / && ./integration-propagation.sh"
- name: "Integration test: restart"
run: docker run --rm --privileged rootlesskit:test-integration ./integration-restart.sh
- name: "Integration test: port"
# NOTE: "--net=host" is a bad hack to enable IPv6
run: docker run --rm --net=host --privileged rootlesskit:test-integration ./integration-port.sh
- name: "Integration test: IPv6 routing"
run: docker run --rm --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 rootlesskit:test-integration ./integration-ipv6.sh
- name: "Integration test: systemd socket activation"
run: docker run --rm --net=none --privileged rootlesskit:test-integration ./integration-systemd-socket.sh
- name: "Integration test: Network (network driver=slirp4netns)"
run: |
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh slirp4netns
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh slirp4netns --detach-netns
- name: "Integration test: Network (network driver=vpnkit)"
run: |
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh vpnkit
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh vpnkit --detach-netns
- name: "Integration test: Network (network driver=lxc-user-nic)"
run: |
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh lxc-user-nic
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh lxc-user-nic --detach-netns
- name: "Integration test: Network (network driver=pasta)"
run: |
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh pasta
docker run --rm --privileged rootlesskit:test-integration ./integration-net.sh pasta --detach-netns
# ===== Benchmark: Network (MTU=1500) =====
- name: "Benchmark: Network (MTU=1500, network driver=slirp4netns)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh slirp4netns 1500
- name: "Benchmark: Network (MTU=1500, network driver=slirp4netns with sandbox and seccomp)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh slirp4netns 1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto
- name: "Benchmark: Network (MTU=1500, network driver=slirp4netns with sandbox and seccomp) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh slirp4netns 1500 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto --detach-netns
# NOTE: MTU greater than 16424 is known not to work for VPNKit.
# Also, MTU greather than 4K might not be effective for VPNKit: https://twitter.com/mugofsoup/status/1017665057738641408
- name: "Benchmark: Network (MTU=1500, network driver=vpnkit)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh vpnkit 1500
- name: "Benchmark: Network (MTU=1500, network driver=vpnkit) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh vpnkit 1500 --detach-netns
- name: "Benchmark: Network (MTU=1500, network driver=pasta)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh pasta 1500
- name: "Benchmark: Network (MTU=1500, network driver=pasta) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh pasta 1500 --detach-netns
- name: "Benchmark: Network (MTU=1500, network driver=lxc-user-nic)"
run: |
docker run --rm --privileged \
rootlesskit:test-integration ./benchmark-iperf3-net.sh lxc-user-nic 1500
- name: "Benchmark: Network (MTU=1500, network driver=lxc-user-nic) with detach-netns"
run: |
docker run --rm --privileged \
rootlesskit:test-integration ./benchmark-iperf3-net.sh lxc-user-nic 1500 --detach-netns
- name: "Benchmark: Network (MTU=1500, rootful veth for comparison)"
run: |
docker run --rm --privileged \
rootlesskit:test-integration ./benchmark-iperf3-net.sh rootful_veth 1500
# ===== Benchmark: Network (MTU=65520) =====
- name: "Benchmark: Network (MTU=65520, network driver=slirp4netns)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh slirp4netns 65520
- name: "Benchmark: Network (MTU=65520, network driver=slirp4netns with sandbox and seccomp)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh slirp4netns 65520 --slirp4netns-sandbox=auto --slirp4netns-seccomp=auto
- name: "Benchmark: Network (MTU=65520, network driver=pasta)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-net.sh pasta 65520
- name: "Benchmark: Network (MTU=65520, network driver=lxc-user-nic)"
run: |
docker run --rm --privileged \
rootlesskit:test-integration ./benchmark-iperf3-net.sh lxc-user-nic 65520
- name: "Benchmark: Network (MTU=65520, rootful veth for comparison)"
run: |
docker run --rm --privileged \
rootlesskit:test-integration ./benchmark-iperf3-net.sh rootful_veth 65520
# ===== Benchmark: TCP Ports =====
- name: "Benchmark: TCP Ports (network driver=slirp4netns, port driver=slirp4netns)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port.sh slirp4netns
- name: "Benchmark: TCP Ports (network driver=slirp4netns, port driver=slirp4netns) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port.sh slirp4netns --detach-netns
- name: "Benchmark: TCP Ports (network driver=slirp4netns, port driver=builtin)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port.sh builtin
- name: "Benchmark: TCP Ports (network driver=slirp4netns, port driver=builtin) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port.sh builtin --detach-netns
- name: "Benchmark: TCP Ports (network driver=pasta, port driver=implicit)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port.sh implicit --net=pasta
- name: "Benchmark: TCP Ports (network driver=pasta, port driver=implicit) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port.sh implicit --net=pasta --detach-netns
# ===== Benchmark: UDP Ports =====
- name: "Benchmark: UDP Ports (port driver=slirp4netns)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port-udp.sh slirp4netns
- name: "Benchmark: UDP Ports (port driver=slirp4netns) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port-udp.sh slirp4netns --detach-netns
- name: "Benchmark: UDP Ports (network driver=pasta, port driver=implicit)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port-udp.sh implicit --net=pasta
- name: "Benchmark: UDP Ports (network driver=pasta, port driver=implicit) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port-udp.sh implicit --net=pasta --detach-netns
- name: "Benchmark: UDP Ports (port driver=builtin)"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port-udp.sh builtin
- name: "Benchmark: UDP Ports (port driver=builtin) with detach-netns"
run: |
docker run --rm --security-opt seccomp=unconfined --security-opt apparmor=unconfined --device /dev/net/tun \
rootlesskit:test-integration ./benchmark-iperf3-port-udp.sh builtin --detach-netns
test-integration-docker:
name: "Integration test (Docker)"
runs-on: ubuntu-24.04
steps:
- name: "Set up AppArmor"
run: |
cat <<EOT | sudo tee "/etc/apparmor.d/home.user.bin.rootlesskit"
abi <abi/4.0>,
include <tunables/global>
/home/user/bin/rootlesskit flags=(unconfined) {
userns,
}
EOT
sudo systemctl restart apparmor.service
- name: "Check out"
uses: actions/checkout@v4
- name: "Build integration test image"
run: DOCKER_BUILDKIT=1 docker build -t rootlesskit:test-integration-docker --target test-integration-docker .
- name: "Create a custom network to avoid IP confusion"
run: docker network create custom
- name: "Docker Integration test: net=slirp4netns, port-driver=builtin"
run: |
docker run -d --name test --network custom --privileged -e DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns -e DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=builtin rootlesskit:test-integration-docker
sleep 2
docker exec test docker info
docker exec test ./integration-docker.sh
docker rm -f test
- name: "Docker Integration test: net=slirp4netns, port-driver=slirp4netns"
run: |
docker run -d --name test --network custom --privileged -e DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns -e DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns rootlesskit:test-integration-docker
sleep 2
docker exec test docker info
docker exec test ./integration-docker.sh
docker rm -f test
- name: "Docker Integration test: net=vpnkit, port-driver=builtin"
run: |
docker run -d --name test --network custom --privileged -e DOCKERD_ROOTLESS_ROOTLESSKIT_NET=vpnkit -e DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=builtin rootlesskit:test-integration-docker
sleep 2
docker exec test docker info
docker exec test ./integration-docker.sh
docker rm -f test
- name: "Docker Integration test: net=pasta, port-driver=implicit"
run: |
docker run -d --name test --network custom --privileged -e DOCKERD_ROOTLESS_ROOTLESSKIT_NET=pasta -e DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=implicit rootlesskit:test-integration-docker
sleep 2
docker exec test docker info
docker exec test ./integration-docker.sh
docker rm -f test