Commit Graph

37 Commits

Author SHA1 Message Date
Xiaoge Su
a3850c3589 Fix the misuse of BIO_get_mem_data
BIO_get_mem_data will return the length of the string, however, the
string is not zero-terminated. The length value determines where the
string terminates.
2024-08-06 05:08:14 +08:00
Syed Paymaan Raza
c3e7542cda Update end year in copyright header 2024-08-02 09:40:11 -07:00
Xiaoge Su
9f15c57b26 Add peer address when TLS policy failed
See #5854
2024-07-23 09:52:49 -07:00
Xiaoge Su
bb29465713 fixup! Remove unused is_client flag 2024-07-23 09:52:49 -07:00
Xiaoge Su
390e88c0ae fixup! Address issues per comment
Also try to introduce [[unlikely]] to ASSERT, this is related to issue #11422
2024-07-23 09:52:49 -07:00
Xiaoge Su
4b70993d89 Better TraceEvent output for TLS failures
This patch adds more output about TLS failures, e.g.

<Event Severity="20" Time="1716265824.713579" DateTime="2024-05-21T04:30:24Z" Type="TLSPolicyFailure" ID="0000000000000000" SuppressedEventCount="0" Reason="Rule.Cert.Issuer" Rule="Rule{ verify_cert=1, verify_time=1, Subject=[ ], Issuer=[ ], Root=[ ] }" ThreadID="7547317051334743152" LogGroup="default" />

The failure data will include the rule, the reason of failure and the
value of corresponding fields.
2024-07-23 09:52:49 -07:00
Sam Gwydir
6c16875c34 Add networkoption to disable non-TLS connections (#9984)
* Add networkoption to disable non-TLS connections

* add disable plaintext connection to fdbserver

* python doc

* Formatting

* Add tls disable plaintext connection to client api test

* review

* fix negative test

* formatting

* add TLS support to c client config tests

Adds support for TLS in the client and server separately

* add tests for disable_plaintext_connections

Test TLS and Plaintext Clusters and Clients

* Fix documentation

* Rename option to indicate it is client-only

* clearer formatting

* default to allowing plaintext connections

* add SetTLSDisablePlaintextConnection to go bindings
2023-05-13 00:14:11 +02:00
Xiaoge Su
88eeb5a526 Remove WolfSSL support in FoundationDB 2023-03-23 20:17:18 -07:00
Sam Gwydir
833f2f9f5a TLS error messages are non-fatal
To avoid confusing users, TLS error messages should reflect the fact
that they are non-fatal and thus note that they are warnings.
2022-12-13 13:17:59 -08:00
Sam Gwydir
61ce598aef Specify cert and key files separately 2022-09-26 11:59:42 -07:00
Sam Gwydir
d71a2870e2 TLS certificate and key path should not default to pwd 2022-09-26 11:32:26 -07:00
Junhyun Shim
1dbb13a899 Accept non-mTLS clients as untrusted 2022-07-28 20:03:07 +02:00
Markus Pilman
a47ed89018 Linux fixes and addressed review comments 2022-06-23 20:52:13 -06:00
Markus Pilman
10e478dfc3 Flow is compiling 2022-06-23 16:35:19 -06:00
sfc-gh-tclinkenbeard
7f05221cfe Removed TLS_DISABLED macro 2022-05-02 22:15:27 -07:00
Sam Gwydir
5403a29ecb add WolfSSL support (#6682)
remove extraneous include
2022-04-28 16:53:38 -07:00
sfc-gh-tclinkenbeard
a71099471b Update copyright header dates 2022-03-21 13:36:23 -07:00
Markus Pilman
8b77c8d79a Remove unused OpenSSL code 2022-01-11 10:34:37 -08:00
A.J. Beamon
a51988ff3a Refactor our PRIVATE_EXCEPT_FOR_TLSCONFIG_CPP macro to be compatible with clang-format. Remove one use of it that is no longer needed now that actors can access private members. 2021-08-27 16:41:45 -07:00
Cynthia
f8054b82de fdbcli prints error on TLS File not found 2021-04-19 22:25:19 -06:00
FDB Formatster
df90cc89de apply clang-format to *.c, *.cpp, *.h, *.hpp files 2021-03-10 10:18:07 -08:00
Steve Atherton
76a4293d1d Merge branch 'release-6.3'
# Conflicts:
#	fdbserver/fdbserver.actor.cpp
2021-02-15 02:13:06 -08:00
Russell Sears
a56184c0b7 log TLSVerifyFailure as a warning (severity 20) since it generally indicates a miconfiguration or important network problem 2021-02-08 22:01:48 +00:00
A.J. Beamon
aaf0a9aa7b Merge branch 'release-6.3' into merge-release-6.3-into-master
# Conflicts:
#	build/docker-compose.yaml
#	cmake/ConfigureCompiler.cmake
#	fdbclient/FileBackupAgent.actor.cpp
#	fdbrpc/AsyncFileCached.actor.h
#	fdbrpc/IAsyncFile.h
#	fdbrpc/IRateControl.h
#	fdbrpc/simulator.h
#	fdbserver/KeyValueStoreSQLite.actor.cpp
#	fdbserver/storageserver.actor.cpp
#	fdbservice/ServiceBase.cpp
2021-02-08 12:58:34 -08:00
A.J. Beamon
67e783acf8 Merge branch 'release-6.2' into merge-release-6.2-into-release-6.3
# Conflicts:
#	cmake/CompileBoost.cmake
#	cmake/FDBComponents.cmake
#	fdbrpc/AsyncFileCached.actor.h
#	fdbrpc/simulator.h
#	fdbserver/KeyValueStoreSQLite.actor.cpp
#	fdbserver/Knobs.cpp
#	fdbserver/Knobs.h
#	fdbserver/storageserver.actor.cpp
#	flow/Knobs.h
#	flow/network.h
2021-02-08 09:20:28 -08:00
Russell Sears
589eaf54d7 Switch to BoringSSL by default 2021-01-22 20:39:12 +00:00
sfc-gh-tclinkenbeard
4669f837fa Add uses of makeReference 2020-11-07 22:10:18 -08:00
sfc-gh-tclinkenbeard
0ac08f6a9b Replace NULL with nullptr in flow 2020-09-20 11:31:49 -07:00
A.J. Beamon
6f4d6f1923 Refreshing TLS files was done to an incorrect location that resulted in random memory being wiped out. Also fixed a typo that loaded the key bytes into the CA bytes in some cases. 2020-06-12 14:40:10 -07:00
tclinken
eaad516f3a Removed const_cast from readEntireFile 2020-05-13 19:59:35 -07:00
Alex Miller
94b4f78ea9 Fix clients crashing in TLS code on exit.
If client code initiates an FDB operation to a TLS cluster, and then
immediately exits the main thread, then OpenSSL's atexit handler would
potentially run while the network thread is attempting to do TLS
operations, and thus crash.

This commit removes the OpenSSL atexit hander, and instead relies on a
client intentionally ending the network thread to do TLS cleanup.  If
the client code exits without stopping the network thread, then we'll
never free OpenSSL data structures, which is the safer thing to do.
2020-04-18 15:48:02 -07:00
Alex Miller
db5863145a Merge remote-tracking branch 'upstream/release-6.2' into fdbcli-tlsinfo 2020-03-16 12:33:50 -07:00
Alex Miller
a5568b2fc6 Rewrite tlsinfo into --debug-tls, and print out configuration. 2020-03-13 15:46:03 -07:00
Alex Miller
0c558efcfe Add a tlsinfo command to fdbcli that prints the certificate chain.
This requires the certificate chain to load successfully, otherwise
fdbcli will error out at an earlier point due to Net2 not being able to
configure TLS.
2020-03-13 00:11:53 -07:00
Alex Miller
1f56bf8933 Fix the build with success()
Co-Authored-By: A.J. Beamon <ajbeamon@users.noreply.github.com>
2020-03-06 10:15:04 -08:00
Alex Miller
ac52b6b474 Rework a bit of error and exception handling.
I went back and dug through all of the "what functions can throw what
types", and made sane decisions about them.  boost errors are
aggressively translated into FDB ones, whcih might result in multiple
lines of logging about errors, but this is in infrequently run code, so
it should be fine.
2020-03-06 02:33:16 -08:00
Alex Miller
9b5ef3416e Refactor TLSParams into TLSConfig + LoadedTLSConfig
The idea being that we keep around a TLSConfig that the configuration
that the user has provided, and then when we want to intialize an SSL
context, we ask the TLSConfig to load all certificates and return us a
LoadedTLSConfig that is a concrete set of certificate bytes in memory.

initTLS now just takes the in-memory bytes and applies them to the ssl
context.

This is a large refactor to lead up into certificate refeshing, where we
will periodically check for changes to the certificates, and then
re-load them and apply them to a new SSL context.
2020-03-04 20:14:47 -08:00