Commit Graph

800 Commits

Author SHA1 Message Date
Edward K. McGuire
bcc3c7c1fb Prevent logfile corruption by control codes
Do not corrupt logfiles when kernel messages contain control codes,
notably \n. Instead, preserve the kernel's protective C-style hex
encoding. For example, \n embedded in a message by a kernel-level
facility is received as "\x0a". Kernel-level facilities cannot be
trusted to use only syslog-safe codes in kernel messages. See:
<https://kernel.org/doc/Documentation/ABI/testing/dev-kmsg>
2022-06-16 15:52:04 -05:00
Joachim Wiberg
8f83328850 Fake usec timestamp for RFC3164 messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-05 16:43:20 +02:00
Joachim Wiberg
1e9f164198 Fake usec timestamp for untrusted kernel log messages
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-06-04 18:55:14 +02:00
Joachim Wiberg
4bbed71c29 Move debian/ dir to separate branch to ease packaging downstream
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 19:32:23 +02:00
Joachim Wiberg
7dc4783af8 .github: install valgrind also for release build
We call `make distcheck` in the release build, so the tests run.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 18:41:45 +02:00
Joachim Wiberg
eafde9550d Update ChangeLog and bump version for v2.4.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 18:27:48 +02:00
Joachim Wiberg
dfc32d7843 Fix memory leak on exit
Only to clean up, possibly relevant for no-MMU systems, but
they have other issues as well (e.g. fork) that prevent them
from using the sysklogd project.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 16:59:50 +02:00
Joachim Wiberg
7ff4a7d210 test: reduce verbosity of new test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 16:59:32 +02:00
Joachim Wiberg
715c52dc21 .github: prefix test logs with current compiler
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 16:24:34 +02:00
Joachim Wiberg
abb093c330 .github: create tarball of test logs for upload
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 15:59:02 +02:00
Joachim Wiberg
0d02ba63bb .github: need valgrind for new memleak test
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 15:47:37 +02:00
Joachim Wiberg
d76b78c873 .github: upload test logs as build artifacts
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 15:45:32 +02:00
Joachim Wiberg
47a980728a test: new memleak test using valgrind
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-29 15:45:32 +02:00
Joachim Wiberg
0892914581 Update changelog for upcoming v2.4.0 release
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:50:25 +02:00
Joachim Wiberg
a5bf845118 Enforce 'secure_mode 1' in default syslog.conf file
This disables the "unauthenticated remote disk-filling service" by
default.  A user can easily change this to 0 (or 2) to allow other
systems to log to their syslogd.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:29:43 +02:00
Joachim Wiberg
62dea3aecf Minor, fix missing \n in calls to logit()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:12 +02:00
Joachim Wiberg
477bb40c44 test: new test, verifies .conf option secure_mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:12 +02:00
Joachim Wiberg
075815eeb8 Add support for setting secure_mode=[0,1,2] in .conf file
Logic for secure mode setting in .conf file

 - Command line always wins
 - SIGHUP activates changes

Note, if -s is given on command line it always wins, regardless.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:12 +02:00
Joachim Wiberg
577d20b8da test: use new logger() function in all tests
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
7e1d7bcb06 test: a few more helper functions
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
a453eca4be Minor, rename local variable for consistency
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
4e70aff619 Refactor: add cfkey_match() with new struct cfkey for file options
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
619422b7ed Minor, whitespace fixup
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-22 22:10:11 +02:00
Joachim Wiberg
508ed72bcf Merge branch 'meta-ed-master'
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-14 11:59:45 +02:00
Edward K. McGuire
4f24bce339 Don't skip the <PRI> field in the call to wallmsg()
This is redundant and causes message truncation.  The <PRI> field is
skipped within wallmsg() itself.

Signed-off-by: Edward K. McGuire <metaed@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-05-14 11:58:33 +02:00
Joachim Wiberg
5b48dac64e test: new test to verify facility sorting to custom log file
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-04-08 18:56:30 +02:00
Joachim Wiberg
7825c453c4 Move Gentoo Tip earlier, quicker to find
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-30 21:30:49 +02:00
Joachim Wiberg
13cc1ad5ce Add link to the nice wiki article on the Gentoo wiki
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-30 19:07:45 +02:00
Joachim Wiberg
4fd55cd1ac syslog.conf: disable debug messages by default from /var/log/syslog
Many projects use sysklogd with the shipped syslog.conf as their own
default /etc/syslog.conf.  This is fine of course, but for many small
embedded systems getting all debug messages in the log by default is not
desirable.

This change drops debug messages from /var/log/syslog by default and
recommends admins to use /var/log/debug, or drop the debug filter.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-30 18:56:41 +02:00
Joachim Wiberg
6798fe76d5 Document reason for stat() in opensys()
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-14 06:59:51 +01:00
Joachim Wiberg
889dd1aed9 Merge pull request #47 from sdaoden/keep_mode
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-14 05:55:52 +01:00
Steffen Nurpmeso
45554a54e6 syslogd.c: rotate_file(): do not loose file mode due to rotation 2022-03-14 05:55:27 +01:00
Joachim Wiberg
0b3d379001 Merge pull request #46 from sdaoden/rotate
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-14 05:53:25 +01:00
Steffen Nurpmeso
908f1e6821 test/rotate_all.sh: address Joachim Wiberg comments (pull/46) 2022-03-14 05:52:46 +01:00
Steffen Nurpmeso
0bc4c82bae Test for "Implement forced log file rotation upon SIGUSR2" 2022-03-14 05:52:46 +01:00
Steffen Nurpmeso
949e80f150 Implement forced log file rotation upon SIGUSR2 2022-03-14 05:52:46 +01:00
Joachim Wiberg
23a6d81ea2
Merge pull request #45 from sdaoden/notify
Notify handle

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-14 05:45:17 +01:00
Steffen Nurpmeso
f7abd0d10a test/notify.sh: address Joachim Wiberg's comments (pull/45) 2022-03-12 17:22:18 +01:00
Steffen Nurpmeso
7038e51a0f "notify": address Joachim Wiberg's comments (pull/45) 2022-03-12 17:22:18 +01:00
Steffen Nurpmeso
bc103013cb Test for "Add "notify" keyword" 2022-03-12 15:29:33 +01:00
Steffen Nurpmeso
72f2faef6e Add "notify" keyword 2022-03-12 15:28:02 +01:00
Joachim Wiberg
6022d3c7d0 Fix #49: add support for -8 command line option to allow 8-bit data
This patch allows the user to disable the 8-bit data check in the log
message validator.  If you have experienced problems with logging any
unicode (utf-8) messages after v1.6, this option is for you.

The correct way to handle this is to add proper parser support for the
Unicode BOM, defined in RFC5424[1], as NetBSD syslogd does[2], search
for IS_BOM().

[1]: https://datatracker.ietf.org/doc/html/rfc5424#appendix-A.8
[2]: http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/syslogd/syslogd.c?rev=1.138

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-07 20:57:00 +01:00
Joachim Wiberg
eb6e85e851 test: minor test cleanup and comments
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 01:10:32 +01:00
Joachim Wiberg
13b1fd0aa0 test: minor, shellcheck fixes
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 01:10:32 +01:00
Joachim Wiberg
0a99c7f386 test: minor aesthetic, slightly improve test logging
Conforming tests should use SKIP/FAIL/OK, so let existing tests follow
that better.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 01:02:03 +01:00
Joachim Wiberg
f29f31340c test: refactor and generalize setup(), adding a setup2()
This patch refactors the way the primary and secondary syslogd is
started by the test framework.  The generalizations not only make the
code more readable, it hopefully also makes it easier to add new tests
in the future.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 00:56:03 +01:00
Joachim Wiberg
7707715c78 man: update '-b' option description to match '-a' and usage text
The usage text (syslogd -?) and the syslogd.8 man page was not in sync
wrt. the -b option.  This patch updates it to match the layout of -a,
the -a option is also slightly updated.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-06 00:49:25 +01:00
Joachim Wiberg
aceb4cddcf Add missing -H option to usage text, issue #41
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-05 18:37:49 +01:00
Joachim Wiberg
99028414c3 test: run all syslogd with kernel logging disabled
Since we currently cannot test kernel logging, and we don't want to risk
any log messages from the kernel to suddenly pop up and disturb tests,
this patch explicitly disables it.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-05 16:33:52 +01:00
Joachim Wiberg
e4330515e8 Disable KernLog in container
No need to save seqno when we've detected being in container and have
disabled kernel logging.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
2022-03-05 15:31:46 +01:00