cculianu / Fulcrum

A fast & nimble SPV Server for BCH, BTC, and LTC
Other
343 stars 77 forks source link

Add option to use `.cookie` file #79

Closed ejose19 closed 3 years ago

ejose19 commented 3 years ago

It would be great if Fulcrum could read from the cookie file instead of using rpc credentials, as it saves the user from managing another pair of credentials by relying on directory permissions.

cculianu commented 3 years ago

Hmm.. I'll have to look at that auth scheme and how it works. I understand that's actually preferred nowadays, right? This is a good suggestion -- I'll look into it and perhaps do it Thanks!

ejose19 commented 3 years ago

Yes, both electrs and electrum-personal-server uses cookie method, which is the preferred way: [1] [2] [3]

cculianu commented 3 years ago

Hmm -- ok. Yeah I just did some research on this. Apparently under-the-hood the .cookie file and the user:pass mechanism end up identical on the HTTP layer. This is good. I can easily do this. Consider this a feature I will work on soon. Thanks for the tip and the heads-up on it. I'm a bit of an old-timer I guess -- I remember a time when this auth mechanism did not exist, :)

cculianu commented 3 years ago

Hi @ejose19 -- do you know how to build Fulcrum from source? If so can you pull latest master and try out the new .cookie file feature? It has been added in this commit: 3fc0a85f03ceaf9d1094ce357f8c4f03426762ce

Let me know how you like it and/or if it works as expected. (I'm testing it now with BCHN on BCH and it works great.)

cculianu commented 3 years ago

Ok, well I have been testing this here and it's working (using BCHN on BCH). I will close this issue since it is implemented in latest master. If you want me to shoot you a pre-built static binary off master just let me know.

Or if you encounter problems with this feature now, re-open the issue or write here or create a new issue.

Thanks @ejose19 for the suggestion!

ejose19 commented 3 years ago

Also tested with BCHN and it works great, I was preparing a PR to improve the error message when the cookie load had an issue, I'm using docker build but it seems it's rebuilding jemalloc & rocksdb every time, is there an argument to skip rebuilding of those 2 and just go straight to Fulcrum build?

EDIT: Actually, I've checked and the script doesn't include any option to skip rebuild, I will also submit a PR to improve build.sh script.

cculianu commented 3 years ago

Great, thanks for testing and confirming it works.