Commit Graph

782 Commits

Author SHA1 Message Date
Joachim Nilsson
760ec4cc36 Fix too small destination buffer in snprintf() call, found by GCC 8
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-10-12 11:34:11 +02:00
Joachim Nilsson
d754f91a66 Update GPL to latest revision, FSF address change + minor fixups
This patch updates the sysklogd local copy of the GPL to the official
new/upstream GPL v2 license.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-10-12 10:42:24 +02:00
Joachim Nilsson
3a74817df2 Update ChangeLog and bump version for v1.6 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 17:32:25 +02:00
Joachim Nilsson
d69f6d3e87 Merge branch 'gzip-rotated-files' 2018-09-25 17:31:52 +02:00
Joachim Nilsson
ea24aa5378 Usability, size modifiers to log rotate: 100k:5, 1G:3, and 100M:5
This applies to both the command line '-b SIZE' option and the
optional per log file setting.  Modifiers supported are: k, M, G

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 17:27:24 +02:00
Joachim Nilsson
98f6f3ae3d Minor, spelling
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 10:16:17 +02:00
Joachim Nilsson
ab24b2efff Add configurable retry timeout for remote syslog servers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 10:10:28 +02:00
Joachim Nilsson
141b3d5c7c Update man pages with info on new per-file log rotation settings
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 09:39:16 +02:00
Joachim Nilsson
179a137a1d Update ReadMe and ChangeLog for upcoming v1.6 release
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-24 20:11:29 +02:00
Joachim Nilsson
3039c285e3 Add missing getopt.h include
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-24 20:06:24 +02:00
Joachim Nilsson
234cd4e669 Add required feature flags for when building with -std=c11
These feature flags are required to build with modern GCC that default
to newser C standard.  However, we should never enforce a standard on
the user -- there are far too many old/embedded systems out there with
very old toolchains that just want bug fixes and minor features for an
otherwise stable system.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-24 20:06:24 +02:00
Joachim Nilsson
84437f88e3 Avoid for loop initial declarations
May need to build on/for systems with quite old GCC version.  Also,
fixes build on Travis-CI.  (Enabling C99 brings in a lot of other
warnings that we'll take care of at a later stage.)

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-24 17:28:26 +02:00
Joachim Nilsson
bc92e860ef Initial support for per log file rotate size:count as last arg.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-24 17:03:54 +02:00
Joachim Nilsson
01a46ae8cc Compress rotated files >= .1, keep .0 uncompressed
This patch adds support for rotating compressed files as well as
compressing (gzip) all files older than .1.

Props goes to @Znahoj for the first prototype implementation made at
Westermo.  Only minor changes to his draft were made.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-24 14:17:28 +02:00
Joachim Nilsson
5a32c5a66c Add pointers to service man pages in unit files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 19:20:17 +02:00
Joachim Nilsson
2ceaab2a1d Run syslogd and klogd in foreground under systemd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 19:18:40 +02:00
Joachim Nilsson
cda4c6a037 Integrate systemd unit files with paths from configure
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 19:15:44 +02:00
Joachim Nilsson
9829309bc4 Add basic systemd unit files
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 19:07:57 +02:00
Joachim Nilsson
aef7e07704 Refactor, use NULL and not (char *)0 and similar
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 19:02:25 +02:00
Joachim Nilsson
2e84a34758 Refctor, simplify return statements, no parenthesis needed
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 18:59:50 +02:00
Joachim Nilsson
f1f1ee3563 Reindent to Linux KNF
Most of the code base seemed to follow Linux style, loosely.  This patch
brings it all together.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 18:55:56 +02:00
Joachim Nilsson
53c4dd817d Fix archaic #include statements, for building with musl libc
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 16:51:13 +02:00
Joachim Nilsson
9f21a8a0f5 Refactor, replace reserved dprintf() with logit()
dprintf() was standardized by POSIX.1-2008.  This patch replaces
all occurrences with logit().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-05 16:39:31 +02:00
Joachim Nilsson
ea586826be Flip logic to simplify code a bit
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 09:22:17 +02:00
Joachim Nilsson
0f01cf7cff Update usage, klogd probes for a System.map file by default
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 09:16:47 +02:00
Joachim Nilsson
d222e82d83 Add --with-syslogd-pidfile=FILE configure option
This enables the same functionality as the old build system, only
slightly more flexible since you don't need to edit the Makefile.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 09:07:36 +02:00
Joachim Nilsson
38651d9322 Add --with-klogd-delay=SEC configure option
This enables the same functionality as the old build system, only
slightly more flexible since you don't need to edit the Makefile.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 08:53:33 +02:00
Joachim Nilsson
2b1dd66f0f Add missing syslog.c define from conversion to GNU configure & build
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 08:45:45 +02:00
Joachim Nilsson
0f4d458a59 Prop up usage text and launch on -? for both klogd and syslogd
Also, avoid returning error when user actually requests help.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 08:10:38 +02:00
Joachim Nilsson
a08b8ee38a Add missing '*' to Emacs local variables indentation hinting
A local variables section must start with /** otherwise Emacs will
prompt the user every time if the settings should be applied.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 01:32:33 +02:00
Joachim Nilsson
d7bfb2c66f Activate built-in log rotation feature, disabled by default
Basically just removes the #ifdef blocks around the code.  With the
feature disabled by defult this should be safe.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-03 00:58:42 +02:00
Joachim Nilsson
1a42935c2f Document log rotation command line options
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:47:21 +02:00
Joachim Nilsson
614cb78aef Install ChangeLog.md and example syslog.conf in doc/ and add to dist
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:30:11 +02:00
Joachim Nilsson
2fda4352ea Remove doc_DATE fro src/Makefile.am, archived now
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:29:45 +02:00
Joachim Nilsson
83fda541e2 Rename and do initial conversion to Markdown
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:26:22 +02:00
Joachim Nilsson
fc7e90d25a Archive old docs
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:12:26 +02:00
Joachim Nilsson
5e7883318f Travis-CI: Remove ldd + size, for now
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:10:41 +02:00
Joachim Nilsson
221dc9ca8b Initial support for Travis-CI
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:07:53 +02:00
Joachim Nilsson
e6a88e13ed Replace version.h with auto-generated version from configure script
Also, remove DEBRELEASE, no longer a package with Debian focus, and add
'v' before version number in logs/usage text.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 23:02:49 +02:00
Joachim Nilsson
363b9a2201 Add new project README, with background and rationale
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 22:52:40 +02:00
Joachim Nilsson
880cb2aa4d Relocate files to man/ and src/ and change to GNU configure & build
- Relocate all source files to src/ and manual pages to man/
- Replace static Makefile with GNU configure and build system

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 22:52:40 +02:00
Joachim Nilsson
f4110c8571 Enable configuration of INET_SUSPEND_TIME from build system
When sysklogd is built with SYSLOG_INET the user can now optionally also
define the INET_SUSPEND_TIME.  The default is 180 sec, which may be a
bit too long for some systems.

In practice when a system comes up syslogd+klogd starts before all other
processes, even those that bring up the network, so waiting 3 minutes
before trying again to send to a remote syslog server would mean losing
a lot of info from the bootstrapping of a system.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:40:59 +02:00
Joachim Nilsson
a09150a061 Touch PID file on SIGHUP to ACK signal
When used with Finit a daemon is expected to acknowledge SIGHUP
by touching its PID file.  Finit can do this by itself, however,
but having native support for this in sysklgod is highly useful.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:37:02 +02:00
Joachim Nilsson
9c2d0cb9fc Ignore backed up console, continue writing when its unclogged
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:28:38 +02:00
Joachim Nilsson
678b309f71 Merge FreeBSD socket receive buffer size patch, SVN r259368
https://svnweb.freebsd.org/base/stable/10/usr.sbin/syslogd/syslogd.c?r1=256281&r2=259368

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:24:42 +02:00
Joachim Nilsson
b3aa3f4830 Add basic .gitignore file
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:16:29 +02:00
Joachim Nilsson
039bd99d10 Add support for built-in log rotation from BusyBox syslogd
Port log rotation from BusyBox syslogd, see SYSLOG_ROTATE_FILES.
This adds support for -b and -c options for size and rotate count.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:15:14 +02:00
Joachim Nilsson
aeba1d31b7 Fix build error with GCC v7.3, wait3() takes an int *status
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-08-02 15:12:59 +02:00
Joey Schulze
9abddd6b55 Document changes 2014-10-04 21:44:28 +02:00
mancha
5b156a9033 Bugfix against minor vulnerability caused by invalid PRI value (CVE-2014-3634)
Rainer Gerhards, rsyslog project leader, discovered an issue in rsyslogd
where invalid priority values can trigger DoS and potentially RCE.

As his analysis reveals, the cause of the problem identified in rsyslog's
rsyslogd also exists in sysklogd's syslogd (from which rsyslogd was forked)
and stems from the use of a (LOG_FACMASK|LOG_PRIMASK) mask to detect invalid
priority values.

In sysklogd's syslogd, invalid priority values between 192 and 1023 (directly
or arrived at via overflow wraparound) can propagate through code causing
out-of-bounds access to the f_pmask array within the 'filed' structure by up
to 104 bytes past its end. Though most likely insufficient to reach
unallocated memory because there are around 544 bytes past f_pmask in 'filed'
(mod packing and other differences), incorrect access of fields at higher
positions of the 'filed' structure definition can cause unexpected behavior
including message mis-classification, forwarding issues, message loss,
or other.

This patch imposes a restriction on PRI message parts and requires they
be properly-delimited priority value strings that have non-negative
numerical values not exceeding 191. As before, sysklogd's syslogd permits
zero padding to not break compatibility with RFC-non-compliant loggers that
issue PRIs such as <0091>. Messages without well-formed PRI parts get
logged with priority user.notice (13). (c.f. RFC 3164)

Thanks to Rainer Gerhards for the initial report and analysis.
2014-10-04 21:34:41 +02:00