3579 Commits

Author SHA1 Message Date
Rainer Gerhards
4a63f8e962
rscript fix: ruleset called async when ruleset had queue.type="direct"
The call rscript statement is able to call a rule set either synchronously or
asynchronously. We did this, because practice showed that both modes
are needed. For various reasons we decided to make async
calls if the ruleset has a queue assigned and sync if not.

To know if a "queue is assigned" we just checked if queue parameters were
given. It was overlookeded the case of someone explicitly specifying a
"direct  queue", aka "no queue". As such, queue="direct" triggered async
calls. That in turn meant that when a write operation to a variable was
made inside that rule set, other rulesets could or could not see the
write. While if was often not seen, this was a data race where the
change could also be seen by the outside.

This is now fixed. No matter if queue.type="direct" is specified or
left out, the call will always by synchronous. Any values written to
variables will also be seen by the "outside world" in later processing
stages.

Note that this has some potential to BREAK EXISTING CONFIGURATIONS.
We deem this acceptable because:

1. this was racy at all, so unexpected behaviour could alwas occur
2. it is actually unlikely that someone used the triggering conditions
   in practice. But we can not outrule this, especially when the
   configuration was auto-generated.

Potential compatibility issues can be solved by defining a small
array-memory queue on the ruleset in question instead of specifying
direct type.

Again, we expect that almost all users will never experience any
problems. If you do, however, please let us know: we may add an
option to re-enable the bug.
2021-10-11 15:07:16 +02:00
Rainer Gerhards
ed512aa18a
Merge pull request #4692 from alorbach/pr-issue-4686
openssl: Correct gnutlsPriorityString (custom ciphers) behaviour
2021-10-11 15:00:24 +02:00
Rainer Gerhards
c54b0989c0
build issue: handle undefined MAXPATHLEN, PATH_MAX
While we handled missing PATH_MAX, we did not handle missing MAXPATHLEN.
This happens under GNU/Hurd, because there is no official limit. However,
extremely long pathes are extremely uncommon, so we do not want to
use slow dynamic alloc each time we need to build pathes. So we
impose a limit of 4KiB, which should be fairly enough. Note that
this obviously increases stack requirements in GNU/Hurd.

As suggested by Michael Biebl, we have now implemented a generic
approach to handle this via autoconf.
2021-10-11 10:10:06 +02:00
edc1b186c1 openssl: Correct gnutlsPriorityString (custom ciphers) behaviour
- Only apply default anon ciphers if gnutlsPriorityString is NULL and
  Authentication Mode is set to anon. Otherwise we do not set them
  as they overwrite custom Ciphers.
- Added two tests for custom cipher configuration (anon/certvalid mode).
- Add call for applyGnutlsPriorityString if gnutlsPriorityString changes.
- Merged openssl init code from Connect into osslInitSession

closes: https://github.com/rsyslog/rsyslog/issues/4686
2021-09-21 11:21:14 +02:00
dddcc9df90 openssl: extended output information on connection failure
Now includes the remote client/server IP address in the log output.

closes: https://github.com/rsyslog/rsyslog/issues/4680
2021-09-08 15:59:00 +02:00
Rainer Gerhards
9f1f11bb96
Merge pull request #4666 from Egston/fix-imuxsock-ratelimit
imuxsock: fix rate limiting not working in default configuration
2021-09-07 09:43:17 +02:00
Rainer Gerhards
640b936117
Merge pull request #4673 from rgerhards/i4670
core bugfix: use of property $wday terminates string
2021-09-07 09:41:08 +02:00
74a49d3b63 queue: Add NULL check in qDeqLinkedList
Add NULL value handling for pDeqRoot. This caused seqfaults if
messages were discarded during dequeue.

Also fix iOverallQueueSize calculation (discarded items) in imdiag.

While building a testcase for issue #4437 , I discovered an issue with the
iOverallQueueSize counter not being substracting discarded messages. This caused
the testcase to fail with testcase timeout at the count of "discardMark" queue
setting.

closes: https://github.com/rsyslog/rsyslog/issues/4437
2021-09-06 16:02:40 +02:00
Rainer Gerhards
bd420481cb
core bugfix: use of property $wday terminates string
When $wday is used inside a template, all template parts after it
are ignored. For exmaple:
template(name="json_filename" type="string" string="/var/log/%$wday%.log")
would generate something like "/var/log/0" - the ".log" part would be
missing. For the same reason, $wday can not reliably checked in script
filters.

Thannks to Alain Thivillon for reporting the bug and providing an
excellent analysis, which essentiellay was exactly this fix here.

closes https://github.com/rsyslog/rsyslog/issues/4670
2021-09-06 11:26:14 +02:00
alakatos
4f9f3af2eb gnutls: Propagate PrioritizeSAN when accepting a new connection 2021-09-02 14:43:08 +02:00
Petr Gajdůšek
d69420a6a1 ratelimit: fix rate limiting for already parsed messages
Rate limiting may not have worked if the considered message had already
been parsed (not having NEEDS_PARSING in msgFlags).

This affects also imuxsock in its default configuration
(useSpecialParser="true" and ratelimit.severity="1")

A test for imuxsock is included which requires
./configure --enable-liblogging-stdlog
2021-08-25 17:33:17 +02:00
Rainer Gerhards
6080121ab7
config: implement script-equavalent for $PrivDrop* statements
closes https://github.com/rsyslog/rsyslog/issues/891
2021-08-23 14:10:16 +02:00
139057ff80 openssl tls: Improved error message output on tls failures.
closes: https://github.com/rsyslog/rsyslog/issues/4645
2021-08-16 09:47:35 +02:00
Rainer Gerhards
0c9b169a64
Merge pull request #4612 from n2yen/dev2-percentile
Percentile module to track percentile metrics via impstats
2021-08-16 08:31:21 +02:00
Rainer Gerhards
d93c5e9d48
imfile bugfix: hash char invalidly added in readmode != 0
If imfile is ingesting log files with readMode set to 2 or 1, the resulting
messages all have a '#' character at the end. This patch corrects the behaviour.

Note: if some external script "supported" the bug of extra hash character at
the end of line, it may be necessary to update them.

closes https://github.com/rsyslog/rsyslog/issues/4491
2021-08-09 12:38:06 +02:00
Rainer Gerhards
38856e6989
Merge pull request #4628 from rgerhards/ci-add-test
CI: add test for imtcp not correctly starting up
2021-08-09 09:29:34 +02:00
Rainer Gerhards
be22ec54ad
CI: add test for imtcp not correctly starting up and a Solaris fix
Test should have been added to commit 3d23c7ac8aea but was forgotten.

This test also showed an issue on Solaris, where NULL values cannot
be used in printf functions. This has also been addressed.

see also: https://github.com/rsyslog/rsyslog/pull/4627
2021-08-06 12:42:58 +02:00
Rainer Gerhards
39e81e133b
omfwd: add capability for action-specific TLS certificate settings
This permits to override the global definitions for TLS certificates
at the action() level.
2021-08-06 09:00:24 +02:00
Rainer Gerhards
13f5dfe2e2
imtcp: permit to use different certificate files per input/action 2021-08-04 10:23:24 +02:00
Rainer Gerhards
ad08ed2634
openssl network driver bugfix: small memory leak
Fixes a static, non-growing memory leak which existed when parameter
"GnutTLSPriorityString" was used. This was primarily a cosmetic issue,
but caused some grief during development in regard to memory leak
detectors.

Note: yes, this is for openssl -- the parameter name is history ;-)
2021-07-08 14:30:50 +02:00
Rainer Gerhards
0a2702df92
Merge pull request #4627 from rgerhards/fix-imtcp-no-startup
tcpsrv bugfix: abort if no listener could be started
2021-07-07 14:38:39 +02:00
Rainer Gerhards
3d23c7ac8a
tcpsrv bugfix: abort if no listener could be started
Modules (like imtcp and imdiag) which use tcpsrv could abort or
otherwise malfunction if no listener for a specific input could
be started.

Found during implementing a new feature, no report from practice.
But could very well happen.
2021-07-07 13:16:28 +02:00
Rainer Gerhards
0df769e2dc
fix typo in error message 2021-07-01 11:35:46 +02:00
Nelson Yen
91a2049877
percentile module to track percentile metrics via impstats
Brief overview:
TO configure tracking percentile metrics in rainerscript:
User would need to define:
  - which percentile to track, such as [p50, p99, etc.]
  - window size - note, this correlates directly with memory usage to
  track the percentiles.

To track a value, user would call built-in function `percentile_observe()` in their configurations to
record an integer value, and percentile metrics would be emitted every
impstats interval.
2021-06-23 00:14:39 -07:00
Rainer Gerhards
1aa1979179
Merge pull request #4605 from rgerhards/i4384
add predefined template RSYSLOG_SyslogRFC5424Format
2021-06-17 09:49:06 +02:00
Rainer Gerhards
e6a730f1bb
Merge pull request #4601 from rgerhards/fix-sender-stats
bugfix: _sender_stats reports integer counter as string
2021-06-17 09:40:39 +02:00
Rainer Gerhards
29b1493cb7
add predefined template RSYSLOG_SyslogRFC5424Format
This is essentially the same as RSYSLOG_SyslogProtocol23Format with
a better name and a fix to remove the unnecessary LF at the end of
the message.

The different name also enables us to fix the LF issue without
any concern about backwards compatibility.

closes https://github.com/rsyslog/rsyslog/issues/4384
2021-06-14 13:54:32 +02:00
Rainer Gerhards
7fb25a2306
bugfix: _sender_stats reports integer counter as string 2021-06-14 13:10:31 +02:00
Rainer Gerhards
50da918ae0
new global option "parser.supportCompressionExtension"
This permits to turn off rsyslog's single-message compression extension
when it interferes with non-syslog message processing (the parser
subsystem expects syslog messages, not generic text)

closes https://github.com/rsyslog/rsyslog/issues/4598
2021-06-09 14:05:44 +02:00
Rainer Gerhards
a08591be5d
imtcp: add stream driver parameter to input() configuration
This permits to have different inputs use different stream drivers
and stream driver parameters.

closes https://github.com/rsyslog/rsyslog/issues/3727
2021-05-05 12:57:09 +02:00
Rainer Gerhards
89be1d86d5
imtcp: permit to run multiple inputs in parallel
Previously, a single server was used to run all imtcp inputs. This
had a couple of drawsbacks. First and foremost, we could not use
different stream drivers in the varios inputs. This patch now
provides a baseline to do that, but does still not implement the
capability (in this sense it is a staging patch).

Secondly, we now ensure that each input has at least one exclusive
thread for processing, untangling the performance of multiple
inputs from each other.

This is part of the patch series to enable different driver
configurations for imtcp.

see also: https://github.com/rsyslog/rsyslog/issues/3727
2021-04-27 12:30:28 +02:00
Rainer Gerhards
b160813f82
tcpsrv bugfix: potential sluggishnes and hang on shutdown
tcpsrv is used by multiple other modules (imtcp, imdiag, imgssapi, and,
in theory, also others - even ones we do not know about). However, the
internal synchornization did not properly take multiple tcpsrv users
in consideration.

As such, a single user could hang under some circumstances. This was
caused by improperly awaking all users from a pthread condition wait.
That in turn could lead to some sluggish behaviour and, in rare cases,
a hang at shutdown.

Note: it was highly unlikely to experience real problems with the
officially provided modules.

This patch corrects the situation.
2021-04-27 08:31:24 +02:00
Rainer Gerhards
3470728d44
further refactoring of tcpsrv parameter passing
Some further stream-lining and cleanup of paramter passing. This
levels ground for more substantial changes to the imtcp/tcpsrv
interaction.

see also https://github.com/rsyslog/rsyslog/issues/3727#issuecomment-525705318
2021-04-26 09:05:01 +02:00
Rainer Gerhards
926e207575
phase 1: consolidate current imtcp input params in a single structure
see also https://github.com/rsyslog/rsyslog/issues/3727
2021-04-22 08:44:55 +02:00
Rainer Gerhards
ab3bd4609b
Merge pull request #4537 from VultureProject/fix_empty_foreach
RainerScript::FIX:: handle foreach with empty arrays/objects
2021-04-19 10:42:21 +02:00
Rainer Gerhards
1d74aa7064
Merge pull request #4543 from VultureProject/imhiredis_upstream
NEW CONTRIB::IMHIREDIS:: input redis module
2021-04-19 10:18:02 +02:00
Rainer Gerhards
2381890467
Merge pull request #4551 from julthomas/dev/jth/fmunflatten
fmunflatten: rscript function to unflatten keys in a JSON object
2021-04-06 19:14:23 +02:00
Rainer Gerhards
55b68be792
Merge pull request #4509 from Anusha-Pai95/adding_tag_to_tls_handshake_failures
Improving nsd ossl logs for better debugging
2021-03-29 13:12:00 +02:00
Julien Thomas
454088780a msg: expose function jsonDeepCopy()
This function will be used by rainerscript function module
fmunflatten in next commit. Let's expose it to make it public.
2021-03-09 21:33:26 +01:00
b0b6320c2a testbench: Enhanced error detection in imrelp-tls-cfgcmd.sh
This solves test failures on some platforms like solaris.

Also added _attribute__((unused)) into SetTlsVerifyDepth in
nsd_ptcp.c to fix compiler errors with gcc9.

closes: https://github.com/rsyslog/rsyslog/issues/4544
2021-03-09 09:18:08 +01:00
Anusha Pai G
9e8614a6f2
Improving nsd ossl logs for better debugging
when tls handshake fails, function osslLastSSLErrorMsg is called to
print the logs saved on error stack, adding the tag "nsd_ossl:" for the
better identification of these logs in such failure scenarios.
2021-02-24 10:22:31 +01:00
Jérémie Jourdin
5823abf0f8 NEW CONTRIB::IMHIREDIS:: input redis module 2021-02-23 19:06:44 +01:00
frikilax
65d34853eb RAINERSCRIPT::FOREACH:: HANDLE EMPTY ARRAYS/OBJECTS 2021-02-16 22:41:14 +01:00
Tim Gates
e3247d4557
docs: fix simple typo, charcters -> characters
There is a small typo in runtime/msg.h.

Should read `characters` rather than `charcters`.
2020-11-29 10:06:29 +11:00
Rainer Gerhards
1c85aa8a59
add new system property $now-unixtimestamp
Among others, this may be used as a monotonic counter
for doing load-balancing and other things.

Thanks to Nicholas Brown for suggesting this feature.
2020-11-04 13:02:22 +01:00
Rainer Gerhards
0716d8983b
Merge pull request #4440 from Dinesh-Ramakrishnan/master
omfwd: adding new rate limit option
2020-11-04 12:38:06 +01:00
b5356f8db7 tls: Allow calling PermitExpiredCerts with NULL parameter
In order to set the default PermitExpiredCerts handling (Denied),
we need to call PermitExpiredCerts with NULL parameter.

testbench: Add test to check expired handling in omfwd

debug: Fix dbgprintf calls with possible NULL character parameters

closes: https://github.com/rsyslog/rsyslog/issues/4425
2020-10-28 09:18:25 +01:00
Rainer Gerhards
1ecb54b600
Merge pull request #4439 from alorbach/pr-issue-4288
gnutls: Added handshake error handling into doRetry handler.
2020-10-13 09:19:58 +02:00
Rainer Gerhards
11b58367dd
Merge pull request #4443 from julthomas/dev/jth/json-set-segfault
msg: Fix segfault and memory leak on set operation
2020-10-13 09:08:04 +02:00
Rainer Gerhards
d3c3c68213
Merge pull request #4433 from Anusha-Pai95/adding_tag
Improving nsd ossl logs for better debugging
2020-10-13 09:03:39 +02:00