Skip to content
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
2 changes: 2 additions & 0 deletions setup/bootc_configure_kernel_ima_module/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ RUN mkdir -p /keylime-tests /etc/ima/
COPY 10-ima_kargs.toml /usr/lib/bootc/kargs.d/10-ima_kargs.toml
COPY ima-policy /etc/ima/ima-policy
COPY yum.repos.d/* /etc/yum.repos.d/
COPY .ssh /var/roothome/.ssh
COPY resolv.conf /etc/resolv.conf
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): Overwriting /etc/resolv.conf may interfere with container DNS resolution.

Copying resolv.conf may disrupt container DNS settings. Please confirm this is required, and if so, document the reason and provide a way to restore or update DNS configuration as needed.

ARG KEYLIME_BOOTC_INSTALL_PACKAGES="rsync beakerlib selinux-policy-devel swtpm swtpm-tools nmap keylime expect"
Comment on lines +8 to 10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Consider file permissions and ownership for copied SSH directory.

Ensure that after copying the .ssh directory, you set appropriate permissions and ownership to protect private keys and restrict access to the intended user. Consider adding a RUN command for this purpose.

Suggested change
COPY .ssh /var/roothome/.ssh
COPY resolv.conf /etc/resolv.conf
ARG KEYLIME_BOOTC_INSTALL_PACKAGES="rsync beakerlib selinux-policy-devel swtpm swtpm-tools nmap keylime expect"
COPY .ssh /var/roothome/.ssh
RUN chown -R root:root /var/roothome/.ssh && \
chmod 700 /var/roothome/.ssh && \
find /var/roothome/.ssh -type f -name "id_*" -exec chmod 600 {} \;
COPY resolv.conf /etc/resolv.conf
ARG KEYLIME_BOOTC_INSTALL_PACKAGES="rsync beakerlib selinux-policy-devel swtpm swtpm-tools nmap keylime expect"

RUN dnf -y install ${KEYLIME_BOOTC_INSTALL_PACKAGES}
RUN sed -i '/tss/ d' /usr/lib/group; ls -ld /etc/keylime /var/lib/keylime; ls -l /etc/keylime /var/lib/keylime; /bin/true
Expand Down
4 changes: 3 additions & 1 deletion setup/bootc_configure_kernel_ima_module/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ rlJournalStart
rlRun "cat > 10-ima_kargs.toml <<EOF
kargs = [\"ima_appraise=${IMA_APPRAISE}, ima_canonical_fmt, ima_policy=${IMA_POLICY}, ima_template=${IMA_TEMPLATE}\"]
EOF"
# copy dnf repos
# copy various data to CWD so we can add them to the image
rlRun "cp -r /root/.ssh ."
rlRun "cp /etc/resolv.conf ."
rlRun "cp -r /etc/yum.repos.d yum.repos.d"
# download bootc image and build and install an update
[ "${KEYLIME_BOOTC_BASE_IMAGE}" == "localhost/bootc:latest" ] && rlRun "bootc image copy-to-storage"
Expand Down