Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,8 @@
enforce_for_root
minlen=9
difok=0
lcredit=-1
ocredit=-1
dcredit=-1
ucredit=-1
maxrepeat=3
@@ -0,0 +1,5 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += " \
file://pwquality.conf \
"
@@ -0,0 +1,2 @@
deny=5
unlock_time=1800
@@ -0,0 +1,4 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += " file://faillock.conf \
"
@@ -0,0 +1,91 @@
#Host console log
module(load="imuxsock" SysSock.Use="off")
template(name="ConsoleTemplate" type="string" string="%rawmsg%")
ruleset(name="ConsoleCPURuleset") {
action(type="omfile" file="/var/log/obmc-console-cpu.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleATFRuleset") {
action(type="omfile" file="/var/log/obmc-console-atf.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleSECPRO0Ruleset") {
action(type="omfile" file="/var/log/obmc-console-secpro0.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleSECPRO1Ruleset") {
action(type="omfile" file="/var/log/obmc-console-secpro1.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleMPRO0Ruleset") {
action(type="omfile" file="/var/log/obmc-console-mpro0.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleMPRO1Ruleset") {
action(type="omfile" file="/var/log/obmc-console-mpro1.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleSCP0Ruleset") {
action(type="omfile" file="/var/log/obmc-console-scp0.log" template="ConsoleTemplate")
}
ruleset(name="ConsoleSCP1Ruleset") {
action(type="omfile" file="/var/log/obmc-console-scp1.log" template="ConsoleTemplate")
}
# Custom socket for serial console logs.
input(type="imuxsock"
Socket="/run/rsyslog/console/cpu"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleCPURuleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/atf"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleATFRuleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/secpro0"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleSECPRO0Ruleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/secpro1"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleSECPRO1Ruleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/mpro0"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleMPRO0Ruleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/mpro1"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleMPRO1Ruleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/scp0"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleSCP0Ruleset")
input(type="imuxsock"
Socket="/run/rsyslog/console/scp1"
CreatePath="on"
UseSpecialParser="off"
ParseHostname="off"
ruleset="ConsoleSCP1Ruleset")
$EscapeControlCharactersOnReceive off
$DropTrailingLFOnReception off
@@ -0,0 +1,9 @@
[Unit]
Description=Rotate the event logs
[Service]
Type=simple
ExecStart=/usr/bin/rotate-event-logs.sh
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,10 @@
#!/bin/sh
while true; do
sleep 60
/usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog
ec=$?
if [ $ec -ne 0 ] ; then
echo "logrotate failed ($ec)"
fi
done
@@ -0,0 +1,2 @@
[Service]
ExecReload=/bin/kill -HUP $MAINPID
@@ -0,0 +1,79 @@
# if you experience problems, check
# http://www.rsyslog.com/troubleshoot for assistance
# rsyslog v3: load input modules
# If you do not load inputs, nothing happens!
# You may need to set the module load path if modules are not found.
#
# Ported from debian's sysklogd.conf
# Journal-style logging
# Limit to no more than 2000 entries in one minute and enable the
# journal workaround to avoid duplicate entries
module(load="imjournal" StateFile="/var/log/state"
RateLimit.Interval="60"
RateLimit.Burst="4000")
# Template for IPMI SEL messages
# "<timestamp> <ID>,<Type>,<EventData>,[<Generator ID>,<Path>,<Direction>]"
template(name="IPMISELTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
property(name="$!IPMI_SEL_RECORD_ID")
constant(value=",")
property(name="$!IPMI_SEL_RECORD_TYPE")
constant(value=",")
property(name="$!IPMI_SEL_DATA")
constant(value=",")
property(name="$!IPMI_SEL_GENERATOR_ID")
constant(value=",")
property(name="$!IPMI_SEL_SENSOR_PATH")
constant(value=",")
property(name="$!IPMI_SEL_EVENT_DIR")
constant(value="\n")
}
# Template for Redfish messages
# "<timestamp> <MessageId>,<MessageArgs>"
template(name="RedfishTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
property(name="$!REDFISH_MESSAGE_ID")
constant(value=",")
property(name="$!REDFISH_MESSAGE_ARGS")
constant(value="\n")
}
# Template for Application Crashes
# "<timestamp> <MessageId>,<MessageArgs>"
template(name="CrashTemplate" type="list") {
property(name="timereported" dateFormat="rfc3339")
constant(value=" ")
constant(value="OpenBMC.0.1.ServiceFailure")
constant(value=",")
property(name="$!UNIT")
constant(value="\n")
}
# If the journal entry has the IPMI SEL MESSAGE_ID, save as IPMI SEL
# The MESSAGE_ID string is generated using journalctl and must match the
# MESSAGE_ID used in IPMI to correctly find the SEL entries.
if ($!MESSAGE_ID == "b370836ccf2f4850ac5bee185b77893a") then {
action(type="omfile" file="/var/log/ipmi_sel" template="IPMISELTemplate")
}
# If the journal entry has a Redfish MessageId, save as a Redfish event
if ($!REDFISH_MESSAGE_ID != "") then {
action(type="omfile" file="/var/log/redfish" template="RedfishTemplate")
}
# If the journal entry has a Exit Code, save as a Redfish event
if ($!EXIT_STATUS != "" and $!EXIT_STATUS != "0") then {
action(type="omfile" file="/var/log/redfish" template="CrashTemplate")
}
#
# Include all config files in /etc/rsyslog.d/
#
$IncludeConfig /etc/rsyslog.d/*.conf
@@ -0,0 +1,67 @@
# /etc/logrotate.d/rsyslog - Ported from Debian
# Keep up to four 64k files for ipmi_sel (256k total)
/var/log/ipmi_sel
{
rotate 3
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to four 64k files for redfish (256k total)
/var/log/redfish
{
rotate 3
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to 2 256k files for cpu console logs
/var/log/obmc-console-cpu.log
{
copytruncate
rotate 1
size 256k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to 2 64k files for atf console logs
/var/log/obmc-console-atf.log
{
copytruncate
rotate 1
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to 2 64k files for secpro and mpro console logs
/var/log/obmc-console-*pro*.log
{
copytruncate
rotate 1
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
# Keep up to 2 64k files for Mt.Jade's scp console logs
/var/log/obmc-console-scp*.log
{
copytruncate
rotate 1
size 64k
missingok
postrotate
systemctl reload rsyslog 2> /dev/null || true
endscript
}
@@ -0,0 +1,26 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://rsyslog.conf \
file://rsyslog.logrotate \
file://rotate-event-logs.service \
file://rotate-event-logs.sh \
file://rsyslog-override.conf \
file://hostconsole.conf \
"
FILES:${PN} += "${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf"
PACKAGECONFIG:append = " imjournal"
do_install:append() {
install -m 0644 ${WORKDIR}/rotate-event-logs.service ${D}${systemd_system_unitdir}
install -d ${D}${systemd_system_unitdir}/rsyslog.service.d
install -m 0644 ${WORKDIR}/rsyslog-override.conf \
${D}${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf
install -d ${D}${bindir}
install -m 0755 ${WORKDIR}/rotate-event-logs.sh ${D}/${bindir}/rotate-event-logs.sh
install -m 0755 ${WORKDIR}/hostconsole.conf ${D}${sysconfdir}/rsyslog.d/hostconsole.conf
rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf
}
SYSTEMD_SERVICE:${PN} += " rotate-event-logs.service"