Hi all, this is a testing patch and the first try to drop sysklogd and replace it with rsyslogd. This patch also do not includes needed core update.sh changes... Please do not use this for productive systems!
Did some testings with all changes and a freshly builded ISO in a VM and have had so far no problems with it but as in the commit message mentioned, there needs to be reviewed a lot and surely adjusted some things which i also probably forgot. The logging WUI needs to be checked far better then i did it until now but for the first checkout it seems to be working.
@Peter this should be a working base for you to check also the already merged syslogctrl.c changes, did in there also some smaller changes which i have also listed in the commit message.
All can also be found in Git --> https://git.ipfire.org/?p=people/ummeegge/ipfire-2.x.git;a=commit;h=8bdd3636... .
Hope this is helpful.
Best,
Erik
Am 06.02.2018 um 09:56 schrieb Erik Kapfer:
Sysklogd are replaced by Rsyslogd. Reduced version with 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. Process drops his permissions to already existing 'syslogd'. A work directory has been set to /var/spool/rsyslogd. New configuration directory /etc/rsyslog.d has been introduced to. One change of the old sysklogd configuration lines needed to be done whereby ':omusrmsg:*' for emergency messages has been set.
Rsyslog initscript: Set a usermod and includes 'syslogd' to 'tty' otherwise the privileges can not be reduced. Bootlog lines from sysklogd has been integrated.
ToDo´s: Check if usermod in initscript is practical and if there are possible other ways. Check for really needed modules. Config for encrypted remote log server streams (there are currently no directives for this). Adapted only the configuration name in syslogdctrl.c and if pid file doesn't exists, initscript will be used for restart instead of sysklogd command.
Signed-off-by: Erik Kapfer erik.kapfer@ipfire.org
config/etc/rsyslog.conf | 74 +++++++++++++++++++++ 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 | 6 +- config/rootfiles/common/rsyslog | 42 ++++++++++++ config/rootfiles/common/stage2 | 2 +- config/rootfiles/common/sysklogd | 8 --- config/rootfiles/common/x86_64/initscripts | 8 +-- config/rootfiles/common/x86_64/stage2 | 2 +- lfs/initscripts | 6 +- lfs/libestr | 86 ++++++++++++++++++++++++ lfs/libfastjson | 86 ++++++++++++++++++++++++ lfs/liblogging | 86 ++++++++++++++++++++++++ lfs/rsyslog | 98 ++++++++++++++++++++++++++++ make.sh | 5 +- src/initscripts/system/rsyslogd | 84 ++++++++++++++++++++++++ src/initscripts/system/sysklogd | 63 ------------------ src/misc-progs/syslogdctrl.c | 20 +++--- 22 files changed, 619 insertions(+), 125 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/rsyslogd delete mode 100644 src/initscripts/system/sysklogd
diff --git a/config/etc/rsyslog.conf b/config/etc/rsyslog.conf new file mode 100644 index 0000000..92a0fe4 --- /dev/null +++ b/config/etc/rsyslog.conf @@ -0,0 +1,74 @@ +# /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/rsyslogd
+# +# 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 cdef756..0000000 --- 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 d3a3cf8..0d7a99b 100644 --- a/config/rootfiles/common/armv5tel/initscripts +++ b/config/rootfiles/common/armv5tel/initscripts @@ -79,7 +79,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/rsyslogd etc/rc.d/init.d/template etc/rc.d/init.d/udev etc/rc.d/init.d/udev_retry @@ -108,7 +108,7 @@ etc/rc.d/rc0.d/K80network etc/rc.d/rc0.d/K82wlanclient #etc/rc.d/rc0.d/K84bluetooth #etc/rc.d/rc0.d/K85messagebus -etc/rc.d/rc0.d/K90sysklogd +etc/rc.d/rc0.d/K90rsyslogd etc/rc.d/rc0.d/S60sendsignals etc/rc.d/rc0.d/S70localnet etc/rc.d/rc0.d/S80mountfs @@ -116,7 +116,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/S10rsyslogd etc/rc.d/rc3.d/S11unbound etc/rc.d/rc3.d/S15fireinfo #etc/rc.d/rc3.d/S15messagebus @@ -157,7 +157,7 @@ etc/rc.d/rc6.d/K80network etc/rc.d/rc6.d/K82wlanclient #etc/rc.d/rc6.d/K84bluetooth #etc/rc.d/rc6.d/K85messagebus -etc/rc.d/rc6.d/K90sysklogd +etc/rc.d/rc6.d/K90rsyslogd 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 67e495c..21edcc7 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/rsyslogd 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/K90rsyslogd 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/S10rsyslogd 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/K90rsyslogd 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 0000000..d58e7a9 --- /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 0000000..f7611e1 --- /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 0000000..e51bfd9 --- /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 fe67a8c..a6ec26d 100644 --- a/config/rootfiles/common/logwatch +++ b/config/rootfiles/common/logwatch @@ -56,7 +56,7 @@ usr/share/logwatch/default.conf/logfiles/samba.conf #usr/share/logwatch/default.conf/logfiles/secure.conf #usr/share/logwatch/default.conf/logfiles/sonicwall.conf #usr/share/logwatch/default.conf/logfiles/spamassassin.conf -usr/share/logwatch/default.conf/logfiles/syslog.conf +#usr/share/logwatch/default.conf/logfiles/syslog.conf #usr/share/logwatch/default.conf/logfiles/tac_acc.conf #usr/share/logwatch/default.conf/logfiles/tivoli-smc.conf #usr/share/logwatch/default.conf/logfiles/up2date.conf @@ -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 0000000..0eb4dd4 --- /dev/null +++ b/config/rootfiles/common/rsyslog @@ -0,0 +1,42 @@ +etc/rc.d/init.d/rsyslogd +etc/rsyslog.conf +etc/rsyslog.d +usr/bin/rscryutil +#usr/lib/rsyslog +#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 a5ba6ae..953255b 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 f5d55c2..0000000 --- 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 67e495c..21edcc7 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/rsyslogd 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/K90rsyslogd 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/S10rsyslogd 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/K90rsyslogd 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 70a33d6..b8cb01b 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/lfs/initscripts b/lfs/initscripts index 9d3a52c..df6f0a5 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/rsyslogd /etc/rc.d/rc0.d/K90rsyslogd 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/rsyslogd /etc/rc.d/rc3.d/S10rsyslogd 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/rsyslogd /etc/rc.d/rc6.d/K90rsyslogd 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 0000000..5e2d168 --- /dev/null +++ b/lfs/libestr @@ -0,0 +1,86 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team info@ipfire.org # +# # +# 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 http://www.gnu.org/licenses/. # +# # +###############################################################################
+############################################################################### +# 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 0000000..80f41af --- /dev/null +++ b/lfs/libfastjson @@ -0,0 +1,86 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team info@ipfire.org # +# # +# 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 http://www.gnu.org/licenses/. # +# # +###############################################################################
+############################################################################### +# 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 0000000..22ae480 --- /dev/null +++ b/lfs/liblogging @@ -0,0 +1,86 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team info@ipfire.org # +# # +# 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 http://www.gnu.org/licenses/. # +# # +###############################################################################
+############################################################################### +# 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 0000000..ebb3766 --- /dev/null +++ b/lfs/rsyslog @@ -0,0 +1,98 @@ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2018 IPFire Team info@ipfire.org # +# # +# 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 http://www.gnu.org/licenses/. # +# # +###############################################################################
+############################################################################### +# Definitions +###############################################################################
+include Config
+VER = 8.32.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 = 0811aad3186bcae3b2dcd92063d9eb1d
+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 \
--enable-usertools \
CFLAGS="-L/lib"
- cd $(DIR_APP) && make $(MAKETUNING)
- cd $(DIR_APP) && make install
- touch /var/log/{dhcpcd.log,messages}
- chmod 664 /var/log/{dhcpcd.log,messages}
- chown root:syslogd /var/log/{dhcpcd.log,messages}
- # Add additional configuration directory
- mkdir -v /etc/rsyslog.d
- chown -R root:root /etc/rsyslog.d
- chmod 755 /etc/rsyslog.d
- @rm -rf $(DIR_APP)
- @$(POSTBUILD)
diff --git a/make.sh b/make.sh index c7b6eb8..043f0e4 100755 --- a/make.sh +++ b/make.sh @@ -1016,7 +1016,6 @@ buildbase() { lfsmake2 patch lfsmake2 psmisc lfsmake2 shadow
- lfsmake2 sysklogd lfsmake2 sysvinit lfsmake2 tar lfsmake2 texinfo
@@ -1142,6 +1141,10 @@ buildipfire() { lfsmake2 gdbm lfsmake2 pam lfsmake2 curl
- lfsmake2 libestr
- lfsmake2 liblogging
- lfsmake2 libfastjson
- lfsmake2 rsyslog lfsmake2 tcl lfsmake2 sqlite lfsmake2 libffi
diff --git a/src/initscripts/system/rsyslogd b/src/initscripts/system/rsyslogd new file mode 100644 index 0000000..cb9e6af --- /dev/null +++ b/src/initscripts/system/rsyslogd @@ -0,0 +1,84 @@ +#!/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/rsyslogd.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
+if ! grep -q "^tty:x:5:syslogd$" /etc/group; then
- usermod -a -G tty syslogd
+fi
+# Add work dir if not presant +if [ ! -e "/var/spool/${NAME}" ]; then
mkdir /var/spool/${NAME}
+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}
- ;;
- reload)
boot_mesg "Reloading ${DESC}..."
reloadproc ${BIN} ${SYSLOGD_OPTIONS}
- ;;
- restart)
${0} stop
sleep 1
${0} start
- ;;
- status)
statusproc ${BIN}
- ;;
- *)
echo "Usage: ${0} {start|stop|reload|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 4482559..0000000 --- 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 d73c422..e3d665b 100644 --- a/src/misc-progs/syslogdctrl.c +++ b/src/misc-progs/syslogdctrl.c @@ -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);
} else { /* if remote syslog has been disabled */snprintf(buffer, STRING_SIZE - 1, "/bin/sed -e 's/^#\\?\\(\\*\\.\\*[[:blank:]]\\+\\)@@\\?.\\+$/\\1@%s/' /etc/rsyslog.conf >&%d", hostname, config_fd); }
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,31 +137,31 @@ int main(void) { fprintf(stderr, "sed returned bad exit code: %d\n", rc); close(config_fd);
unlink("/etc/syslog.conf.new");
} close(config_fd);unlink("/etc/rsyslog.conf.new"); exit(ERR_CONFIG);
- 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);
}
/* Get syslogd to read the new config file */
- if ((fd = open("/var/run/syslogd.pid", O_RDONLY)) == -1)
- if ((fd = open("/var/run/rsyslogd.pid", O_RDONLY)) == -1) { if(errno == ENOENT) { /* pid file doesn't exists.. restart syslog */
if((rc = safe_system("/usr/sbin/syslogd u syslogd -m 0")) == 0 )
if((rc = safe_system("/etc/init.d/rsyslog restart")) == 0 ) return 0; else { fprintf(stderr,
"Unable to restart syslogd - returned exit code %d\n", rc);
"Unable to restart rsyslogd - returned exit code %d\n", rc); exit(ERR_SYSLOG); } } else {
-- 2.7.4