2543 Commits

Author SHA1 Message Date
8d8fe80d87 openssl: Replaced depreceated method SSLv23_method with TLS_method
In OpenSSL 1.1.0 and higher, SSLv23_method causes some errors
in TLS handshake from time to time. As this method is depreceated
since 1.1.0, I have replaced it with the follow up method
TLS_method which is the most generic one.

It fixes the random test failures in tests like
- sndrcv_tls_ossl_anon_rebind.sh

Also added some debug output in OpenSSL error handling, which is
useful when analysing debug files.

closes: ./sndrcv_tls_ossl_anon_rebind.sh
2023-07-28 16:27:07 +02:00
Rainer Gerhards
ee69c29beb
Merge pull request #5196 from rgerhards/testbench-imfile-statefiles
testbench improvement: define state file directories for imfile tests
2023-07-28 16:00:44 +02:00
Rainer Gerhards
a9b8c57443
Merge pull request #5197 from rgerhards/tcpflood-fix-tcp-sending
tcpflood bugfix: TCP sending was not implemented properly
2023-07-28 14:31:42 +02:00
Rainer Gerhards
11933498f9
testbench improvement: define state file directories for imfile tests
Not all imfile tests have state file directories or a global working
directory defined. This results in usage of the default location.
While state file names should be sufficiently different, there is still
some riks of using the same name in different tests. That becomes
problematic if tests are run in parallel (and they are run in
parallel inside the regular CI).
2023-07-28 14:30:56 +02:00
Rainer Gerhards
f34eee3a82
Merge pull request #5199 from rgerhards/testbench-sndrcv-cleanup
testbench: cleanup a test and some nitfixes to it
2023-07-28 14:26:57 +02:00
Rainer Gerhards
68a9014b6c
testbench: cleanup a test and some nitfixes to it 2023-07-28 10:27:27 +02:00
Rainer Gerhards
5050249a1e
tcpflood bugfix: TCP sending was not implemented properly
Note: tcpflood is a testbench tool. This bug could lead to testbench
false positives. No way it can affect production deployments.

The tcpflood tool did improperly assume that a TCP sendto() call
would send messages of any size in a single shot. This is not the
case. It has now been corrected to proper behavior.

As a side-activity, some int variables which acutally needed to be
size_t have been fixed as well.
2023-07-28 09:08:41 +02:00
Rainer Gerhards
0e5444706d
testbench: make waiting for HUP processing more reliable
The previous approach was more or less delay based. We have now
changed the code to enable imdiag to detect if HUP is underway
and wait until it is completed. The new method still employs some
kind of timeout, but is now quite reliable. Most importantly,
it works great with long-running HUP processing, which can happen
e.g. when querying the system name takes long or some actions need
longer time to persist their HUP processing.

The new approach will most likely reduce CI flakes and also speed
up testbench runs. The speedup happens from not having to wait a
full delay in cases where we detect HUP is completed (plus reduced
timeout when we cannot clearly detect this - see code comments why
the new method is still considered more reliable than the old one).

Code note: we needed to slightly re-structure the way actual HUP
processing and the "HUP mutex" is handled. After best analysis,
this does not affect the reliability or speed in production
settings.

closes https://github.com/rsyslog/rsyslog/issues/5192
2023-07-26 17:17:01 +02:00
Rainer Gerhards
e08e5ec72f
CI: update zookeper download to newer version
Old version is no longer available.
2023-07-25 16:07:59 +02:00
a9aa043a82 ossl driver: Using newer INIT API for OpenSSL 1.1+ Versions
See reference from: https://wiki.openssl.org/index.php/Library_Initialization

closes: https://github.com/rsyslog/rsyslog/issues/4981
2023-07-11 10:57:15 +02:00
45c8d47696 ossl: Fix CRL File Expire from 1 day to 100 years.
The default in openssl.cnf was set to 1 day (Which is valid for
live systems). However for testbench we do not need an expired CRL
List, so changing it to 100 years is fine for the testbench.

This fixes issues with testcases added in PR
https://github.com/rsyslog/rsyslog/pull/5175

closes: https://github.com/rsyslog/rsyslog/issues/5180
2023-07-11 09:56:29 +02:00
Rainer Gerhards
8f6845e000
Merge pull request #5175 from darrenmoffat/master
TLS CRL Support Issue 5081
2023-07-07 13:21:44 +02:00
Rainer Gerhards
d4ac70e48a
Merge pull request #4881 from alorbach/omazureeventhubs
omazureeventhubs: Initial implementation of new output module
2023-07-07 13:17:23 +02:00
6c83bffb6a PR5175: Add TLS CRL Support for GnuTLS driver and OpenSSL 1.0.2+
- Add TLS CRL support tp GnuTLS driver using gnutls_certificate_set_x509_crl_file.
- Add code in OpenSSL driver that works with OpenSSL 1.0.2 and higher.
  Disable feature on older features with error message.
- Some cosmetic changes
- testbench: Add revoked certificate for testing (Including CRL PEM and other files)
- testbench: Add testcase for gtls and ossl testing revoked certificates
2023-07-07 08:02:05 +02:00
d5ce3daa3f omazureeventhubs: Initial implementation of new output module
The output module uses Apache "Qpid Proton C API" which is a solid
AMQP protocol library implementation that can be integrated
very well into the rsyslog dev environment.

- Implemented Delivery with submitted and accepted state checking
- impstatscounter used in testcases
- saving of failed messages in a failed list with support of saving
  and restoring.
- Add testcases (requires ENV variables) to testbench
- Using application/octect-stream (binary) to send messages based on
  Microsoft Code Sample:
  https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-c-getstarted-send
  * Note original Microsoft Samplecode is not working anymore, we are using
  * QPID Proton Proactor based on
    https://github.com/apache/qpid-proton/blob/main/c/examples/send.c
- requires QPID-PROTON Version 0.13 or higher because of the proactor API
- Add EventProperties configuration parameters
- using internal array instead of linkedlist for better performance
- using single byte helper to store message status (ubsubmit/submitted...)
- trigger wake up if messages need to be resubmitted (rejected)
- Slow down when sender credit reaches zero (10ns).
- Add enhanced performance stress test omazureeventhubs-stress.sh
- Add support for static library linking of qpid-proton
  This is needed to build the module from source and remove
  library package dependencies.
- adjusted valgrind suppressions
2023-07-06 23:40:20 +02:00
Rainer Gerhards
102e492182
testbench: use newer zookeeper version in tests 2023-06-22 15:34:03 +02:00
Rainer Gerhards
fa83b5b4bd
Merge pull request #5143 from VultureProject/redis_streams
New Redis streams functionality + various fixes and improvements
2023-06-19 10:22:00 +02:00
Rainer Gerhards
66dfa396da
Merge pull request #5141 from paulfertser/fix-mmexternal-test-typo
tests: mmexternal-SegFault-empty-jroot-vg.sh: fix typo
2023-06-19 10:18:24 +02:00
alakatos
4abe60f526 imjournal: Add FileCreateMode module parameter
FileCreateMode allows to set the default file mode bits
when creating new files. As of now, it has only impact on the state file.
Add test suite as well.

Minor indentation fix in run_journal.yml
2023-06-08 12:18:02 +02:00
Rainer Gerhards
e1ad71da39
Merge pull request #5012 from sakateka/fix-external-dir-fd-leaking
imfile: Fix leak of fd of external directories
2023-06-06 15:00:28 +02:00
frikilax
ca4e320c3a OMHIREDIS::ADDED:: New support for 'stream' mode
### ADDED
- [OMHIREDIS] module is now able to insert entries to a Redis Stream
- [OMHIREDIS] in 'stream' mode, module can insert the message to a custom field in the entry ('msg' by default)
- [OMHIREDIS] in 'stream' mode, module can acknowledge an entry coming from imhiredis (if entry was claimed but not ACK'ed)
- [OMHIREDIS] in 'stream' mode, acknowledgements can be made from dynamic templates or static values
- [OMHIREDIS] in 'stream' mode, module can approximately cap the size of the output stream
- [OMHIREDIS] in 'stream' mode, module can delete an entry while inserting its message (useful to remove entry coming from another stream with imhiredis)
- [OMHIREDIS] new tests for 'stream' mode
 ### FIXED
- [CONFIGURE.AC] Missing line to give omhiredis compilation status
2023-05-23 11:01:03 +02:00
frikilax
4fa296727c OMHIREDIS::ADDED:: new tests for existing functionalities 2023-05-23 11:01:03 +02:00
frikilax
3ac9fa5267 IMHIREDIS::ADDED:: New support for 'stream' mode
- [IMHIREDIS] Add support for simple XREADs from Redis Streams (Redis >= 5.0 required)
- [IMHIREDIS] Add support for XREADGROUP from Redis Streams, allowing for user to define workers to dequeue logs in a stream
- [IMHIREDIS] stream mode can select fields to extract and insert in custom keys
- [IMHIREDIS] Add tests for the new 'stream' modes
2023-05-23 10:58:40 +02:00
frikilax
4ef42fde7a REDIS::ADDED:: Implement tests for imhiredis module
- changed diag.sh to be able to start/stop/clean a redis server
- added helper functions in diag.sh to be able to query a redis server instance
- added new tests for imhiredis module to check
  - that the queue mode works, with both lpop and rpop
  - that the module is capable of handling a redis server going down
  - that the module is capable of handling a redis server that appears afterwards
  - that the subscribe mode works
2023-05-17 12:02:22 +02:00
Paul Fertser
086358c61b tests: mmexternal-SegFault-empty-jroot-vg.sh: fix typo
Fix the typo that makes the test fail.
2023-05-17 08:08:10 +03:00
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