Build Debian image(s): stx-audit

This commit enables the creation of audit docker image in Debian.

Test Plan:

PASS: Install new audit pod using debian docker image.
1. Build audit docker image using stx-debian.
2. Install a new debian simplex.
3. Push the new audit docker image to local.registry.
4. Modify application file auditd.tgz to point to the new docker
   image at the local registries.
5. Change service parameter "auditd" to 1, upload and apply
   application.
6. Check if the pod is running correctly and is using the new
   docker image with "kubectl describe pod".

Story: 2009831
Task: 45076

Signed-off-by: Karla Felix <karla.karolinenogueirafelix@windriver.com>
Change-Id: Idba556eca232c4b6c51f2360b016e198562693fc
This commit is contained in:
Karla Felix 2022-09-14 13:01:05 -03:00
parent 9e218ef44e
commit b6bb1eed33
4 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1 @@
stx-audit-helm

View File

@ -0,0 +1,16 @@
ARG BASE
FROM ${BASE} AS stx
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -y update && \
apt-get -y install auditd
COPY startAuditd.sh .
RUN mkdir -p /etc/audit && \
touch /etc/audit/audit.rules && \
chmod 600 /etc/audit/audit.rules
RUN chmod 755 startAuditd.sh
ENTRYPOINT ["./startAuditd.sh"]

View File

@ -0,0 +1,26 @@
#!/bin/bash
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
set -u
echo "Starting auditd …"
# update /etc/audit/audit.rules with any changes made to
# /etc/audit/rules.d/audit.rules
augenrules --load
# start auditd with no fork to run in the background in the container
/sbin/auditd -n -l
EXIT_STATUS=$?
if [ "$EXIT_STATUS" -ne "0" ]; then
echo "Error code: $EXIT_STATUS"
echo "Could not start auditd" >&2
fi
exit ${EXIT_STATUS}

View File

@ -0,0 +1,3 @@
BUILDER=docker
LABEL=stx-audit
DOCKER_CONTEXT=docker/stx-audit