Closed tonyaldon closed 1 year ago
@tonyaldon Thank you for testing.
It is expected behaviour from curl as, by default, it expects certificates to be signed by a trusted certificate authority.
Currently clnrest follows below steps to use/generate certificates:
1 - If the rest-certs
path is set in config, search for the certificates at the location.
2 - Else, search at the default location (current working directory), where cln-grpc's generated certificates reside.
3 - If certificates are missing at the configured/default location, create self signed certificate and use them.
Certificates generated by either cln-grpc/clnrest are self signed and will not be recognised by curl. Some possible options are:
rest-certs
path with trusted certificate location.--cacert
option to specify the trusted certificate. For example
curl --cacert /path/to/client.pem -X POST 'https://127.0.0.1:3010/v1/getinfo' -H 'accept: application/json' -H 'Rune: xxx' -H 'Nodeid: xxx' -H 'Content-Type: application/json' -d '{}'
Closing this issue now.
Thanks for the explanation. I'll try to use a trusted certificate with rest-certs
option.
Hi Shahana,
when I use
clnrest
withrest_protocol=http
, everything works fine.But when I use the default
https
protocol, I can't doPOST
requests withcurl
(I also tried with Python and the libraryrequests
) without ignoring the self-signed certificate.You can check this by running the following (assuming we have
lightning
andclnrest
repository cloned locally in the current directory):I have no idea why is this.