51 Commits

Author SHA1 Message Date
Rainer Gerhards
694eb79c39
tcpsrv bugfix: build problem regression 2020-01-18 10:49:45 +01:00
Rainer Gerhards
9b56191970
Merge pull request #3924 from Frogging101/ciena-fixes-for-upstream-20191023
Various bug fixes relating to shutdown handling
2020-01-17 12:56:17 +01:00
fcffb063e3 tls: Added support to configure certificate verify depth
Support added in omfwd as instance parameter:
streamdriver.TlsVerifyDepth
Support added in imtcp as module parameter:
streamdriver.TlsVerifyDepth

Can be 2 or higher.

Support added into ossl driver
Support added into gtls driver
Added testcases for both drivers.

Parameter
streamdriver.TlsVerifyDepth

closes: https://github.com/rsyslog/rsyslog/issues/4035
2020-01-08 11:40:14 +01:00
Charles (Chas) Williams
9f0282c7b8 ratelimit: increase rate limit interval parameter
The burst parameter in the ratelimit was increased to an unsigned int
but the interval remained an unsigned short. While it may be unusual,
there is possibly a chance to need to represent an interval longer than
about 3/4 of a day.

While here, go through and normalize all the various incarnations of
rate limiting to be explicitly unsigned int for the burst and interval.
2019-11-20 18:05:12 -05:00
John Brooks
bf59b82fbd tcpsrv: Wait for workers to finish before terminating
The TCP server may still have workers running when its main thread
terminates, and the workers may be using state that is liable to disappear
during the shutdown process.

This fixes a segfault in hashtable_insert() which will occur if a worker
thread processes a connection while rsyslog is shutting down, and attempts
to use the DNS cache after it has been deinitialized (and the hashtable
destroyed) by dnscacheDeinit().

Signed-off-by: John Brooks <jbrooks@ciena.com>
2019-11-15 15:21:17 -05:00
John Brooks
0745225238 tcpsrv: Don't decrement wrkrRunning if terminating without a work item
wrkrRunning only gets incremented when a work item is issued, so the worker
shouldn't decrement it when terminating without a work item.

Fixes: 47982120408e ("work around clang static analyzer false positives")
Signed-off-by: John Brooks <jbrooks@ciena.com>
2019-11-15 15:21:17 -05:00
John Brooks
851ca7b550 tcpsrv: Add cancellation cleanup handler to unlock mutex
Ensure that the mutex is released if the module's main thread is cancelled
while holding it.

Signed-off-by: John Brooks <jbrooks@ciena.com>
2019-11-15 15:21:17 -05:00
John Brooks
bcdd220142 tcpsrv: Improve thread cancellation handling
Ideally, the TCP server is terminated cleanly via the non-cancel path, but
it's possible for this to time out and have the thread be forcibly
cancelled. Install a cancellation handler to clean up Run() in case this
happens.

Signed-off-by: John Brooks <jbrooks@ciena.com>
2019-11-15 15:21:16 -05:00
Rainer Gerhards
c7b5979752
Merge pull request #3845 from jvymazal/tls_verify
Stricter GnuTLS operation
2019-09-02 10:13:53 +02:00
Jiri Vymazal
937e278fdf Stricter GnuTLS operation
This commit adds to new flags which can be set to allow
1) checking of extendedKeyUsage certificate field
2) stricter checking of certificate name/adresses
2019-08-30 09:40:25 +02:00
Rainer Gerhards
29500f75f4
core/tcpsrv: potential race on startup/shutdown
if the tcpsrv component is started and quickly terminated, it may hang
for a short period of time. Also a very small amout of memory is leaked
immediately before shutdown. While this leak is irrelevant in practice
(the OS clean up the process anyways), it leads to CI failures. The hang,
however, can lead to longer than expected shutdown times for rsyslog.

The problem can be experienced via imtcp, imgssapi and imdiag (users
of affected core component).
2019-08-19 09:05:47 +02:00
Rainer Gerhards
ff4887280e imtcp bugfix: multiple listnerPortFile parameter did not work
... because they were treated as module-global. If we had multiple imtcp
listeners with multiple port files, only the last filename was always used.

closes https://github.com/rsyslog/rsyslog/issues/3817
2019-08-14 14:42:09 +02:00
Rainer Gerhards
7cb4cdfab7
imtcp: enable listenPortFileName parameter
this parameter was added, but it had no effect as it was not
passed down to the driver layer. This has been fixed. That also
now enables us to use dynamically-assigned port, which are
very useful for further testbench stabilization. Quite some
false positives occurred because the pre-selected port was
already in use again when rsyslog started.
2019-07-18 10:05:00 +02:00
Philippe Duveau
c8d8871aea
Merge branch 'AIX_Port_step2' into master 2019-02-21 09:23:40 +01:00
Rainer Gerhards
00f09d8723
cleanup: use less verbose C11 method to use pragmas 2019-02-20 17:13:28 +01:00
Philippe Duveau
9ad7324dfa AIX_port: second phase 2019-02-14 14:36:05 +01:00
Rainer Gerhards
0c74a1902f
cleanup: remove commented-out code
detected by lgtm.com
2019-01-14 13:14:18 +01:00
3d9b8df6fb tls(ossl/gtls): add new Option "StreamDriver.PermitExpiredCerts"
The new Option can have one of the following values:
on = Expired certificates are allowed
off = Expired certificates are not allowed
warn = Expired certificates are allowed but warning will be logged (Default)

Includes necessary tests to validate new code.

closes https://github.com/rsyslog/rsyslog/issues/3364
2018-12-21 15:24:41 +01:00
Rainer Gerhards
9bece39dc6
SQUASH
debug cleanup: remove some old, no longer used macros
2018-10-30 12:46:04 +01:00
Rainer Gerhards
31d58a2eee AIX: HUP not processed when running as non-service
When rsyslog is not run as a service (under SRC control), HUP does not
awake the main loop timeout. In theory, it should do so, but in practice
this does not happen. As a work-around we now implement a kind of
ressource-saving busy waiting where we awake every half second to check
if HUP (or something else noteworthy) happened. This should not cause
any real issue in any case, because running rsyslog as a non-service
is very uncommon and probably only happens during testbench runs.

closes https://github.com/rsyslog/rsyslog/issues/2997
2018-09-07 03:25:38 -05:00
PascalWithopf
aec60a90e4 tcp driver: port 0 is now accepted
Until now when port 0 was specified in imtcp, imgssapi or imdiag,
it was automatically changed to 514 in tcpsrv.
Imtcp and imgssapi accept port 0, but only if parameter listenPortFileName
(imgssapi: inputgsslistenportfilename) is specified. Otherwise it will
still change the port.
Imdiag always accepts 0 as a port and will create a socket with a random
port.
2018-09-01 10:29:59 +02:00
PascalWithopf
df85be1130 tcp driver: add support for parameter LstnPortFileName 2018-08-29 15:14:29 +02:00
Noriko Hosoi
9ac54f0d7d Introducing an option preservecase to imudp and imtcp module for
managing the case of FROMHOST value.

Usage:
module(load="imudp" [preservecase="on"|"off"])
module(load="imtdp" [preservecase="on"|"off"])

If preservecase="on", FROMHOST value is handled in the case sensitive manner.
If preservecase="off", FROMHOST value is handled in the case insensitive manner.

To maintain the current behaviour, the default value of preservecase is
"on" for imtcp and "off" for imudp.

Incremented tcpsrvCURR_IF_VERSION by 1.

References:
https://github.com/rsyslog/rsyslog/pull/2774
https://bugzilla.redhat.com/show_bug.cgi?id=1309698
2018-08-16 06:22:13 -07:00
PascalWithopf
c83e3ed216 correct codestyle in rsyslog part 2 2018-08-01 16:11:33 +02:00
PascalWithopf
19133327cc correct codestyle in rsyslog 2018-07-31 09:44:27 +02:00
Jan Gerhards
d727d49a35 tcpsrv: use new errmsg interface
see also https://github.com/rsyslog/rsyslog/issues/1684
2017-12-29 16:20:46 +01:00
PascalWithopf
29c9fb1f9a codestyle: reduce line length to 120
lines are still checked for a length of 125 because
these are just some of the lines
2017-12-21 17:09:32 +01:00
PascalWithopf
79de51e4fc codestyle: reduce max line length to 125 2017-12-20 16:16:57 +01:00
Rainer Gerhards
a82bb9cb2d "fix" Coverity scan false positives 2017-11-23 09:15:56 +01:00
PascalWithopf
e485c5c5bc codestyle: shorten lines to max 130 chars 2017-11-15 09:04:42 +01:00
Rainer Gerhards
3e418b148b core/tcpsrv: fix potential hang on shutdown
During shutdown of a tcpsrv, a race could occur, resulting in
a hang on shutdown of rsyslog as whole.

Detected via valgrind's helgrind thread debugger.
2017-11-09 16:05:17 +01:00
Rainer Gerhards
b8a9c014db tcpsrv: fix potential memory leak on startup
small leak, can theoretically occur during rsyslog startup; will not
grow afterwards. Prime trigger would be out of process memory, which is
fatal in any case if it already occurs on startup.

Deteced by Coverity scan, CID 185322
2017-11-05 12:46:54 +01:00
Rainer Gerhards
4bc24fb952 core/tcp: fix potential buffer overflow
Detected by Coverity scan, CID 182329
2017-10-28 14:30:13 +02:00
PascalWithopf
d67f72979e imtcp: change error msg to check for NULL
On Solaris trying to print an empty parameter leads to a Segmentation Fault when the error message, which contains the parameter, is printed.
2017-10-25 11:48:48 +02:00
Rainer Gerhards
4798212040 work around clang static analyzer false positives 2017-10-24 11:23:33 +02:00
Rainer Gerhards
aa1bd5eb9c Merge pull request #1750 from rgerhards/i-1749
tcpsrv subsystem: better error messages
2017-09-06 08:37:12 +02:00
Rainer Gerhards
5c5a7a3ed5 tcpsrv subsystem: better error messages
Most importantly, output os error messages on API failures.
Among others, this improves error messages in imtcp.

closes https://github.com/rsyslog/rsyslog/issues/1749
2017-09-05 15:47:12 +02:00
PascalWithopf
56e3132320 imtcp bugfix: priorityString was not set
The variable priorityString was not used when rsyslog acted as the
server and the defaults were always set. Now the priorityString
is used when specified.

fixes https://github.com/rsyslog/rsyslog/issues/1722
2017-09-05 11:19:29 +02:00
PascalWithopf
717092d93e gnutls: add possibility to use priority string 2017-08-08 14:57:15 +02:00
Rainer Gerhards
5e27f96554 Merge pull request #1527 from PascalWithopf/imtcpMaxFrame
imtcp: add parameter maxFrameSize
2017-04-26 12:21:01 +02:00
PascalWithopf
08c265d24d imtcp: add new parameter discardTruncatedMsg 2017-04-25 08:54:00 +02:00
PascalWithopf
01feb44bf1 imtcp: add parameter maxFrameSize 2017-04-20 12:58:57 +02:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
68b10060e5 tcpsrv: Sleeptimer added when accept loops because of no free file handles.
When file handle limit is reached, tcpsrv cannot accept new sockets and will
start looping until it can. The 20ms sleep avoids high cpu usage.
2016-12-16 13:28:41 +01:00
purnima
d45daa2af0 Rebase,redefine msgDestruct() as smsg_t is used 2016-11-22 14:24:25 +05:30
Rainer Gerhards
448f16495c remove "inline" attribute from excessivly long functions 2016-10-26 11:50:15 +02:00
Rainer Gerhards
b3940cb966 remove excessive "inline" attributes 2016-06-03 12:24:27 +02:00
Rainer Gerhards
5e3b075d53 fix compiler warnings 2016-06-02 12:08:55 +02:00
Rainer Gerhards
fa6d26051a tcpsrv fix: cosmetic memleak on exit
upon listener destruction (rsyslog shutdown), stats objects were not
destructed
2016-04-25 17:24:31 +02:00
Rainer Gerhards
5f9df23347 nitfix: theoretical memory leak
happend only when we already were at OOM condidtion

detected by clang static analyzer
2015-12-05 18:01:20 +01:00