From 74ac4b1e8a5615b487df13aba029492110ecf6d1 Mon Sep 17 00:00:00 2001 From: Erik Kapfer Date: Thu, 21 Jun 2018 12:03:32 +0200 Subject: [PATCH] Rsyslog: New advanced Syslogger MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sysklogd and Klogd are replaced by Rsyslogd. Version includes libestr libfastjson and liblogging. Rsyslog configuration: Two modules are used 'imuxsock' and 'imklog' which is the minimum to get the old sysklod ouput. Works in 'RSYSLOG_TraditionalFileFormat' which equals to the log output of the old sysklogd. A work directory will be included to /var/spool/rsyslog. Additional user configuration directory under /etc/rsyslog.d has been introduced too. One old sysklogd directive needed to be changed whereby ':omusrmsg:*' for emergency messages has been set (all old sysklogd configuration directives could be used in new config). Since Rsyslog drops his privileges (to already existing user 'syslogd'), syslogd user is now member of group tty (/etc/group), group dialout has also been tested but have had partly problems and didn´t logged persistently. logrotate.conf has been adapted to Rsyslog, -HUP will be send before restart so all files should be closed before rotation. Rsyslog initscript: Checks if user syslogd is part of tty group otherwise a usermod includes 'syslogd' to 'tty' (needed to be done to drop the privileges). Bootlog lines from sysklogd has been integrated. syslogctrl: Remote logging configuration is located under /etc/rsyslog.conf and works with UDP (@) and TCP (@@). Rsyslog restart will be executed after configuration has been saved via logs.cgi/config.dat. Other files/changes: User 'klogd' has been deleted from passwd. rsyslogd default.conf for 'logwatch' has been activated. services.cgi has been adapted to rsyslog as logging and kernel logging server and a link has also been set to related logs.cgi/config.dat. firstsetup has been adapted to rsyslog. Signed-off-by: Erik Kapfer --- config/etc/group | 3 +- config/etc/logrotate.conf | 3 +- config/etc/rsyslog.conf | 75 ++++++++++++++ config/etc/syslog.conf | 23 ----- config/rootfiles/common/armv5tel/initscripts | 8 +- config/rootfiles/common/i586/initscripts | 8 +- config/rootfiles/common/libestr | 6 ++ config/rootfiles/common/libfastjson | 13 +++ config/rootfiles/common/liblogging | 10 ++ config/rootfiles/common/logwatch | 4 +- config/rootfiles/common/rsyslog | 43 ++++++++ config/rootfiles/common/stage2 | 2 +- config/rootfiles/common/sysklogd | 8 -- config/rootfiles/common/x86_64/initscripts | 8 +- config/rootfiles/common/x86_64/stage2 | 2 +- html/cgi-bin/services.cgi | 6 +- lfs/initscripts | 6 +- lfs/libestr | 86 ++++++++++++++++ lfs/libfastjson | 86 ++++++++++++++++ lfs/liblogging | 86 ++++++++++++++++ lfs/rsyslog | 101 +++++++++++++++++++ make.sh | 4 + src/initscripts/system/firstsetup | 4 +- src/initscripts/system/rsyslog | 80 +++++++++++++++ src/initscripts/system/sysklogd | 63 ------------ src/misc-progs/syslogdctrl.c | 26 ++--- 26 files changed, 629 insertions(+), 135 deletions(-) create mode 100644 config/etc/rsyslog.conf delete mode 100644 config/etc/syslog.conf create mode 100644 config/rootfiles/common/libestr create mode 100644 config/rootfiles/common/libfastjson create mode 100644 config/rootfiles/common/liblogging create mode 100644 config/rootfiles/common/rsyslog delete mode 100644 config/rootfiles/common/sysklogd create mode 100644 lfs/libestr create mode 100644 lfs/libfastjson create mode 100644 lfs/liblogging create mode 100644 lfs/rsyslog create mode 100644 src/initscripts/system/rsyslog delete mode 100644 src/initscripts/system/sysklogd diff --git a/config/etc/group b/config/etc/group index 198b68aa36..ba28e6e61a 100644 --- a/config/etc/group +++ b/config/etc/group @@ -2,7 +2,7 @@ root:x:0:root bin:x:1:root,bin,daemon daemon:x:2:root,bin,daemon sys:x:3:root,bin -tty:x:5: +tty:x:5:syslogd disk:x:6:root lp:x:7:daemon mem:x:8: @@ -30,7 +30,6 @@ snort:x:101: logwatch:x:102: cron:x:104: syslogd:x:105: -klogd:x:106: postfix:x:107: postdrop:x:108: clamav:x:109: diff --git a/config/etc/logrotate.conf b/config/etc/logrotate.conf index d38570de55..865b2ccfdf 100644 --- a/config/etc/logrotate.conf +++ b/config/etc/logrotate.conf @@ -73,7 +73,8 @@ include /etc/logrotate.d sharedscripts ifempty postrotate - /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + /bin/kill -HUP $(cat /var/run/rsyslog.pid 2> /dev/null) 2> /dev/null || true + /etc/init.d/rsyslog restart >/dev/null 2>&1 || true endscript } diff --git a/config/etc/rsyslog.conf b/config/etc/rsyslog.conf new file mode 100644 index 0000000000..df3eae6e9f --- /dev/null +++ b/config/etc/rsyslog.conf @@ -0,0 +1,75 @@ +# /etc/rsyslog.conf Configuration file for rsyslog. +# +# For more information see +# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html +# + +################# +#### MODULES #### +################# + +# provides support for local system logging +module(load="imuxsock") + +# provides kernel logging support (previously done by rklogd) +module(load="imklog") + +########################### +#### GLOBAL DIRECTIVES #### +########################### + +# +# Use traditional timestamp format. +# To enable high precision timestamps, comment out the following line. +# +$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat + +# Filter duplicated messages +#$RepeatedMsgReduction on + +# +# Drop privileges. +# +$PrivDropToUser syslogd +$PrivDropToGroup syslogd + +# +# Where to place spool and state files +# +$WorkDirectory /var/spool/rsyslog + +# +# Include all config files in /etc/rsyslog.d/ +# +$IncludeConfig /etc/rsyslog.d/*.conf + +############### +#### RULES #### +############### + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* /dev/console + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +# local0.* any dhcpcd log (even debug) in messages +cron.none;daemon.*;local0.*;local2.*;\ +*.info;mail.none;authpriv.* -/var/log/messages + +# Log crons +#cron.* -/var/log/cron.log + +# Everybody gets emergency messages +*.emerg :omusrmsg:* + +# Display logs on tty12 +*.* /dev/tty12 + +# Optionally log to a remote host +#*.* @hostname.domain + +# Postfix logs +mail.* -/var/log/mail + + diff --git a/config/etc/syslog.conf b/config/etc/syslog.conf deleted file mode 100644 index cdef756822..0000000000 --- a/config/etc/syslog.conf +++ /dev/null @@ -1,23 +0,0 @@ -# Log all kernel messages to the console. -# Logging much else clutters up the screen. -#kern.* /dev/console - -# Log anything (except mail) of level info or higher. -# Don't log private authentication messages! -# local0.* any dhcpcd log (even debug) in messages -cron.none;daemon.*;local0.*;local2.*;*.info;mail.none;authpriv.* -/var/log/messages - -# Log crons -#cron.* -/var/log/cron.log - -# Everybody gets emergency messages -*.emerg * - -# Display logs on tty12 -*.* /dev/tty12 - -# Optionally log to a remote host -#*.* @hostname.domain - -# Postfix logs -mail.* -/var/log/mail diff --git a/config/rootfiles/common/armv5tel/initscripts b/config/rootfiles/common/armv5tel/initscripts index 9e9e1a71a5..1e7c655c03 100644 --- a/config/rootfiles/common/armv5tel/initscripts +++ b/config/rootfiles/common/armv5tel/initscripts @@ -80,7 +80,7 @@ etc/rc.d/init.d/static-routes etc/rc.d/init.d/swap etc/rc.d/init.d/swconfig etc/rc.d/init.d/sysctl -etc/rc.d/init.d/sysklogd +etc/rc.d/init.d/rsyslog etc/rc.d/init.d/template etc/rc.d/init.d/udev etc/rc.d/init.d/udev_retry @@ -110,7 +110,7 @@ etc/rc.d/rc0.d/K82wlanclient #etc/rc.d/rc0.d/K84bluetooth #etc/rc.d/rc0.d/K85messagebus etc/rc.d/rc0.d/K87acpid -etc/rc.d/rc0.d/K90sysklogd +etc/rc.d/rc0.d/K90rsyslog etc/rc.d/rc0.d/S60sendsignals etc/rc.d/rc0.d/S70localnet etc/rc.d/rc0.d/S80mountfs @@ -118,7 +118,7 @@ etc/rc.d/rc0.d/S90swap etc/rc.d/rc0.d/S99halt #etc/rc.d/rc3.d etc/rc.d/rc3.d/S01vnstat -etc/rc.d/rc3.d/S10sysklogd +etc/rc.d/rc3.d/S10rsyslog etc/rc.d/rc3.d/S11unbound etc/rc.d/rc3.d/S12acpid etc/rc.d/rc3.d/S15fireinfo @@ -161,7 +161,7 @@ etc/rc.d/rc6.d/K82wlanclient #etc/rc.d/rc6.d/K84bluetooth #etc/rc.d/rc6.d/K85messagebus etc/rc.d/rc6.d/K87acpid -etc/rc.d/rc6.d/K90sysklogd +etc/rc.d/rc6.d/K90rsyslog etc/rc.d/rc6.d/S60sendsignals etc/rc.d/rc6.d/S70mountfs etc/rc.d/rc6.d/S80swap diff --git a/config/rootfiles/common/i586/initscripts b/config/rootfiles/common/i586/initscripts index cc0e4580d8..a2674ecd0a 100644 --- a/config/rootfiles/common/i586/initscripts +++ b/config/rootfiles/common/i586/initscripts @@ -79,7 +79,7 @@ etc/rc.d/init.d/sshd etc/rc.d/init.d/static-routes etc/rc.d/init.d/swap etc/rc.d/init.d/sysctl -etc/rc.d/init.d/sysklogd +etc/rc.d/init.d/rsyslog etc/rc.d/init.d/template etc/rc.d/init.d/udev etc/rc.d/init.d/udev_retry @@ -109,7 +109,7 @@ etc/rc.d/rc0.d/K82wlanclient #etc/rc.d/rc0.d/K84bluetooth #etc/rc.d/rc0.d/K85messagebus etc/rc.d/rc0.d/K87acpid -etc/rc.d/rc0.d/K90sysklogd +etc/rc.d/rc0.d/K90rsyslog etc/rc.d/rc0.d/S60sendsignals etc/rc.d/rc0.d/S70localnet etc/rc.d/rc0.d/S80mountfs @@ -117,7 +117,7 @@ etc/rc.d/rc0.d/S90swap etc/rc.d/rc0.d/S99halt #etc/rc.d/rc3.d etc/rc.d/rc3.d/S01vnstat -etc/rc.d/rc3.d/S10sysklogd +etc/rc.d/rc3.d/S10rsyslog etc/rc.d/rc3.d/S12acpid etc/rc.d/rc3.d/S15fireinfo #etc/rc.d/rc3.d/S15messagebus @@ -160,7 +160,7 @@ etc/rc.d/rc6.d/K82wlanclient #etc/rc.d/rc6.d/K84bluetooth #etc/rc.d/rc6.d/K85messagebus etc/rc.d/rc6.d/K87acpid -etc/rc.d/rc6.d/K90sysklogd +etc/rc.d/rc6.d/K90rsyslog etc/rc.d/rc6.d/S60sendsignals etc/rc.d/rc6.d/S70mountfs etc/rc.d/rc6.d/S80swap diff --git a/config/rootfiles/common/libestr b/config/rootfiles/common/libestr new file mode 100644 index 0000000000..d58e7a926a --- /dev/null +++ b/config/rootfiles/common/libestr @@ -0,0 +1,6 @@ +#usr/include/libestr.h +#usr/lib/libestr.la +#usr/lib/libestr.so +usr/lib/libestr.so.0 +usr/lib/libestr.so.0.0.0 +#usr/lib/pkgconfig/libestr.pc diff --git a/config/rootfiles/common/libfastjson b/config/rootfiles/common/libfastjson new file mode 100644 index 0000000000..f7611e1190 --- /dev/null +++ b/config/rootfiles/common/libfastjson @@ -0,0 +1,13 @@ +#usr/include/libfastjson +#usr/include/libfastjson/atomic.h +#usr/include/libfastjson/json.h +#usr/include/libfastjson/json_object.h +#usr/include/libfastjson/json_object_iterator.h +#usr/include/libfastjson/json_object_private.h +#usr/include/libfastjson/json_tokener.h +#usr/include/libfastjson/json_util.h +#usr/lib/libfastjson.la +#usr/lib/libfastjson.so +usr/lib/libfastjson.so.4 +usr/lib/libfastjson.so.4.2.0 +#usr/lib/pkgconfig/libfastjson.pc diff --git a/config/rootfiles/common/liblogging b/config/rootfiles/common/liblogging new file mode 100644 index 0000000000..e51bfd93a3 --- /dev/null +++ b/config/rootfiles/common/liblogging @@ -0,0 +1,10 @@ +#usr/bin/stdlogctl +#usr/include/liblogging +#usr/include/liblogging/stdlog.h +#usr/lib/liblogging-stdlog.la +#usr/lib/liblogging-stdlog.so +usr/lib/liblogging-stdlog.so.0 +usr/lib/liblogging-stdlog.so.0.1.0 +#usr/lib/pkgconfig/liblogging-stdlog.pc +#usr/share/man/man1/stdlogctl.1 +#usr/share/man/man3/stdlog.3 diff --git a/config/rootfiles/common/logwatch b/config/rootfiles/common/logwatch index fe67a8c846..4be3ead3ee 100644 --- a/config/rootfiles/common/logwatch +++ b/config/rootfiles/common/logwatch @@ -146,7 +146,7 @@ usr/share/logwatch/default.conf/services/postfix.conf #usr/share/logwatch/default.conf/services/qmail.conf #usr/share/logwatch/default.conf/services/raid.conf usr/share/logwatch/default.conf/services/resolver.conf -#usr/share/logwatch/default.conf/services/rsyslogd.conf +usr/share/logwatch/default.conf/services/rsyslogd.conf #usr/share/logwatch/default.conf/services/rt314.conf usr/share/logwatch/default.conf/services/samba.conf usr/share/logwatch/default.conf/services/saslauthd.conf @@ -290,7 +290,7 @@ usr/share/logwatch/scripts/services/postfix #usr/share/logwatch/scripts/services/qmail-smtpd #usr/share/logwatch/scripts/services/raid usr/share/logwatch/scripts/services/resolver -#usr/share/logwatch/scripts/services/rsyslogd +usr/share/logwatch/scripts/services/rsyslogd #usr/share/logwatch/scripts/services/rt314 usr/share/logwatch/scripts/services/samba usr/share/logwatch/scripts/services/saslauthd diff --git a/config/rootfiles/common/rsyslog b/config/rootfiles/common/rsyslog new file mode 100644 index 0000000000..c0d7434b02 --- /dev/null +++ b/config/rootfiles/common/rsyslog @@ -0,0 +1,43 @@ +etc/rsyslog.d +#usr/lib/rsyslog +#usr/lib/rsyslog/fmhash.la +usr/lib/rsyslog/fmhash.so +#usr/lib/rsyslog/fmhttp.la +usr/lib/rsyslog/fmhttp.so +#usr/lib/rsyslog/imklog.la +usr/lib/rsyslog/imklog.so +#usr/lib/rsyslog/immark.la +usr/lib/rsyslog/immark.so +#usr/lib/rsyslog/imtcp.la +usr/lib/rsyslog/imtcp.so +#usr/lib/rsyslog/imudp.la +usr/lib/rsyslog/imudp.so +#usr/lib/rsyslog/imuxsock.la +usr/lib/rsyslog/imuxsock.so +#usr/lib/rsyslog/lmcry_gcry.la +usr/lib/rsyslog/lmcry_gcry.so +#usr/lib/rsyslog/lmnet.la +usr/lib/rsyslog/lmnet.so +#usr/lib/rsyslog/lmnetstrms.la +usr/lib/rsyslog/lmnetstrms.so +#usr/lib/rsyslog/lmnsd_ptcp.la +usr/lib/rsyslog/lmnsd_ptcp.so +#usr/lib/rsyslog/lmregexp.la +usr/lib/rsyslog/lmregexp.so +#usr/lib/rsyslog/lmstrmsrv.la +usr/lib/rsyslog/lmstrmsrv.so +#usr/lib/rsyslog/lmtcpclt.la +usr/lib/rsyslog/lmtcpclt.so +#usr/lib/rsyslog/lmtcpsrv.la +usr/lib/rsyslog/lmtcpsrv.so +#usr/lib/rsyslog/lmzlibw.la +usr/lib/rsyslog/lmzlibw.so +#usr/lib/rsyslog/mmexternal.la +usr/lib/rsyslog/mmexternal.so +#usr/lib/rsyslog/omtesting.la +usr/lib/rsyslog/omtesting.so +usr/sbin/rsyslogd +#usr/share/man/man5/rsyslog.conf.5 +#usr/share/man/man8/rsyslogd.8 +var/log/dhcpcd.log +var/log/messages diff --git a/config/rootfiles/common/stage2 b/config/rootfiles/common/stage2 index a5ba6ae269..953255b5bf 100644 --- a/config/rootfiles/common/stage2 +++ b/config/rootfiles/common/stage2 @@ -42,7 +42,7 @@ etc/profile.d/umask.sh etc/resolv.conf etc/securetty etc/sysctl.conf -etc/syslog.conf +etc/rsyslog.conf etc/system-release #home home/nobody diff --git a/config/rootfiles/common/sysklogd b/config/rootfiles/common/sysklogd deleted file mode 100644 index f5d55c2202..0000000000 --- a/config/rootfiles/common/sysklogd +++ /dev/null @@ -1,8 +0,0 @@ -usr/sbin/klogd -usr/sbin/syslogd -#usr/share/man/man5/syslog.conf.5 -#usr/share/man/man8/klogd.8 -#usr/share/man/man8/sysklogd.8 -#usr/share/man/man8/syslogd.8 -var/log/dhcpcd.log -var/log/messages diff --git a/config/rootfiles/common/x86_64/initscripts b/config/rootfiles/common/x86_64/initscripts index cc0e4580d8..a2674ecd0a 100644 --- a/config/rootfiles/common/x86_64/initscripts +++ b/config/rootfiles/common/x86_64/initscripts @@ -79,7 +79,7 @@ etc/rc.d/init.d/sshd etc/rc.d/init.d/static-routes etc/rc.d/init.d/swap etc/rc.d/init.d/sysctl -etc/rc.d/init.d/sysklogd +etc/rc.d/init.d/rsyslog etc/rc.d/init.d/template etc/rc.d/init.d/udev etc/rc.d/init.d/udev_retry @@ -109,7 +109,7 @@ etc/rc.d/rc0.d/K82wlanclient #etc/rc.d/rc0.d/K84bluetooth #etc/rc.d/rc0.d/K85messagebus etc/rc.d/rc0.d/K87acpid -etc/rc.d/rc0.d/K90sysklogd +etc/rc.d/rc0.d/K90rsyslog etc/rc.d/rc0.d/S60sendsignals etc/rc.d/rc0.d/S70localnet etc/rc.d/rc0.d/S80mountfs @@ -117,7 +117,7 @@ etc/rc.d/rc0.d/S90swap etc/rc.d/rc0.d/S99halt #etc/rc.d/rc3.d etc/rc.d/rc3.d/S01vnstat -etc/rc.d/rc3.d/S10sysklogd +etc/rc.d/rc3.d/S10rsyslog etc/rc.d/rc3.d/S12acpid etc/rc.d/rc3.d/S15fireinfo #etc/rc.d/rc3.d/S15messagebus @@ -160,7 +160,7 @@ etc/rc.d/rc6.d/K82wlanclient #etc/rc.d/rc6.d/K84bluetooth #etc/rc.d/rc6.d/K85messagebus etc/rc.d/rc6.d/K87acpid -etc/rc.d/rc6.d/K90sysklogd +etc/rc.d/rc6.d/K90rsyslog etc/rc.d/rc6.d/S60sendsignals etc/rc.d/rc6.d/S70mountfs etc/rc.d/rc6.d/S80swap diff --git a/config/rootfiles/common/x86_64/stage2 b/config/rootfiles/common/x86_64/stage2 index 70a33d6591..b8cb01b670 100644 --- a/config/rootfiles/common/x86_64/stage2 +++ b/config/rootfiles/common/x86_64/stage2 @@ -42,7 +42,7 @@ etc/profile.d/umask.sh etc/resolv.conf etc/securetty etc/sysctl.conf -etc/syslog.conf +etc/rsyslog.conf etc/system-release #home home/nobody diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi index 64fdbba05a..4014e51186 100644 --- a/html/cgi-bin/services.cgi +++ b/html/cgi-bin/services.cgi @@ -50,8 +50,7 @@ my %servicenames =( $Lang::tr{'web server'} => 'httpd', $Lang::tr{'cron server'} => 'fcron', $Lang::tr{'dns proxy server'} => 'unbound', - $Lang::tr{'logging server'} => 'syslogd', - $Lang::tr{'kernel logging server'} => 'klogd', + $Lang::tr{'logging server'} => 'rsyslog', $Lang::tr{'ntp server'} => 'ntpd', $Lang::tr{'secure shell server'} => 'sshd', $Lang::tr{'vpn'} => 'charon', @@ -64,8 +63,7 @@ my %link =( $Lang::tr{'web server'} => $Lang::tr{'web server'}, $Lang::tr{'cron server'} => $Lang::tr{'cron server'}, $Lang::tr{'dns proxy server'} => $Lang::tr{'dns proxy server'}, - $Lang::tr{'logging server'} => $Lang::tr{'logging server'}, - $Lang::tr{'kernel logging server'} => $Lang::tr{'kernel logging server'}, + $Lang::tr{'logging server'} => "$Lang::tr{'logging server'}", $Lang::tr{'ntp server'} => "$Lang::tr{'ntp server'}", $Lang::tr{'secure shell server'} => "$Lang::tr{'secure shell server'}", $Lang::tr{'vpn'} => "$Lang::tr{'vpn'}", diff --git a/lfs/initscripts b/lfs/initscripts index 0d7f40cadb..82eb75ac68 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -92,13 +92,13 @@ $(TARGET) : install -v -m 755 $$i /etc/rc.d/helper/; \ done - ln -sf ../init.d/sysklogd /etc/rc.d/rc0.d/K90sysklogd + ln -sf ../init.d/rsyslog /etc/rc.d/rc0.d/K90rsyslog ln -sf ../init.d/sendsignals /etc/rc.d/rc0.d/S60sendsignals ln -sf ../init.d/localnet /etc/rc.d/rc0.d/S70localnet ln -sf ../init.d/mountfs /etc/rc.d/rc0.d/S80mountfs ln -sf ../init.d/swap /etc/rc.d/rc0.d/S90swap ln -sf ../init.d/halt /etc/rc.d/rc0.d/S99halt - ln -sf ../init.d/sysklogd /etc/rc.d/rc3.d/S10sysklogd + ln -sf ../init.d/rsyslog /etc/rc.d/rc3.d/S10rsyslog ln -sf ../init.d/smartenabler /etc/rc.d/rc3.d/S19smartenabler ln -sf ../init.d/messagebus /etc/rc.d/rc3.d/S15messagebus ln -sf ../init.d/messagebus /etc/rc.d/rc0.d/K85messagebus @@ -107,7 +107,7 @@ $(TARGET) : ln -sf ../init.d/bluetooth /etc/rc.d/rc0.d/K84bluetooth ln -sf ../init.d/bluetooth /etc/rc.d/rc6.d/K84bluetooth ln -sf ../init.d/cpufreq /etc/rc.d/rc3.d/S18cpufreq - ln -sf ../init.d/sysklogd /etc/rc.d/rc6.d/K90sysklogd + ln -sf ../init.d/rsyslog /etc/rc.d/rc6.d/K90rsyslog ln -sf ../init.d/sendsignals /etc/rc.d/rc6.d/S60sendsignals ln -sf ../init.d/mountfs /etc/rc.d/rc6.d/S70mountfs ln -sf ../init.d/swap /etc/rc.d/rc6.d/S80swap diff --git a/lfs/libestr b/lfs/libestr new file mode 100644 index 0000000000..5e2d168260 --- /dev/null +++ b/lfs/libestr @@ -0,0 +1,86 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 0.1.10 + +THISAPP = libestr-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +PROG = libestr + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = f4c9165a23587e77f7efe65d676d5e8e + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && ./configure \ + --prefix=/usr \ + --enable-static=no + + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && make install + + @rm -rf $(DIR_APP) + @$(POSTBUILD) + diff --git a/lfs/libfastjson b/lfs/libfastjson new file mode 100644 index 0000000000..80f41af3cd --- /dev/null +++ b/lfs/libfastjson @@ -0,0 +1,86 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 0.99.8 + +THISAPP = libfastjson-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +PROG = libfastjson + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = fe7b4eae1bf40499f6f92b51d7e5899e + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && ./configure \ + --prefix=/usr \ + --enable-static=no + + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && make install + + @rm -rf $(DIR_APP) + @$(POSTBUILD) + diff --git a/lfs/liblogging b/lfs/liblogging new file mode 100644 index 0000000000..22ae4808e9 --- /dev/null +++ b/lfs/liblogging @@ -0,0 +1,86 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 1.0.6 + +THISAPP = liblogging-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +PROG = liblogging + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = f215c7e7ac6cfd1f5dabdba08c522b29 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && ./configure \ + --prefix=/usr \ + --enable-static=no + + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && make install + + @rm -rf $(DIR_APP) + @$(POSTBUILD) + diff --git a/lfs/rsyslog b/lfs/rsyslog new file mode 100644 index 0000000000..e18aa4ace8 --- /dev/null +++ b/lfs/rsyslog @@ -0,0 +1,101 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +############################################################################### +# Definitions +############################################################################### + +include Config + +VER = 8.35.0 + +THISAPP = rsyslog-$(VER) +DL_FILE = $(THISAPP).tar.gz +DL_FROM = $(URL_IPFIRE) +DIR_APP = $(DIR_SRC)/$(THISAPP) +TARGET = $(DIR_INFO)/$(THISAPP) +PROG = rsyslog + +############################################################################### +# Top-level Rules +############################################################################### + +objects = $(DL_FILE) + +$(DL_FILE) = $(DL_FROM)/$(DL_FILE) + +$(DL_FILE)_MD5 = 5c691d1c743a07df855a8c89bd3bc903 + +install : $(TARGET) + +check : $(patsubst %,$(DIR_CHK)/%,$(objects)) + +download :$(patsubst %,$(DIR_DL)/%,$(objects)) + +md5 : $(subst %,%_MD5,$(objects)) + +dist: + @$(PAK) + +############################################################################### +# Downloading, checking, md5sum +############################################################################### + +$(patsubst %,$(DIR_CHK)/%,$(objects)) : + @$(CHECK) + +$(patsubst %,$(DIR_DL)/%,$(objects)) : + @$(LOAD) + +$(subst %,%_MD5,$(objects)) : + @$(MD5) + +############################################################################### +# Installation Details +############################################################################### + +$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) + @$(PREBUILD) + @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + + cd $(DIR_APP) && ./configure \ + --prefix=/usr \ + --disable-largefile \ + CFLAGS="-L/lib" + + cd $(DIR_APP) && make $(MAKETUNING) + cd $(DIR_APP) && make install + + # Add rsyslog.d additional configuration and PKI directory + -mkdir -pv /etc/rsyslog.d + chmod 0755 /etc/rsyslog.d + chown -R root:root /etc/rsyslog.d + + # Add dhcpd and messages logs + touch /var/log/dhcpcd.log + touch /var/log/messages + chmod 664 /var/log/dhcpcd.log + chmod 664 /var/log/messages + chown root:syslogd /var/log/dhcpcd.log + chown root:syslogd /var/log/messages + + @rm -rf $(DIR_APP) + @$(POSTBUILD) + diff --git a/make.sh b/make.sh index 0238cc3871..e00fe49d46 100755 --- a/make.sh +++ b/make.sh @@ -1318,6 +1318,10 @@ buildipfire() { lfsmake2 hplip lfsmake2 cifs-utils lfsmake2 krb5 + lfsmake2 libestr + lfsmake2 liblogging + lfsmake2 libfastjson + lfsmake2 rsyslog lfsmake2 samba lfsmake2 sudo lfsmake2 mc diff --git a/src/initscripts/system/firstsetup b/src/initscripts/system/firstsetup index 0704a98dcc..1214055e6a 100644 --- a/src/initscripts/system/firstsetup +++ b/src/initscripts/system/firstsetup @@ -19,7 +19,7 @@ fi # reload inittab /sbin/init q # -/etc/init.d/sysklogd start +/etc/init.d/rsyslog start export LANG=en_US.utf8 /usr/sbin/setup /dev/tty2 INSTALL if [ "${?}" == "1" ]; then @@ -42,5 +42,5 @@ killall udevd /sbin/udevd --daemon /sbin/udevadm trigger /sbin/udevadm settle -/etc/init.d/sysklogd stop +/etc/init.d/rsyslog stop touch /var/ipfire/main/firstsetup_ok diff --git a/src/initscripts/system/rsyslog b/src/initscripts/system/rsyslog new file mode 100644 index 0000000000..695c1714df --- /dev/null +++ b/src/initscripts/system/rsyslog @@ -0,0 +1,80 @@ +#!/bin/bash + +# +# Startup script for rsyslog. +# +# Short-Description: Enhanced system logging and kernel message trapping BINs +# +# $Author: ummeegge ipfire org +# $Date: 02.02.2018 +############################################################################# +# + +. /etc/sysconfig/rc +. ${rc_functions} + +NAME="rsyslogd" +BIN="/usr/sbin/${NAME}" +CONF="/etc/rsyslog.conf" +lockfile="/var/lock/subsys/${NAME}" +PIDFILE="/var/run/rsyslog.pid" +DESC="enhanced syslogd" +SYSLOGD_OPTIONS="-i ${PIDFILE}" + +# Exit if the package is not installed +[ -x ${BIN} ] || exit 5 + +# Do not start rsyslog when sysklogd is running +if [ -e /var/run/syslogd.pid ]; then + echo "Shut down sysklogd before you run rsyslog" + exit 1 +fi + +# syslogd needs to be in tty group +if ! grep -q "^tty:x:5:syslogd$" /etc/group; then + usermod -a -G tty syslogd 2>/dev/null +fi + +# Add work dir if not presant +if [ ! -e "/var/spool/rsyslog" ]; then + mkdir /var/spool/rsyslog 2>/dev/null +fi + +case "${1}" in + start) + boot_mesg "Starting ${DESC}... " + loadproc ${BIN} ${SYSLOGD_OPTIONS} + + boot_mesg "Saving Bootlog..." + if [ -e /var/log/bootlog ]; then + mv -f /var/log/bootlog /var/log/bootlog.old + fi + dmesg -c > /var/log/bootlog + + evaluate_retval && touch ${lockfile} + ;; + + stop) + boot_mesg "Stopping ${DESC}... " + killproc ${BIN} + rm -f ${PIDFILE} ${lockfile} + ;; + + restart) + ${0} stop + sleep 1 + ${0} start + ;; + + status) + statusproc ${BIN} + ;; + + *) + echo "Usage: ${0} {start|stop|restart|status}" + exit 1 + ;; +esac + +# End $rc_base/init.d/rsyslog + diff --git a/src/initscripts/system/sysklogd b/src/initscripts/system/sysklogd deleted file mode 100644 index 4482559b3b..0000000000 --- a/src/initscripts/system/sysklogd +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/sysklogd -# -# Description : Sysklogd loader -# -# Authors : Gerard Beekmans - gerard@linuxfromscratch.org -# -# Version : 00.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -case "${1}" in - start) - boot_mesg "Starting kernel log daemon..." - loadproc klogd -c 1 - - boot_mesg "Starting system log daemon..." - loadproc syslogd -m 0 - - boot_mesg "Saving Bootlog..." - if [ -e /var/log/bootlog ]; then - mv -f /var/log/bootlog /var/log/bootlog.old - fi - dmesg -c > /var/log/bootlog - evaluate_retval - ;; - stop) - boot_mesg "Stopping kernel log daemon..." - killproc klogd - - boot_mesg "Stopping system log daemon..." - killproc syslogd - ;; - - reload) - boot_mesg "Reloading system log daemon config file..." - reloadproc syslogd 1 - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - status) - statusproc syslogd - statusproc klogd - ;; - - *) - echo "Usage: ${0} {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/sysklogd diff --git a/src/misc-progs/syslogdctrl.c b/src/misc-progs/syslogdctrl.c index d73c422651..dad9493239 100644 --- a/src/misc-progs/syslogdctrl.c +++ b/src/misc-progs/syslogdctrl.c @@ -27,8 +27,8 @@ #define ERR_ANY 1 #define ERR_SETTINGS 2 /* error in settings file */ #define ERR_ETC 3 /* error with /etc permissions */ -#define ERR_CONFIG 4 /* error updating syslogd config */ -#define ERR_SYSLOG 5 /* error restarting syslogd */ +#define ERR_CONFIG 4 /* error updating rsyslog config */ +#define ERR_SYSLOG 5 /* error restarting rsyslog */ int main(void) { @@ -52,7 +52,7 @@ int main(void) if (!readkeyvalues(kv, "/var/ipfire/logging/settings")) { - fprintf(stderr, "Cannot read syslog settings\n"); + fprintf(stderr, "Cannot read rsyslog settings\n"); exit(ERR_SETTINGS); } @@ -106,7 +106,7 @@ int main(void) /* O_CREAT with O_EXCL will make open() fail if the file already exists - * mostly to prevent 2 copies running at once */ - if ((config_fd = open( "/etc/syslog.conf.new", O_WRONLY|O_CREAT|O_EXCL, 0644 )) == -1 ) + if ((config_fd = open( "/etc/rsyslog.conf.new", O_WRONLY|O_CREAT|O_EXCL, 0644 )) == -1 ) { perror("Unable to open new config file"); exit(ERR_CONFIG); @@ -118,18 +118,18 @@ int main(void) if (strcmp(protocol, "tcp") == 0) { /* write line for TCP */ - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@@%s/' /etc/syslog.conf >&%d", hostname, config_fd); + snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@@%s/' /etc/rsyslog.conf >&%d", hostname, config_fd); } else { /* write line for UDP */ - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@%s/' /etc/syslog.conf >&%d", hostname, config_fd); + snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@%s/' /etc/rsyslog.conf >&%d", hostname, config_fd); } } else { /* if remote syslog has been disabled */ - snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@@\\?.\\+\\)$/#\\1/' /etc/syslog.conf >&%d", config_fd ); + snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+@@\\?.\\+\\)$/#\\1/' /etc/rsyslog.conf >&%d", config_fd ); } /* if the return code isn't 0 failsafe */ @@ -137,15 +137,15 @@ int main(void) { fprintf(stderr, "sed returned bad exit code: %d\n", rc); close(config_fd); - unlink("/etc/syslog.conf.new"); + unlink("/etc/rsyslog.conf.new"); exit(ERR_CONFIG); } close(config_fd); - if (rename("/etc/syslog.conf.new", "/etc/syslog.conf") == -1) + if (rename("/etc/rsyslog.conf.new", "/etc/rsyslog.conf") == -1) { perror("Unable to replace old config file"); - unlink("/etc/syslog.conf.new"); + unlink("/etc/rsyslog.conf.new"); exit(ERR_CONFIG); } @@ -155,13 +155,13 @@ int main(void) { if(errno == ENOENT) { - /* pid file doesn't exists.. restart syslog */ - if((rc = safe_system("/usr/sbin/syslogd u syslogd -m 0")) == 0 ) + /* pid file does exists.. restart rsyslog */ + if((safe_system("/etc/init.d/rsyslog restart >/dev/null")) == 0 ) return 0; else { fprintf(stderr, - "Unable to restart syslogd - returned exit code %d\n", rc); + "Unable to restart rsyslog - returned exit code %d\n", rc); exit(ERR_SYSLOG); } } else { -- 2.47.2