commit
31659b0961
@ -0,0 +1,3 @@
|
||||
SOURCES/qpid-proton-0.34.0.tar.gz
|
||||
SOURCES/rsyslog-8.2102.0.tar.gz
|
||||
SOURCES/rsyslog-doc-8.2102.0.tar.gz
|
@ -0,0 +1,3 @@
|
||||
390e5cb87a6331cf0ce451d7f6552e2c0d97f706 SOURCES/qpid-proton-0.34.0.tar.gz
|
||||
fdda78ed808e7a0dca03ead9227a0a5d913a050f SOURCES/rsyslog-8.2102.0.tar.gz
|
||||
9c2188d435cb5f79c1c35749003bd2a61e7f2d07 SOURCES/rsyslog-doc-8.2102.0.tar.gz
|
@ -0,0 +1,83 @@
|
||||
diff -up ./qpid-proton-0.34.0/c/src/ssl/openssl.c.orig ./qpid-proton-0.34.0/c/src/ssl/openssl.c
|
||||
--- ./qpid-proton-0.34.0/c/src/ssl/openssl.c.orig 2021-06-01 09:29:27.976842727 +0200
|
||||
+++ ./qpid-proton-0.34.0/c/src/ssl/openssl.c 2021-06-01 09:31:05.232015887 +0200
|
||||
@@ -353,65 +353,6 @@ static int verify_callback(int preverify
|
||||
return preverify_ok;
|
||||
}
|
||||
|
||||
-// This was introduced in v1.1
|
||||
-#if OPENSSL_VERSION_NUMBER < 0x10100000
|
||||
-int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
|
||||
-{
|
||||
- dh->p = p;
|
||||
- dh->q = q;
|
||||
- dh->g = g;
|
||||
- return 1;
|
||||
-}
|
||||
-#endif
|
||||
-
|
||||
-// this code was generated using the command:
|
||||
-// "openssl dhparam -C -2 2048"
|
||||
-static DH *get_dh2048(void)
|
||||
-{
|
||||
- static const unsigned char dhp_2048[]={
|
||||
- 0xAE,0xF7,0xE9,0x66,0x26,0x7A,0xAC,0x0A,0x6F,0x1E,0xCD,0x81,
|
||||
- 0xBD,0x0A,0x10,0x7E,0xFA,0x2C,0xF5,0x2D,0x98,0xD4,0xE7,0xD9,
|
||||
- 0xE4,0x04,0x8B,0x06,0x85,0xF2,0x0B,0xA3,0x90,0x15,0x56,0x0C,
|
||||
- 0x8B,0xBE,0xF8,0x48,0xBB,0x29,0x63,0x75,0x12,0x48,0x9D,0x7E,
|
||||
- 0x7C,0x24,0xB4,0x3A,0x38,0x7E,0x97,0x3C,0x77,0x95,0xB0,0xA2,
|
||||
- 0x72,0xB6,0xE9,0xD8,0xB8,0xFA,0x09,0x1B,0xDC,0xB3,0x80,0x6E,
|
||||
- 0x32,0x0A,0xDA,0xBB,0xE8,0x43,0x88,0x5B,0xAB,0xC3,0xB2,0x44,
|
||||
- 0xE1,0x95,0x85,0x0A,0x0D,0x13,0xE2,0x02,0x1E,0x96,0x44,0xCF,
|
||||
- 0xA0,0xD8,0x46,0x32,0x68,0x63,0x7F,0x68,0xB3,0x37,0x52,0xCE,
|
||||
- 0x3A,0x4E,0x48,0x08,0x7F,0xD5,0x53,0x00,0x59,0xA8,0x2C,0xCB,
|
||||
- 0x51,0x64,0x3D,0x5F,0xEF,0x0E,0x5F,0xE6,0xAF,0xD9,0x1E,0xA2,
|
||||
- 0x35,0x64,0x37,0xD7,0x4C,0xC9,0x24,0xFD,0x2F,0x75,0xBB,0x3A,
|
||||
- 0x15,0x82,0x76,0x4D,0xC2,0x8B,0x1E,0xB9,0x4B,0xA1,0x33,0xCF,
|
||||
- 0xAA,0x3B,0x7C,0xC2,0x50,0x60,0x6F,0x45,0x69,0xD3,0x6B,0x88,
|
||||
- 0x34,0x9B,0xE4,0xF8,0xC6,0xC7,0x5F,0x10,0xA1,0xBA,0x01,0x8C,
|
||||
- 0xDA,0xD1,0xA3,0x59,0x9C,0x97,0xEA,0xC3,0xF6,0x02,0x55,0x5C,
|
||||
- 0x92,0x1A,0x39,0x67,0x17,0xE2,0x9B,0x27,0x8D,0xE8,0x5C,0xE9,
|
||||
- 0xA5,0x94,0xBB,0x7E,0x16,0x6F,0x53,0x5A,0x6D,0xD8,0x03,0xC2,
|
||||
- 0xAC,0x7A,0xCD,0x22,0x98,0x8E,0x33,0x2A,0xDE,0xAB,0x12,0xC0,
|
||||
- 0x0B,0x7C,0x0C,0x20,0x70,0xD9,0x0B,0xAE,0x0B,0x2F,0x20,0x9B,
|
||||
- 0xA4,0xED,0xFD,0x49,0x0B,0xE3,0x4A,0xF6,0x28,0xB3,0x98,0xB0,
|
||||
- 0x23,0x1C,0x09,0x33,
|
||||
- };
|
||||
- static const unsigned char dhg_2048[]={
|
||||
- 0x02,
|
||||
- };
|
||||
- DH *dh = DH_new();
|
||||
- BIGNUM *dhp_bn, *dhg_bn;
|
||||
-
|
||||
- if (dh == NULL)
|
||||
- return NULL;
|
||||
- dhp_bn = BN_bin2bn(dhp_2048, sizeof (dhp_2048), NULL);
|
||||
- dhg_bn = BN_bin2bn(dhg_2048, sizeof (dhg_2048), NULL);
|
||||
- if (dhp_bn == NULL || dhg_bn == NULL
|
||||
- || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) {
|
||||
- DH_free(dh);
|
||||
- BN_free(dhp_bn);
|
||||
- BN_free(dhg_bn);
|
||||
- return NULL;
|
||||
- }
|
||||
- return dh;
|
||||
-}
|
||||
-
|
||||
typedef struct {
|
||||
char *id;
|
||||
SSL_SESSION *session;
|
||||
@@ -542,13 +483,6 @@ static bool pni_init_ssl_domain( pn_ssl_
|
||||
domain->default_seclevel = SSL_CTX_get_security_level(domain->ctx);
|
||||
# endif
|
||||
|
||||
- DH *dh = get_dh2048();
|
||||
- if (dh) {
|
||||
- SSL_CTX_set_tmp_dh(domain->ctx, dh);
|
||||
- DH_free(dh);
|
||||
- SSL_CTX_set_options(domain->ctx, SSL_OP_SINGLE_DH_USE);
|
||||
- }
|
||||
-
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
diff -up ./plugins/imjournal/imjournal.c.default-tag ./plugins/imjournal/imjournal.c
|
||||
--- ./plugins/imjournal/imjournal.c.default-tag 2018-05-17 08:50:11.416418022 -0400
|
||||
+++ ./plugins/imjournal/imjournal.c 2018-05-17 08:53:02.884418022 -0400
|
||||
@@ -78,6 +78,7 @@ static struct configSettings_s {
|
||||
int bWorkAroundJournalBug; /* deprecated, left for backwards compatibility only */
|
||||
int bFsync;
|
||||
int bRemote;
|
||||
+ char *dfltTag;
|
||||
} cs;
|
||||
|
||||
static rsRetVal facilityHdlr(uchar **pp, void *pVal);
|
||||
@@ -93,7 +94,8 @@ static struct cnfparamdescr modpdescr[]
|
||||
{ "usepid", eCmdHdlrString, 0 },
|
||||
{ "workaroundjournalbug", eCmdHdlrBinary, 0 },
|
||||
{ "fsync", eCmdHdlrBinary, 0 },
|
||||
- { "remote", eCmdHdlrBinary, 0 }
|
||||
+ { "remote", eCmdHdlrBinary, 0 },
|
||||
+ { "defaulttag", eCmdHdlrGetWord, 0 }
|
||||
};
|
||||
static struct cnfparamblk modpblk =
|
||||
{ CNFPARAMBLK_VERSION,
|
||||
@@ -104,6 +106,7 @@ static struct cnfparamblk modpblk =
|
||||
#define DFLT_persiststateinterval 10
|
||||
#define DFLT_SEVERITY pri2sev(LOG_NOTICE)
|
||||
#define DFLT_FACILITY pri2fac(LOG_USER)
|
||||
+#define DFLT_TAG "journal"
|
||||
|
||||
static int bLegacyCnfModGlobalsPermitted = 1;/* are legacy module-global config parameters permitted? */
|
||||
|
||||
@@ -268,7 +271,7 @@ readjournal(void)
|
||||
|
||||
/* Information from messages */
|
||||
char *message = NULL;
|
||||
- char *sys_iden;
|
||||
+ char *sys_iden = NULL;
|
||||
char *sys_iden_help = NULL;
|
||||
|
||||
const void *get;
|
||||
@@ -331,7 +334,7 @@ readjournal(void)
|
||||
if (journalGetData("SYSLOG_IDENTIFIER", &get, &length) >= 0) {
|
||||
CHKiRet(sanitizeValue(((const char *)get) + 18, length - 18, &sys_iden));
|
||||
} else {
|
||||
- CHKmalloc(sys_iden = strdup("journal"));
|
||||
+ CHKmalloc(sys_iden = strdup(cs.dfltTag));
|
||||
}
|
||||
|
||||
/* trying to get PID, default is "SYSLOG_PID" property */
|
||||
@@ -654,6 +657,11 @@ CODESTARTrunInput
|
||||
"\"usepidfromsystem\" is depricated, use \"usepid\" instead");
|
||||
}
|
||||
|
||||
+ if (cs.dfltTag == NULL) {
|
||||
+ cs.dfltTag = strdup(DFLT_TAG);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
if (cs.usePid && (strcmp(cs.usePid, "system") == 0)) {
|
||||
pidFieldName = "_PID";
|
||||
bPidFallBack = 0;
|
||||
@@ -732,6 +740,7 @@ CODESTARTbeginCnfLoad
|
||||
cs.bWorkAroundJournalBug = 1;
|
||||
cs.bFsync = 0;
|
||||
cs.bRemote = 0;
|
||||
+ cs.dfltTag = NULL;
|
||||
ENDbeginCnfLoad
|
||||
|
||||
|
||||
@@ -754,6 +763,7 @@ BEGINfreeCnf
|
||||
CODESTARTfreeCnf
|
||||
free(cs.stateFile);
|
||||
free(cs.usePid);
|
||||
+ free(cs.dfltTag);
|
||||
free(journalContext.cursor);
|
||||
statsobj.Destruct(&(statsCounter.stats));
|
||||
ENDfreeCnf
|
||||
@@ -832,6 +842,8 @@ CODESTARTsetModCnf
|
||||
cs.bFsync = (int) pvals[i].val.d.n;
|
||||
} else if (!strcmp(modpblk.descr[i].name, "remote")) {
|
||||
cs.bRemote = (int) pvals[i].val.d.n;
|
||||
+ } else if (!strcmp(modpblk.descr[i].name, "defaulttag")) {
|
||||
+ cs.dfltTag = (char *)es_str2cstr(pvals[i].val.d.estr, NULL);
|
||||
} else {
|
||||
dbgprintf("imjournal: program error, non-handled "
|
||||
"param '%s' in beginCnfLoad\n", modpblk.descr[i].name);
|
||||
@@ -799,6 +820,8 @@ CODEmodInit_QueryRegCFSLineHdlr
|
||||
facilityHdlr, &cs.iDfltFacility, STD_LOADABLE_MODULE_ID));
|
||||
CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournalusepidfromsystem", 0, eCmdHdlrBinary,
|
||||
NULL, &cs.bUseJnlPID, STD_LOADABLE_MODULE_ID));
|
||||
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imjournaldefaulttag", 0, eCmdHdlrGetWord,
|
||||
+ NULL, &cs.dfltTag, STD_LOADABLE_MODULE_ID));
|
||||
ENDmodInit
|
||||
/* vim:set ai:
|
||||
*/
|
@ -0,0 +1,21 @@
|
||||
diff -up rsyslog-8.2102.0/plugins/omrelp/omrelp.c.orig rsyslog-8.2102.0/plugins/omrelp/omrelp.c
|
||||
--- rsyslog-8.2102.0/plugins/omrelp/omrelp.c.orig 2021-06-15 12:46:14.758589030 +0200
|
||||
+++ rsyslog-8.2102.0/plugins/omrelp/omrelp.c 2021-06-15 12:47:08.130516632 +0200
|
||||
@@ -303,7 +303,7 @@ ENDfreeCnf
|
||||
BEGINcreateInstance
|
||||
CODESTARTcreateInstance
|
||||
pData->sizeWindow = 0;
|
||||
- pData->timeout = 90;
|
||||
+ pData->timeout = 5;
|
||||
pData->connTimeout = 10;
|
||||
pData->rebindInterval = 0;
|
||||
pData->bEnableTLS = DFLT_ENABLE_TLS;
|
||||
@@ -365,7 +365,7 @@ setInstParamDefaults(instanceData *pData
|
||||
pData->target = NULL;
|
||||
pData->port = NULL;
|
||||
pData->tplName = NULL;
|
||||
- pData->timeout = 90;
|
||||
+ pData->timeout = 5;
|
||||
pData->connTimeout = 10;
|
||||
pData->sizeWindow = 0;
|
||||
pData->rebindInterval = 0;
|
@ -0,0 +1,47 @@
|
||||
diff -up rsyslog-8.2102.0/doc/configuration/modules/imfile.html.state-file-leaking-doc rsyslog-8.2102.0/doc/configuration/modules/imfile.html
|
||||
--- rsyslog-8.2102.0/doc/configuration/modules/imfile.html.state-file-leaking-doc 2021-02-15 12:53:31.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/doc/configuration/modules/imfile.html 2022-03-29 10:35:07.187827004 +0200
|
||||
@@ -294,6 +294,28 @@ rsyslog needs write permissions to work
|
||||
also might require SELinux definitions (or similar for other enhanced security
|
||||
systems).</p>
|
||||
</div>
|
||||
+<div class="section" id="deletestateonfilemove">
|
||||
+<h4>deleteStateOnFileMove<a class="headerlink" href="#deletestateonfilemove" title="Permalink to this headline">¶</a></h4>
|
||||
+<table border="1" class="colwidths-auto parameter-table docutils">
|
||||
+<thead valign="bottom">
|
||||
+<tr class="row-odd"><th class="head">type</th>
|
||||
+<th class="head">default</th>
|
||||
+<th class="head">mandatory</th>
|
||||
+<th class="head"><code class="docutils literal notranslate"><span class="pre">obsolete</span> <span class="pre">legacy</span></code> directive</th>
|
||||
+</tr>
|
||||
+</thead>
|
||||
+<tbody valign="top">
|
||||
+<tr class="row-even"><td>binary</td>
|
||||
+<td>off</td>
|
||||
+<td>no</td>
|
||||
+<td>none</td>
|
||||
+</tr>
|
||||
+</tbody>
|
||||
+</table>
|
||||
+<p>This parameter controls if state files are deleted if their associated main file is rotated via move. Usually, this is a good idea, because otherwise state files are not deleted when log rotation occurs.</p>
|
||||
+
|
||||
+<p>However, there is one situation where not deleting associated state file after log rotation makes sense: this is the case if a monitored file is later moved back to the same location as it was before.</p>
|
||||
+</div>
|
||||
</div>
|
||||
<div class="section" id="input-parameters">
|
||||
<h3>Input Parameters<a class="headerlink" href="#input-parameters" title="Permalink to this headline">¶</a></h3>
|
||||
@@ -1214,6 +1236,7 @@ and Others.</p>
|
||||
<li><a class="reference internal" href="#sortfiles">sortFiles</a></li>
|
||||
<li><a class="reference internal" href="#pollinginterval">PollingInterval</a></li>
|
||||
<li><a class="reference internal" href="#statefile-directory">statefile.directory</a></li>
|
||||
+<li><a class="reference internal" href="#deletestateonfilemove">deleteStateOnFileMove</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#input-parameters">Input Parameters</a><ul>
|
||||
@@ -1311,4 +1334,4 @@ and Others.</p>
|
||||
<div class="footer" role="contentinfo">
|
||||
</div>
|
||||
</body>
|
||||
-</html>
|
||||
\ No newline at end of file
|
||||
+</html>
|
@ -0,0 +1,162 @@
|
||||
diff -up rsyslog-8.2102.0/plugins/imfile/imfile.c.state-file-leaking rsyslog-8.2102.0/plugins/imfile/imfile.c
|
||||
--- rsyslog-8.2102.0/plugins/imfile/imfile.c.state-file-leaking 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/plugins/imfile/imfile.c 2022-03-28 12:51:03.572554843 +0200
|
||||
@@ -259,6 +259,7 @@ struct modConfData_s {
|
||||
Must be manually reset to 0 if desired. Helper for
|
||||
polling mode.
|
||||
*/
|
||||
+ sbool deleteStateOnFileMove;
|
||||
};
|
||||
static modConfData_t *loadModConf = NULL;/* modConf ptr to use for the current load process */
|
||||
static modConfData_t *runModConf = NULL;/* modConf ptr to use for run process */
|
||||
@@ -305,7 +306,8 @@ static struct cnfparamdescr modpdescr[]
|
||||
{ "sortfiles", eCmdHdlrBinary, 0 },
|
||||
{ "statefile.directory", eCmdHdlrString, 0 },
|
||||
{ "normalizepath", eCmdHdlrBinary, 0 },
|
||||
- { "mode", eCmdHdlrGetWord, 0 }
|
||||
+ { "mode", eCmdHdlrGetWord, 0 },
|
||||
+ { "deletestateonfilemove", eCmdHdlrBinary, 0 }
|
||||
};
|
||||
static struct cnfparamblk modpblk =
|
||||
{ CNFPARAMBLK_VERSION,
|
||||
@@ -545,11 +547,20 @@ static int
|
||||
in_setupWatch(act_obj_t *const act, const int is_file)
|
||||
{
|
||||
int wd = -1;
|
||||
+ int flags;
|
||||
if(runModConf->opMode != OPMODE_INOTIFY)
|
||||
goto done;
|
||||
|
||||
- wd = inotify_add_watch(ino_fd, act->name,
|
||||
- (is_file) ? IN_MODIFY|IN_DONT_FOLLOW : IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO);
|
||||
+ // wd = inotify_add_watch(ino_fd, act->name,
|
||||
+ // (is_file) ? IN_MODIFY|IN_DONT_FOLLOW : IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO);
|
||||
+ if(is_file)
|
||||
+ flags = IN_MODIFY|IN_DONT_FOLLOW;
|
||||
+ else if(runModConf->deleteStateOnFileMove)
|
||||
+ flags = IN_CREATE|IN_DELETE|IN_MOVED_TO;
|
||||
+ else
|
||||
+ flags = IN_CREATE|IN_DELETE|IN_MOVED_FROM|IN_MOVED_TO;
|
||||
+ wd = inotify_add_watch(ino_fd, act->name, flags);
|
||||
+
|
||||
if(wd < 0) {
|
||||
if (errno == EACCES) { /* There is high probability of selinux denial on top-level paths */
|
||||
DBGPRINTF("imfile: permission denied when adding watch for '%s'\n", act->name);
|
||||
@@ -713,7 +724,7 @@ act_obj_add(fs_edge_t *const edge, const
|
||||
char basename[MAXFNAME];
|
||||
DEFiRet;
|
||||
int fd = -1;
|
||||
-
|
||||
+
|
||||
DBGPRINTF("act_obj_add: edge %p, name '%s' (source '%s')\n", edge, name, source? source : "---");
|
||||
for(act = edge->active ; act != NULL ; act = act->next) {
|
||||
if(!strcmp(act->name, name)) {
|
||||
@@ -977,9 +988,18 @@ act_obj_destroy(act_obj_t *const act, co
|
||||
if(act == NULL)
|
||||
return;
|
||||
|
||||
- DBGPRINTF("act_obj_destroy: act %p '%s' (source '%s'), wd %d, pStrm %p, is_deleted %d, in_move %d\n",
|
||||
- act, act->name, act->source_name? act->source_name : "---", act->wd, act->pStrm, is_deleted,
|
||||
- act->in_move);
|
||||
+ // DBGPRINTF("act_obj_destroy: act %p '%s' (source '%s'), wd %d, pStrm %p, is_deleted %d, in_move %d\n",
|
||||
+ // act, act->name, act->source_name? act->source_name : "---", act->wd, act->pStrm, is_deleted,
|
||||
+ // act->in_move);
|
||||
+ if (runModConf->deleteStateOnFileMove) {
|
||||
+ DBGPRINTF("act_obj_destroy: act %p '%s' (source '%s'), wd %d, pStrm %p, is_deleted %d\n",
|
||||
+ act, act->name, act->source_name? act->source_name : "---", act->wd, act->pStrm, is_deleted);
|
||||
+ } else {
|
||||
+ DBGPRINTF("act_obj_destroy: act %p '%s' (source '%s'), wd %d, pStrm %p, is_deleted %d, in_move %d\n",
|
||||
+ act, act->name, act->source_name? act->source_name : "---", act->wd, act->pStrm,
|
||||
+ is_deleted, act->in_move);
|
||||
+ }
|
||||
+
|
||||
if(act->is_symlink && is_deleted) {
|
||||
act_obj_t *target_act;
|
||||
for(target_act = act->edge->active ; target_act != NULL ; target_act = target_act->next) {
|
||||
@@ -996,13 +1016,15 @@ act_obj_destroy(act_obj_t *const act, co
|
||||
pollFile(act); /* get any left-over data */
|
||||
if(inst->bRMStateOnDel) {
|
||||
statefn = getStateFileName(act, statefile, sizeof(statefile));
|
||||
- getFullStateFileName(statefn, "", toDel, sizeof(toDel)); // TODO: check!
|
||||
+ // getFullStateFileName(statefn, "", toDel, sizeof(toDel)); // TODO: check!
|
||||
+ getFullStateFileName(statefn, act->file_id, toDel, sizeof(toDel)); // TODO: check!
|
||||
statefn = toDel;
|
||||
}
|
||||
persistStrmState(act);
|
||||
strm.Destruct(&act->pStrm);
|
||||
/* we delete state file after destruct in case strm obj initiated a write */
|
||||
- if(is_deleted && !act->in_move && inst->bRMStateOnDel) {
|
||||
+ // if(is_deleted && !act->in_move && inst->bRMStateOnDel) {
|
||||
+ if(is_deleted && inst->bRMStateOnDel && (runModConf->deleteStateOnFileMove || !act->in_move)) {
|
||||
DBGPRINTF("act_obj_destroy: deleting state file %s\n", statefn);
|
||||
unlink((char*)statefn);
|
||||
}
|
||||
@@ -1012,6 +1034,7 @@ act_obj_destroy(act_obj_t *const act, co
|
||||
}
|
||||
#ifdef HAVE_INOTIFY_INIT
|
||||
if(act->wd != -1) {
|
||||
+ inotify_rm_watch(ino_fd, act->wd);
|
||||
wdmapDel(act->wd);
|
||||
}
|
||||
#endif
|
||||
@@ -2026,6 +2049,7 @@ CODESTARTbeginCnfLoad
|
||||
loadModConf->timeoutGranularity = 1000; /* default: 1 second */
|
||||
loadModConf->haveReadTimeouts = 0; /* default: no timeout */
|
||||
loadModConf->normalizePath = 1;
|
||||
+ loadModConf->deleteStateOnFileMove = 0;
|
||||
loadModConf->sortFiles = GLOB_NOSORT;
|
||||
loadModConf->stateFileDirectory = NULL;
|
||||
loadModConf->conf_tree = calloc(sizeof(fs_node_t), 1);
|
||||
@@ -2085,6 +2109,8 @@ CODESTARTsetModCnf
|
||||
loadModConf->stateFileDirectory = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
|
||||
} else if(!strcmp(modpblk.descr[i].name, "normalizepath")) {
|
||||
loadModConf->normalizePath = (sbool) pvals[i].val.d.n;
|
||||
+ } else if(!strcmp(modpblk.descr[i].name, "deletestateonfilemove")) {
|
||||
+ loadModConf->deleteStateOnFileMove = (sbool) pvals[i].val.d.n;
|
||||
} else if(!strcmp(modpblk.descr[i].name, "mode")) {
|
||||
if(!es_strconstcmp(pvals[i].val.d.estr, "polling"))
|
||||
loadModConf->opMode = OPMODE_POLLING;
|
||||
@@ -2388,16 +2414,35 @@ in_processEvent(struct inotify_event *ev
|
||||
DBGPRINTF("in_processEvent process Event %x is_file %d, act->name '%s'\n",
|
||||
ev->mask, etry->act->edge->is_file, etry->act->name);
|
||||
|
||||
- if((ev->mask & IN_MOVED_FROM)) {
|
||||
- flag_in_move(etry->act->edge->node->edges, ev->name);
|
||||
- }
|
||||
- if(ev->mask & (IN_MOVED_FROM | IN_MOVED_TO)) {
|
||||
- fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
- } else if(etry->act->edge->is_file && !(etry->act->is_symlink)) {
|
||||
- in_handleFileEvent(ev, etry); // esentially poll_file()!
|
||||
+ // if((ev->mask & IN_MOVED_FROM)) {
|
||||
+ // flag_in_move(etry->act->edge->node->edges, ev->name);
|
||||
+ // }
|
||||
+ // if(ev->mask & (IN_MOVED_FROM | IN_MOVED_TO)) {
|
||||
+ // fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
+ // } else if(etry->act->edge->is_file && !(etry->act->is_symlink)) {
|
||||
+ // in_handleFileEvent(ev, etry); // esentially poll_file()!
|
||||
+ // } else {
|
||||
+ // fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
+ // }
|
||||
+ if(!runModConf->deleteStateOnFileMove) {
|
||||
+ if((ev->mask & IN_MOVED_FROM)) {
|
||||
+ flag_in_move(etry->act->edge->node->edges, ev->name);
|
||||
+ }
|
||||
+ if(ev->mask & (IN_MOVED_FROM | IN_MOVED_TO)) {
|
||||
+ fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
+ } else if(etry->act->edge->is_file && !(etry->act->is_symlink)) {
|
||||
+ in_handleFileEvent(ev, etry); // esentially poll_file()!
|
||||
+ } else {
|
||||
+ fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
+ }
|
||||
} else {
|
||||
- fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
+ if((ev->mask & IN_MODIFY) && etry->act->edge->is_file && !(etry->act->is_symlink)) {
|
||||
+ in_handleFileEvent(ev, etry); // esentially poll_file()!
|
||||
+ } else {
|
||||
+ fs_node_walk(etry->act->edge->node, poll_tree);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
done: return;
|
||||
}
|
||||
|
@ -0,0 +1,163 @@
|
||||
diff -up rsyslog-8.2102.0/contrib/imdocker/imdocker.c.covscan rsyslog-8.2102.0/contrib/imdocker/imdocker.c
|
||||
--- rsyslog-8.2102.0/contrib/imdocker/imdocker.c.covscan 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/contrib/imdocker/imdocker.c 2021-07-22 14:10:31.877231143 +0200
|
||||
@@ -1527,6 +1527,7 @@ process_json(sbool isInit, const char* j
|
||||
pInstances->last_container_id,
|
||||
(unsigned)pInstances->last_container_created);
|
||||
}
|
||||
+ // coverity[leaked_storage : FALSE]
|
||||
CHKiRet(dockerContLogsInstSetUrlById(isInit, pInst,
|
||||
pInstances->curlm, containerId));
|
||||
CHKiRet(dockerContLogReqsAdd(pInstances, pInst));
|
||||
diff -up rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c.covscan rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c
|
||||
--- rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c.covscan 2020-10-03 19:06:47.000000000 +0200
|
||||
+++ rsyslog-8.2102.0/contrib/omhiredis/omhiredis.c 2021-07-22 14:10:31.877231143 +0200
|
||||
@@ -324,7 +324,6 @@ BEGINnewActInst
|
||||
struct cnfparamvals *pvals;
|
||||
int i;
|
||||
int iNumTpls;
|
||||
- uchar *keydup = NULL;
|
||||
CODESTARTnewActInst
|
||||
if((pvals = nvlstGetParams(lst, &actpblk, NULL)) == NULL)
|
||||
ABORT_FINALIZE(RS_RET_MISSING_CNFPARAMS);
|
||||
@@ -417,14 +416,11 @@ CODESTARTnewActInst
|
||||
CHKiRet(OMSRsetEntry(*ppOMSR, 0, (uchar*)pData->tplName, OMSR_NO_RQD_TPL_OPTS));
|
||||
|
||||
if (pData->dynaKey) {
|
||||
- CHKmalloc(keydup = ustrdup(pData->key));
|
||||
CHKiRet(OMSRsetEntry(*ppOMSR, 1, ustrdup(pData->key), OMSR_NO_RQD_TPL_OPTS));
|
||||
- keydup = NULL; /* handed over */
|
||||
}
|
||||
|
||||
CODE_STD_FINALIZERnewActInst
|
||||
cnfparamvalsDestruct(pvals, &actpblk);
|
||||
- free(keydup);
|
||||
ENDnewActInst
|
||||
|
||||
|
||||
diff -up rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c.covscan rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c
|
||||
--- rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c.covscan 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/contrib/omrabbitmq/omrabbitmq.c 2021-07-22 14:10:31.877231143 +0200
|
||||
@@ -778,6 +778,7 @@ static rsRetVal publishRabbitMQ(wrkrInst
|
||||
ABORT_FINALIZE(RS_RET_RABBITMQ_CONN_ERR);
|
||||
}
|
||||
|
||||
+ // coverity[identical_branches : FALSE]
|
||||
if (manage_error(amqp_basic_publish(self->a_conn, 1, exchange, routing_key,
|
||||
0, 0, p_amqp_props, body_bytes), "amqp_basic_publish")) {
|
||||
/* error already notified */
|
||||
diff -up rsyslog-8.2102.0/grammar/rainerscript.c.covscan rsyslog-8.2102.0/grammar/rainerscript.c
|
||||
--- rsyslog-8.2102.0/grammar/rainerscript.c.covscan 2021-02-15 12:06:16.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/grammar/rainerscript.c 2021-07-22 14:10:31.878231140 +0200
|
||||
@@ -2814,7 +2814,7 @@ evalVar(struct cnfvar *__restrict__ cons
|
||||
if(bMustBeFreed)
|
||||
free(pszProp);
|
||||
}
|
||||
-
|
||||
+ // coverity[leaked_storage : FALSE]
|
||||
}
|
||||
|
||||
/* perform a string comparision operation against a while array. Semantic is
|
||||
diff -up rsyslog-8.2102.0/plugins/imfile/imfile.c.covscan rsyslog-8.2102.0/plugins/imfile/imfile.c
|
||||
--- rsyslog-8.2102.0/plugins/imfile/imfile.c.covscan 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/plugins/imfile/imfile.c 2021-07-22 14:10:31.878231140 +0200
|
||||
@@ -1278,6 +1278,7 @@ static void ATTR_NONNULL(1)
|
||||
getFileID(act_obj_t *const act)
|
||||
{
|
||||
char tmp_id[FILE_ID_HASH_SIZE];
|
||||
+ // coverity[buffer_size_warning : FALSE]
|
||||
strncpy(tmp_id, (const char*)act->file_id, FILE_ID_HASH_SIZE);
|
||||
act->file_id[0] = '\0';
|
||||
assert(act->fd >= 0); /* fd must have been opened at act_obj_t creation! */
|
||||
@@ -1290,6 +1291,7 @@ getFileID(act_obj_t *const act)
|
||||
DBGPRINTF("getFileID partial or error read, ret %d\n", r);
|
||||
}
|
||||
if (strncmp(tmp_id, act->file_id, FILE_ID_HASH_SIZE)) {/* save the old id for cleaning purposes */
|
||||
+ // coverity[buffer_size_warning : FALSE]
|
||||
strncpy(act->file_id_prev, tmp_id, FILE_ID_HASH_SIZE);
|
||||
}
|
||||
DBGPRINTF("getFileID for '%s', file_id_hash '%s'\n", act->name, act->file_id);
|
||||
@@ -1544,6 +1546,7 @@ openFileWithoutStateFile(act_obj_t *cons
|
||||
const int fd = open(act->name, O_RDONLY | O_CLOEXEC);
|
||||
if(fd >= 0) {
|
||||
act->pStrm->iCurrOffs = lseek64(fd, 0, SEEK_END);
|
||||
+ close(fd);
|
||||
if(act->pStrm->iCurrOffs < 0) {
|
||||
act->pStrm->iCurrOffs = 0;
|
||||
LogError(errno, RS_RET_ERR, "imfile: could not query current "
|
||||
diff -up rsyslog-8.2102.0/plugins/imptcp/imptcp.c.covscan rsyslog-8.2102.0/plugins/imptcp/imptcp.c
|
||||
--- rsyslog-8.2102.0/plugins/imptcp/imptcp.c.covscan 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/plugins/imptcp/imptcp.c 2021-07-22 14:10:31.878231140 +0200
|
||||
@@ -1920,6 +1920,7 @@ lstnActivity(ptcplstn_t *const pLstn)
|
||||
}
|
||||
|
||||
finalize_it:
|
||||
+ // coverity[leaked_handle : FALSE]
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
diff -up rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c.covscan rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c
|
||||
--- rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c.covscan 2020-10-03 19:06:47.000000000 +0200
|
||||
+++ rsyslog-8.2102.0/plugins/mmjsonparse/mmjsonparse.c 2021-07-22 14:10:31.879231138 +0200
|
||||
@@ -394,7 +394,7 @@ CODEmodInit_QueryRegCFSLineHdlr
|
||||
ABORT_FINALIZE(RS_RET_NO_MSG_PASSING);
|
||||
}
|
||||
|
||||
-
|
||||
+ // coverity[identical_branches : FALSE]
|
||||
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
|
||||
resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
|
||||
ENDmodInit
|
||||
diff -up rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c.covscan rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c
|
||||
--- rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c.covscan 2020-10-03 19:06:47.000000000 +0200
|
||||
+++ rsyslog-8.2102.0/plugins/omclickhouse/omclickhouse.c 2021-07-22 14:10:31.879231138 +0200
|
||||
@@ -368,6 +368,7 @@ writeDataError(wrkrInstanceData_t *const
|
||||
}
|
||||
|
||||
finalize_it:
|
||||
+ // coverity[leaked_storage : FALSE]
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
diff -up rsyslog-8.2102.0/runtime/nsd_gtls.c.covscan rsyslog-8.2102.0/runtime/nsd_gtls.c
|
||||
--- rsyslog-8.2102.0/runtime/nsd_gtls.c.covscan 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/runtime/nsd_gtls.c 2021-07-22 14:17:06.183174167 +0200
|
||||
@@ -227,7 +227,7 @@ gtlsLoadOurCertKey(nsd_gtls_t *pThis)
|
||||
pThis->bOurKeyIsInit = 1;
|
||||
CHKgnutls(gnutls_x509_privkey_import(pThis->ourKey, &data, GNUTLS_X509_FMT_PEM));
|
||||
free(data.data);
|
||||
-
|
||||
+ data.data = NULL;
|
||||
|
||||
finalize_it:
|
||||
if(iRet == RS_RET_CERTLESS) {
|
||||
diff -up rsyslog-8.2102.0/runtime/nsd_ptcp.c.covscan rsyslog-8.2102.0/runtime/nsd_ptcp.c
|
||||
--- rsyslog-8.2102.0/runtime/nsd_ptcp.c.covscan 2021-02-15 08:20:04.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/runtime/nsd_ptcp.c 2021-07-22 14:10:31.879231138 +0200
|
||||
@@ -191,6 +191,7 @@ SetTlsVerifyDepth(nsd_t __attribute__((u
|
||||
nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd;
|
||||
DEFiRet;
|
||||
ISOBJ_TYPE_assert((pThis), nsd_ptcp);
|
||||
+ // coverity[identical_branches : FALSE]
|
||||
if (verifyDepth == 0) {
|
||||
FINALIZE;
|
||||
}
|
||||
diff -up rsyslog-8.2102.0/tools/rsyslogd.c.covscan rsyslog-8.2102.0/tools/rsyslogd.c
|
||||
--- rsyslog-8.2102.0/tools/rsyslogd.c.covscan 2021-01-18 11:21:14.000000000 +0100
|
||||
+++ rsyslog-8.2102.0/tools/rsyslogd.c 2021-07-22 14:10:31.879231138 +0200
|
||||
@@ -293,6 +293,7 @@ writePidFile(void)
|
||||
free((void*)tmpPidFile);
|
||||
}
|
||||
finalize_it:
|
||||
+ // coverity[leaked_storage : FALSE]
|
||||
RETiRet;
|
||||
}
|
||||
|
||||
@@ -1026,6 +1027,7 @@ splitOversizeMessage(smsg_t *const pMsg)
|
||||
/* if necessary, write partial last segment */
|
||||
if(len_last_segment != 0) {
|
||||
CHKmalloc(pMsg_seg = MsgDup(pMsg));
|
||||
+ // coverity[copy_paste_error : FALSE]
|
||||
MsgSetRawMsg(pMsg_seg, rawmsg + (nsegments * maxlen), len_last_segment);
|
||||
submitMsg2(pMsg_seg);
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
diff -up rsyslog-8.2102.0/plugins/imjournal/imjournal.c.orig rsyslog-8.2102.0/plugins/imjournal/imjournal.c
|
||||
--- rsyslog-8.2102.0/plugins/imjournal/imjournal.c.orig 2021-06-15 12:30:35.238832058 +0200
|
||||
+++ rsyslog-8.2102.0/plugins/imjournal/imjournal.c 2021-06-15 12:32:04.699721356 +0200
|
||||
@@ -565,6 +565,8 @@ persistJournalState(void)
|
||||
ABORT_FINALIZE(RS_RET_IO_ERROR);
|
||||
}
|
||||
|
||||
+ fflush(sf);
|
||||
+
|
||||
/* change the name of the file to the configured one */
|
||||
if (rename(tmp_sf, cs.stateFile) < 0) {
|
||||
LogError(errno, iRet, "imjournal: rename() failed for new path: '%s'", cs.stateFile);
|
||||
@@ -586,6 +588,7 @@ persistJournalState(void)
|
||||
LogError(errno, RS_RET_IO_ERROR, "imjournal: fsync on '%s' failed", glbl.GetWorkDir());
|
||||
ABORT_FINALIZE(RS_RET_IO_ERROR);
|
||||
}
|
||||
+ closedir(wd);
|
||||
}
|
||||
|
||||
DBGPRINTF("Persisted journal to '%s'\n", cs.stateFile);
|
@ -0,0 +1,102 @@
|
||||
diff -up rsyslog-8.2102.0/runtime/cfsysline.c.orig rsyslog-8.2102.0/runtime/cfsysline.c
|
||||
--- rsyslog-8.2102.0/runtime/cfsysline.c.orig 2021-08-04 07:16:02.663163106 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/cfsysline.c 2021-08-04 07:18:05.952490008 +0200
|
||||
@@ -353,13 +353,8 @@ static rsRetVal doGetGID(uchar **pp, rsR
|
||||
assert(*pp != NULL);
|
||||
|
||||
if(getSubString(pp, (char*) szName, sizeof(szName), ' ') != 0) {
|
||||
- if(loadConf->globals.abortOnIDResolutionFail) {
|
||||
- fprintf(stderr, "could not extract group name: %s\n", (char*)szName);
|
||||
- exit(1); /* good exit */
|
||||
- } else {
|
||||
- LogError(0, RS_RET_NOT_FOUND, "could not extract group name");
|
||||
- ABORT_FINALIZE(RS_RET_NOT_FOUND);
|
||||
- }
|
||||
+ LogError(0, RS_RET_NOT_FOUND, "could not extract group name");
|
||||
+ ABORT_FINALIZE(RS_RET_NOT_FOUND);
|
||||
}
|
||||
|
||||
do {
|
||||
@@ -380,10 +375,6 @@ static rsRetVal doGetGID(uchar **pp, rsR
|
||||
LogError(0, RS_RET_NOT_FOUND, "ID for group '%s' could not be found", szName);
|
||||
}
|
||||
iRet = RS_RET_NOT_FOUND;
|
||||
- if(loadConf->globals.abortOnIDResolutionFail) {
|
||||
- fprintf(stderr, "ID for group '%s' could not be found or error\n", szName);
|
||||
- exit(1); /* good exit */
|
||||
- }
|
||||
} else {
|
||||
if(pSetHdlr == NULL) {
|
||||
/* we should set value directly to var */
|
||||
@@ -418,25 +409,15 @@ static rsRetVal doGetUID(uchar **pp, rsR
|
||||
assert(*pp != NULL);
|
||||
|
||||
if(getSubString(pp, (char*) szName, sizeof(szName), ' ') != 0) {
|
||||
- if(loadConf->globals.abortOnIDResolutionFail) {
|
||||
- fprintf(stderr, "could not extract user name: %s\n", (char*)szName);
|
||||
- exit(1); /* good exit */
|
||||
- } else {
|
||||
- LogError(0, RS_RET_NOT_FOUND, "could not extract user name");
|
||||
- ABORT_FINALIZE(RS_RET_NOT_FOUND);
|
||||
- }
|
||||
+ LogError(0, RS_RET_NOT_FOUND, "could not extract user name");
|
||||
+ ABORT_FINALIZE(RS_RET_NOT_FOUND);
|
||||
}
|
||||
|
||||
getpwnam_r((char*)szName, &pwBuf, stringBuf, sizeof(stringBuf), &ppwBuf);
|
||||
|
||||
if(ppwBuf == NULL) {
|
||||
- if(loadConf->globals.abortOnIDResolutionFail) {
|
||||
- fprintf(stderr, "ID for user '%s' could not be found or error\n", (char*)szName);
|
||||
- exit(1); /* good exit */
|
||||
- } else {
|
||||
- LogError(0, RS_RET_NOT_FOUND, "ID for user '%s' could not be found or error", (char*)szName);
|
||||
- iRet = RS_RET_NOT_FOUND;
|
||||
- }
|
||||
+ LogError(0, RS_RET_NOT_FOUND, "ID for user '%s' could not be found or error", (char*)szName);
|
||||
+ iRet = RS_RET_NOT_FOUND;
|
||||
} else {
|
||||
if(pSetHdlr == NULL) {
|
||||
/* we should set value directly to var */
|
||||
diff -up rsyslog-8.2102.0/runtime/glbl.c.orig rsyslog-8.2102.0/runtime/glbl.c
|
||||
--- rsyslog-8.2102.0/runtime/glbl.c.orig 2021-08-04 07:18:19.301633677 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/glbl.c 2021-08-04 07:19:02.409019106 +0200
|
||||
@@ -210,7 +210,6 @@ static struct cnfparamdescr cnfparamdesc
|
||||
{ "environment", eCmdHdlrArray, 0 },
|
||||
{ "processinternalmessages", eCmdHdlrBinary, 0 },
|
||||
{ "umask", eCmdHdlrFileCreateMode, 0 },
|
||||
- { "security.abortonidresolutionfail", eCmdHdlrBinary, 0 },
|
||||
{ "internal.developeronly.options", eCmdHdlrInt, 0 },
|
||||
{ "internalmsg.ratelimit.interval", eCmdHdlrPositiveInt, 0 },
|
||||
{ "internalmsg.ratelimit.burst", eCmdHdlrPositiveInt, 0 },
|
||||
@@ -1443,8 +1442,6 @@ glblDoneLoadCnf(void)
|
||||
glblInputTimeoutShutdown = (int) cnfparamvals[i].val.d.n;
|
||||
} else if(!strcmp(paramblk.descr[i].name, "privdrop.group.keepsupplemental")) {
|
||||
loadConf->globals.gidDropPrivKeepSupplemental = (int) cnfparamvals[i].val.d.n;
|
||||
- } else if(!strcmp(paramblk.descr[i].name, "security.abortonidresolutionfail")) {
|
||||
- loadConf->globals.abortOnIDResolutionFail = (int) cnfparamvals[i].val.d.n;
|
||||
} else if(!strcmp(paramblk.descr[i].name, "net.acladdhostnameonfail")) {
|
||||
*(net.pACLAddHostnameOnFail) = (int) cnfparamvals[i].val.d.n;
|
||||
} else if(!strcmp(paramblk.descr[i].name, "net.aclresolvehostname")) {
|
||||
diff -up rsyslog-8.2102.0/runtime/rsconf.c.orig rsyslog-8.2102.0/runtime/rsconf.c
|
||||
--- rsyslog-8.2102.0/runtime/rsconf.c.orig 2021-08-04 07:19:13.103104854 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/rsconf.c 2021-08-04 07:19:44.635357684 +0200
|
||||
@@ -156,7 +156,6 @@ static void cnfSetDefaults(rsconf_t *pTh
|
||||
pThis->globals.maxErrMsgToStderr = -1;
|
||||
pThis->globals.umask = -1;
|
||||
pThis->globals.gidDropPrivKeepSupplemental = 0;
|
||||
- pThis->globals.abortOnIDResolutionFail = 1;
|
||||
pThis->templates.root = NULL;
|
||||
pThis->templates.last = NULL;
|
||||
pThis->templates.lastStatic = NULL;
|
||||
diff -up rsyslog-8.2102.0/runtime/rsconf.h.orig rsyslog-8.2102.0/runtime/rsconf.h
|
||||
--- rsyslog-8.2102.0/runtime/rsconf.h.orig 2021-08-04 07:20:15.848607958 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/rsconf.h 2021-08-04 07:20:42.782823920 +0200
|
||||
@@ -73,7 +73,6 @@ struct globals_s {
|
||||
int uidDropPriv; /* user-id to which priveleges should be dropped to */
|
||||
int gidDropPriv; /* group-id to which priveleges should be dropped to */
|
||||
int gidDropPrivKeepSupplemental; /* keep supplemental groups when dropping? */
|
||||
- int abortOnIDResolutionFail;
|
||||
int umask; /* umask to use */
|
||||
uchar *pszConfDAGFile; /* name of config DAG file, non-NULL means generate one */
|
||||
|
@ -0,0 +1,26 @@
|
||||
diff -up rsyslog-8.2102.0/runtime/ratelimit.c.orig rsyslog-8.2102.0/runtime/ratelimit.c
|
||||
--- rsyslog-8.2102.0/runtime/ratelimit.c.orig 2021-07-27 10:37:50.972903104 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/ratelimit.c 2021-07-27 10:38:26.141002988 +0200
|
||||
@@ -235,7 +235,6 @@ ratelimitMsg(ratelimit_t *__restrict__ c
|
||||
{
|
||||
DEFiRet;
|
||||
rsRetVal localRet;
|
||||
- int severity = 0;
|
||||
|
||||
*ppRepMsg = NULL;
|
||||
|
||||
@@ -246,13 +245,12 @@ ratelimitMsg(ratelimit_t *__restrict__ c
|
||||
DBGPRINTF("Message discarded, parsing error %d\n", localRet);
|
||||
ABORT_FINALIZE(RS_RET_DISCARDMSG);
|
||||
}
|
||||
- severity = pMsg->iSeverity;
|
||||
}
|
||||
}
|
||||
|
||||
/* Only the messages having severity level at or below the
|
||||
* treshold (the value is >=) are subject to ratelimiting. */
|
||||
- if(ratelimit->interval && (severity >= ratelimit->severity)) {
|
||||
+ if(ratelimit->interval && (pMsg->iSeverity >= ratelimit->severity)) {
|
||||
char namebuf[512]; /* 256 for FGDN adn 256 for APPNAME should be enough */
|
||||
snprintf(namebuf, sizeof namebuf, "%s:%s", getHOSTNAME(pMsg),
|
||||
getAPPNAME(pMsg, 0));
|
@ -0,0 +1,11 @@
|
||||
diff -up ./rsyslog-8.2102.0/runtime/nsd_gtls.c.ori ./rsyslog-8.2102.0/runtime/nsd_gtls.c
|
||||
--- rsyslog-8.2102.0/runtime/nsd_gtls.c.ori 2022-01-17 15:50:08.285827256 +0100
|
||||
+++ rsyslog-8.2102.0/runtime/nsd_gtls.c 2022-01-17 15:52:33.282594512 +0100
|
||||
@@ -1791,6 +1791,7 @@ AcceptConnReq(nsd_t *pNsd, nsd_t **ppNew
|
||||
pNew->gnutlsPriorityString = pThis->gnutlsPriorityString;
|
||||
pNew->DrvrVerifyDepth = pThis->DrvrVerifyDepth;
|
||||
pNew->dataTypeCheck = pThis->dataTypeCheck;
|
||||
+ pNew->bSANpriority = pThis->bSANpriority;
|
||||
|
||||
/* if we reach this point, we are in TLS mode */
|
||||
iRet = gtlsInitSession(pNew);
|
@ -0,0 +1,215 @@
|
||||
diff -up rsyslog-8.2102.0/runtime/nsd_gtls.c.orig rsyslog-8.2102.0/runtime/nsd_gtls.c
|
||||
--- rsyslog-8.2102.0/runtime/nsd_gtls.c.orig 2022-04-11 09:26:17.826271989 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/nsd_gtls.c 2022-04-11 09:33:28.702012052 +0200
|
||||
@@ -556,7 +556,9 @@ gtlsRecordRecv(nsd_gtls_t *pThis)
|
||||
DEFiRet;
|
||||
|
||||
ISOBJ_TYPE_assert(pThis, nsd_gtls);
|
||||
- DBGPRINTF("gtlsRecordRecv: start\n");
|
||||
+ DBGPRINTF("gtlsRecordRecv: start (Pending Data: %zd | Wanted Direction: %s)\n",
|
||||
+ gnutls_record_check_pending(pThis->sess),
|
||||
+ (gnutls_record_get_direction(pThis->sess) == gtlsDir_READ ? "READ" : "WRITE") );
|
||||
|
||||
lenRcvd = gnutls_record_recv(pThis->sess, pThis->pszRcvBuf, NSD_GTLS_MAX_RCVBUF);
|
||||
if(lenRcvd >= 0) {
|
||||
@@ -581,14 +583,30 @@ gtlsRecordRecv(nsd_gtls_t *pThis)
|
||||
(NSD_GTLS_MAX_RCVBUF+lenRcvd));
|
||||
pThis->lenRcvBuf = NSD_GTLS_MAX_RCVBUF+lenRcvd;
|
||||
} else {
|
||||
- goto sslerr;
|
||||
+ if (lenRcvd == GNUTLS_E_AGAIN || lenRcvd == GNUTLS_E_INTERRUPTED) {
|
||||
+ goto sslerragain; /* Go to ERR AGAIN handling */
|
||||
+ } else {
|
||||
+ /* Do all other error handling */
|
||||
+ int gnuRet = lenRcvd;
|
||||
+ ABORTgnutls;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
} else if(lenRcvd == GNUTLS_E_AGAIN || lenRcvd == GNUTLS_E_INTERRUPTED) {
|
||||
-sslerr:
|
||||
- pThis->rtryCall = gtlsRtry_recv;
|
||||
- dbgprintf("GnuTLS receive requires a retry (this most probably is OK and no error condition)\n");
|
||||
- ABORT_FINALIZE(RS_RET_RETRY);
|
||||
+sslerragain:
|
||||
+ /* Check if the underlaying file descriptor needs to read or write data!*/
|
||||
+ if (gnutls_record_get_direction(pThis->sess) == gtlsDir_READ) {
|
||||
+ pThis->rtryCall = gtlsRtry_recv;
|
||||
+ dbgprintf("GnuTLS receive requires a retry, this most probably is OK and no error condition\n");
|
||||
+ ABORT_FINALIZE(RS_RET_RETRY);
|
||||
+ } else {
|
||||
+ uchar *pErr = gtlsStrerror(lenRcvd);
|
||||
+ LogError(0, RS_RET_GNUTLS_ERR, "GnuTLS receive error %zd has wrong read direction(wants write) "
|
||||
+ "- this could be caused by a broken connection. GnuTLS reports: %s\n",
|
||||
+ lenRcvd, pErr);
|
||||
+ free(pErr);
|
||||
+ ABORT_FINALIZE(RS_RET_GNUTLS_ERR);
|
||||
+ }
|
||||
} else {
|
||||
int gnuRet = lenRcvd;
|
||||
ABORTgnutls;
|
||||
@@ -1978,6 +1996,7 @@ static rsRetVal
|
||||
Send(nsd_t *pNsd, uchar *pBuf, ssize_t *pLenBuf)
|
||||
{
|
||||
int iSent;
|
||||
+ int wantsWriteData = 0;
|
||||
nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd;
|
||||
DEFiRet;
|
||||
ISOBJ_TYPE_assert(pThis, nsd_gtls);
|
||||
@@ -1998,10 +2017,12 @@ Send(nsd_t *pNsd, uchar *pBuf, ssize_t *
|
||||
break;
|
||||
}
|
||||
if(iSent != GNUTLS_E_INTERRUPTED && iSent != GNUTLS_E_AGAIN) {
|
||||
+ /* Check if the underlaying file descriptor needs to read or write data!*/
|
||||
+ wantsWriteData = gnutls_record_get_direction(pThis->sess);
|
||||
uchar *pErr = gtlsStrerror(iSent);
|
||||
- LogError(0, RS_RET_GNUTLS_ERR, "unexpected GnuTLS error %d - this "
|
||||
- "could be caused by a broken connection. GnuTLS reports: %s \n",
|
||||
- iSent, pErr);
|
||||
+ LogError(0, RS_RET_GNUTLS_ERR, "unexpected GnuTLS error %d, wantsWriteData=%d - this "
|
||||
+ "could be caused by a broken connection. GnuTLS reports: %s\n",
|
||||
+ iSent, wantsWriteData, pErr);
|
||||
free(pErr);
|
||||
gnutls_perror(iSent);
|
||||
ABORT_FINALIZE(RS_RET_GNUTLS_ERR);
|
||||
diff -up rsyslog-8.2102.0/runtime/nsd_gtls.h.orig rsyslog-8.2102.0/runtime/nsd_gtls.h
|
||||
--- rsyslog-8.2102.0/runtime/nsd_gtls.h.orig 2022-04-11 09:26:32.744262781 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/nsd_gtls.h 2022-04-11 09:34:29.909982895 +0200
|
||||
@@ -33,6 +33,11 @@ typedef enum {
|
||||
gtlsRtry_recv = 2
|
||||
} gtlsRtryCall_t; /**< IDs of calls that needs to be retried */
|
||||
|
||||
+typedef enum {
|
||||
+ gtlsDir_READ = 0, /**< GNUTLS wants READ */
|
||||
+ gtlsDir_WRITE = 1 /**< GNUTLS wants WRITE */
|
||||
+} gtlsDirection_t;
|
||||
+
|
||||
typedef nsd_if_t nsd_gtls_if_t; /* we just *implement* this interface */
|
||||
|
||||
/* the nsd_gtls object */
|
||||
diff -up rsyslog-8.2102.0/runtime/nsdsel_gtls.c.orig rsyslog-8.2102.0/runtime/nsdsel_gtls.c
|
||||
--- rsyslog-8.2102.0/runtime/nsdsel_gtls.c.orig 2022-04-11 09:26:42.529256742 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/nsdsel_gtls.c 2022-04-11 09:38:27.425869737 +0200
|
||||
@@ -81,6 +81,7 @@ Add(nsdsel_t *pNsdsel, nsd_t *pNsd, nsds
|
||||
|
||||
ISOBJ_TYPE_assert(pThis, nsdsel_gtls);
|
||||
ISOBJ_TYPE_assert(pNsdGTLS, nsd_gtls);
|
||||
+ DBGPRINTF("Add on nsd %p:\n", pNsdGTLS);
|
||||
if(pNsdGTLS->iMode == 1) {
|
||||
if(waitOp == NSDSEL_RD && gtlsHasRcvInBuffer(pNsdGTLS)) {
|
||||
++pThis->iBufferRcvReady;
|
||||
@@ -99,6 +100,8 @@ Add(nsdsel_t *pNsdsel, nsd_t *pNsd, nsds
|
||||
}
|
||||
}
|
||||
|
||||
+ dbgprintf("nsdsel_gtls: reached end on nsd %p, calling nsdsel_ptcp.Add with waitOp %d... \n", pNsdGTLS, waitOp);
|
||||
+
|
||||
/* if we reach this point, we need no special handling */
|
||||
CHKiRet(nsdsel_ptcp.Add(pThis->pTcp, pNsdGTLS->pTcp, waitOp));
|
||||
|
||||
@@ -120,7 +123,8 @@ Select(nsdsel_t *pNsdsel, int *piNumRead
|
||||
if(pThis->iBufferRcvReady > 0) {
|
||||
/* we still have data ready! */
|
||||
*piNumReady = pThis->iBufferRcvReady;
|
||||
- dbgprintf("nsdsel_gtls: doing dummy select, data present\n");
|
||||
+ dbgprintf("nsdsel_gtls: doing dummy select for %p->iBufferRcvReady=%d, data present\n",
|
||||
+ pThis, pThis->iBufferRcvReady);
|
||||
} else {
|
||||
iRet = nsdsel_ptcp.Select(pThis->pTcp, piNumReady);
|
||||
}
|
||||
@@ -138,7 +142,7 @@ doRetry(nsd_gtls_t *pNsd)
|
||||
DEFiRet;
|
||||
int gnuRet;
|
||||
|
||||
- dbgprintf("GnuTLS requested retry of %d operation - executing\n", pNsd->rtryCall);
|
||||
+ dbgprintf("doRetry: GnuTLS requested retry of %d operation - executing\n", pNsd->rtryCall);
|
||||
|
||||
/* We follow a common scheme here: first, we do the systen call and
|
||||
* then we check the result. So far, the result is checked after the
|
||||
@@ -151,7 +155,7 @@ doRetry(nsd_gtls_t *pNsd)
|
||||
case gtlsRtry_handshake:
|
||||
gnuRet = gnutls_handshake(pNsd->sess);
|
||||
if(gnuRet == GNUTLS_E_AGAIN || gnuRet == GNUTLS_E_INTERRUPTED) {
|
||||
- dbgprintf("GnuTLS handshake retry did not finish - "
|
||||
+ dbgprintf("doRetry: GnuTLS handshake retry did not finish - "
|
||||
"setting to retry (this is OK and can happen)\n");
|
||||
FINALIZE;
|
||||
} else if(gnuRet == 0) {
|
||||
@@ -167,9 +171,20 @@ doRetry(nsd_gtls_t *pNsd)
|
||||
}
|
||||
break;
|
||||
case gtlsRtry_recv:
|
||||
- dbgprintf("retrying gtls recv, nsd: %p\n", pNsd);
|
||||
- CHKiRet(gtlsRecordRecv(pNsd));
|
||||
- pNsd->rtryCall = gtlsRtry_None; /* we are done */
|
||||
+ dbgprintf("doRetry: retrying gtls recv, nsd: %p\n", pNsd);
|
||||
+ iRet = gtlsRecordRecv(pNsd);
|
||||
+ if (iRet == RS_RET_RETRY) {
|
||||
+ // Check if there is pending data
|
||||
+ size_t stBytesLeft = gnutls_record_check_pending(pNsd->sess);
|
||||
+ if (stBytesLeft > 0) {
|
||||
+ // We are in retry and more data waiting, finalize it
|
||||
+ goto finalize_it;
|
||||
+ } else {
|
||||
+ dbgprintf("doRetry: gtlsRecordRecv returned RETRY, but there is no pending"
|
||||
+ "data on nsd: %p\n", pNsd);
|
||||
+ }
|
||||
+ }
|
||||
+ pNsd->rtryCall = gtlsRtry_None; /* no more data, we are done */
|
||||
gnuRet = 0;
|
||||
break;
|
||||
case gtlsRtry_None:
|
||||
@@ -241,7 +256,7 @@ IsReady(nsdsel_t *pNsdsel, nsd_t *pNsd,
|
||||
* socket. -- rgerhards, 2010-11-20
|
||||
*/
|
||||
if(pThis->iBufferRcvReady) {
|
||||
- dbgprintf("nsd_gtls: dummy read, buffer not available for this FD\n");
|
||||
+ dbgprintf("nsd_gtls: dummy read, %p->buffer not available for this FD\n", pThis);
|
||||
*pbIsReady = 0;
|
||||
FINALIZE;
|
||||
}
|
||||
diff -up rsyslog-8.2102.0/runtime/tcpsrv.c.orig rsyslog-8.2102.0/runtime/tcpsrv.c
|
||||
--- rsyslog-8.2102.0/runtime/tcpsrv.c.orig 2022-04-11 09:27:00.376245726 +0200
|
||||
+++ rsyslog-8.2102.0/runtime/tcpsrv.c 2022-04-11 09:41:57.885777708 +0200
|
||||
@@ -609,14 +609,15 @@ doReceive(tcpsrv_t *pThis, tcps_sess_t *
|
||||
int oserr = 0;
|
||||
|
||||
ISOBJ_TYPE_assert(pThis, tcpsrv);
|
||||
- DBGPRINTF("netstream %p with new data\n", (*ppSess)->pStrm);
|
||||
+ prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
+ DBGPRINTF("netstream %p with new data from remote peer %s\n", (*ppSess)->pStrm, pszPeer);
|
||||
/* Receive message */
|
||||
iRet = pThis->pRcvData(*ppSess, buf, sizeof(buf), &iRcvd, &oserr);
|
||||
switch(iRet) {
|
||||
case RS_RET_CLOSED:
|
||||
if(pThis->bEmitMsgOnClose) {
|
||||
errno = 0;
|
||||
- prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
+ // prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
LogError(0, RS_RET_PEER_CLOSED_CONN, "Netstream session %p closed by remote "
|
||||
"peer %s.\n", (*ppSess)->pStrm, pszPeer);
|
||||
}
|
||||
@@ -632,13 +633,13 @@ doReceive(tcpsrv_t *pThis, tcps_sess_t *
|
||||
/* in this case, something went awfully wrong.
|
||||
* We are instructed to terminate the session.
|
||||
*/
|
||||
- prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
+ // prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
LogError(oserr, localRet, "Tearing down TCP Session from %s", pszPeer);
|
||||
CHKiRet(closeSess(pThis, ppSess, pPoll));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
- prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
+ // prop.GetString((*ppSess)->fromHostIP, &pszPeer, &lenPeer);
|
||||
LogError(oserr, iRet, "netstream session %p from %s will be closed due to error",
|
||||
(*ppSess)->pStrm, pszPeer);
|
||||
CHKiRet(closeSess(pThis, ppSess, pPoll));
|
||||
@@ -838,6 +839,7 @@ RunSelect(tcpsrv_t *pThis, nsd_epworkset
|
||||
while(iTCPSess != -1) {
|
||||
/* TODO: access to pNsd is NOT really CLEAN, use method... */
|
||||
CHKiRet(nssel.Add(pSel, pThis->pSessions[iTCPSess]->pStrm, NSDSEL_RD));
|
||||
+ DBGPRINTF("tcpsrv process session %d:\n", iTCPSess);
|
||||
/* now get next... */
|
||||
iTCPSess = TCPSessGetNxtSess(pThis, iTCPSess);
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
--- a/source/configuration/actions.rst 2020-01-13 09:35:54.000000000 +0100
|
||||
+++ b/source/configuration/actions.rst 2022-03-09 10:46:23.945881936 +0100
|
||||
@@ -90,6 +90,12 @@
|
||||
provided to the action in question, the action name as well as
|
||||
the rsyslog status code roughly explaining why it failed.
|
||||
|
||||
+- **action.errorfile.maxsize** integer
|
||||
+
|
||||
+ In some cases, error file needs to be limited in size.
|
||||
+ This option allows specifying a maximum size, in bytes, for the error file.
|
||||
+ When error file reaches that size, no more errors are written to it.
|
||||
+
|
||||
- **action.execOnlyOnceEveryInterval** integer
|
||||
|
||||
Execute action only if the last execute is at last seconds in the
|
||||
--- a/build/_sources/configuration/actions.rst.txt 2020-01-13 09:35:54.000000000 +0100
|
||||
+++ b/build/_sources/configuration/actions.rst.txt 2022-03-09 11:17:44.391213038 +0100
|
||||
@@ -90,6 +90,12 @@
|
||||
provided to the action in question, the action name as well as
|
||||
the rsyslog status code roughly explaining why it failed.
|
||||
|
||||
+- **action.errorfile.maxsize** integer
|
||||
+
|
||||
+ In some cases, error file needs to be limited in size.
|
||||
+ This option allows specifying a maximum size, in bytes, for the error file.
|
||||
+ When error file reaches that size, no more errors are written to it.
|
||||
+
|
||||
- **action.execOnlyOnceEveryInterval** integer
|
||||
|
||||
Execute action only if the last execute is at last seconds in the
|
||||
--- a/build/configuration/actions.html 2021-02-15 12:53:30.000000000 +0100
|
||||
+++ b/build/configuration/actions.html 2022-03-09 11:27:04.035799702 +0100
|
||||
@@ -122,6 +122,11 @@
|
||||
provided to the action in question, the action name as well as
|
||||
the rsyslog status code roughly explaining why it failed.</p>
|
||||
</li>
|
||||
+<li><p class="first"><strong>action.errorfile.maxsize</strong> integer</p>
|
||||
+<p>In some cases, error file needs to be limited in size.
|
||||
+This option allows specifying a maximum size, in bytes, for the error file.
|
||||
+When error file reaches that size, no more errors are written to it.</p>
|
||||
+</li>
|
||||
<li><p class="first"><strong>action.execOnlyOnceEveryInterval</strong> integer</p>
|
||||
<p>Execute action only if the last execute is at last seconds in the
|
||||
past (more info in ommail, but may be used with any action)</p>
|
||||
@@ -672,4 +677,4 @@
|
||||
<div class="footer" role="contentinfo">
|
||||
</div>
|
||||
</body>
|
||||
-</html>
|
||||
\ No newline at end of file
|
||||
+</html>
|
@ -0,0 +1,192 @@
|
||||
--- rsyslog-8.2102.0-ori/action.c 2021-02-15 12:06:16.000000000 +0100
|
||||
+++ rsyslog-8.2102.0-changes/action.c 2022-03-10 11:00:11.027242300 +0100
|
||||
@@ -198,6 +198,7 @@
|
||||
{ "name", eCmdHdlrGetWord, 0 }, /* legacy: actionname */
|
||||
{ "type", eCmdHdlrString, CNFPARAM_REQUIRED }, /* legacy: actionname */
|
||||
{ "action.errorfile", eCmdHdlrString, 0 },
|
||||
+ { "action.errorfile.maxsize", eCmdHdlrInt, 0 },
|
||||
{ "action.writeallmarkmessages", eCmdHdlrBinary, 0 }, /* legacy: actionwriteallmarkmessages */
|
||||
{ "action.execonlyeverynthtime", eCmdHdlrInt, 0 }, /* legacy: actionexeconlyeverynthtime */
|
||||
{ "action.execonlyeverynthtimetimeout", eCmdHdlrInt, 0 }, /* legacy: actionexeconlyeverynthtimetimeout */
|
||||
@@ -400,6 +401,8 @@
|
||||
pThis->iResumeRetryCount = 0;
|
||||
pThis->pszName = NULL;
|
||||
pThis->pszErrFile = NULL;
|
||||
+ pThis->maxErrFileSize = 0;
|
||||
+ pThis->errFileWritten = 0;
|
||||
pThis->pszExternalStateFile = NULL;
|
||||
pThis->fdErrFile = -1;
|
||||
pThis->bWriteAllMarkMsgs = 1;
|
||||
@@ -1436,6 +1439,14 @@
|
||||
pThis->pszName, pThis->pszErrFile);
|
||||
goto done;
|
||||
}
|
||||
+ if (pThis->maxErrFileSize > 0) {
|
||||
+ struct stat statbuf;
|
||||
+ if (fstat(pThis->fdErrFile, &statbuf) == -1) {
|
||||
+ LogError(errno, RS_RET_ERR, "failed to fstat %s", pThis->pszErrFile);
|
||||
+ goto done;
|
||||
+ }
|
||||
+ pThis->errFileWritten += statbuf.st_size;
|
||||
+ }
|
||||
}
|
||||
|
||||
for(int i = 0 ; i < nparams ; ++i) {
|
||||
@@ -1454,16 +1465,26 @@
|
||||
char *const rendered = strdup((char*)fjson_object_to_json_string(etry));
|
||||
if(rendered == NULL)
|
||||
goto done;
|
||||
- const size_t toWrite = strlen(rendered) + 1;
|
||||
- /* note: we use the '\0' inside the string to store a LF - we do not
|
||||
- * otherwise need it and it safes us a copy/realloc.
|
||||
- */
|
||||
- rendered[toWrite-1] = '\n'; /* NO LONGER A STRING! */
|
||||
- const ssize_t wrRet = write(pThis->fdErrFile, rendered, toWrite);
|
||||
- if(wrRet != (ssize_t) toWrite) {
|
||||
- LogError(errno, RS_RET_IO_ERROR,
|
||||
- "action %s: error writing errorFile %s, write returned %lld",
|
||||
- pThis->pszName, pThis->pszErrFile, (long long) wrRet);
|
||||
+ size_t toWrite = strlen(rendered) + 1;
|
||||
+ // Check if need to truncate the amount of bytes to write
|
||||
+ if (pThis->maxErrFileSize > 0) {
|
||||
+ if (pThis->errFileWritten + toWrite > pThis->maxErrFileSize) {
|
||||
+ // Truncate to the pending available
|
||||
+ toWrite = pThis->maxErrFileSize - pThis->errFileWritten;
|
||||
+ }
|
||||
+ pThis->errFileWritten += toWrite;
|
||||
+ }
|
||||
+ if(toWrite > 0) {
|
||||
+ /* note: we use the '\0' inside the string to store a LF - we do not
|
||||
+ * otherwise need it and it safes us a copy/realloc.
|
||||
+ */
|
||||
+ rendered[toWrite-1] = '\n'; /* NO LONGER A STRING! */
|
||||
+ const ssize_t wrRet = write(pThis->fdErrFile, rendered, toWrite);
|
||||
+ if(wrRet != (ssize_t) toWrite) {
|
||||
+ LogError(errno, RS_RET_IO_ERROR,
|
||||
+ "action %s: error writing errorFile %s, write returned %lld",
|
||||
+ pThis->pszName, pThis->pszErrFile, (long long) wrRet);
|
||||
+ }
|
||||
}
|
||||
free(rendered);
|
||||
|
||||
@@ -2048,6 +2069,8 @@
|
||||
continue; /* this is handled seperately during module select! */
|
||||
} else if(!strcmp(pblk.descr[i].name, "action.errorfile")) {
|
||||
pAction->pszErrFile = es_str2cstr(pvals[i].val.d.estr, NULL);
|
||||
+ } else if(!strcmp(pblk.descr[i].name, "action.errorfile.maxsize")) {
|
||||
+ pAction->maxErrFileSize = pvals[i].val.d.n;
|
||||
} else if(!strcmp(pblk.descr[i].name, "action.externalstate.file")) {
|
||||
pAction->pszExternalStateFile = es_str2cstr(pvals[i].val.d.estr, NULL);
|
||||
} else if(!strcmp(pblk.descr[i].name, "action.writeallmarkmessages")) {
|
||||
--- rsyslog-8.2102.0-ori/action.h 2020-10-03 19:06:47.000000000 +0200
|
||||
+++ rsyslog-8.2102.0-changes/action.h 2022-03-04 11:36:47.024588972 +0100
|
||||
@@ -77,6 +77,8 @@
|
||||
/* error file */
|
||||
const char *pszErrFile;
|
||||
int fdErrFile;
|
||||
+ size_t maxErrFileSize;
|
||||
+ size_t errFileWritten;
|
||||
pthread_mutex_t mutErrFile;
|
||||
/* external stat file system */
|
||||
const char *pszExternalStateFile;
|
||||
--- rsyslog-8.2102.0-ori/tests/Makefile.am 2021-02-15 12:06:16.000000000 +0100
|
||||
+++ rsyslog-8.2102.0-changes/tests/Makefile.am 2022-03-04 11:38:01.625095709 +0100
|
||||
@@ -695,7 +695,8 @@
|
||||
mysql-actq-mt.sh \
|
||||
mysql-actq-mt-withpause.sh \
|
||||
action-tx-single-processing.sh \
|
||||
- action-tx-errfile.sh
|
||||
+ action-tx-errfile.sh \
|
||||
+ action-tx-errfile-maxsize.sh
|
||||
|
||||
mysql-basic.log: mysqld-start.log
|
||||
mysql-basic-cnf6.log: mysqld-start.log
|
||||
@@ -2156,6 +2157,8 @@
|
||||
sndrcv_omudpspoof_nonstdpt.sh \
|
||||
sndrcv_gzip.sh \
|
||||
action-tx-single-processing.sh \
|
||||
+ omfwd-errfile-maxsize.sh \
|
||||
+ action-tx-errfile-maxsize.sh \
|
||||
action-tx-errfile.sh \
|
||||
testsuites/action-tx-errfile.result \
|
||||
pipeaction.sh \
|
||||
--- rsyslog-8.2102.0-ori/tests/omfwd-errfile-maxsize.sh 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ rsyslog-8.2102.0-changes/tests/omfwd-errfile-maxsize.sh 2022-03-04 11:39:02.060506234 +0100
|
||||
@@ -0,0 +1,17 @@
|
||||
+#!/bin/bash
|
||||
+# part of the rsyslog project, released under ASL 2.0
|
||||
+. ${srcdir:=.}/diag.sh init
|
||||
+
|
||||
+export MAX_ERROR_SIZE=1999
|
||||
+
|
||||
+generate_conf
|
||||
+add_conf '
|
||||
+action(type="omfwd" target="1.2.3.4" port="1234" Protocol="tcp" NetworkNamespace="doesNotExist"
|
||||
+ action.errorfile="'$RSYSLOG2_OUT_LOG'" action.errorfile.maxsize="'$MAX_ERROR_SIZE'")
|
||||
+'
|
||||
+startup
|
||||
+shutdown_when_empty
|
||||
+wait_shutdown
|
||||
+check_file_exists ${RSYSLOG2_OUT_LOG}
|
||||
+file_size_check ${RSYSLOG2_OUT_LOG} ${MAX_ERROR_SIZE}
|
||||
+exit_test
|
||||
--- rsyslog-8.2102.0-ori/tests/action-tx-errfile-maxsize.sh 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ rsyslog-8.2102.0-changes/tests/action-tx-errfile-maxsize.sh 2022-03-04 11:59:22.592796989 +0100
|
||||
@@ -0,0 +1,35 @@
|
||||
+#!/bin/bash
|
||||
+# part of the rsyslog project, released under ASL 2.0
|
||||
+
|
||||
+. ${srcdir:=.}/diag.sh init
|
||||
+
|
||||
+export NUMMESSAGES=50 # enough to generate big file
|
||||
+export MAX_ERROR_SIZE=100
|
||||
+
|
||||
+generate_conf
|
||||
+add_conf '
|
||||
+$ModLoad ../plugins/ommysql/.libs/ommysql
|
||||
+global(errormessagestostderr.maxnumber="5")
|
||||
+
|
||||
+template(type="string" name="tpl" string="insert into SystemEvents (Message, Facility) values (\"%msg%\", %$!facility%)" option.sql="on")
|
||||
+
|
||||
+if((not($msg contains "error")) and ($msg contains "msgnum:")) then {
|
||||
+ set $.num = field($msg, 58, 2);
|
||||
+ if $.num % 2 == 0 then {
|
||||
+ set $!facility = $syslogfacility;
|
||||
+ } else {
|
||||
+ set $/cntr = 0;
|
||||
+ }
|
||||
+ action(type="ommysql" name="mysql_action_errfile_maxsize" server="127.0.0.1" template="tpl"
|
||||
+ db="'$RSYSLOG_DYNNAME'" uid="rsyslog" pwd="testbench" action.errorfile="'$RSYSLOG2_OUT_LOG'" action.errorfile.maxsize="'$MAX_ERROR_SIZE'")
|
||||
+}
|
||||
+'
|
||||
+mysql_prep_for_test
|
||||
+startup
|
||||
+injectmsg
|
||||
+shutdown_when_empty
|
||||
+wait_shutdown
|
||||
+mysql_get_data
|
||||
+check_file_exists ${RSYSLOG2_OUT_LOG}
|
||||
+file_size_check ${RSYSLOG2_OUT_LOG} ${MAX_ERROR_SIZE}
|
||||
+exit_test
|
||||
--- rsyslog-8.2102.0/tests/omfwd-errfile-maxsize-filled.sh 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ rsyslog-8.2102.0-changes/tests/omfwd-errfile-maxsize-filled.sh 2022-03-08 16:24:01.174365289 +0100
|
||||
@@ -0,0 +1,19 @@
|
||||
+#!/bin/bash
|
||||
+# part of the rsyslog project, released under ASL 2.0
|
||||
+. ${srcdir:=.}/diag.sh init
|
||||
+ERRFILE=$(mktemp)
|
||||
+export MAX_ERROR_SIZE=1999
|
||||
+export INITIAL_FILE_SIZE=$((MAX_ERROR_SIZE - 100))
|
||||
+dd if=/dev/urandom of=${ERRFILE} bs=1 count=${INITIAL_FILE_SIZE}
|
||||
+generate_conf
|
||||
+add_conf '
|
||||
+action(type="omfwd" target="1.2.3.4" port="1234" Protocol="tcp" NetworkNamespace="doesNotExist"
|
||||
+ action.errorfile="'$ERRFILE'" action.errorfile.maxsize="'$MAX_ERROR_SIZE'")
|
||||
+'
|
||||
+startup
|
||||
+shutdown_when_empty
|
||||
+wait_shutdown
|
||||
+check_file_exists ${ERRFILE}
|
||||
+file_size_check ${ERRFILE} ${MAX_ERROR_SIZE}
|
||||
+exit_test
|
||||
+rm ${ERRFILE}
|
@ -0,0 +1,30 @@
|
||||
diff -up rsyslog-8.37.0/plugins/imptcp/imptcp.c.orig rsyslog-8.37.0/plugins/imptcp/imptcp.c
|
||||
--- rsyslog-8.37.0/plugins/imptcp/imptcp.c.orig 2022-05-09 12:22:59.050623119 +0200
|
||||
+++ rsyslog-8.37.0/plugins/imptcp/imptcp.c 2022-05-09 12:34:39.979854853 +0200
|
||||
@@ -1032,7 +1032,10 @@ processDataRcvd(ptcpsess_t *const __rest
|
||||
if(pThis->iOctetsRemain <= 200000000) {
|
||||
pThis->iOctetsRemain = pThis->iOctetsRemain * 10 + c - '0';
|
||||
}
|
||||
- *(pThis->pMsg + pThis->iMsg++) = c;
|
||||
+ // *(pThis->pMsg + pThis->iMsg++) = c;
|
||||
+ if(pThis->iMsg < iMaxLine) {
|
||||
+ *(pThis->pMsg + pThis->iMsg++) = c;
|
||||
+ }
|
||||
} else { /* done with the octet count, so this must be the SP terminator */
|
||||
DBGPRINTF("TCP Message with octet-counter, size %d.\n", pThis->iOctetsRemain);
|
||||
prop.GetString(pThis->peerName, &propPeerName, &lenPeerName);
|
||||
diff -up rsyslog-8.37.0/runtime/tcps_sess.c.orig rsyslog-8.37.0/runtime/tcps_sess.c
|
||||
--- rsyslog-8.37.0/runtime/tcps_sess.c.orig 2022-05-09 12:23:12.789627661 +0200
|
||||
+++ rsyslog-8.37.0/runtime/tcps_sess.c 2022-05-09 12:36:51.426898549 +0200
|
||||
@@ -389,7 +389,10 @@ processDataRcvd(tcps_sess_t *pThis,
|
||||
if(pThis->iOctetsRemain <= 200000000) {
|
||||
pThis->iOctetsRemain = pThis->iOctetsRemain * 10 + c - '0';
|
||||
}
|
||||
- *(pThis->pMsg + pThis->iMsg++) = c;
|
||||
+ // *(pThis->pMsg + pThis->iMsg++) = c;
|
||||
+ if(pThis->iMsg < iMaxLine) {
|
||||
+ *(pThis->pMsg + pThis->iMsg++) = c;
|
||||
+ }
|
||||
} else { /* done with the octet count, so this must be the SP terminator */
|
||||
DBGPRINTF("TCP Message with octet-counter, size %d.\n", pThis->iOctetsRemain);
|
||||
prop.GetString(pThis->fromHost, &propPeerName, &lenPeerName);
|
@ -0,0 +1,79 @@
|
||||
# rsyslog configuration file
|
||||
|
||||
# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
|
||||
# or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html
|
||||
# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
|
||||
|
||||
#### GLOBAL DIRECTIVES ####
|
||||
|
||||
# Where to place auxiliary files
|
||||
global(workDirectory="/var/lib/rsyslog")
|
||||
|
||||
# Use default timestamp format
|
||||
module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
|
||||
|
||||
# Include all config files in /etc/rsyslog.d/
|
||||
include(file="/etc/rsyslog.d/*.conf" mode="optional")
|
||||
|
||||
#### MODULES ####
|
||||
|
||||
module(load="imuxsock" # provides support for local system logging (e.g. via logger command)
|
||||
SysSock.Use="off") # Turn off message reception via local log socket;
|
||||
# local messages are retrieved through imjournal now.
|
||||
module(load="imjournal" # provides access to the systemd journal
|
||||
StateFile="imjournal.state") # File to store the position in the journal
|
||||
#module(load="imklog") # reads kernel messages (the same are read from journald)
|
||||
#module(load="immark") # provides --MARK-- message capability
|
||||
|
||||
# Provides UDP syslog reception
|
||||
# for parameters see http://www.rsyslog.com/doc/imudp.html
|
||||
#module(load="imudp") # needs to be done just once
|
||||
#input(type="imudp" port="514")
|
||||
|
||||
# Provides TCP syslog reception
|
||||
# for parameters see http://www.rsyslog.com/doc/imtcp.html
|
||||
#module(load="imtcp") # needs to be done just once
|
||||
#input(type="imtcp" port="514")
|
||||
|
||||
#### RULES ####
|
||||
|
||||
# Log all kernel messages to the console.
|
||||
# Logging much else clutters up the screen.
|
||||
#kern.* /dev/console
|
||||
|
||||
# Log anything (except mail) of level info or higher.
|
||||
# Don't log private authentication messages!
|
||||
*.info;mail.none;authpriv.none;cron.none /var/log/messages
|
||||
|
||||
# The authpriv file has restricted access.
|
||||
authpriv.* /var/log/secure
|
||||
|
||||
# Log all the mail messages in one place.
|
||||
mail.* -/var/log/maillog
|
||||
|
||||
|
||||
# Log cron stuff
|
||||
cron.* /var/log/cron
|
||||
|
||||
# Everybody gets emergency messages
|
||||
*.emerg :omusrmsg:*
|
||||
|
||||
# Save news errors of level crit and higher in a special file.
|
||||
uucp,news.crit /var/log/spooler
|
||||
|
||||
# Save boot messages also to boot.log
|
||||
local7.* /var/log/boot.log
|
||||
|
||||
|
||||
# ### sample forwarding rule ###
|
||||
#action(type="omfwd"
|
||||
# # An on-disk queue is created for this action. If the remote host is
|
||||
# # down, messages are spooled to disk and sent when it is up again.
|
||||
#queue.filename="fwdRule1" # unique name prefix for spool files
|
||||
#queue.maxdiskspace="1g" # 1gb space limit (use as much as possible)
|
||||
#queue.saveonshutdown="on" # save messages to disk on shutdown
|
||||
#queue.type="LinkedList" # run asynchronously
|
||||
#action.resumeRetryCount="-1" # infinite retries if host is down
|
||||
# # Remote Logging (we use TCP for reliable delivery)
|
||||
# # remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514
|
||||
#Target="remote_host" Port="XXX" Protocol="tcp")
|
@ -0,0 +1,12 @@
|
||||
/var/log/cron
|
||||
/var/log/maillog
|
||||
/var/log/messages
|
||||
/var/log/secure
|
||||
/var/log/spooler
|
||||
{
|
||||
missingok
|
||||
sharedscripts
|
||||
postrotate
|
||||
/usr/bin/systemctl kill -s HUP rsyslog.service >/dev/null 2>&1 || true
|
||||
endscript
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=System Logging Service
|
||||
;Requires=syslog.socket
|
||||
Documentation=man:rsyslogd(8)
|
||||
Documentation=https://www.rsyslog.com/doc/
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
EnvironmentFile=-/etc/sysconfig/rsyslog
|
||||
ExecStart=/usr/sbin/rsyslogd -n $SYSLOGD_OPTIONS
|
||||
ExecReload=/usr/bin/kill -HUP $MAINPID
|
||||
UMask=0066
|
||||
StandardOutput=null
|
||||
Restart=on-failure
|
||||
|
||||
# Increase the default a bit in order to allow many simultaneous
|
||||
# files to be monitored, we might need a lot of fds.
|
||||
LimitNOFILE=16384
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
;Alias=syslog.service
|
@ -0,0 +1,5 @@
|
||||
# Options for rsyslogd
|
||||
# Syslogd options are deprecated since rsyslog v3.
|
||||
# If you want to use them, switch to compatibility mode 2 by "-c 2"
|
||||
# See rsyslogd(8) for more details
|
||||
SYSLOGD_OPTIONS=""
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue