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

feat(rpc): default binding to localhost vs 0.0.0.0 open to world #2955

Merged
merged 6 commits into from
Dec 18, 2023

Conversation

ramin
Copy link
Contributor

@ramin ramin commented Nov 23, 2023

fixes #2824 which requests we bind to localhost by default (previously was world accessible)

  • sets defaults to bind to localhost properly (previously flags SAID the defaults were localhost but were actually 0.0.0.0)
  • removes an unused DefaultConfig defined in api/gateway/package
  • moves defaults (bind address and port) to vars so we can use them to set in flag usage messages so they don't drift out of sync with reality
  • adds tests for the defaults
  • adds test cases for flag definitions
  • adds test cases for flag parsing

Other

skips suggestion of binding vhosts, we don't do any kind of middleware checking in rpc (i believe in geth this would be a way to bind to 0.0.0.0 then limit to allowed remote IPs making requests). I'd suggest this is a more advanced configuration use case and belongs outside of the node itself to be managed by the infra operator where it'd be handled by a ingress gateway or routing rule to the machine/instance/orchestrator where the node software is running

@ramin ramin added kind:refactor Attached to refactoring PRs area:rpc labels Nov 23, 2023
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cde1065) 50.57% compared to head (6f84f31) 50.93%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2955      +/-   ##
==========================================
+ Coverage   50.57%   50.93%   +0.36%     
==========================================
  Files         168      176       +8     
  Lines       11022    11193     +171     
==========================================
+ Hits         5574     5701     +127     
- Misses       4942     4988      +46     
+ Partials      506      504       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ramin ramin merged commit fae3024 into main Dec 18, 2023
17 of 19 checks passed
@ramin ramin deleted the feat/ramin/bind-address branch December 18, 2023 10:39
renaynay pushed a commit to renaynay/celestia-node that referenced this pull request Jan 15, 2024
…estiaorg#2955)

fixes celestiaorg#2824 which requests we bind to localhost by default (previously
was world accessible)

- sets defaults to bind to localhost properly (previously flags SAID the
defaults were localhost but were actually 0.0.0.0)
- removes an unused `DefaultConfig` defined in `api/gateway/package`
- moves defaults (bind address and port) to vars so we can use them to
set in flag usage messages so they don't drift out of sync with reality
- adds tests for the defaults
- adds test cases for flag definitions
- adds test cases for flag parsing
 
Other

skips suggestion of binding vhosts, we don't do any kind of middleware
checking in rpc (i believe in geth this would be a way to bind to
0.0.0.0 then limit to allowed remote IPs making requests). I'd suggest
this is a more advanced configuration use case and belongs outside of
the node itself to be managed by the infra operator where it'd be
handled by a ingress gateway or routing rule to the
machine/instance/orchestrator where the node software is running
@zvolin
Copy link

zvolin commented Feb 9, 2024

I think this was actually a breaking change. If you run node in docker, you now need to add --xxx.addr flags if you want to reach out to the node from container published ports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rpc kind:refactor Attached to refactoring PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(feat): Allow binding RPC to only specific addresses
5 participants