-
Notifications
You must be signed in to change notification settings - Fork 19
Using bytes
options for TLS rather than path
does not appear to work
#52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't know why 1026 doesn't show up in the documentation, but the description in the code is just "Network connection failed" so that's not really any help either. The |
Hi @kocolosk This was testing with 6.2.28-1 (and now with 6.3.23 as well) Noticed that in fact In erlfdb_nif the following tls ca/key/cert options are types for
But, index 8cb03b0..fc27e00 100644
--- a/c_src/main.c
+++ b/c_src/main.c
@@ -488,6 +488,8 @@ erlfdb_network_set_option(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
option = FDB_NET_OPTION_CLIENT_BUGGIFY_SECTION_FIRED_PROBABILITY;
} else if(IS_ATOM(argv[0], tls_ca_bytes)) {
option = FDB_NET_OPTION_TLS_CA_BYTES;
+ } else if(IS_ATOM(argv[0], tls_ca_path)) {
+ option = FDB_NET_OPTION_TLS_CA_PATH;
} else if(IS_ATOM(argv[0], tls_password)) {
option = FDB_NET_OPTION_TLS_PASSWORD; I've also had a look at a few of the 'blessed' language bindings at https://github.com/apple/foundationdb/tree/main/bindings and they all seem to support the |
Good catch @leonardb. I think we just need to add the option. It looks like we validate the network options so it's surprising it didn't blow up at https://github.com/apache/couchdb-erlfdb/blob/main/c_src/main.c#L514 from https://github.com/apache/couchdb-erlfdb/blob/main/src/erlfdb_nif.erl#L105-L106 @kocolosk is right that we may have to wrangle the correct API versions here if it's not documented or was available only earlier/later we could resort to ifdefs possibly. |
BTW did not mean to close the issue, sorry. |
I'm really just worried about the They're accepted when setting the network options (no errors) but obviously 'something' is not working as erlfdb is not connecting properly to the cluster. Maybe it's a bug in the C lib itself, but that's beyond my capabilities to track down. Enabling trace on the connection gives very limited info. All I can see is a connection failure.
|
I see the logs are referring to paths To separate the values being mismanaged in the erlfdb erlang/c code vs fdb client not handling it properly see if you can pass the exact values via the environment variables https://apple.github.io/foundationdb/tls.html |
This did not help so I decided to just nuke my entire local DB and start from scratch. After setting up a fresh install of 6.3.23 with new certs it appears that passing the So, not a bug and apologies for the distraction. I do still have an open question about the ability to defer loading and initialization of the NIF though. Currently I have a branch which:
Would this be considered as a contribution? It does not change or alter default behavior but it does give consumers the ability to control initialization and network settings outside of settings in sys.config |
Fascinating. I was just going to comment that I cannot seem to get the |
"I wish I knew....." what I was doing wrong previously. All I can add is that when I added That sent me down a rabbit-hole of checking with different settings and keys and finally re-installing/initializing with newly generated keys, at which point I discovered you now have to manually add all the key settings to the backup_agent command in foundationdb.conf to stop that throwing a ton of errors. Once I had a 6.3.23 fresh cluster up and could connect, erlfdb just started working with all the I honestly wish I knew why though |
OK I figured out the issue on my side, just some whitespace issues with the way I was producing the byte strings for the key and cert to pass to the application environment. Agreed that Regarding the loading and initialization behavior for the NIF ... I'm wondering if we ought to just always defer the part that sets up the network thread until the first call to |
FDB allows for:
tls_ca_path
tls_ca_bytes
tls_key_path
tls_key_bytes
tls_cert_path
tls_cert_bytes
When erlfdb inits using the
path
env values I can connect to the cluster and use the DB.If I use the
bytes
options erlfdb 'seems' to connect and returns a database whenerlfdb:open(Cluster).
, but all further operations just hang. A simple transactionalset
ends up stuck in erlfdb:wait and never returns.The only error I see in the fdb trace logs is a 1026 network error which is of course helpfully undocumented.
Rationale:
I currently have a branch which does a lazy init of erlfdb_nif and passes in the network options as they are pulled from a key server on init of the parent application. Currently I'm having to store keys to disk and pass in the
path
variants, but would definitely prefer that keys do no get saved to disk at all.The text was updated successfully, but these errors were encountered: