Commit Graph

521 Commits

Author SHA1 Message Date
Joachim Nilsson
06b26aae7b syslogd: Reformat usage text a bit for readability, hopefully
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 15:16:05 +01:00
Joachim Nilsson
0c61fe73f2 logger: Sort options in usage text alphabetically
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 14:49:05 +01:00
Joachim Nilsson
62137926ec syslogd: Add support for FreeBSD -a allowed_peer filtering
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 14:48:49 +01:00
Joachim Nilsson
05f14d8366 Massive cleanup and simplification of syslogd man page
Most of the functionality in syslogd is now up to par with NetBSD and
FreeBSD syslogd.  Lots of syklogd project features have been removed and
syslog in itself is nothing new and surprising, so much of the text can
be greatly simplified or just removed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 11:55:17 +01:00
Joachim Nilsson
3b6199aaef Drop --with-syslogd-pidfile from configure, use -P option to syslogd
This patch drops the configure flag --with-syslogd-pidfile=foo since
syslogd now natively supports custom PID file using -P foo.

Also, the default PID file and syslog.conf paths have been changed from
the hard-coded /var/run (_PATH_VARRUN) and /etc to use configure paths.
This may not be appreciated by everyone but allows the project to have
support for all use-cases in a de facto standard fashion.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 11:52:15 +01:00
Joachim Nilsson
4b175653cb syslogd: Fix formatting of usage text, and spell check
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 10:27:39 +01:00
Joachim Nilsson
c2d9f80859 syslogd: Drop -h flag, does not do anything since 353cd10
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 10:22:15 +01:00
Joachim Nilsson
18f9611d3e Install systemd unit files, follow-up to cda4c6a
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 10:18:10 +01:00
Joachim Nilsson
31630f73cc Mention klogd now is optional and rest of project is 3-clause BSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 10:09:41 +01:00
Joachim Nilsson
5b2d9d313d Revert "Travis-CI: Disable clang temporarily for Coverity Scan run"
This reverts commit e1f9a1a566.
2019-11-13 09:58:05 +01:00
Joachim Nilsson
4a9b9b7756 Travis-CI: Simplify, syslogd now continues if /proc/kmsg is missing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 09:57:15 +01:00
Joachim Nilsson
45c7dcc6df syslogd: Only warn when opening /proc/kmsg fails, continue anyway
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 09:55:33 +01:00
Joachim Nilsson
353cd10a06 Refactor, graft in FreeBSD fprintlog_first() & fprintlog_successive()
This patch looks big, but it's really just fprintlog() being split up
into three new functions: fprintlog_first() & fprintlog_successive() and
fprintlog_write().  Similar to how the FreeBSD syslogd is structured.

In the refactoring process Joey's proxy-prevention was removed.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 09:43:57 +01:00
Joachim Nilsson
ef22d6dbe9 Travis-CI: Run unit tests with klogd enabled, add 2nd pass
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 08:34:46 +01:00
Joachim Nilsson
d6370aeb1f Follow-up to 69608f7: Update API test with TAG formatting change
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 08:31:36 +01:00
Joachim Nilsson
97dfe638b4 Fix uninitialized variable, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 08:16:14 +01:00
Joachim Nilsson
0555e0989f Fix suspicius code for allocating a sockaddr_un to a sockaddr ptr
Remarked on by Coverity Scan.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 08:14:48 +01:00
Joachim Nilsson
e1f9a1a566 Travis-CI: Disable clang temporarily for Coverity Scan run
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 23:50:48 +01:00
Joachim Nilsson
69608f7158 syslogd: Fix RFC3164 TAG formatting when no PID is included
This patch fixes the omission of final ':' following a content TAG when
an app-name without a process ID is included.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 16:42:44 +01:00
Joachim Nilsson
d92f8466f8 syslogd: Minor refactor, move init code from main() to init()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 16:42:44 +01:00
Joachim Nilsson
823bb4cf2a Support for building the project w/o separate klogd (default)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 16:42:44 +01:00
Joachim Nilsson
0455da805f syslogd: Rename -R flag to -r, same as logger tool
Now that we've dropped the previous -r flag we can rename the rotation
flag so it's the same between both logger and syslogd.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:30:25 +01:00
Joachim Nilsson
6ac6abe60e test: Verify new secure mode, and remote log to default port
It's a lot easier to debug the remote test with Wireshark if we log to
the default service port on the remote host.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
11ab6c55bc test: Don't overwrite bar.conf
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
2f72a17b8e syslogd: If system has SO_REUSEPORT, use it
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
095aa56996 Minor, don't touch PID file on SIGHUP in debug mode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
f606667038 syslogd: Add support for FreeBSD -s, secure mode
- Update man page
- Enable -s in default systemd service settings
- Add support for SecureMode, with shutdown()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
d607d6b845 syslogd: Update usage text and man page for new -b flag, drop -r
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
762e09d7e8 syslogd: Drop -l HOST flag, the RFCs are very clear on this point
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
d1035377cc syslogd: Drop -s HOST flag in favor of future BSD SecureMode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:02 +01:00
Joachim Nilsson
4ee6211277 syslogd: Refactor internals to use new socket API
This patch is inspired, in part, by FreeBSD syslogd but now diverges
onto its own path.  Special handling for AF_UNIX sockets are required
on Linux, which unlike BSD cannot use getaddrinfo() on UNIX sockets.

- Rip out old funix[] and finet support
- Add new concept of peers
- Linked list of peers can be > 20
- Temporarily open up to accept all remote conns
- Remove old logerror(), replaced with new log macros

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:01 +01:00
Joachim Nilsson
07677c78a5 Graft struct addrinfo support on top of new socket API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 13:28:01 +01:00
Joachim Nilsson
a4c1acbca8 syslogd: Drop -r flag, to be replaced with BSD -s (secure) flag
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 09:19:54 +01:00
Joachim Nilsson
c66411e8c2 Use new log macros and err.h fns
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-12 08:56:06 +01:00
Joachim Nilsson
53c2d0e3d9 Export flog() function and define new log macros ERR(), WARN(), etc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-11 18:52:00 +01:00
Joachim Nilsson
90fb520c06 Add socket helper functions from SMCRoute, licesened as 3-clause BSD
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-10 11:22:14 +01:00
Joachim Nilsson
c31a7d1031 Minor refactor/cleanup
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-10 09:35:01 +01:00
Joachim Nilsson
a2feba69e2 Allow klogd to send LOG_KERN messages to syslogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-09 11:46:56 +01:00
Joachim Nilsson
b15420fdc5 syslogd: Inherit parsed PRI value in RFC3164 front-end
The RFC5424 front-end already does this.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-09 11:23:03 +01:00
Joachim Nilsson
9aaa7ec8c4 syslogd: Install SIGHUP handler earlier
When a heavily loaded system starts up syslogd may not in time reach its
original installation of the SIGHUP handler before receiving the signal.
It will then die and have to be restarted by PID 1.

This patch installs the SIGHUP handler early, with all the other signals
right after command line parsing.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 16:15:29 +01:00
Joachim Nilsson
9ed0fe672a Bump version for second release candidate
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 16:04:04 +01:00
Joachim Nilsson
dd5b470342 Fix assert when buffer->hostname == NULL at startup
Default to use 'from' in RFC3164 parser, just like the RFC5424 parser
already does.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 15:50:09 +01:00
Joachim Nilsson
0435139ec9 man: Formatting fixes for readability
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:56:16 +01:00
Joachim Nilsson
625a0d4abc Relicense example code/readme/makefile as public domain
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:43:37 +01:00
Joachim Nilsson
1546d3ce94 Bump version for v2.0-rc1 release candidate
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:23:33 +01:00
Joachim Nilsson
9a3d5b6a4d Mention syslogp() code example and Dr. Wettstein's formative work
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 13:21:41 +01:00
Joachim Nilsson
307dcd073e Revert "Disable clang in Coverity Scan run"
This reverts commit bafdb29743.
2019-11-08 12:39:45 +01:00
Joachim Nilsson
fbb7c5ce86 Minor, same look for contact information as previous maintainers
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 12:37:47 +01:00
Joachim Nilsson
0a3c5e1544 syslogd: Update usage text, drop -a add -b and simplify
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 08:50:17 +01:00
Joachim Nilsson
3377f07a5a klogd: Update usage text, no more -i or -I
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-08 08:50:17 +01:00