141 Commits

Author SHA1 Message Date
Arne Nordmark
ec9c22df6e gnutls driver: support intermediate certificates
this is necessary for certificate chains

closes https://github.com/rsyslog/rsyslog/issues/2762
2018-06-13 14:16:52 +02:00
2f30c4270a add openssl TLS driver (#2761)
add openssl TLS driver

Also fixes some nits in existing testbench tests (e.g. expired test certs) and extend tcpflood to support openssl as well.

closes: https://github.com/rsyslog/rsyslog/issues/1390
closes: https://github.com/rsyslog/rsyslog/issues/1840
closes: https://github.com/rsyslog/rsyslog/issues/1352
closes: https://github.com/rsyslog/rsyslog/issues/1702
closes: https://github.com/rsyslog/rsyslog/issues/2547
2018-06-13 13:20:23 +02:00
Jan Gerhards
703669762d nsd_gtls: use new errmsg interface
see also https://github.com/rsyslog/rsyslog/issues/1684
2018-01-29 19:04:54 +01:00
Rainer Gerhards
6daf835cd0 fix build warnings on alpine linux
Alpine compiles with size optimization, and then the compiler
finds a couple of inline functions that are really not worth it.
2018-01-26 17:26:44 +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
Rainer Gerhards
82c66a4b0b "fix" Coverity scan cosmetic issue CID 185430 2017-12-01 08:59:03 +01:00
Rainer Gerhards
9aa41d515a "fix" Coverity scan false positives
plus some mild refactoring while we are at it
2017-11-22 11:16:17 +01:00
PascalWithopf
e485c5c5bc codestyle: shorten lines to max 130 chars 2017-11-15 09:04:42 +01:00
Art O Cathain
ba0436eb63 Merge remote-tracking branch 'origin/master' into tls-client-sni
# Conflicts:
#	tests/Makefile.am
2017-11-05 14:55:57 +00:00
Rainer Gerhards
69869d5c01 core/nsd_gtls: fix potential unitialized data access
detected by clang 5.0 static analyzer
2017-10-23 15:16:09 +02:00
PascalWithopf
f8294b2a42 TLS errmsg more specific when file can not be read
When a certificate can not be read the error message now contains
more information about what went wrong when trying to read the file.
2017-09-21 14:26:13 +02:00
Rainer Gerhards
aa1bd5eb9c Merge pull request #1750 from rgerhards/i-1749
tcpsrv subsystem: better error messages
2017-09-06 08:37:12 +02:00
Rainer Gerhards
5c5a7a3ed5 tcpsrv subsystem: better error messages
Most importantly, output os error messages on API failures.
Among others, this improves error messages in imtcp.

closes https://github.com/rsyslog/rsyslog/issues/1749
2017-09-05 15:47:12 +02:00
PascalWithopf
56e3132320 imtcp bugfix: priorityString was not set
The variable priorityString was not used when rsyslog acted as the
server and the defaults were always set. Now the priorityString
is used when specified.

fixes https://github.com/rsyslog/rsyslog/issues/1722
2017-09-05 11:19:29 +02:00
PascalWithopf
717092d93e gnutls: add possibility to use priority string 2017-08-08 14:57:15 +02:00
Art
6dab9834cb Support SNI when connecting as a client
Add SNI hostname if and only if host is not a bare IP address
Rename sndrcv_tls_anon -> sndrcv_tls_anon_hostname, and include a hostname in this test
Add bare IPv4 and IPv6 TLS tests
Change port in some tests to make wireshark traces easier to interpret during a full test run
2017-04-03 11:33:11 +02:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
David Ahern
19e5d06f66 omfwd imudp: Add support for bind-to-device
Add support for bind-to-device option to omfwd and imudp modules.
Configured using device="name". Only new syntax format is supported.
e.g.,

input(type="imudp" port=["10514"] device="eth0" name="udp")
action(type="omfwd" Target="192.168.1.23" Port="10514" Device="eth0")

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
2016-11-15 17:55:56 -07:00
Rainer Gerhards
51c03c66e0 make inline functions C99-compliant
As it seems, different C compilers have different rules/interpretations
on inline functions. The current code base did not properly obey all C99
rules. We fix this by converting some functions to macros and others to
include the necessary C99 plumbing. We also remove some inline attributes
for functions where this seems to be to agressive (aka "function to big").

This fixes build problems in some environments and is a general code
cleanup measure.
2016-09-05 16:47:14 +02:00
Rainer Gerhards
2407693552 TLS forwarding: slightly improved error message
especially in the common case that a certificat file is not present.
The GnuTLS provided error messages is pretty misleading, so we now
check this ourselves.

Note that further improvements to TLS error reporting are desirable,
this fixes just one annoying case that frequently causes confusion.
2016-08-23 13:02:06 +02:00
Rainer Gerhards
8a8675b223 fix compiler warnings 2016-06-02 10:18:05 +02:00
Rainer Gerhards
a2b83c4a3f fix invalid use of cstrGetSzStr() 2016-05-19 12:29:02 +02:00
Rainer Gerhards
f8738727f9 change cstrFinalize() interface
the function can no longer fail and it is not expected that this
will ever happen again in the future. So we remove the return value,
giving a small speedup to the code.
2016-05-19 10:49:37 +02:00
Rainer Gerhards
9382a555cc gnutls driver: better wording in error case that could be caused by broken connection
see also https://github.com/rsyslog/rsyslog/issues/846
2016-04-23 14:47:18 +02:00
888a8ae5b9 gnutls: Possible fix for issue #732
Commit 1394e0bec2
changed how the receive buffer was freed in rcv() call. However Retry handling
was not considered properly.
2016-03-01 12:20:22 +01:00
Rainer Gerhards
240a7fe8f6 travis: re-enable full test environment, turn on extra warnings 2016-01-27 08:37:53 +01:00
Rainer Gerhards
11404600c1 travis: track down why we still get compile errors 2016-01-27 08:17:09 +01:00
Rainer Gerhards
740dc44202 fix or suppress compiler warnings 2016-01-26 18:25:38 +01:00
1394e0bec2 gnutls: fixed memory leak when gtlsRecordRecv returned a failure.
When the connection was broken and gtlsRecordRecv returned a
failure, pszRcvBuf was not freed. The code to free pszRcvBuf has
been moved to finalize_it if iRet is not RS_RET_OK.
2015-12-01 11:15:18 +01:00
Charles Southerland
6272aa12bc Possible fix for #575 2015-11-05 14:52:40 -06:00
Rainer Gerhards
9399f0a503 nsd_gtls: remove unused parameter 2015-05-18 10:33:39 +02:00
Rainer Gerhards
21674039db use gnutls_certificate_type_set_priority() only if available
The gnutls_certificate_type_set_priority function is deprecated
and not available in recent GnuTLS versions. However, there is no
doc how to properly replace it with gnutls_priority_set_direct.
A lot of folks have simply removed it, when they also called
gnutls_set_default_priority. This is what we now also do. If
this causes problems or someone has an idea of how to replace
the deprecated function in a better way, please let us know!
In any case, we use it as long as it is available and let
not insult us by the deprecation warnings.
2015-05-18 10:33:39 +02:00
Rainer Gerhards
23c5b3e1e6 replace deprecated GnuTLS functions with newer ones if available
closes https://github.com/rsyslog/rsyslog/issues/302
2015-05-18 10:33:39 +02:00
Jan Gerhards
9125ddf99d add global parameter "debug.gnutls"
enables GnuTLS indepth debugging
closes https://github.com/rsyslog/rsyslog/issues/219
2015-01-26 16:02:24 +01:00
Reed Morrison
e301ed53d5 Adding options for tcp keep alive. 2014-12-13 18:15:51 +01:00
Rainer Gerhards
537a5aa90a undo commit 077d59c2c7984eb0273be949969585be241408c8 due to regression
There is a regression in this feature-add commit and I don't have the
time to search for it. Refering it back to contributor.

see also https://github.com/rsyslog/rsyslog/pull/145
2014-11-03 17:05:18 +01:00
Tomas Heinrich
077d59c2c7 imtcp: add options to configure keep-alive params
New options:        (legacy counterparts)
keepalive.time      $inputtcpserverkeepalive_time
keepalive.probes    $inputtcpserverkeepalive_probes
keepalive.interval  $inputtcpserverkeepalive_interval

The options are set separately for each instance.

This patch bumps the interface version of the nsd,
netstrm and tcpsrv modules.
2014-10-30 15:34:39 +01:00
Rainer Gerhards
b34c35e38f replace deprecated gnutls data types with current one
Note that the "current ones" were introduced in GNUTls 1.2.0 and
we already require at least 1.4.0, so this does not cause any
problem with platforms rsyslog already runs on.
2014-09-30 14:42:34 +02:00
Reed Morrison
7c515efa36 Fixing bug with keep-alive with gtls. 2014-09-19 23:43:13 -07:00
Rainer Gerhards
20d8a9904e make gntls tcp syslog driver emit more error messages
Messages previously emitted only to the debug log are now emitted as
syslog error messages. It has shown that they contain information
helpful to the user for troubleshooting config issues. Note that this
change is a bit experimental, as we are not sure if there are situations
where large amounts of error messages may be emitted.
2014-09-05 13:02:28 +02:00
Tomas Heinrich
04bf9d5d81 bugfix: don't leak an open FD
Error: RESOURCE_LEAK (CWE-772):
rsyslog-7.4.10/runtime/nsd_gtls.c:120: open_fn: Returning handle opened by function "open(char const *, int, ...)".
rsyslog-7.4.10/runtime/nsd_gtls.c:120: var_assign: Assigning: "fd" = handle returned from "open((char *)pszFile, 0)".
rsyslog-7.4.10/runtime/nsd_gtls.c:126: noescape: Resource "fd" is not freed or pointed-to in function "fstat(int, struct stat *)".
rsyslog-7.4.10/runtime/nsd_gtls.c:139: noescape: Resource "fd" is not freed or pointed-to in function "read(int, void *, size_t)".
rsyslog-7.4.10/runtime/nsd_gtls.c:154: leaked_handle: Handle variable "fd" going out of scope leaks the handle.
2014-07-22 17:44:01 +02:00
Rainer Gerhards
f7ad21626f silence compiler warnings
mostly cosmetic things
2014-03-16 10:52:54 +01:00
Rainer Gerhards
5a09d0915b bugfix: segfault on startup if TCP TLS was used but no cert or key set 2013-09-13 12:08:56 +02:00
Rainer Gerhards
7903677bfb Merge branch 'v7-stable' into v7-stable-tlsfix
Conflicts:
	ChangeLog
	runtime/rsyslog.h
2013-09-13 02:39:42 +02:00
Rainer Gerhards
ad77733062 bugfix: segfault on startup if TLS was used but no CA cert set 2013-09-13 02:37:06 +02:00
Tomas Heinrich
4d83139192 Utilize the new rsCStr*Strf() functions 2013-04-09 17:20:29 +02:00
Tomas Heinrich
6923b9a4a7 Check return code from gnutls_x509_crt_get_*_dn
Enlarge the supplied buffer if necessary.
2013-04-09 17:20:29 +02:00
Rainer Gerhards
9ca63ee532 fix: gtls stream driver must support new interface 2013-01-24 07:17:09 +01:00
88faed212c Fixed TCP CheckConnection handling in omfwd.c.
Interface needed to be changed in lower stream classes. Syslog TCP Sending is now resumed properly.
2012-08-25 12:08:08 -07:00