2718 Commits

Author SHA1 Message Date
Rainer Gerhards
d9223cda58
modify testbench test to detect wrong imptcp truncation 2023-04-17 11:32:38 +02:00
Rainer Gerhards
7245abb709
core/template: implement negative position.to
This will easily permit to drop the last n characters from a property
without the need to know the exact length of the string. This is
especially useful as the exact length is most often not known
beforehand.
2023-01-20 10:47:22 +01:00
Rainer Gerhards
8d4b115f64
Merge pull request #5065 from rgerhards/substring-enhance
substring function: enhancement and hardening
2023-01-16 14:59:28 +01:00
Rainer Gerhards
8715e5556d
Merge pull request #5063 from rgerhards/modern-outchannel
omfile: add action parameters "rotation.*"
2023-01-16 13:16:46 +01:00
Rainer Gerhards
1e7abb8a1a
substring function: enhancement and hardening
Now, length can have a negative value -n to denote that the
substring should be build between startpos and the character
-n chars from the end. This is a shortcut for stripping charactes
on "both ends" of the string.

Also, some hardening against invalid startpos and length has
been added.
2023-01-13 13:20:24 +01:00
Rainer Gerhards
f95676d849
omfile: add action parameters "rotation.*"
Add new action parameters
- rotation.sizeLimit
- rotation.sizeLimitCommand
provide automatic output file rotation functionality feature-wise
equivalent to legacy $outchannel. This finally permits to use
this feature set in rscript.
2023-01-11 13:06:15 +01:00
Rainer Gerhards
5f5fbef8f8
CI: use newer version of zookeeper
The older one is no longer available.
2023-01-11 09:15:27 +01:00
Rainer Gerhards
e6f1866f55
testbench: add test for invalid json template generation
see also: commit 246b8d8553b6880146d6c489a28cf4bacea8a199
see also: https://github.com/rsyslog/rsyslog/pull/5050
see also: https://github.com/rsyslog/rsyslog/pull/5052
2022-12-30 17:57:13 +01:00
Rainer Gerhards
2975a093ad
testbench: make python http server based tests more reliable
Harden them against races during server port assignment. Prevents
testbench flakes.
2022-12-05 11:03:34 +01:00
Sergey Kacheev
e8ac82e09f imfile tests: ext directory's fd leak in case of inotify on symlink 2022-12-05 12:35:33 +07:00
Guodong Zhu
18a824ca2f
testbench: fix the wrong message injection object of instance 1
In some client-server test cases, messages are supposed to be injected into
the instance 2(client), but they are actually injected into instance 1(server),
which may lead to false negative results. This patch fixed it by replacing
'injectmsg' with 'injectmsg2', and dealt with some minor issues.
2022-11-23 12:28:15 +01:00
Rainer Gerhards
2623a89a0c
imtcp bugfix: legacy config directives did no longer work
Many "$InputTCPServer..." config directives did no longer work
and were completely ignored (e.g. "$InputTCPServerStreamDriverMode").

This was a regression from a08591be5d9 (May, 5th 2021).

closes https://github.com/rsyslog/rsyslog/issues/5021
2022-11-16 18:52:55 +01:00
21b68afa03 testbench: Adjusted timing for test imfile-logrotate-async.sh
In some cases, the logrotate is not fast enough rotating the
logfile after sighub has been send to inputfilegen process. It appears
to happen more often on github CI machines, when it happens,
inputfilegen reopens the NOT yet rotated file and keeps writing
into it. However most messages written until the next sighub are lost
after the logfile finally is rotated.

In order to avoid this, I have added an extra sleep between file
CLOSE and OPEN after sighub with a default of 5ms which appears to work
very well. This should give logrotate enough time to perform the
actuzal rotate.

Also added another parameter to inputfilegen to keep the process
open after finish. Which helps syncing with the testcases.

closes: https://github.com/rsyslog/rsyslog/issues/5000
2022-10-14 11:15:45 +02:00
e8c6cc91ab testbench: fix imfile-statefile-delete.sh (INOTIFY trigger)
Due the patch in PR https://github.com/rsyslog/rsyslog/pull/4895
state files are deleted with a 5 second delay in order to fix
missing or duplicated messages. However in INOTIFY mode, we need
an INOTIFY event to trigger a poll_tree that triggers the
delayed deletion. The testcase imfile-statefile-delete.sh will now
create empty dummy files after 6 seconds delay in order to trigger
INOTIFY events.

This fixes & closes https://github.com/rsyslog/rsyslog/issues/4958
2022-10-05 20:41:09 +02:00
Rainer Gerhards
d083a2a2c2
Merge pull request #4977 from rgerhards/i4975
core bugfix: correct local host name after config processing
2022-09-07 09:24:55 +02:00
Rainer Gerhards
ba00a9f252
core bugfix: correct local host name after config processing
rsyslog.conf may affect the host's local name. These changes were
so far only activated after the first HUP. This patch now ensures
that the configured local host name is applied correctly throughout
all processing, including early startup.

This patch causes a slight change of behaviour. However, the behaviour
was inconsitent before. Now it is consistent and according to the config.

Please note: this patch also exposes a global entry point via "regular"
dynamic loading as this makes things much easier to do. This is in-line
with ongoing simplification effort.

Finally, we also remove a CI test that we do no longer need because
the problem covered is now addressed differently and the original issue
can no longer occur.

closes https://github.com/rsyslog/rsyslog/issues/4975
2022-09-06 13:01:37 +02:00
0bec49cbe3 testbench: Add more valgrind tests for sndrcv (omrelp/imrelp)
- These tests will help find race conditions hopefully
- fix diag.sh issues running second instance in valgrind mode only
- Add check for minimum valgrind version for new relp tests
2022-09-01 13:59:49 +02:00
Rainer Gerhards
580d239535
Merge pull request #4969 from rgerhards/imtcp-notifyconnectionopen
imtcp: add option notifyonconnectionopen
2022-08-31 14:36:57 +02:00
Rainer Gerhards
ffd0acc9ca
Merge pull request #4889 from sarroutbi/ca_extra_files
Add mechanism to include extra CA files parameter
2022-08-26 16:20:38 +02:00
Rainer Gerhards
4c66ab3abc
imtcp: add option notifyonconnectionopen
Add this both as module an input parameter. Complements already-existing
config param notifyonconnectionclose and mirrors the similar feature from
imptcp.

The module parameter acts as default, similarly to notifyonconnectionclose.

Note that in contrast to imptcp, we emit IP addresses and not host
names. This sticks with the traditional semantics of imtcp.

Note that we also fixed a mislading error message in the case when a
disallowed sender tried to connect.

Thanks to John Chivian for suggesting the addition.
2022-08-23 14:41:57 +02:00
Rainer Gerhards
5520373959
imfile bugfix: message loss/duplication when monitored file is rotated
When a to-be-monitored file is being rotated, some messages may be lost or
duplicated. In case of duplication, many file lines may be duplicated
depending on actual timing. The whole bug was primarily timing depenedent
in general. It most often was visible in practice when the monitored
file was very frequently rotated (we had some report with every few
seconds).

Note that while we try hard to not lose any messages, input file
rotation always has some loss potential. This is inevitable if
the monitored file is being truncated.

Also note that this bugfix affects imfile, only. It has nothing to do
and no relation to rsyslog output files being rotated on HUP.

closes: https://github.com/rsyslog/rsyslog/issues/4797
2022-08-04 12:54:07 +02:00
Rainer Gerhards
6be9a266ea
testbench: add testcase for frequent imfile input file change
PoC test, yet incomplete

This patch not only contains the new test but also supporting
changes to testbench tooling.

see also: https://github.com/rsyslog/rsyslog/issues/4797
2022-08-04 12:54:07 +02:00
Rainer Gerhards
157d50b814
Merge pull request #4899 from alorbach/pr-issue-4852
openssl: Add support to split tls commands by semicolon
2022-08-04 12:36:15 +02:00
Rainer Gerhards
90a2717752
Merge pull request #4900 from kulikjak/fix-strings
strings.h is missing in several files
2022-08-04 12:33:29 +02:00
a335ec06f0 mmanon: Simplified and fixed IPv4 digit detection.
- Fixed an issue with numbers above int64 in syntax_ipv4.
  Numbers that were up to 256 above the max of an int64
  could incorrectly be detected as valid ipv4 digit.
- Simplified the IPv4 digit detection function and renamed
  to isPosByte.
- added testcasse for malformed IPvc4 addresses

closes: https://github.com/rsyslog/rsyslog/issues/4940
2022-08-03 14:29:39 +02:00
dc36db742a openssl: Add support to split tls commands by semicolon
- Add support to split tls commands by semicolon.
- Changed one test with multiple tls commands to use semicolon as
  seperator instead of newline.

closes: https://github.com/rsyslog/rsyslog/issues/4852
2022-08-02 12:58:03 +02:00
Rainer Gerhards
087f304897
Merge pull request #4937 from rgerhards/imptcp-slight-tuning
imptcp: slight tuning
2022-07-21 15:22:44 +02:00
Rainer Gerhards
f052717178 imptcp: slight tuning
- reduce indirect addressing to obtain more speed
- also a fix for an annoying typo
- minor other optimizations
- modernization of one test
2022-07-15 15:46:27 +02:00
Rainer Gerhards
050a611fa2
CI: suppress TSAN false positive
Close of fd previously added to an epoll set is ok.
2022-07-15 10:14:33 +02:00
Rainer Gerhards
90feae08e6
omfile: support for zstd compression
The zstd library provides better and faster compression than zlib.
This patch integrates zstd as a dynamically-loadable functionality.
As such, no further dependencies need to be added to the rsyslog
base package.

Due to the increased performance, usage of zstd is highly recommended
for high-volume use cases.

This patch also refactor zlib compression in order to unify handling
in both compression cases.
2022-07-13 14:31:51 +02:00
Rainer Gerhards
36392e745d
CI: add new TSAN suppression
This is a cosmetic issue, only seen during debug logging. We actually
cannot fix it, as it would alter runtime behaviour too much and would
pontentially render debug runs useless. It also causes no harm.
2022-07-13 12:14:51 +02:00
Sergio Arroutbi
318449ad3a Add mechanism to include extra CA files parameter
This change allows to include extra CA files
so that no "unable to get issuer certificates" issue
is obtained when using chained cert files.
Proposed new parameter name is "NetstreamDriverCAExtraFiles"

fixes #4851

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
2022-07-13 11:12:29 +02:00
Rainer Gerhards
6ef5e826d7
CI: suppress TSAN exception for known-good case
We do not use a mutex an epd, but we do always access it in
pure sequence. Adding a mutex just to cover this "cosmetic"
would result in uncesseary performance penalty.
2022-07-06 10:30:44 +02:00
Rainer Gerhards
829a6f6a64
CI: improve use of github action matrix feature; optimization
Matrix feature was initially barely usable because github did not permit
to restart just failed jobs. This has changed. So we now migrate back to
the use of matrix feature where it is useful.

We also reduce the number of plain compile tests to newest and oldest
compiler version only. This saves CI ressources. The important other
ones (distro default!) are used during other CI tests anyways.

We also fix some minor coding errors detected by new compiler builds.
None of them seems to be related to any real issues.
2022-07-01 10:12:38 +02:00
Rainer Gerhards
e92f85b588
build error fix: libbson requires out-of-date language constructs 2022-06-27 17:44:28 +02:00
Jakub Kulík
ee3f88ffe4 Import <strings.h> when index() is used. 2022-06-15 16:49:24 +02:00
Rainer Gerhards
18e3505b62 omelasticsearch: some amendments to contributed patch
We disable ElasticSearch strict security in testbench, as
we do not need it for test runs, and it complicates thing.s
Note: this does NOT introduce a security weakness, because we use
only temporary testing ES instances which are always immediately
discarded after the test AND are run in our own test env with
user permissions.
2022-05-19 13:17:18 +02:00
Jarkko Oranen
d47b5c9b1c omelastisearch: allow omitting _type field
Allow omitting the _type field by setting it to an empty string.

Setting this field has been deprecated since 6.0, and support will
be removed in 8.0

Also add testbench test for empty searchType with ES 7.0

This checks for messages in the deprecation log and also provides
avoids deprecation messages from usage of transport.tcp.port in the
test configuration
2022-05-19 13:17:05 +02:00
Rainer Gerhards
d1a98b8260
tcpsrv/imtcp: slight performance improvements
This patch slightly improves performance for tcpsrv-based servers.
This affects imtcp and imgssapi as well as some helpers.

No other functional change is included in this patch.
2022-05-18 10:08:47 +02:00
Rainer Gerhards
b564a13451
testbench bugfix: some valgrind tests were run when valgrind disabled
This leads to test failures e.g. with LLVM sanitizers.
2022-05-09 13:06:59 +02:00
Rainer Gerhards
f211042ecb
Merge pull request from GHSA-ggw7-xr6h-mmr8
net bugfix: potential buffer overrun
2022-05-05 14:04:42 +02:00
c49180abdd testbench: removed unused notworking tls tests
Testcase sndrcv_tls_certless_ossl_client.sh was not finished
and was not used by testbench. Newer tests replaced its test usage.
See testcases sndrcv_tls_gtls_serveranon*.sh and
sndrcv_tls_ossl_serveranon*.sh

closes: https://github.com/rsyslog/rsyslog/issues/4853
2022-05-02 13:43:06 +02:00
Rainer Gerhards
03ba122e90
mmanon bugfix: shortened IPv6 form not always anonymized
If the IPv6 is in non-recommended form followed by a 5 digit port number, it
is not anonymized.

A reproducer for this is: 1a00:c820:1180:c84c::ad3f:d991:ec2e:49255

closes https://github.com/rsyslog/rsyslog/issues/4856
2022-04-25 18:00:01 +02:00
Rainer Gerhards
30ccf7cd4c
testbench: new tests for potential buffer overrun 2022-04-25 10:25:17 +02:00
Rainer Gerhards
aaf3ffd364
cleanup: remove file accidentally added to git 2022-04-22 10:45:20 +02:00
Rainer Gerhards
88c67d80e4
Merge pull request #4822 from sarroutbi/maxfilesize_non_empty_errorfile
Ensure error file does not increase appropriately when action.errorfile.maxsize option is enabled
2022-04-18 11:02:38 +02:00
Rainer Gerhards
33b7ccc928
Merge pull request #4823 from alorbach/pr-issue-4818
gnutls bugfix: Fix error handling in gtlsRecordRecv
2022-04-18 11:01:35 +02:00
Art O Cathain
a5ba462da8 Fixed a broken link in the PR failure message 2022-04-05 14:05:47 +01:00
aefcfa4d0f gnutls bugfix: Fix error handling in gtlsRecordRecv
There was a rare possibility that the E_AGAIN/E_INTERRUPT handling
could cause an infinite loop (100% CPU Usage), for example when a TLS
handshake is interrupted at a certain stage.

- After gnutls_record_recv is called, and E_AGAIN/E_INTERRUPT error
  occurs, we need to do additional read/write direction handling
  with gnutls_record_get_direction.
- After the second call of gnutls_record_recv (Expand buffer)
  we needed to also check the eror codes for E_AGAIN/E_INTERRUPT
  to do propper errorhandling.
- Add extra debug output based on ossl driver.
- Potential fix for 100% CPU Loop Receiveloop after gtlsRecordRecv
  in doRetry call.

see also: https://github.com/rsyslog/rsyslog/issues/4818
2022-04-04 16:38:07 +02:00
Rainer Gerhards
6c16d84237
Merge pull request #4758 from mbarbon/mbarbon/format-iso-week
add property options to support ISO week/year number
2022-04-01 12:57:31 +02:00