Giter Site home page Giter Site logo

Support for EC certificates about fulcrum HOT 13 CLOSED

cculianu avatar cculianu commented on July 30, 2024
Support for EC certificates

from fulcrum.

Comments (13)

cculianu avatar cculianu commented on July 30, 2024 1

Ok. Here is a build from my working branch where I am probing keys and trying to accept all:

Fulcrum-linux-65ec080b.tar.gz

Untar it and use the enclosed binary on your system. Let me know if/how it works and also if you manage to connect to your SSL port, etc.

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024 1

I'm closing this issue now since the support for more cert types were added to master. However -- it's not very thoroughly tested and I noticed elliptic curve certs don't all work with Electron Cash. So with that caveat, I am closing this -- but it still needs testing. Hopefully when #28 is resolved we can see if your server "works as before" out of the box.

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

What algorithm does this key use?

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

Oh I see -- you pasted it -- Ec private key eh? I can add a CLI arg to allow you to specify which key type it is. Are you able to compile fulcrum? Or did you just download the release binary? And if so what platform? I can send you a test build tomorrow or sometime this week and you can tell me if it works.

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

Well I was able to use EC, DSA, EH etc keys with Fulcrum no problem -- I wrote code to "probe" the file and figure out the format -- however note that Electron Cash seems to be unable to communicate with such servers. Are you intending to serve up data to Electron Cash wallets? Or for some other purpose?

Did that same key work with ElectrumX and were you able to connect to your server using Electron Cash?

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

Ok so I got EC keys working but note that Python (and Electron Cash) don't support all possible EC keys and curves your can create. I managed to get it working with these params:

$ openssl ecparam -name secp521r1 -genkey -param_enc explicit -out key-ec3.pem
$ openssl req -new -x509 -key key-ec3.pem -out cert-ec3.pem -days 3650

I will push a commit to master soon and also do another release after I finish testing. Let me know if you would like a build to test (what platform are you on?).

from fulcrum.

infertux avatar infertux commented on July 30, 2024

Yes I was using this key successfully with ElectrumX for serve up data to Electron Cash wallets. The EC certificate/key pair is generated automatically by https://caddyserver.com/. My platform is Linux x86_64 (Debian 10). Happy to test a new build.

from fulcrum.

infertux avatar infertux commented on July 30, 2024

Alright the EC certificate works fine now but I'm running into another issue. Have you tried to point Fulcrum at bchd instead of bitcoind? It looks like bchd is more strict about checking HTTP headers and refusing the request sent by Fulcrum because it's missing the Host header:

<BitcoinD.1> 400 (header): HTTP/1.1 400 Bad Request: missing required Host header

Indeed if I MITM with netcat I cannot see any Host header:

$ nc -vlp 8334
listening on [any] 8334 ...
connect to [127.0.0.1] from localhost [127.0.0.1] 42256
POST / HTTP/1.1
Content-Type: application/json-rpc
Authorization: Basic blah==
Content-Length: 38

{"id":5,"method":"ping","params":[]}

Sending the request with curl works just fine (notice the extra headers):

$ curl http://127.0.0.1:8334/ -vi -H "Authorization: Basic blah==" --data '{"id":5,"method":"ping","params":[]}'

> POST / HTTP/1.1
> Host: 127.0.0.1:8334
> User-Agent: curl/7.64.0
> Accept: */*
> Authorization: Basic blah==
> Content-Length: 36
> Content-Type: application/x-www-form-urlencoded
[...]
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Connection: close
Connection: close
< Content-Type: application/json
Content-Type: application/json

< 
{"jsonrpc":"1.0","result":null,"error":null,"id":5}

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

I don't officially support bchd. Their RPC api is a bit quirky. If you like I can try adding the Host: header and seeing if it works -- but they are not maintaining their RPC api so it would involve my having to make exceptions for their quirks ... all over the code.

The devs of bchd want everybody to use gRPC. gRPC support in C++ is an atrocity against man.

I'm glad the cert is working -- I'll see how deep the rabbit hole goes with bchd after adding the host header.

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

Ok, I created a new issue #28 where we can discuss bchd -- did you manage to get a node running against not bchd and verify the EC cert is working with Electron Cash? Or not yet?

from fulcrum.

infertux avatar infertux commented on July 30, 2024

I don't officially support bchd. Their RPC api is a bit quirky. If you like I can try adding the Host: header and seeing if it works -- but they are not maintaining their RPC api so it would involve my having to make exceptions for their quirks ... all over the code.

Well in this case it's not a quirk but an actual bug in Fulcrum since the Host header MUST be present with HTTP/1.1 as per the RFC: A client MUST include a Host header field in all HTTP/1.1 request messages . [...] All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request) status code to any HTTP/1.1 request message which lacks a Host header field.. So bchd is doing exactly what it's supposed to do.

I'm glad the cert is working -- I'll see how deep the rabbit hole goes with bchd after adding the host header.

Yes thank you for the quick fix BTW. Hopefully the Host header is the only bit missing.

did you manage to get a node running against not bchd and verify the EC cert is working with Electron Cash? Or not yet?

No I don't have the hardware to sync another fullnode with bitcoind. I already have a bchd fullnode and was hoping I could use it with Fulcrum too since it worked nicely with ElectrumX ;)

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

It's not a bug, but a feature. None of the bitcoind's except for bchd require it. We aren't implementing the full RFC anyway -- this is just to get data to/from a very customized server. The host header is useless here -- but ok. I'll add it and can see how deep the rabbit hole goes.

Please subscribe to issue #28 if you haven't done so already so we may continue the discussion there. I'll let you know when Host: is added and you can try it.

from fulcrum.

cculianu avatar cculianu commented on July 30, 2024

@infertux I just tried using bchd -- I remembered why I never support them -- they don't support HTTP persistent connections. See the other issue #28 comment #28 (comment).

Please consider switching to BCHN or any other node implementation that properly supports HTTP/1.1 persistent connections.

from fulcrum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.