81 Commits

Author SHA1 Message Date
Rainer Gerhards
a9dd12b967
queue: permit ability to double size at shutdown
This prevents message loss due to "queue full" when re-enqueueing data
under quite exotic settings.

see also https://github.com/rsyslog/rsyslog/issues/3941#issuecomment-549765813
closes https://github.com/rsyslog/rsyslog/issues/4020
2020-03-03 16:14:31 +01:00
Rainer Gerhards
cbcaf2c7e5
core: add global parameter "security.abortOnIDResolutionFail"
This parameter controls whether or not rsyslog aborts when a name ID
lookup fails (for user and group names). This is necessary as a security
measure, as otherwise the wrong permissions can be assigned or privileges
are not dropped.

CHANGE OF BEHAVIOR
The default for this parameter is "on". In previous versions, the default
was "off" (by virtue) of this parameter not existing. As such, existing
configurations may now error out.

We have decided to accept this change of behavior because of the potential
security implications.

closes https://github.com/rsyslog/rsyslog/issues/4164
2020-02-11 12:54:19 +01:00
Rainer Gerhards
55d4c7dbf2
imrelp: fix cosmetic race in recently-added code
It is extremely unlikly that the race could have caused harm, except
during test runs with thread sanitizer (TSAN) enabled.
2019-08-05 09:31:18 +02:00
Rainer Gerhards
0b2477a9f5
imrelp bugfix: hang after HUP
termination condition was not properly checked; this lead to
premature termination after patch 1c8712415b9 was applied.

It is open to debate if patch 1c8712415b9 changed the module
interface. Actually it looks like this was previously not
well thought out.

closes https://github.com/rsyslog/rsyslog/issues/3760
2019-07-31 10:35:58 +02:00
Rainer Gerhards
68686a3a51 debug: add instrumentation to investigate 8.1905.0 regression
see also https://github.com/rsyslog/rsyslog/issues/3686
2019-06-21 09:33:06 +02:00
Rainer Gerhards
160f2d7a52
new global config parameter "internalmsg.severity"
permits to specify a severity filter for internal message. Only
messages with this severity level or more severe are logged.

Orignally this was done in rsyslog.conf as usual: you can filter
rsyslog messages on severity, just like any other. But with systemd,
we now emit primarily to the journal, and this is outside of rsyslog's
rule engine and so regular filters do not apply (at least in regard
to the journal). Logging to journal is good, because finally
folks begin to see the messages (traditional distro configs discard
them, for whatever is the reason).

This commit implements a global setting for a severity-based filter
for internal messages, before submitted to journal. So it's not 100%
of what rsyslog can do, but at least some way to customize.

see also https://github.com/rsyslog/rsyslog/issues/3639
2019-05-07 11:27:08 +02:00
Joan Sala
9315787c6d report child process exit status according to config parameter
Add new global setting 'reportChildProcessExits' with possible values
'none|errors|all' (default 'errors'), and new global function
'glblReportChildProcessExit' to report the exit status of a child
process according to the setting.

Invoke the report function whenever rsyslog reaps a child, namely in:
- rsyslogd.c (SIGCHLD signal handler)
- omprog
- mmexternal
- srutils.c (execProg function, invoked from stream.c and omshell)

Remove redundant "reaped by main loop" info log in omprog.

Promote debug message in mmexternal indicating that the child has
terminated prematurely to a warning log, like in omprog.

Closes #3281
2018-12-21 20:29:01 +01:00
Rainer Gerhards
d09416c95f
core: add operating state file capability (new feature)
adds global(operatingStateFile="fn") and related handling (see doc
for details).

closes https://github.com/rsyslog/rsyslog/issues/1721
2018-10-29 15:59:47 +01:00
Rainer Gerhards
e200b2192f add new global config parameter "inputs.timeout.shutdown" 2018-07-27 09:09:38 +02:00
Rainer Gerhards
2656afd4f5
build system: do not disable testbench tests via --disable-liblogging-stdlog 2018-07-02 11:13:05 +02:00
Rainer Gerhards
90308823df core: consistent handling of oversize input messages
In the community we frequently discuss handling of oversize messages.
David Lang rightfully suggested to create a central capability inside
rsyslog core to handle them.

We need to make a distinction between input and output messages. Also,
input messages frequently need to have some size restrictions done at
a lower layer (e.g. protocol layer) for security reasons. Nevertheless,
we should have a central capability

* for cases where it need not be handled at a lower level
* as a safeguard when a module invalidly emits it (imfile is an example,
  see https://github.com/rsyslog/rsyslog/pull/2632 for a try to fix it
  on the module level - we will replace that with the new capability
  described here).

The central capability works on message submission, and so cannot be
circumvented. It has these capabilities:

* overisze message handling modes:
  - truncate message
  - split message
    this is of questionable use, but also often requested. In that mode,
    the oversize message content is split into multiple messages. Usually,
    this ends up with message segments where all but the first is lost
    anyhow as the regular filter rules do not match the other fragments.
    As it is requested, we still implemented it.
  - accept message as is, even if oversize
    This may be required for some cases. Most importantly, it makes
    quite some sense when writing messages to file, where oversize
    does not matter (accept from a DoS PoV).
* report message to a special "oversize message log file" (not via the
  regular engine, as that would obviously cause another oversize message)

This commit, as the title says, handles oversize INPUT messages.

see also https://github.com/rsyslog/rsyslog/issues/2190
closes https://github.com/rsyslog/rsyslog/issues/2681
closes https://github.com/rsyslog/rsyslog/issues/498

Note: this commit adds global parameters:
 * "oversizemsg.errorfile",
   is used to specify the location of the oversize message log file.
 * "oversizemsg.report",
   is used to control if an error shall be reported when an oversize
   message is seen. The default it "on".
 * add global parameter "oversizemsg.input.mode"
   is used to specify the mode with which oversized messages will
   be handled.
2018-05-14 11:24:20 +02:00
Rainer Gerhards
bd6f016db0 add global option internal.developeronly.options
This permits the ability to set some developer-specific behaviour
changes, e.g. for testbench testing or things like this. NEVER to
be used by users.
2018-04-28 12:46:32 +02:00
Rainer Gerhards
b9cac88204 add global config setting shutdown.enable.ctl-c to enable ctl-c
It can be useful to ctl-c out of rsyslog, even if it is started via
-n, especially inside containers.  The new config setting permits
to enable this capability.

closes https://github.com/rsyslog/rsyslog/issues/533
2018-01-08 18:10:47 +01:00
Jan Gerhards
edfc4396a3 core: add parameters debug.file and debug.whitelist
allows to generate debug log output only of specific files
2017-08-08 12:12:39 +02:00
Jan Gerhards
ac9874cf49 core: make rsyslog internal message rate-limiter configurable
closes https://github.com/rsyslog/rsyslog/issues/1670
2017-07-16 13:34:09 +02:00
PascalWithopf
8ceaddde35 imfile: add posibility to truncate msg
closes https://github.com/rsyslog/rsyslog/issues/1552
2017-05-19 12:04:02 +02:00
Radovan Sroka
d649d77cd5 Fixed segfault in glblDoneLoadCnf()
This is caused by uninitialized net static structure in glbl objUse(net)
is not called after start of glbl module.

It looks like it is not possible to use objUse(net) when glbl module
starts. So we call it inside of glblDoneLoadCnf().
2017-02-23 15:11:11 +01:00
Rainer Gerhards
ae20a4d1e9 Revert "Sanitizer longmsg fix2" 2017-02-20 10:21:15 +01:00
Rainer Gerhards
cce49b0f79 core: prevent too-long messages from entering the system
MsgSetRawMsg() did not check max message size. So if an input module
submitted a too-long message, it was silently accepted. This now adds
a check and truncates the message if too long. If not turned off, this
will also be logged as a rsyslog error message.

TODO: currently only partly implemented!
2017-02-16 19:21:00 +01:00
Rainer Gerhards
471f503063 add option "parser.PermitSlashInProgramname"
The new option permits to have slashes inside the programname
property. This is counter the BSD syslog defintitions, but
sometimes useful (e.g. the journal records path names, which
obviously contain slashes).

closes https://github.com/rsyslog/rsyslog/issues/1365
see also https://github.com/rsyslog/rsyslog/issues/1361
2017-01-13 15:08:57 +01:00
Rainer Gerhards
51c03c66e0 make inline functions C99-compliant
As it seems, different C compilers have different rules/interpretations
on inline functions. The current code base did not properly obey all C99
rules. We fix this by converting some functions to macros and others to
include the necessary C99 plumbing. We also remove some inline attributes
for functions where this seems to be to agressive (aka "function to big").

This fixes build problems in some environments and is a general code
cleanup measure.
2016-09-05 16:47:14 +02:00
Rainer Gerhards
070d987a45 fix compiler warnings 2016-06-01 09:49:46 +02:00
Rainer Gerhards
ed3bf185cb implement global parameter "debug.unloadModules"
This permits to disable unloading of modules, e.g.
to make valgrind reports more useful (without a need
to recompile).

implements https://github.com/rsyslog/rsyslog/issues/704
2016-03-03 15:33:05 +01:00
Rainer Gerhards
c7b455524b add "senders.reportNew" global parameter 2016-02-01 17:27:11 +01:00
Rainer Gerhards
af1a845a96 add "senders.keeptrack" global parameters
permits to turn on/off (default) sender tracking and stats
2016-02-01 15:49:17 +01:00
Rainer Gerhards
c0736fe344 emit warning if sender has not been seen for a period of time
controllable via
   global(senders.reportGoneAway="on" senders.timeoutAfter="10")

see also https://github.com/rsyslog/rsyslog/issues/751
2016-02-01 15:07:32 +01:00
Jan Gerhards
9125ddf99d add global parameter "debug.gnutls"
enables GnuTLS indepth debugging
closes https://github.com/rsyslog/rsyslog/issues/219
2015-01-26 16:02:24 +01:00
Rainer Gerhards
7c097d363a bugfixes for maxMessageSize global parameter
closely related, thus done in a single commit:

- bugfix: invalid data size for iMaxLine global property
  It was defined as int, but inside the config system it was declared as
  size type, which uses int64_t. With legacy config statements, this could
  lead to misadressing, which usually meant the another config variable was
  overwritten (depending on memory layout).
  closes https://github.com/rsyslog/rsyslog/issues/205

- bugfix: negative values for maxMessageSize global parameter were permitted
2015-01-13 09:55:42 +01:00
Tomas Heinrich
fddd1d98f4 Make liblogging-stdlog optional
Conflicts:
	configure.ac
	tools/rsyslogd.c
2014-12-03 15:33:26 +01:00
Rainer Gerhards
56b17e6a81 make datetime parser use new tzinfo infrastructure
also do some additons/modifications to infrastructure
2014-07-09 19:34:12 +02:00
Rainer Gerhards
d426ac4af2 new tzinfo config object -- permits to define time zone offsets 2014-07-09 19:11:59 +02:00
Rainer Gerhards
fcf8e953b0 janitor: base functionality given for omfile 2014-05-16 14:22:20 +02:00
Rainer Gerhards
3065e0fbcd add support for specifying the liblogging-stdlog channel spec
new global parameter "stdlog.channelspec"
2014-04-01 12:41:51 +02:00
Nate Brown
87480252e9 Making parser.escapeControlCharactersCStyle in line with the other parser configs 2014-01-28 11:10:38 -08:00
Nate Brown
9aeda6447b Merge remote-tracking branch 'upstream/master' into global_config
Conflicts:
	runtime/glbl.c
2014-01-27 14:11:03 -08:00
Nate Brown
80edcd575b Adding global config support for parser.escapecontrolcharactertab 2014-01-27 11:30:56 -08:00
Nate Brown
f4bdc3673d Adding global config support for parser.escape8bitcharactersonreceive 2014-01-27 11:17:27 -08:00
Nate Brown
a42ef0a122 Adding global config support for parser.spacelfonreceive 2014-01-27 11:09:14 -08:00
Nate Brown
e5f5f73e2b Adding global config support for parser.escapecontrolcharactersonreceive 2014-01-27 11:00:31 -08:00
Nate Brown
59580d3f7d Adding global config support for parser.droptrailinglfonreception 2014-01-27 10:40:38 -08:00
Nate Brown
6711ea4349 Porting over controlcharacterescapeprefix to global parser.controlcharacterescapeprefix 2014-01-24 19:42:17 -08:00
Rainer Gerhards
4b5eba722c Merge branch 'v7-stable-stdlog' into v7-devel
Conflicts:
	runtime/glbl.c
	runtime/glbl.h
	tools/syslogd.c
2014-01-21 12:08:42 +01:00
Rainer Gerhards
ec01259427 add "processInternalMessages" global config parameter 2014-01-21 11:50:06 +01:00
Rainer Gerhards
80be25a5e0 add debug.OnShutdown global parameter 2013-12-11 14:51:53 +01:00
Rainer Gerhards
22ad2d2f0a re-enable legacy $WorkDir for queue spool directory use 2013-12-09 15:51:46 +01:00
Rainer Gerhards
dcee4926b5 re-enable legacy $WorkDir for queue spool directory use 2013-12-09 15:40:20 +01:00
Rainer Gerhards
e82d4c8f3e main_queue() config object added
doc still missing
2013-07-19 13:11:26 +02:00
Rainer Gerhards
53e99a6cff fix invalid function prototypes
regression from yet-unreleased enhancement (RELP IP address setting)
2013-05-13 08:50:06 +02:00
Axel Rau
7369904b57 Add configurable local client IP 2013-05-06 17:42:17 +02:00
Rainer Gerhards
8aad93c582 imuxsock: add capability to ignore messages from ourselfes
This helps prevent message routing loops, and is vital to have
if omjournal is used together with traditional syslog.
2013-02-26 09:58:17 +01:00