3603 Commits

Author SHA1 Message Date
alakatos
6f7347342a Make action counter part of the config 2022-02-11 11:48:01 +01:00
Ameer Ghani
e98e691ad8
ompgsql: allow connection params via connection string
Happy new years! Add another action parameter `conninfo` that allows specifying
a postgres connection string. This enables us to use any of the postgres connection
parameters, particularly `sslmode` and `sslrootcert`.

Per the postgres docs, this connection string can be a URI or several key-value
pairs. https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING

Here's an example:
```
module(load="ompgsql")

action(
	type="ompgsql"
	conninfo="postgresql://postgres:password@localhost/Syslog?sslmode=require"
)
```

This addresses https://github.com/rsyslog/rsyslog/issues/4741 by allowing the
user to specify ssl options as part of the connection string. `libpq` will take
care of the rest.

This also addresses https://github.com/rsyslog/rsyslog/issues/4698 because
`libpq` is not constrained by MAXHOSTNAMELEN. Long hostnames will work.

`conninfo` can be specified in lieu of the other parameters. `ompgsql` will
prioritize using `conninfo` to connect over the other parameters.

Signed-off-by: Ameer Ghani <inahga@gmail.com>
2022-01-17 15:09:43 -06:00
alakatos
3edbe334e7 Move timezone specific variables to rsconf 2022-01-14 15:46:40 +01:00
alakatos
321fc76f0f Move rsyslog global parameters to rsconf_t struct 2022-01-13 12:43:21 +01:00
Rainer Gerhards
7d2e532d34
cleanup: remove unused variable
Especially as this caused confusion when doing other work inside the code.

see also https://github.com/rsyslog/rsyslog/pull/4760#discussion_r783118550
2022-01-12 15:22:08 +01:00
alakatos
66bcd91196 Clarify meaning of loadConf and RunConf 2021-12-15 10:26:52 +01:00
Rainer Gerhards
d7dc2f1f75
Merge pull request #4745 from Cropi/outchannel-leak
Deallocate outchannel resources in rsconf destructor
2021-12-14 18:07:35 +01:00
alakatos
ab99d68009 Use runConf instead of loadConf in ratelimiting during runtime 2021-12-08 19:36:48 +01:00
alakatos
4fc5ed645a Deallocate outchannel resources in rsconf destructor 2021-11-30 18:15:33 +01:00
Rainer Gerhards
03aa23a038
Merge pull request #4728 from VultureProject/faup_upstream
NEW CONTRIB::FFAUP:: URL parser module function using libfaup
2021-11-22 09:03:44 +01:00
frikilax
aeaf1160ed NEW CONTRIB::FFAUP:: URL parser module function using libfaup 2021-11-19 09:26:34 +01:00
Rainer Gerhards
cdf364f290
ruleset bugfix: ruleset queue was incorrectly named
The ruleset was incorrectly and unusably named. This was a regeression
from 4a63f8e9629c3c9481a8b6f9d7787e3b3304320b.

Many thanks to github user digirati82 for alerting us.

closes https://github.com/rsyslog/rsyslog/issues/4730
2021-11-09 14:46:40 +01:00
Rainer Gerhards
f83306fe2a
imtcp: add support for permittedPeers setting at input() level
The permittedPeers settig was actually forgotten during the refactoring
of TLS input() level settings. This functionality is now added.

closes: https://github.com/rsyslog/rsyslog/issues/4706
2021-10-25 11:05:20 +02:00
9ca44ad300 openssl: Removed legacy parameter bAnonInit
- Added precompiler check to remove depreceated openssl API
  SSL_CTX_set_ecdh_auto
- Should fix problems related to the TSAN check in PR4708
  see also: https://github.com/rsyslog/rsyslog/pull/4708
2021-10-22 11:37:49 +02:00
Orgad Shaneh
550935194e openssl: remove unused global 2021-10-21 21:46:20 +03:00
Rainer Gerhards
7b7a538da3
Merge pull request #4710 from alorbach/pr-issue-4642
PrivDropToUser: fix abortOnIDResolutionFail handling
2021-10-13 09:22:01 +02:00
03fdbfda74 PrivDropToUser: fix abortOnIDResolutionFail handling
security.abortonidresolutionfail needs to be loaded glblProcessCnf,
otherwise the setting is ignored in doGetUID / doGetGID.

see also: https://github.com/rsyslog/rsyslog/issues/4642
see also: cbcaf2c7e5
2021-10-12 12:15:15 +02:00
Rainer Gerhards
68f1727066
Merge pull request #4688 from rgerhards/queue-direct-ml
rscript fix: ruleset called async when ruleset had queue.type="direct"
2021-10-12 10:25:41 +02:00
Rainer Gerhards
c4054cba4e
Merge pull request #4689 from taavi-valjaots/ksi-locking-bug-fix
ksi bugfix: locking bug fixed in rsksiCtxOpenFile
2021-10-12 09:07:42 +02:00
Rainer Gerhards
5ecd8d0c29
Merge pull request #4704 from jkschulz/patch-1
Fix typo in error message.
2021-10-11 16:43:17 +02:00
Rainer Gerhards
a649d03d8c
Merge pull request #4705 from orgads/pthread-errors
tcpsrv: fix compilation without exceptions
2021-10-11 16:41:05 +02:00
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
Orgad Shaneh
bca5a891a7 tcpsrv: fix compilation without exceptions
tcpsrv.c:992:1: error: label at end of compound statement
 finalize_it:
 ^~~~~~~~~~~

Quoting from pthread.h:
  pthread_cleanup_push and pthread_cleanup_pop are macros and must always
  be used in matching pairs at the same nesting level of braces.

Amends commit bcdd220142ec9eb106550195ba331fd114adb0bd.
2021-10-11 15:25:03 +03: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
jkschulz
eadb23560b
Fix typo in error message. 2021-10-06 23:49:20 -04: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
taavi.valjaots
858a5292c1 ksi bugfix: locking bug fixed in rsksiCtxOpenFile 2021-09-20 11:11:47 +03: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