Skip to content
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

plugins/grpc: default value for grpc port #7479

Merged
merged 4 commits into from
Nov 11, 2024

Conversation

jackstar12
Copy link
Contributor

The gRPC server will always start this way. Current port choice is arbitrary, open to suggestions.

closes: #7473

@jackstar12 jackstar12 requested a review from cdecker as a code owner July 21, 2024 20:48
Copy link
Contributor

@niftynei niftynei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 9127f94

plugins/grpc-plugin/src/main.rs Outdated Show resolved Hide resolved
@cdecker
Copy link
Member

cdecker commented Jul 31, 2024

The change in the behavior appears to cause the cln-grpc-plugin to terminate almost immediately which is causing the tests to also fail right away. Can you check what is causing the plugin to exit?

@jackstar12
Copy link
Contributor Author

Can you check what is causing the plugin to exit?

The test is starting two nodes and both are now trying to use the default port 9736 for the cln-grpc plugin which is causing one of them to crash

@jackstar12 jackstar12 force-pushed the grpc-default-port branch 2 times, most recently from ec5a53c to a2f3b0e Compare August 12, 2024 22:18
@ShahanaFarooqui ShahanaFarooqui force-pushed the grpc-default-port branch 4 times, most recently from 6285509 to 957a999 Compare August 13, 2024 03:03
@rustyrussell
Copy link
Contributor

So, when people upgrade they will have a new random port open to the internet?

I know @michael1011 wants this, but would it be sufficient to open a localhost-bound port by default in this case?

@ShahanaFarooqui ShahanaFarooqui force-pushed the grpc-default-port branch 4 times, most recently from 7a64585 to faa814e Compare August 13, 2024 03:41
@michael1011
Copy link
Contributor

michael1011 commented Aug 13, 2024

So, when people upgrade they will have a new random port open to the internet?

I know @michael1011 wants this, but would it be sufficient to open a localhost-bound port by default in this case?

@rustyrussell that's a very valid point. What about adding an option to configure the host on which the plugin will listen and defaulting that to 127.0.0.1?

Edit: I can't think of any other sensible option, so let's do that. The only concern is that it's a breaking change for all existing CLNs that have a gRPC port configured and expect the plugin to listen on 0.0.0.0.

@ShahanaFarooqui ShahanaFarooqui added this to the v24.08 milestone Aug 13, 2024
@ShahanaFarooqui ShahanaFarooqui modified the milestones: v24.08, v24.11 Aug 19, 2024
tests/test_clnrest.py Show resolved Hide resolved
tests/test_plugin.py Outdated Show resolved Hide resolved
@jackstar12 jackstar12 force-pushed the grpc-default-port branch 2 times, most recently from d0c0b7e to d5efb27 Compare October 7, 2024 20:01
@ShahanaFarooqui
Copy link
Collaborator

@jackstar12 Thanks for the PR. Just FYI, I reordered the commits to move 'set default grpc-host to localhost' before the tests. This ensures that test_clnrest with l1.daemon.wait_for_logs([r'serving grpc on 127.0.0.1:' does not fail.

ACK 467fbaa.

Changelog-Changed: grpc now starts on port 9736 by default
A port should not be opened by default on 0.0.0.0, so change the default
to localhost

Changelog-Added: `grpc-host` option for grpc plugin
@rustyrussell
Copy link
Contributor

Only problem now is that this will break existing setups which set grpc-port and do an upgrade!

Suggest that the default grpc-host be localhost IF the port is not specified, otherwise 0.0.0.0?

@ShahanaFarooqui
Copy link
Collaborator

Only problem now is that this will break existing setups which set grpc-port and do an upgrade!

Suggest that the default grpc-host be localhost IF the port is not specified, otherwise 0.0.0.0?

Shouldn't we instead encourage existing users to explicitly configure their grpc-host to limit their node's exposure? New users who wish to run cln-grpc on a custom port may unintentionally expose their node on 0.0.0.0 if they assume the default grpc-host setting of localhost applies universally. We can update the docs to make this clearer, but it might be a good idea to ask existing users to set their grpc-host intentionally and understand the risks.

@jackstar12
Copy link
Contributor Author

jackstar12 commented Nov 2, 2024

While the suggestion from @rustyrussell would maintain backward compatibility, it could become burdensome in the future and complicated to explain in the documentation. So, I think it's easier to simply mention the change in the release notes and have all gRPC users verify whether it affects their setup.

@rustyrussell rustyrussell merged commit 64b7b98 into ElementsProject:master Nov 11, 2024
38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable cln-grpc by default
7 participants