Commit Graph

585 Commits

Author SHA1 Message Date
Joachim Nilsson
73736adbfd Bump version for v2.1 release cycle
The changes in the timer handling are quite extensive, so we cannot in
good conscience call this a patch release.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:24:38 +01:00
Joachim Nilsson
9cf1f97cef Fix nasty parallel build problem reported by Gentoo and Westermo
Independently of each other both the Gentoo project and Westermo found
an issue with massively parallel builds on monster-core-machines.  At
Westermo there are 40 core Xeon monsters that stumble when building
sysklogd.

The Gentoo bug report is here:

    https://bugs.gentoo.org/701894

The problem stems from strlcat.c and strlcpy.c being used for both
the libcompat convenience library built for libsyslog and als for
syslogd when the system does not have either of the APIs in libc,
i.e. most Linux systems with GLIBC or musl libc.

I can either rewrite the Makefile.am files to handle dependencies
better, or we just disable parallel build like this patch. There's
too few source files to gain anything from parallel build anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:19:05 +01:00
Joachim Nilsson
3f94ae2906 man: Fix formatting of interval / 2
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:15:04 +01:00
Joachim Nilsson
7b122449cc test: Increase run time for -- MARK -- test
We should make sure to also check that we don't get more MARK messages
than expected based on the -mMIN value.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:13:55 +01:00
Joachim Nilsson
6e6c0ddfaa syslogd: Integrate new timer API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-06 18:13:15 +01:00
Joachim Nilsson
5ac6c39687 syslogd: Add generic timer API to replace exising buggy one
This patch adds a alarm()/SIGALRM based generic timer API to syslogd.
The API takes care to wrap SIGALRM and serialize all timer events to
a standard UNIX pipe(2) which syslogd can poll() for like any other
incoming event.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-05 20:38:43 +01:00
Joachim Nilsson
ad686ca86d Update ChangeLog and bump version for v2.0.3 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:40:20 +01:00
Joachim Nilsson
55f2122393 release: Make sure distcheck runs --with-klogd
Otherwise the resulting tarball will not include klogd.8

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:22:01 +01:00
Joachim Nilsson
163aa84cc4 klogd: Add '-F' as alias for '-n', for compat with syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:17:02 +01:00
Joachim Nilsson
f6713bdb84 syslogd: Increase granularity of background flush/mark timer
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:12:54 +01:00
Joachim Nilsson
799b03447a test: Add --MARK-- test to verify idle functionality works
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 21:12:02 +01:00
Joachim Nilsson
4556901a2b syslogd: Update documentation, -m interval is in minutes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-12-01 15:59:35 +01:00
Joachim Nilsson
f4c01a3ba3 syslogd: Refactor domark() timer handling, always run at TIMERINTVL
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-30 17:55:58 +01:00
Joachim Nilsson
77119e2625 test: stop.sh: Exit on first error
We want to catch regressions when syslogd dies before we can tell it to
exit.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
c3acff5fae syslogd: Only Initialize syslogd once
This bug caused syslogd to fall back to logging to /dev/console for
internal log messages/errors during reconfiguration at runtime.

syslogd has the FreeBSD style of keeping already open log files ready
for logging until re:init() has completed, when new log files are rolled
in and any old ones not to be used anymore are closed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
a9758d1559 syslogd: Record time of first occurrence of a message
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
0a8cecfa84 syslogd: Handle DNS lookup of unknown remote hosts in domark()
Refactor of nslookup of unknown remote syslog servers, both when
(re)reading the .conf file and at runtime.  This means we retry
DNS lookup every 30 sec, or INET_SUSPEND_TIME +/- 30 sec.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
90dd1b1c37 syslogd: Always domark() timer, regardless of -mfoo value
The domark() timer handles a lot of the critical maintenance action in
syslogd, it must always be guaranteed to run.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
280b5fd3ec syslogd: Fix blocking of SIGHUP/ALRM during logmsg()
Only block signals *after* all sanity checking of log message has been
completed, otherwise we will end up with blocked SIGHUP and SIGALRM.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
05c5b6752d syslogd: Always create PID file, even in debug mode
We definitely want to be able to run syslogd in debug mode for extended
periods of time and still run under finit/systemd or similar, letting
users know we run as 'PID'.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-29 11:23:05 +01:00
Joachim Nilsson
8e255b7f9d syslogd: Only set debugging_on in Debug (-d) mode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 15:27:52 +01:00
Joachim Nilsson
b7d4225ef1 syslogd: Retry address lookup forever, never give up
When logging to a remote server, using @fqdn syntax in syslog.conf,
syslogd calls getaddrinfo() to resolve the IP address.  Older versions
of syslogd gave up after 10 retries.  We want to retry forever since we
may be running in a setup with bad network connection to the DNS server
for longer periods of time.

This patch only removes the 'give up' mechanism, which unfortunately
reused the f_prevcount value, which in turn could cause that value to
become -1 and thus trigger an assert().  With this code out of the way,
and the type change in the previous commit, the counter can never again
be negative.

Note: The configurable suspend time before trying again remains at its
default of 3 minutes.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 14:53:07 +01:00
Joachim Nilsson
49e168601e syslogd: Change f_prevcount type; int --> size_t
If it wraps around to zero we want to log the message anyway.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 14:39:12 +01:00
Joachim Nilsson
90a993f5a2 Update ChangeLog and bump version for v2.0.2 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 10:08:03 +01:00
Joachim Nilsson
1d8fe4944d syslogd: Reset prevcount in fprintlog_first() to prevent assert()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 10:00:34 +01:00
Joachim Nilsson
3d4b8cb84d syslogd: Improve log messages on error, eg. INET sendto()
When we fail sending to a remote host, help admin debug the issue by
stating which remote we failed to send to.

Also minor changes to other similar error messages, use same form.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-28 09:38:22 +01:00
Joachim Nilsson
0e6c141f4f Fix #6: Add workaround for systems with vanilla/older autoconf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-26 21:42:36 +01:00
Joachim Nilsson
87cef2d268 Update ChangeLog and bump version for v2.0.1
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-25 14:06:47 +01:00
Joachim Nilsson
84b7acf55f Allow --prefix= to install to /sbin
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-25 12:50:09 +01:00
Joachim Nilsson
15b8d386b3 Expand directories for configuration summary
Unexpanded defaults:

  sysconfdir  => ${prefix}/etc
  runstatedir => ${localstatedir}/run

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-25 12:14:18 +01:00
Joachim Nilsson
7793fcbd14 Fix #3: Don't guess PID file location, use configure --runstatedir
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-24 18:52:31 +01:00
Joachim Nilsson
4396004fba Add missing '-k' and '-T' command line flags to getopt()
Fixes GitHub issue #2

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-24 18:38:26 +01:00
Joachim Nilsson
b80a225f73 Minor, simplify previous commit and add logger on/off to summary
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-18 17:54:35 +01:00
Joachim Nilsson
076bd964cf
Merge pull request #1 from Polynomial-C/optional_logger
build: make logger and its man page optional
2019-11-18 17:39:00 +01:00
Lars Wendler
227008ec0f
build: make logger and its man page optional
There are other packages that provide a logger program like util-linux
We should respekt that

Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
2019-11-18 12:36:25 +01:00
Joachim Nilsson
b22e1339c9 Update ChangeLog and bump version for v2.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:16:09 +01:00
Joachim Nilsson
c2061b8f53 Add workaround for systemd unit files in distcheck
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:46 +01:00
Joachim Nilsson
7937cd0f55 test: Include new fwd.sh test in dist
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:28 +01:00
Joachim Nilsson
e45d7d0671 test: No need to export MSG variable
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 11:07:15 +01:00
Joachim Nilsson
c7122811fb Remove files that are no longer needed
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 10:08:14 +01:00
Joachim Nilsson
ac8b8ebf0d klogd.8: Remove wording on role and superiority over syslogd
For most use-cases a kernel with CONFIG_KALLSYMS and a stand-alone
syslogd is sufficient.  No need for the complexity of klogd.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:59:18 +01:00
Joachim Nilsson
49968d977e syslogd.8: Update section on SECURITY and .conf differences
- We have the -a PEER and -s to limit exposure to remote attacks
- Mention include file syntax in .conf file differences section
- Mention SECURITY section in BUGS, there are countermeasures

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:44:15 +01:00
Joachim Nilsson
8dda39c382 logger.1: Clarify use of stand-alone log file
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:24:23 +01:00
Joachim Nilsson
245dea43bc test: Sender randomizes port, allow any in FWD test syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 09:11:53 +01:00
Joachim Nilsson
6bf74351c7 Final touches to ChangeLog for v2.0 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:58:41 +01:00
Joachim Nilsson
a2d88e732e Update feature list and add <PRI> field to logo :)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:58:16 +01:00
Joachim Nilsson
f44a026d86 syslogd: Fix broken wallmsg(), off-by one iov
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:31:46 +01:00
Joachim Nilsson
bd5903509d syslogd: Fix RFC3164 formatting, no space after <PRI> field
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-15 08:26:21 +01:00
Joachim Nilsson
7343c55f6e test: Shift delay to *really* wati for tshark to start before logging
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:40:33 +01:00
Joachim Nilsson
fcded43abf test: Add FWD test, two syslog daemons, a custom port and RFC5424
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:36:41 +01:00