Skip to content

Commit 352d668

Browse files
committed
feat(ubuntu): disable some unit sandboxing options globally
1 parent 1fe75d7 commit 352d668

4 files changed

Lines changed: 48 additions & 6 deletions

File tree

ubuntu/24.04-init/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
FROM docker.io/ubuntu:24.04
22

3-
COPY --chown=0:0 \
4-
ssh-keygen.service /etc/systemd/system/ssh-keygen.service
5-
63
RUN --mount=type=bind,source=extra-packages,target=/extra-packages \
74
set -ex ; \
85
export DEBIAN_FRONTEND=noninteractive ; \
@@ -11,6 +8,11 @@ RUN --mount=type=bind,source=extra-packages,target=/extra-packages \
118
apt clean all ; \
129
rm -rf /var/lib/apt/lists/* /etc/ssh/ssh_host_*
1310

11+
COPY --chown=0:0 \
12+
ssh-keygen.service /etc/systemd/system/ssh-keygen.service
13+
COPY --chown=0:0 \
14+
systemd/10-disable-sandboxing.conf /etc/systemd/system/service.d/10-disable-sandboxing.conf
15+
1416
RUN systemctl enable ssh-keygen.service
1517

1618
RUN truncate -s0 /etc/machine-id /var/lib/dbus/machine-id
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Disable sandboxing options globally that will not work in a container environment
2+
[Service]
3+
ProcSubset=all
4+
ProtectProc=default
5+
ProtectControlGroups=no
6+
ProtectKernelTunables=no
7+
NoNewPrivileges=no
8+
ProtectKernelLogs=no
9+
ProtectKernelModules=no
10+
PrivateTmp=no
11+
PrivateDevices=no
12+
ProtectHome=no
13+
ProtectSystem=no
14+
RestrictNamespaces=no
15+
LockPersonality=no
16+
RestrictRealtime=no
17+
ReadWritePaths=
18+
ReadOnlyPaths=
19+
ImportCredential=

ubuntu/26.04-init/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
FROM docker.io/ubuntu:26.04
22

3-
COPY --chown=0:0 \
4-
ssh-keygen.service /etc/systemd/system/ssh-keygen.service
5-
63
RUN --mount=type=bind,source=extra-packages,target=/extra-packages \
74
set -ex ; \
85
export DEBIAN_FRONTEND=noninteractive ; \
@@ -11,6 +8,11 @@ RUN --mount=type=bind,source=extra-packages,target=/extra-packages \
118
apt clean all ; \
129
rm -rf /var/lib/apt/lists/* /etc/ssh/ssh_host_*
1310

11+
COPY --chown=0:0 \
12+
ssh-keygen.service /etc/systemd/system/ssh-keygen.service
13+
COPY --chown=0:0 \
14+
systemd/10-disable-sandboxing.conf /etc/systemd/system/service.d/10-disable-sandboxing.conf
15+
1416
RUN systemctl enable ssh-keygen.service
1517

1618
RUN truncate -s0 /etc/machine-id /var/lib/dbus/machine-id
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Disable sandboxing options globally that will not work in a container environment
2+
[Service]
3+
ProcSubset=all
4+
ProtectProc=default
5+
ProtectControlGroups=no
6+
ProtectKernelTunables=no
7+
NoNewPrivileges=no
8+
ProtectKernelLogs=no
9+
ProtectKernelModules=no
10+
PrivateTmp=no
11+
PrivateDevices=no
12+
ProtectHome=no
13+
ProtectSystem=no
14+
RestrictNamespaces=no
15+
LockPersonality=no
16+
RestrictRealtime=no
17+
ReadWritePaths=
18+
ReadOnlyPaths=
19+
ImportCredential=

0 commit comments

Comments
 (0)