414 Commits

Author SHA1 Message Date
Rainer Gerhards
3e62a75911
minor: flag function as OK for undefined behaviour
The undefined bahavior sanitizer deteced an integer overflow inside
some code. However, this is hash code and the interger overflow is
perfectly fine.
2024-08-15 13:08:19 +02:00
Rainer Gerhards
6c306af671
build fix: regression from recently merged 615cde156c14
The clang Pragma()s were not correctly enabled due to the new
gcc version check. Also, gcc 4.2 upwards was not processed
correctly. This broke rsyslog build on the affected platforms.

Note: checking the exact version of clang is more complex than
worth the effort. Even very old versions (down to v 3) support
the macros. So we just check if we compile via clang.
2024-08-14 10:41:12 +02:00
Julien Thomas
d24c536ba5 ossl: Fix #pragma GCC diagnostic not allowed inside functions
Some old compilers, eg. GCC 4.4.7 on el6 do not support #pragma GCC
diagnostic in functions. Rsyslog has PRAGMA_* macros to handle those
cases, so let's use them.
2024-07-18 23:02:57 +02:00
Rainer Gerhards
f886d1f1b2
core bugfix: rsyslog messages may not always have FQDN
Even if hostname FQDN is configured, rsyslog internal messages generated
after rsyslog startup and before the first HUP will not necessarily have
FQDN but instead only the shortname of the local host. This commit
fixes the situation.

Special thanks to github user eciii for doing a great bug analysis
and helping us considerably to fix the issue.

closes https://github.com/rsyslog/rsyslog/issues/5218
2023-12-06 17:11:20 +01: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
alakatos
2348c6424a Introduce --enable-libcap-ng configure option
The option allows to drop the capabilities to only
the necessary set, to minimize security exposure in
case there was ever a mistake in a networking
plugin or some other input resource. Moreover, it adds
ability to change uid and gid while retaining the
previously specified capabilities. Resolves #4986

Add ability to change uid and gid while retaining the capabilities previously specified
2022-11-14 09:59:50 +01: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
Julien Thomas
21b5e0225e build: Fix #pragma GCC diagnostic not allowed inside functions
Commit 829a6f6 "CI: improve use of github action matrix feature;
optimization" has introduced use of #pragma GCC diagnostic in function
doNameLine() of runtime/conf.c. This is not supported by old compilers
like GCC 4.4.7 on el6.
2022-08-19 00:11:46 +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
Michael Biebl
6569133c75
Typo fixes (#4801)
* typo fix: ambigious -> ambiguous

* typo fix: aquire -> acquire

* typo fix: assgined -> assigned

* typo fix: cancelation -> cancellation

* typo fix: childs -> children

* typo fix: configuraton -> configuration

* typo fix: delemiter -> delimiter

* typo fix: forwardig -> forwarding

* typo fix: initializiation -> initialization

* typo fix: intializing -> initializing

* typo fix: lengh -> length

* typo fix: mesage -> message

* typo fix: occured -> occurred

* typo fix: occurence -> occurrence

* typo fix: paramter -> parameter

* typo fix: remaing -> remaining

* typo fix: resetted -> reset

* typo fix: suppored -> supported

* typo fix: Sytem -> System

* typo fix: uncommited -> uncommitted

* typo fix: depricated -> deprecated

* typo fix: stoping -> stopping

* type fix: allow to -> allow one to
2022-02-17 10:54:12 +01:00
frikilax
aeaf1160ed NEW CONTRIB::FFAUP:: URL parser module function using libfaup 2021-11-19 09:26:34 +01:00
Jérémie Jourdin
5823abf0f8 NEW CONTRIB::IMHIREDIS:: input redis module 2021-02-23 19:06:44 +01:00
Dagobert Michelsen
d917295065 Only define LOG_CRON if it is not already defined, needed on Solaris 10 2020-01-07 16:08:48 +01:00
Rainer Gerhards
6814f9eb3d fix some alignment issues
So far, this worked everywhere (for years). But it may still have
caused issues on some platforms.

closes https://github.com/rsyslog/rsyslog/issues/2608
2019-12-30 11:15:47 +01:00
Rainer Gerhards
76d582a59b core queue: add config param "queue.takeFlowCtlFromMsg"
This is a fine-tuning option which permits to control whether or not
rsyslog shall alays take the flow control setting from the message. If
so, non-primary queues may also block when reaching high water mark.
This permits to add some synchronous processing to rsyslog core engine.
However, it is dangerous, as improper use may make the core engine
stall. As such, enabling this option requires very careful planning
of the rsyslog configuration and deep understanding of the consequences.

Note that the option is applied to individual queues, so a configuration
with a large number of queues can (and must if use) be fine-tuned to
the exact use case.

The rsyslog team strongly recommends to let the option turned off,
which is the default setting.

see also https://github.com/rsyslog/rsyslog/issues/3941
2019-11-11 13:06:32 +01:00
Rainer Gerhards
1bc60d4ba2
cleanup any libee mentions and clarify state in ChangeLog 2019-07-03 08:24:15 +02:00
Rainer Gerhards
e22fb205a3
config processing: check disk queue file is unique
If the same name is specified for multiple queues, the queue files
will become corrupted. This commit adds a check during config parsing.
If duplicate names are detected the config parser errors out and the
related object is not created.

Note: this may look to a change-of-behaviour to some users. However,
this never worked and it was pure luck that these users did not run
into big problems (e.g. DA queues were never going to disk at the
same time). So it is acceptable to error out in this hard error case.

closes https://github.com/rsyslog/rsyslog/issues/1385
2019-05-02 11:36:49 +02:00
Rainer Gerhards
e81e1fcd1a
imfile: emit error on startup if no working directory is set
When the work directory has not been set or is invalid, state files
are created in the root of the file system. This is neither expected
nor desirable. We now complain loudly about this fact. For backwards
compatibility reasons, we still need to support running imfile in
this case.

closes https://github.com/rsyslog/rsyslog/issues/1296
2019-04-10 09:02:22 +02:00
Philippe Duveau
b2600c2aa6 Featuring omrabbitmq + tests + LGTM alert 2019-04-08 12:11:33 +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
9d72bd6ad8
Merge branch 'master' into AIX_Port_step2 2019-02-19 19:03:32 +01:00
Rainer Gerhards
09e5c7fcc5
portability: hide (some) pragmas in macros 2019-02-18 19:23:42 +01:00
Philippe Duveau
25e666f85a Moving enum values to the right PR 2019-02-18 10:48:19 +01:00
Philippe Duveau
2c7e9f44d4 Modifications after review and discuss. 2019-02-15 14:00:29 +01:00
Philippe Duveau
11c6365eba AIX_port: corrects style and compatibility issues (3) 2019-02-14 17:17:37 +01:00
Philippe Duveau
9ad7324dfa AIX_port: second phase 2019-02-14 14:36:05 +01:00
be10bda36a ossl nsd driver: Added openssl error stack output into GlblInit
When loading CA, Cert or Keyfile, the OpenSSL error stack will be output into LogError.
Also added 3 tests with invalid certificates/keyfiles for testbench.
2018-11-07 14:09:00 +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
223c03e536
cleanup: remove commented-out code
thanks to lgtm.com for the ability to detect commented out code!
2018-10-27 19:04:30 +02:00
Rainer Gerhards
2d15cbc822 imfile: improve truncation detection
previously, truncation was only detected at end of file. Especially with
busy files that could cause loss of data and possibly also stall imfile
reading. The new code now also checks during each read. Obviously, there
is some additional overhead associated with that, but this is unavoidable.

It still is highly recommended NOT to turn on "reopenOnTruncate" in imfile.
Note that there are also inherant reliability issues. There is no way to
"fix" these, as they are caused by races between the process(es) who truncate
and rsyslog reading the file. But with the new code, the "problem window"
should be much smaller and, more importantly, imfile should not stall.

see also https://github.com/rsyslog/rsyslog/issues/2659
see also https://github.com/rsyslog/rsyslog/issues/1605
2018-09-22 15:52:38 +02:00
Rainer Gerhards
6efae3c2fd fix compile warnings under AIX
see also https://github.com/rsyslog/rsyslog/issues/2971
2018-08-31 05:14:01 -05:00
Rainer Gerhards
56b8313f4a
build: disable excessive gcc 8 warnings
GCC, starting at least with version 8, is now really overdoing with it's
warning messages. We turn those off that either cause an enormous amount
of false positives or flag perfectly legal code as problematic.
2018-07-16 10:49:57 +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
b640a84242 nsdsel_ptcp: replace select() by poll()
This removes us of problems with fds > 1024. The performance will
probably also increase in most cases.

Note this is not a replacement for the epoll drivers, but a general
stability improvement when epoll() is not available for some reason.

see also https://github.com/rsyslog/rsyslog/issues/2615
closes https://github.com/rsyslog/rsyslog/issues/1728
closes https://github.com/rsyslog/rsyslog/issues/1459
2018-04-27 09:10:36 +02:00
Mikko Kortelainen
6d7663342b omfile-hardened: add hardening
replaces and closes https://github.com/rsyslog/rsyslog/pull/2490
2018-04-03 08:47:21 +02:00
Rainer Gerhards
d01ea7e2eb core: set TZ on startup if not already set
In theory, TZ should be set by the OS. Unfortuantely, this seems
to be not the case any longer on many Linux distros. We now check
it and set it appropriate if not already given.

closes https://github.com/rsyslog/rsyslog/issues/2054
2018-01-19 10:29:56 +01:00
Rainer Gerhards
8cb0a95a38 code style: fix too-long lines 2017-12-23 18:25:37 +01:00
PascalWithopf
79de51e4fc codestyle: reduce max line length to 125 2017-12-20 16:16:57 +01:00
7508010750 Basic Imfile FEN API support for Solaris (#2141)
imfile: Initial implementation of solaris FEN API (without wildcards)

FEN API is used to implement simular event based file
monitoring like with inotify.

This commit provides partial functionality. It supports event-driven
processing of files but does not yet provide wildcard functionality.
Wildscards will be provided by a later commit.

This can be committed as-is because the previous code did also
not provide wildcard support, so this is an improvement for
Solaris in any case.

see also https://github.com/rsyslog/rsyslog/issues/1954
2017-12-01 12:49:38 +01:00
Rainer Gerhards
a4c7f2ac81 module-template framework: avoid compiler warning in some legal cases
the finalize_it: label is required, but not always used, which each
time results in a compiler warning that needs to be worked around.
Now this is fixed once and for all for gcc and clang - the others
will probably not complain in any case. Great solution until something
comes up that makes us need a revision.
2017-11-22 11:08:34 +01:00
PascalWithopf
e485c5c5bc codestyle: shorten lines to max 130 chars 2017-11-15 09:04:42 +01:00
Rainer Gerhards
7c4adc5598 imdiag bugfix: double mutex unlock
This was caused by double-evaluation of a macro argument; macro changed

Detected by Coverity scan, CID 185348 and 185350
2017-11-01 17:12:54 +01:00
Rainer Gerhards
7b5b00a759 core/msg: refactor locking for json variable access
refactored the method so that it consistent in all functions and easier
to follow. Most importantly, now an as simple as possible locking paradigm
of lock ... unlock within the function. Hopefully easier to understand
both for humans and static code analyzers.
2017-11-01 13:12:57 +01:00
Rainer Gerhards
4798212040 work around clang static analyzer false positives 2017-10-24 11:23:33 +02:00
Rainer Gerhards
4cbebce23d Merge commit 'b8863c2a6a879e54fccae50209ec285ccbe712dd' into merge-961 2017-10-22 15:29:23 +02:00
Rainer Gerhards
7c273a3314 core: emit error message on abnormal input thread termination
this in almost all cases indicates a real problem that the user
should be made aware of

For a case where the missing error message caused confusion
see also https://github.com/rsyslog/rsyslog/issues/1867
2017-10-20 09:22:45 +02:00
Rainer Gerhards
26ef28cfd2 build: add macro to support new FALLTHROUGH checks in gcc7
We add a macro to provide better cross-platform compatibility.
We also intend to do this for other attribues as well.
2017-10-19 13:09:28 +02:00
Rainer Gerhards
57a7c281ff omfwd bugfix: UDP oversize message not properly handled
When a message larger than supported by the UDP stack is to be sent,
EMSGSIZE is returned, but not specifically handled. That in turn
will lead to action suspension. However, this does not make sense
because messages over the UDP max message size simply cannot be sent.

This patch truncates the message in question and reports an error
message with the condition.

closes https://github.com/rsyslog/rsyslog/issues/1654
2017-09-11 12:53:54 +02:00