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

logrotate issue fix #242

Merged
merged 1 commit into from
Aug 5, 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
15 changes: 13 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ uki-provider-image:
RUN apt-get update && apt-get install -y rsync

WORKDIR /
COPY overlay/files/etc/ /etc/
COPY --if-exists overlay/files/etc/ /etc/
IF [ -f /etc/logrotate.d/stylus.conf ]
RUN chmod 644 /etc/logrotate.d/stylus.conf
END
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 @@ -590,7 +593,11 @@ provider-image:
ARG BASE_K8S_VERSION=$K8S_VERSION-$K8S_DISTRIBUTION_TAG
END

COPY overlay/files/etc/ /etc/
COPY --if-exists overlay/files/etc/ /etc/
IF [ -f /etc/logrotate.d/stylus.conf ]
RUN chmod 644 /etc/logrotate.d/stylus.conf
END

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 @@ -840,6 +847,10 @@ iso-image:
RUN rm -f /usr/bin/luet
END
COPY overlay/files/ /

IF [ -f /etc/logrotate.d/stylus.conf ]
RUN chmod 644 /etc/logrotate.d/stylus.conf
END

RUN rm -f /etc/ssh/ssh_host_* /etc/ssh/moduli
RUN touch /etc/machine-id \
Expand Down
9 changes: 7 additions & 2 deletions overlay/files/etc/logrotate.d/stylus.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
missingok
notifempty
compress
delaycompress
dateext
dateformat -%m-%Y
dateformat -%d-%m-%Y
size 100M
create 600 root root
# to avoid 'writable by group or others' error
su root root
# reload or restart to point file handle to new log file
postrotate
systemctl try-reload-or-restart rsyslog 2>&1 || true
endscript
}
6 changes: 3 additions & 3 deletions overlay/files/etc/rsyslog.d/49-stylus.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Running rsyslog as root.
# TODO: should this be done or change acceptance criteria to about audit log file permissions accordingly
# Running rsyslog as root.
$PrivDropToUser root
$PrivDropToGroup 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{
if ($syslogfacility-text == 'local7' and $syslogseverity-text == 'notice' and $syslogtag contains 'stylus-audit') then{
action(
type="omfile"
file="/var/log/stylus-audit.log"
Expand Down