Commit Graph

840 Commits

Author SHA1 Message Date
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
Joachim Nilsson
eb524bf8da syslogd: Minor man page update after last command line change
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-14 01:20:00 +01:00
Joachim Nilsson
09f6b7bf6c syslogd: Minor, don't log to console when exiting ...
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 19:13:49 +01:00
Joachim Nilsson
54edca09d9 syslogd: Close open UNIX and inet sockets on SIGTERM
When creating Inet sockets we may get multiple struct addrinfo records.
With this patch we support up to 16 records per Internet peer.  When
closing we iterate over all peers and all records.

Refactor socket_close() to clean up any lingering socket path when
closing UNIX socket.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 19:11:34 +01:00
Joachim Nilsson
4192e543a5 syslogd: Use common nomenclature for next pointer
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 18:44:01 +01:00
Joachim Nilsson
6350bf2474 syslogd: Fix invalid free(), found by Valgrind
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 18:44:01 +01:00
Joachim Nilsson
b0ff1aa5c7 Travis-CI: Fix build w/o messing up example code build
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:54:35 +01:00
Joachim Nilsson
e373165a3a Revert "Travis-CI: Disable clang for Coverity Scan run"
This reverts commit 113168f53a.
2019-11-13 17:28:04 +01:00
Joachim Nilsson
1599eb904f Travis-CI: Use DESTDIR instead of --prefix to work-around systemd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:26:46 +01:00
Joachim Nilsson
113168f53a Travis-CI: Disable clang for Coverity Scan run
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:19:20 +01:00
Joachim Nilsson
0f0f8f845d syslogd: Add FreeBSD and NetBSD -n flag to disable DNS query
This patch re-adds the -n flag, but now to disable DNS reverse-query for
all incoming messages.  This can potentially speed up logging a lot for
small/embedded systems that act as log sink.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:16:51 +01:00
Joachim Nilsson
cf9d281e5b syslogd: Adopt FreeBSD -F instead of -n to run in foreground
This change will probably break most installations.  We do this to free
up '-n' for use as disabling DNS lookups, from FreeBSD *and* NetBSD.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 17:08:47 +01:00
Joachim Nilsson
9d415f313f syslogd: Add FreeBSD -k option to allow LOG_KERNEL facility messages
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 16:44:51 +01:00
Joachim Nilsson
c465f340bc syslogd: NetBSD/FreeBSD -T option, log remote msgs with local time
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 16:16:23 +01:00
Joachim Nilsson
12fa1f6682 syslogd: Accept pre-RFC3164 formatted messages from remote hosts
This patch makes us wire-compatible with older versions of ourself, and
current versions set up to use default remote format.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2019-11-13 16:09:20 +01:00
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