diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-05-14 12:37:36 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-05-14 12:37:36 +0200 |
commit | 5e51fa8a60cc8f1f68a945afc9b242f5a3057818 (patch) | |
tree | 52049928a53beae16651be1c880a7deadfeca01a /plugins/omrelp/omrelp.c | |
parent | a64a87e0edeb1711271ba277e267eff75564d067 (diff) | |
download | rsyslog-5e51fa8a60cc8f1f68a945afc9b242f5a3057818.tar.gz rsyslog-5e51fa8a60cc8f1f68a945afc9b242f5a3057818.tar.bz2 rsyslog-5e51fa8a60cc8f1f68a945afc9b242f5a3057818.zip |
omrelp: add support for TLS
Diffstat (limited to 'plugins/omrelp/omrelp.c')
-rw-r--r-- | plugins/omrelp/omrelp.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 62f81fca..95571f40 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -55,6 +55,8 @@ DEF_OMOD_STATIC_DATA DEFobjCurrIf(errmsg) DEFobjCurrIf(glbl) +#define DFLT_ENABLE_TLS 0 + static relpEngine_t *pRelpEngine; /* our relp engine */ typedef struct _instanceData { @@ -65,6 +67,7 @@ typedef struct _instanceData { int bIsConnected; /* currently connected to server? 0 - no, 1 - yes */ unsigned timeout; relpClt_t *pRelpClt; /* relp client for this instance */ + sbool bEnableTLS; uchar *tplName; } instanceData; @@ -78,6 +81,7 @@ static configSettings_t __attribute__((unused)) cs; /* action (instance) parameters */ static struct cnfparamdescr actpdescr[] = { { "target", eCmdHdlrGetWord, 1 }, + { "tls", eCmdHdlrBinary, 0 }, { "port", eCmdHdlrGetWord, 0 }, { "timeout", eCmdHdlrInt, 0 }, { "template", eCmdHdlrGetWord, 1 } @@ -113,6 +117,12 @@ doCreateRelpClient(instanceData *pData) ABORT_FINALIZE(RS_RET_RELP_ERR); if(relpCltSetTimeout(pData->pRelpClt, pData->timeout) != RELP_RET_OK) ABORT_FINALIZE(RS_RET_RELP_ERR); + + if(pData->bEnableTLS) { + if(relpCltEnableTLS(pData->pRelpClt) != RELP_RET_OK) + ABORT_FINALIZE(RS_RET_RELP_ERR); + } + if(glbl.GetSourceIPofLocalClient() == NULL) { /* ar Do we have a client IP set? */ if(relpCltSetClientIP(pData->pRelpClt, glbl.GetSourceIPofLocalClient()) != RELP_RET_OK) ABORT_FINALIZE(RS_RET_RELP_ERR); @@ -126,6 +136,7 @@ BEGINcreateInstance CODESTARTcreateInstance pData->bInitialConnect = 1; pData->timeout = 90; + pData->bEnableTLS = DFLT_ENABLE_TLS; ENDcreateInstance BEGINfreeInstance @@ -144,6 +155,7 @@ setInstParamDefaults(instanceData *pData) pData->port = NULL; pData->tplName = NULL; pData->timeout = 90; + pData->bEnableTLS = DFLT_ENABLE_TLS; } @@ -169,6 +181,8 @@ CODESTARTnewActInst pData->tplName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "timeout")) { pData->timeout = (unsigned) pvals[i].val.d.n; + } else if(!strcmp(actpblk.descr[i].name, "tls")) { + pData->bEnableTLS = (unsigned) pvals[i].val.d.n; } else { dbgprintf("omrelp: program error, non-handled " "param '%s'\n", actpblk.descr[i].name); @@ -389,7 +403,6 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1) ++p; } - /* TODO: make this if go away! */ if(*p == ';') { *p = '\0'; /* trick to obtain hostname (later)! */ CHKmalloc(pData->target = ustrdup(q)); |