From 6ea6e4226653dd5e80a497b82fd1bb8b37ad6387 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zolt=C3=A1n=20Felleg?= Date: Tue, 28 Jan 2025 13:59:24 +0100 Subject: [PATCH] Updated log.in (added logwatch). --- .../c3d/firstboot/scripts/90_setupservices.sh | 12 +++++++++ .../logwatch/conf/logfiles/letsencrypt.conf | 24 ++++++++++++++++++ .../etc/logwatch/conf/logwatch.conf | 7 ++++++ .../logwatch/conf/services/letsencrypt.conf | 25 +++++++++++++++++++ .../etc/logwatch/scripts/services/letsencrypt | 20 +++++++++++++++ .../install-data/etc/rsyslog.d/remote.conf | 2 ++ .../postinstall/scripts/10_setupservices.sh | 6 +++-- sources/log.in/envvars | 4 ++- 8 files changed, 97 insertions(+), 3 deletions(-) create mode 100755 sources/log.in/c3d/firstboot/scripts/90_setupservices.sh create mode 100644 sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logfiles/letsencrypt.conf create mode 100644 sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logwatch.conf create mode 100644 sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/services/letsencrypt.conf create mode 100644 sources/log.in/c3d/postinstall/install-data/etc/logwatch/scripts/services/letsencrypt diff --git a/sources/log.in/c3d/firstboot/scripts/90_setupservices.sh b/sources/log.in/c3d/firstboot/scripts/90_setupservices.sh new file mode 100755 index 0000000..be4e8a6 --- /dev/null +++ b/sources/log.in/c3d/firstboot/scripts/90_setupservices.sh @@ -0,0 +1,12 @@ +#!/bin/sh + + +systemctl enable NetworkManager-wait-online.service +systemctl start NetworkManager-wait-online.service +systemctl enable crond.service +systemctl start crond.service +systemctl enable postfix.service +systemctl start postfix.service + +systemctl enable logrotate.timer +systemctl start logrotate.timer diff --git a/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logfiles/letsencrypt.conf b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logfiles/letsencrypt.conf new file mode 100644 index 0000000..fb94704 --- /dev/null +++ b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logfiles/letsencrypt.conf @@ -0,0 +1,24 @@ +########################################################################## +# $Id$ +########################################################################## + +######################################################## +# This was written and is maintained by: +# Kirk Bauer +# +# Please send all comments, suggestions, bug reports, +# etc, to kirk@kaybee.org. +######################################################## + +# What actual file? Defaults to LogPath if not absolute path.... +LogFile = remote/pki.log + +# If the archives are searched, here is one or more line +# (optionally containing wildcards) that tell where they are... +#If you use a "-" in naming add that as well -mgt +Archive = remote/pki.log-*.gz + +# Keep only the lines in the proper date range... +*ApplyStdDate + +# vi: shiftwidth=3 tabstop=3 et diff --git a/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logwatch.conf b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logwatch.conf new file mode 100644 index 0000000..e680a98 --- /dev/null +++ b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/logwatch.conf @@ -0,0 +1,7 @@ +# Local configuration options go here (defaults are in /usr/share/logwatch/default.conf/logwatch.conf) +Output = mail +MailTo = siteadmin@useribm.hu +MailFrom = logwatch@useribm.hu +Service = "-postfix" +Service = "-rsyslogd" +Service = "-systemd" diff --git a/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/services/letsencrypt.conf b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/services/letsencrypt.conf new file mode 100644 index 0000000..5583d74 --- /dev/null +++ b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/conf/services/letsencrypt.conf @@ -0,0 +1,25 @@ +########################################################################### +# ------------------------------------------------------------------------ +########################################################################### + +# You can put comments anywhere you want to. They are effective for the +# rest of the line. + +# this is in the format of = . Whitespace at the beginning +# and end of the lines is removed. Whitespace before and after the = sign +# is removed. Everything is case *insensitive*. + +# Yes = True = On = 1 +# No = False = Off = 0 + +Title = "Letsencrypt" + +# Which logfile group... +LogFile = letsencrypt + +# Only give lines pertaining to letsencrypt (certbot) +*OnlyService = certbot + +*RemoveHeaders = + +# vi: shiftwidth=3 tabstop=3 et diff --git a/sources/log.in/c3d/postinstall/install-data/etc/logwatch/scripts/services/letsencrypt b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/scripts/services/letsencrypt new file mode 100644 index 0000000..7d818f3 --- /dev/null +++ b/sources/log.in/c3d/postinstall/install-data/etc/logwatch/scripts/services/letsencrypt @@ -0,0 +1,20 @@ +#!/bin/bash + + +# This is as nice script that will show you the lines you will +# be processing and reporting on. It will first display the +# standard environment variables and then it takes STDIN and +# dump it right back out to STDOUT. + +# These are the standard environment variables. You can define +# more in your service config file (see above). +#echo "Date Range: $LOGWATCH_DATE_RANGE" +#echo "Detail Level: $LOGWATCH_DETAIL_LEVEL" +#echo "Temp Dir: $LOGWATCH_TEMP_DIR" +#echo "Debug Level: $LOGWATCH_DEBUG" + +# Now take STDIN and dump it to STDOUT +#cat + + +grep -e '(skipped)' -e '(success)' | sort | uniq diff --git a/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf b/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf index dc14500..00a9f14 100644 --- a/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf +++ b/sources/log.in/c3d/postinstall/install-data/etc/rsyslog.d/remote.conf @@ -4,6 +4,7 @@ template(name="remoteTemplate" type="list") { constant(value=".log") } +module(load="imrelp") module(load="imtcp") module(load="imudp") @@ -11,5 +12,6 @@ ruleset(name="remoteRuleset"){ *.* action(type="omfile" DynaFile="remoteTemplate") } +input(type="imrelp" port="2514" ruleset="remoteRuleset") input(type="imtcp" port="514" ruleset="remoteRuleset") input(type="imudp" port="514" ruleset="remoteRuleset") diff --git a/sources/log.in/c3d/postinstall/scripts/10_setupservices.sh b/sources/log.in/c3d/postinstall/scripts/10_setupservices.sh index 706332a..4e4d923 100755 --- a/sources/log.in/c3d/postinstall/scripts/10_setupservices.sh +++ b/sources/log.in/c3d/postinstall/scripts/10_setupservices.sh @@ -1,6 +1,8 @@ #!/bin/sh -systemctl enable NetworkManager-wait-online.service +systemctl disable crond.service +systemctl disable postfix.service +systemctl disable NetworkManager-wait-online.service -systemctl enable logrotate.timer +systemctl disable logrotate.timer diff --git a/sources/log.in/envvars b/sources/log.in/envvars index 2a37b07..b411703 100644 --- a/sources/log.in/envvars +++ b/sources/log.in/envvars @@ -1,3 +1,5 @@ DISTRIBUTION=Fedora DISTRIBUTION_VERSION=41 -SPEC_PACKAGES="rsyslog-doc" +SPEC_PACKAGES="logwatch \ + postfix \ + rsyslog-doc" -- 2.54.0