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

feat: Add TPM emulator #344

Merged
merged 2 commits into from
Jan 18, 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
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ RUN apt-get update \
ovmf \
socat \
nginx \
swtpm \
procps \
iptables \
iproute2 \
Expand All @@ -21,13 +22,13 @@ RUN apt-get update \
ca-certificates \
netcat-openbsd \
qemu-system-x86 \
&& apt-get clean \
&& novnc="1.4.0" \
&& mkdir -p /usr/share/novnc \
&& wget https://github.com/novnc/noVNC/archive/refs/tags/v"$novnc".tar.gz -O /tmp/novnc.tar.gz -q \
&& tar -xf /tmp/novnc.tar.gz -C /tmp/ \
&& cd /tmp/noVNC-"$novnc" \
&& mkdir -p /usr/share/novnc \
&& mv app core vendor package.json *.html /usr/share/novnc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY ./src /run/
Expand Down
10 changes: 10 additions & 0 deletions src/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ if [[ "${BOOT_MODE,,}" != "legacy" ]]; then
BOOT_OPTS="$BOOT_OPTS -drive file=$DEST.rom,if=pflash,unit=0,format=raw,readonly=on"
BOOT_OPTS="$BOOT_OPTS -drive file=$DEST.vars,if=pflash,unit=1,format=raw"

if [[ "${BOOT_MODE,,}" == "windows" ]]; then

BOOT_OPTS="$BOOT_OPTS -chardev socket,id=chrtpm,path=/dev/shm/tpm/swtpm-sock"
BOOT_OPTS="$BOOT_OPTS -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis,tpmdev=tpm0"

mkdir -p /dev/shm/tpm
swtpm socket -t -d --tpmstate dir=/dev/shm/tpm --ctrl type=unixio,path=/dev/shm/tpm/swtpm-sock --log level=1 --tpm2

fi

fi

return 0