IPCEICIS-2952 #20

Closed
Michal.Wrobel wants to merge 107 commits from IPCEI-2952 into development
see https://jira.telekom-mms.com/browse/IPCEICIS-2952
Michal.Wrobel added 2 commits 2025-03-26 14:25:13 +00:00
Michal.Wrobel added 1 commit 2025-03-26 14:40:09 +00:00
Michal.Wrobel added 1 commit 2025-03-26 14:42:18 +00:00
Michal.Wrobel added 1 commit 2025-03-26 14:51:27 +00:00
- mountPath: /var/log
    name: log-storage
    readOnly: false
Michal.Wrobel changed title from IPCEI-2952 to IPCEICIS-2952 2025-03-26 14:57:24 +00:00
Michal.Wrobel added 1 commit 2025-03-27 12:19:49 +00:00
Michal.Wrobel added 1 commit 2025-03-27 12:43:29 +00:00
Michal.Wrobel added 1 commit 2025-03-31 08:04:01 +00:00
image: alpine:latest
      command: ["/bin/sh", "-c", "while true; do /usr/sbin/logrotate /etc/logrotate.conf; sleep 60; done"]
      securityContext:
        runAsUser: 100
      volumeMounts:
        - name: host-log-storage
          mountPath: /openbao/logs
        - name: logrotate-config
          mountPath: /etc/logrotate.conf
          subPath: logrotate.conf
Michal.Wrobel added 1 commit 2025-03-31 08:11:01 +00:00
#   mountPath: /etc/logrotate.conf
        #   subPath: logrotate.conf
Michal.Wrobel added 1 commit 2025-03-31 08:19:41 +00:00
kind: DaemonSet
metadata:
  name: openbao-logging-dir
  namespace: openbao
spec:
  selector:
    matchLabels:
      app: openbao-logging-dir
  template:
    metadata:
      labels:
        app: openbao-logging-dir
    spec:
      initContainers:
      - name: creator
        image: busybox
        command: ["/bin/sh", "-c"]
        args:
        - |
          set -e
          mkdir -p /var/log/openbao
          chown 100:100 /var/log/openbao
        securityContext:
          runAsUser: 0
        volumeMounts:
        - name: host-log
          mountPath: /var/log
      containers:
      - name: running-container
        image: busybox
        command: ["sleep", "infinity"]
      volumes:
      - name: host-log
        hostPath:
          path: /var/log
          type: Directory
Michal.Wrobel added 1 commit 2025-03-31 08:25:50 +00:00
Michal.Wrobel added 1 commit 2025-03-31 08:30:19 +00:00
Michal.Wrobel added 1 commit 2025-03-31 08:54:27 +00:00
Michal.Wrobel added 1 commit 2025-03-31 09:02:15 +00:00
Michal.Wrobel added 1 commit 2025-03-31 09:07:44 +00:00
Michal.Wrobel added 1 commit 2025-03-31 09:21:00 +00:00
Michal.Wrobel added 1 commit 2025-03-31 09:42:16 +00:00
Michal.Wrobel added 1 commit 2025-03-31 09:54:33 +00:00
image: imroc/logrotate:latest
      env:
        - name: LOGROTATE_FILE_PATTERN
          value: "/var/log/nginx/nginx_*.log"
        - name: LOGROTATE_FILESIZE
          value: "20M"
        - name: LOGROTATE_FILENUM
          value: "10"
        - name: CRON_EXPR
          value: "*/1 * * * *"
        - name: CROND_LOGLEVEL
          value: "7"
Michal.Wrobel added 1 commit 2025-03-31 10:07:28 +00:00
Michal.Wrobel added 1 commit 2025-03-31 10:14:22 +00:00
Michal.Wrobel added 1 commit 2025-03-31 10:22:37 +00:00
mountPath: /etc/logrotate.conf
          subPath: logrotate.conf
          readOnly: true
Michal.Wrobel added 1 commit 2025-03-31 10:31:42 +00:00
Michal.Wrobel added 1 commit 2025-03-31 11:28:40 +00:00
Michal.Wrobel added 1 commit 2025-03-31 11:38:36 +00:00
Michal.Wrobel added 1 commit 2025-03-31 11:45:08 +00:00
set -e
          useradd -u 100 logrotate
          chown logrotate:logrotate /var/lib
          tail -f /dev/null
Michal.Wrobel added 1 commit 2025-03-31 11:50:26 +00:00
Michal.Wrobel added 1 commit 2025-03-31 11:58:14 +00:00
Michal.Wrobel added 1 commit 2025-03-31 12:03:45 +00:00
chown 100:100 /var/lib
          tail -f /dev/null
Michal.Wrobel added 1 commit 2025-03-31 12:10:37 +00:00
echo "logrotate100:" >> /etc/group
Michal.Wrobel added 1 commit 2025-03-31 12:27:01 +00:00
Michal.Wrobel added 1 commit 2025-03-31 12:49:11 +00:00
Michal.Wrobel added 1 commit 2025-03-31 12:49:52 +00:00
mkdir -p /var/log/openbao
          chown 100:100 /var/log/openbao
          echo "logrotate100💯:/home/logrotate:/bin/sh" >> /etc/passwd
          echo "logrotate100:" >> /etc/group
          chown logrotate:logrotate /var/lib
Michal.Wrobel added 1 commit 2025-03-31 12:55:42 +00:00
Michal.Wrobel added 1 commit 2025-03-31 13:04:14 +00:00
Michal.Wrobel added 1 commit 2025-03-31 13:09:34 +00:00
mkdir -p /var/log/openbao
          chown 100:100 /var/log/openbao
          echo "logrotate100💯:/home/logrotate:/bin/sh" >> /etc/passwd
          echo "logrotate100:" >> /etc/group
          mkdir -p /home/logrotate
          # chown 100:100 /var/lib
Michal.Wrobel added 1 commit 2025-03-31 13:24:24 +00:00
mountPath: /var/lib/
Michal.Wrobel added 1 commit 2025-03-31 13:35:09 +00:00
Michal.Wrobel added 1 commit 2025-03-31 13:48:45 +00:00
Michal.Wrobel added 1 commit 2025-03-31 13:53:58 +00:00
Michal.Wrobel added 1 commit 2025-04-01 08:05:57 +00:00
Michal.Wrobel added 1 commit 2025-04-01 08:21:09 +00:00
Michal.Wrobel added 1 commit 2025-04-01 08:45:23 +00:00
image: alpine:latest
Michal.Wrobel added 1 commit 2025-04-01 08:51:02 +00:00
Michal.Wrobel added 1 commit 2025-04-01 08:51:45 +00:00
Michal.Wrobel added 1 commit 2025-04-01 08:59:13 +00:00
chmod o+rwx /etc/group
Michal.Wrobel added 1 commit 2025-04-01 09:15:22 +00:00
- chmod o+rwx /etc/passwd
    - chmod o+rwx /etc/group
Michal.Wrobel added 1 commit 2025-04-01 09:16:09 +00:00
- |
      chmod o+rwx /etc/passwd
      chmod o+rwx /etc/group
Michal.Wrobel added 1 commit 2025-04-01 09:20:58 +00:00
Michal.Wrobel added 1 commit 2025-04-01 09:35:30 +00:00
Michal.Wrobel added 1 commit 2025-04-01 09:44:22 +00:00
mountPath: /etc/passwd
          subPath: passwd
Michal.Wrobel added 1 commit 2025-04-01 09:44:55 +00:00
Michal.Wrobel added 1 commit 2025-04-01 09:57:48 +00:00
Michal.Wrobel added 1 commit 2025-04-01 10:53:34 +00:00
Michal.Wrobel added 1 commit 2025-04-01 11:18:47 +00:00
- name: CRON_SCHEDULE
            value: "0 * * * *"
          - name: TINI_SUBREAPER
            value:
Michal.Wrobel added 1 commit 2025-04-01 11:28:13 +00:00
Michal.Wrobel added 1 commit 2025-04-01 11:36:35 +00:00
Michal.Wrobel added 1 commit 2025-04-01 11:53:10 +00:00
Michal.Wrobel added 1 commit 2025-04-01 12:04:17 +00:00
Michal.Wrobel added 1 commit 2025-04-01 12:11:39 +00:00
#   mountPath: /var/lib
Michal.Wrobel added 1 commit 2025-04-01 12:44:49 +00:00
Michal.Wrobel added 1 commit 2025-04-01 12:49:44 +00:00
Michal.Wrobel added 1 commit 2025-04-02 06:59:33 +00:00
- name: host-log-storage
          mountPath: /openbao/logs
Michal.Wrobel added 1 commit 2025-04-02 07:53:12 +00:00
Michal.Wrobel added 1 commit 2025-04-02 08:08:11 +00:00
mountPath: /var/lib
Michal.Wrobel added 1 commit 2025-04-02 08:43:13 +00:00
Michal.Wrobel added 1 commit 2025-04-02 09:03:57 +00:00
Michal.Wrobel added 1 commit 2025-04-02 11:32:19 +00:00
Michal.Wrobel added 1 commit 2025-04-02 11:38:37 +00:00
Michal.Wrobel added 1 commit 2025-04-02 11:46:07 +00:00
Michal.Wrobel added 1 commit 2025-04-02 11:51:33 +00:00
Michal.Wrobel added 1 commit 2025-04-02 11:59:05 +00:00
Michal.Wrobel added 1 commit 2025-04-02 12:21:33 +00:00
Michal.Wrobel added 1 commit 2025-04-02 12:39:58 +00:00
Michal.Wrobel added 1 commit 2025-04-02 12:40:16 +00:00
Michal.Wrobel added 1 commit 2025-04-02 12:53:12 +00:00
Michal.Wrobel added 1 commit 2025-04-02 13:20:15 +00:00
image: nginx:latest
      ports:
        - containerPort: 8080
      volumeMounts:
        - name: idecar-script
          mountPath: /etc/nginx
          subPath: nginx.conf
          subPathExpr: 'nginx.conf'
        - name: idecar-script
          mountPath: /tmp/sidecar.sh
          subPath: sidecar.sh
          mode: 0755
        - name: passwd-volume
          mountPath: /etc/passwd
          subPath: passwd
Michal.Wrobel added 1 commit 2025-04-02 13:26:07 +00:00
Michal.Wrobel added 1 commit 2025-04-02 13:31:41 +00:00
Michal.Wrobel closed this pull request 2025-04-02 13:33:37 +00:00
Michal.Wrobel reopened this pull request 2025-04-23 11:25:48 +00:00
Michal.Wrobel added 1 commit 2025-04-23 11:28:20 +00:00
Michal.Wrobel added 1 commit 2025-04-23 11:54:08 +00:00
Michal.Wrobel added 1 commit 2025-04-23 11:59:34 +00:00
Michal.Wrobel added 1 commit 2025-04-23 12:15:46 +00:00
Michal.Wrobel added 1 commit 2025-04-23 12:17:07 +00:00
Michal.Wrobel added 1 commit 2025-04-23 12:19:50 +00:00
Michal.Wrobel added 1 commit 2025-04-23 12:27:18 +00:00
mountPath: /etc/passwd
                subPath: passwd
Author
Owner

There are multiple components needed for the logging of OpenBao audits:

  • openbao-logging.yaml - References the openbao-logging directory.

  • openbao-logging/create-logging-directory.yaml - DaemonSet that creates a directory on the node's hostPath. Since this task has to be done by a priviledged user and we have a non-root policy for pods which doesn't apply to DeamonSets this appears to be the only possible solution.

  • openbao-logging/logrotate-configmap.yaml - Consists of the logrotate.conf file which speciefies how the logrotation should happen. It's mounted to the CronJob.

  • openbao-logging/logrotate-cronjob.yaml - The definition of the CronJob which runs every hour.

  • openbao-logging/passwd-user-configmap.yaml - Needed for identifying as the user openbao:100 which is required to …

  • openbao-logging/sidecar-script-configmap.yaml - Responsible for setting up two scripts: start.sh - for starting a server listening on the port 3030 for the signal from the CronJob; sidecar.sh - for sending the SIGHUP to openbao.

  • openbao-logging/sidecar-script-service.yaml - The service for the sidecar container inside the openbao-0 pod

  • openbao/values.yaml - Sets up a sidecar container called "sidecar" which is allowed to access the bao process and enables a File Audit Device one the node's hostPath.

There are multiple components needed for the logging of OpenBao audits: - **openbao-logging.yaml** - References the openbao-logging directory. - **openbao-logging/create-logging-directory.yaml** - DaemonSet that creates a directory on the node's hostPath. Since this task has to be done by a priviledged user and we have a non-root policy for pods which doesn't apply to DeamonSets this appears to be the only possible solution. - **openbao-logging/logrotate-configmap.yaml** - Consists of the logrotate.conf file which speciefies how the logrotation should happen. It's mounted to the CronJob. - **openbao-logging/logrotate-cronjob.yaml** - The definition of the CronJob which runs every hour. - **openbao-logging/passwd-user-configmap.yaml** - Needed for identifying as the user openbao:100 which is required to … - **openbao-logging/sidecar-script-configmap.yaml** - Responsible for setting up two scripts: start.sh - for starting a server listening on the port 3030 for the signal from the CronJob; sidecar.sh - for sending the SIGHUP to openbao. - **openbao-logging/sidecar-script-service.yaml** - The service for the sidecar container inside the openbao-0 pod - **openbao/values.yaml** - Sets up a sidecar container called "sidecar" which is allowed to access the bao process and enables a File Audit Device one the node's hostPath.
Michal.Wrobel added 1 commit 2025-04-23 12:40:17 +00:00
Michal.Wrobel added 1 commit 2025-04-23 12:46:28 +00:00
Michal.Wrobel added 1 commit 2025-04-23 12:47:22 +00:00
Michal.Wrobel closed this pull request 2025-04-23 13:23:32 +00:00
Michal.Wrobel deleted branch IPCEI-2952 2025-04-23 13:25:52 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: DevFW-CICD/stacks#20
No description provided.