mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-19 19:52:55 +02:00
Add ratelimit.interval, ratelimit.burst, and ratelimit.name parameters to omusrmsg. This prevents DoS scenarios where emergency message floods can overwhelm user terminals. The implementation follows the established output module pattern: - Sentinel-based (-1) defaults for mutual-exclusivity detection - ratelimit.name references a shared ratelimit() configuration object - Per-action ratelimiters via ratelimitNew()/ratelimitSetLinuxLike() - ratelimitMsgCount() gate in doAction Also adds module-level config (modConfData_s) with beginCnfLoad, endCnfLoad, checkCnf, activateCnf, freeCnf entry points, needed to stash rsconf_t* for ratelimitNewFromConfig(). Includes documentation updates and a config-validation test. Closes: https://github.com/rsyslog/rsyslog/issues/4547 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
18 lines
427 B
Bash
Executable File
18 lines
427 B
Bash
Executable File
#!/bin/bash
|
|
# Test for omusrmsg ratelimit.name support (config-validation test).
|
|
# added 2025-07-10 by RGerhards, released under ASL 2.0
|
|
. ${srcdir:=.}/diag.sh init
|
|
generate_conf
|
|
add_conf '
|
|
ratelimit(name="omusrmsg_test_limit" interval="2" burst="5")
|
|
|
|
:msg, contains, "msgnum:" {
|
|
action(type="omusrmsg" users="nouser"
|
|
ratelimit.name="omusrmsg_test_limit")
|
|
}
|
|
'
|
|
startup
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
exit_test
|