Skip to content

Commit

Permalink
Add UBI8 Dockerfile and use in place of CS8 in Automatus testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mab879 committed Jun 28, 2024
1 parent 6b8f5f2 commit 8eef734
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/automatus-cs8.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Automatus CS8
name: Automatus UBI8
on:
pull_request:
branches: [ master, 'stabilization*' ]
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
run: ssh-keygen -N '' -t rsa -f ~/.ssh/id_rsa
- name: Build test suite container
if: ${{ steps.ctf.outputs.CTF_OUTPUT_SIZE != '0' }}
run: podman build --build-arg "CLIENT_PUBLIC_KEY=$(cat ~/.ssh/id_rsa.pub)" -t ssg_test_suite -f test_suite-cs8
run: podman build --build-arg "CLIENT_PUBLIC_KEY=$(cat ~/.ssh/id_rsa.pub)" -t ssg_test_suite -f test_suite-ubi8
working-directory: ./Dockerfiles
- name: Get oscap-ssh
if: ${{ steps.ctf.outputs.CTF_OUTPUT_SIZE != '0' }}
Expand Down
24 changes: 24 additions & 0 deletions Dockerfiles/test_suite-ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This Dockerfile is a minimal example for a Red Hat UBI 8 Automatus test suite target container.
FROM registry.access.redhat.com/ubi8/ubi:latest

ENV AUTH_KEYS=/root/.ssh/authorized_keys

ARG CLIENT_PUBLIC_KEY
ARG ADDITIONAL_PACKAGES

# Install Python so Ansible remediations can work
# Don't clean all, as the test scenario may require package install.
RUN true \
&& yum install -y openssh-clients openssh-server openscap-scanner \
python39 \
$ADDITIONAL_PACKAGES \
&& true

RUN true \
&& for key_type in rsa ecdsa; do ssh-keygen -N '' -t $key_type -f /etc/ssh/ssh_host_${key_type}_key; done \
&& mkdir -p /root/.ssh \
&& printf "%s\n" "$CLIENT_PUBLIC_KEY" >> "$AUTH_KEYS" \
&& chmod og-rw /root/.ssh "$AUTH_KEYS" \
&& sed -i '/session\s\+required\s\+pam_loginuid.so/d' /etc/pam.d/sshd \
&& true

0 comments on commit 8eef734

Please sign in to comment.