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

PE-4076: Rsyslog and logrotate changes #225

Merged
merged 6 commits into from
Jul 26, 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
8 changes: 5 additions & 3 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ uki-provider-image:
RUN apt-get update && apt-get install -y rsync

WORKDIR /
COPY overlay/files/etc/ /etc/
COPY +luet/luet /usr/bin/luet
COPY +kairos-agent/kairos-agent /usr/bin/kairos-agent
COPY --platform=linux/${ARCH} +trust-boot-unpack/ /trusted-boot
Expand Down Expand Up @@ -557,6 +558,7 @@ provider-image:
ARG BASE_K8S_VERSION=$K8S_VERSION-$K8S_DISTRIBUTION_TAG
END

COPY overlay/files/etc/ /etc/
COPY --platform=linux/${ARCH} +kairos-provider-image/ /
COPY +stylus-image/etc/kairos/branding /etc/kairos/branding
COPY +stylus-image/oem/stylus_config.yaml /etc/kairos/branding/stylus_config.yaml
Expand Down Expand Up @@ -693,7 +695,7 @@ base-image:
END

RUN apt-get update && \
apt-get install --no-install-recommends kbd zstd vim iputils-ping bridge-utils curl tcpdump ethtool -y
apt-get install --no-install-recommends kbd zstd vim iputils-ping bridge-utils curl tcpdump ethtool rsyslog logrotate -y
abhinavnagaraj marked this conversation as resolved.
Show resolved Hide resolved

IF [ "$UPDATE_KERNEL" = "false" ]
RUN if dpkg -l "linux-image-generic-hwe-$OS_VERSION" > /dev/null; then apt-mark hold "linux-image-generic-hwe-$OS_VERSION" "linux-headers-generic-hwe-$OS_VERSION" "linux-generic-hwe-$OS_VERSION" ; fi && \
Expand Down Expand Up @@ -753,7 +755,7 @@ base-image:
END

IF [ "$OS_DISTRIBUTION" = "opensuse-leap" ]
RUN zypper install -y apparmor-parser apparmor-profiles
RUN zypper install -y apparmor-parser apparmor-profiles rsyslog logrotate
RUN zypper cc && \
zypper clean
RUN if [ ! -e /usr/bin/apparmor_parser ]; then cp /sbin/apparmor_parser /usr/bin/apparmor_parser; fi
Expand All @@ -772,7 +774,7 @@ base-image:
RUN --no-cache luet repo update

IF [ "$OS_DISTRIBUTION" = "rhel" ]
RUN yum install -y openssl
RUN yum install -y openssl rsyslog logrotate
END

IF [ "$OS_DISTRIBUTION" = "sles" ]
Expand Down
12 changes: 12 additions & 0 deletions overlay/files/etc/logrotate.d/stylus.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/var/log/stylus-audit.log {
yearly
rotate 2
missingok
notifempty
compress
delaycompress
dateext
dateformat -%m-%Y
size 100M
create 600 root root
}
19 changes: 19 additions & 0 deletions overlay/files/etc/rsyslog.d/49-stylus.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Running rsyslog as root.
# TODO: should this be done or change acceptance criteria to about audit log file permissions accordingly
$PrivDropToUser root
# default config has $Umask 0022 set. That breaks any config related to masks and modes.
$Umask 0000

# Mesage format as per rfc5424.
$template ForwardFormat,"<%pri%>1 %timestamp:::date-rfc3339% %HOSTNAME% %syslogtag% %procid% - - %msg%\n"

# route messages with facility local7 and severity notice to /var/log/stylus-audit.log
if ($syslogfacility-text == 'local7' and $syslogseverity-text == 'notice') then{
action(
type="omfile"
file="/var/log/stylus-audit.log"
FileCreateMode="0600"
fileowner="root"
template="ForwardFormat"
) & stop
}
2 changes: 2 additions & 0 deletions slem/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ RUN zypper in --force-resolution -y --no-allow-vendor-change \
fail2ban \
lldpd \
nethogs \
rsyslog \
logrotate \
&& zypper cc
# NOTE: removed dhcp-client
RUN mkdir -p /run/lock
Expand Down