154 Commits

Author SHA1 Message Date
Rainer Gerhards
5fe7ca92ee
TLS driver bugfix: improper use of calloc()
can cause problems under extreme memory shortage - very unlikely
credits to LGTM.COM for detecting this
2019-10-21 12:21:11 +02:00
Jiri Vymazal
937e278fdf Stricter GnuTLS operation
This commit adds to new flags which can be set to allow
1) checking of extendedKeyUsage certificate field
2) stricter checking of certificate name/adresses
2019-08-30 09:40:25 +02:00
9c60ae361e testbench: reorganized testcases for server/client certless comm
- Corrected ANON Cipher handling in ossl / gtls driver.
- removed error when no CA is configured for ANON Mode in gtls dirver.
- Set GNUTLS Debug level to 2, so we see more informations about gnutls errors
  in rsyslog debug mode.
- fixed tcpdump parameters not using TLS in manytcp-too-few-tls-vg.sh
- fixed minor memory leak in shutdown destructor of ossl tls driver.
2019-02-21 17:43:35 +01:00
d58a4045aa testbench: Added new tests to check certless communication gtls/ossl
closes: https://github.com/rsyslog/rsyslog/issues/3415
closes: https://github.com/rsyslog/rsyslog/issues/3413
2019-02-21 16:47:25 +01:00
7cc4fd697c tls support: Implemented anon cipher support for gtls driver
When no cert/key is configured, we specificially allow ANON ciphers
(ANON-DH). We could also allow ANON-ECDH if necessary, but has been commented our
for now.

See: https://github.com/rsyslog/rsyslog/issues/3415
See: https://github.com/rsyslog/rsyslog/issues/3413
2019-02-21 16:47:25 +01:00
3d9b8df6fb tls(ossl/gtls): add new Option "StreamDriver.PermitExpiredCerts"
The new Option can have one of the following values:
on = Expired certificates are allowed
off = Expired certificates are not allowed
warn = Expired certificates are allowed but warning will be logged (Default)

Includes necessary tests to validate new code.

closes https://github.com/rsyslog/rsyslog/issues/3364
2018-12-21 15:24:41 +01:00
937dbcb801 bugfix tls subsystem: Receiver hang due to insufficient TLS buffersize.
gtls and ossl driver used a default buffersize of 8 x 1024 bytes to store
received TLS packets. When tls read returned more than buffersize, the additional
buffer was not processed until new data arrived on the socket again.

TLS RFCs require up to 16KB buffer for a single TLS record.

closes https://github.com/rsyslog/rsyslog/issues/3325
2018-12-18 14:44:58 +01:00
Rainer Gerhards
9bece39dc6
SQUASH
debug cleanup: remove some old, no longer used macros
2018-10-30 12:46:04 +01:00
Rainer Gerhards
531e356a64
cleanup: remove commented-out code, simplify a bit
commented-out code detected by lgtm.com
2018-10-29 09:14:13 +01:00
PascalWithopf
df85be1130 tcp driver: add support for parameter LstnPortFileName 2018-08-29 15:14:29 +02:00
PascalWithopf
19133327cc correct codestyle in rsyslog 2018-07-31 09:44:27 +02:00
Rainer Gerhards
63ad5ecf6d nds_gtls: fix regression that could lead to attack (never released version)
Commit 7589f42e45888b83f5c2a0d788896d41e6a6a598 introduced support
for loading certificate chains. Unfortunatley the max number of permitted
certificates was miscalculated and so a certificate chain with more than
10 certificates could lead to a buffer overrun. This patch corrects this.

Note that the commit was merged just yesterday and there was no release
with the affected code.

Also, this commit adds  GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED to
ensure the certificate export will fail with an error message if the
certificate list contains too many certificates. Thx to Arne Nordmark
for suggesting that option.
2018-06-14 14:19:22 +02:00
Rainer Gerhards
0d765f194a fix build issues
these were introduced in 7589f42e45888b83f5c2a0d788896d41e6a6a598
2018-06-13 14:17:56 +02:00
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