dshackle icon indicating copy to clipboard operation
dshackle copied to clipboard

Support for basic authentication as part of the URL

Open barnabasbusa opened this issue 2 years ago • 3 comments

Looks like basic authentication is not supported in dshackle.

Is there any quick way to enable this?

Example: config:

cluster:
      upstreams:
        - id: "geth-lighthouse"
          chain: ethereum
          connection:
            ethereum:
              rpc:
                url: "https://username:[email protected]"

dshackle logs:

2023-28-09 13:58:51.821 | INFO  |  ConfiguredUpstreams | Using Ethereum upstream, at https://username:[email protected]
2023-28-09 13:58:52.120 | WARN  |  EthereumRpcUpstream | Setting up upstream geth-lighthouse with RPC-only access, less effective than WS+RPC
2023-28-09 13:58:52.131 | INFO  |  EthereumRpcUpstream | Configured for Ethereum
2023-28-09 13:58:52.727 | INFO  | entMultistreamHolder | Upstream geth-lighthouse with chain ETHEREUM has been added
2023-28-09 13:58:52.741 | WARN  |         AbstractHead | Restarting the Head...
2023-28-09 13:58:53.635 | INFO  |            StarterKt | Started StarterKt in 16.031 seconds (JVM running for 18.811)
2023-28-09 13:59:07.726 | INFO  |          Multistream | State of ETH: height=?, status=[UNAVAILABLE/1], lag=[0], weak=[geth-lighthouse]

Raw curl to the rpc endpoint

curl --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST  https://username:[email protected]

response:

{"jsonrpc":"2.0","id":1,"result":"0x207"}

barnabasbusa avatar Sep 28 '23 14:09 barnabasbusa

Did you try to specify it as basic-auth option? https://github.com/emeraldpay/dshackle/blob/master/docs/reference-configuration.adoc#ethereum-connection-options

PS I guess it's possible to extract from the URL as well, but at this time I could suggest to use the config option

splix avatar Oct 11 '23 01:10 splix

Yeah,I wasn't aware of this field. Thanks it is working using this extra field, but indeed it would be great if the standard method with the prefixed username:pass method would also be supported out of the box.

barnabasbusa avatar Oct 11 '23 14:10 barnabasbusa

Also it would be great if custom auth headers could also be passed, not just basic auth. For example something like this: https://developers.cloudflare.com/cloudflare-one/identity/service-tokens/#connect-your-service-to-access

barnabasbusa avatar Oct 11 '23 14:10 barnabasbusa