Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(-dx): Workaround swtpm SELinux issues #764

Merged
merged 7 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ RUN wget https://raw.githubusercontent.com/ahmetb/kubectx/master/kubectx -O /usr
# Set up services
RUN systemctl enable docker.service && \
systemctl enable podman.socket && \
systemctl enable swtpm-workaround.service && \
systemctl enable --global bluefin-dx-user-vscode.service && \
systemctl disable pmie.service && \
systemctl disable pmlogger.service
Expand Down
20 changes: 20 additions & 0 deletions dx/usr/lib/systemd/system/swtpm-workaround.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[Unit]
Description=Workaround swtpm not having the correct label
ConditionFileIsExecutable=/usr/bin/swtpm
After=local-fs.target

[Service]
Type=oneshot
# Copy if it doens't exist
ExecStartPre=/usr/bin/bash -c "[ -x /usr/local/bin/.swtpm ] || /usr/bin/cp /usr/bin/swtpm /usr/local/bin/.swtpm"
# This is faster than using .mount unit. Also allows for the previous line/cleanup
ExecStartPre=/usr/bin/mount --bind /usr/local/bin/.swtpm /usr/bin/swtpm
# Fix SELinux label
ExecStart=/usr/sbin/restorecon /usr/bin/swtpm
# Clean-up after ourselves
ExecStop=/usr/bin/umount /usr/bin/swtpm
ExecStop=/usr/bin/rm /usr/local/bin/.swtpm
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions dx/usr/lib/tmpfiles.d/swtpm-workaround.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
C /usr/local/bin/.swtpm - - - - /usr/bin/swtpm
d /var/lib/swtpm-localca 0750 tss tss - -