Browse Source

Make RPC bind to localhost by default (#3746)

* Make RPC bind to localhost by default

* Add CHANGELOG_PENDING entry

* Allow testnet command to override RPC listen address

* Update localnet test to bind RPC to 0.0.0.0

* Update p2p test to bind RPC to 0.0.0.0

* Remove rpc-laddr parameter

* Update localnet to use config template with RPC listen address override

* Use config template override method for RPC listen address

* Build config template into localnode image

* Build localnode image locally before starting localnet

* Move testnet config overrides into templates

* Revert deletion of config overrides

* Remove extraneous config parameter overrides
pull/3751/head
Thane Thomson 5 years ago
committed by Ethan Buchman
parent
commit
d88a639838
7 changed files with 15 additions and 5 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +2
    -2
      Makefile
  3. +1
    -1
      config/config.go
  4. +1
    -1
      networks/local/localnode/Dockerfile
  5. +2
    -0
      networks/local/localnode/config-template.toml
  6. +6
    -1
      test/docker/Dockerfile
  7. +2
    -0
      test/docker/config-template.toml

+ 1
- 0
CHANGELOG_PENDING.md View File

@ -36,6 +36,7 @@
- [p2p] \#3666 Add per channel telemetry to improve reactor observability - [p2p] \#3666 Add per channel telemetry to improve reactor observability
- [rpc] [\#3686](https://github.com/tendermint/tendermint/pull/3686) `HTTPClient#Call` returns wrapped errors, so a caller could use `errors.Cause` to retrieve an error code. (@wooparadog) - [rpc] [\#3686](https://github.com/tendermint/tendermint/pull/3686) `HTTPClient#Call` returns wrapped errors, so a caller could use `errors.Cause` to retrieve an error code. (@wooparadog)
- [abci/examples] \#3659 Change validator update tx format (incl. expected pubkey format, which is base64 now) (@needkane) - [abci/examples] \#3659 Change validator update tx format (incl. expected pubkey format, which is base64 now) (@needkane)
- [rpc] \#3724 RPC now binds to `127.0.0.1` by default instead of `0.0.0.0`
### BUG FIXES: ### BUG FIXES:
- [libs/db] \#3717 Fixed the BoltDB backend's Batch.Delete implementation (@Yawning) - [libs/db] \#3717 Fixed the BoltDB backend's Batch.Delete implementation (@Yawning)


+ 2
- 2
Makefile View File

@ -275,8 +275,8 @@ build-docker-localnode:
@cd networks/local && make @cd networks/local && make
# Run a 4-node testnet locally # Run a 4-node testnet locally
localnet-start: localnet-stop
@if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2 ; fi
localnet-start: localnet-stop build-docker-localnode
@if ! [ -f build/node0/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/tendermint:Z tendermint/localnode testnet --config /etc/tendermint/config-template.toml --v 4 --o . --populate-persistent-peers --starting-ip-address 192.167.10.2; fi
docker-compose up docker-compose up
# Stop testnet # Stop testnet


+ 1
- 1
config/config.go View File

@ -369,7 +369,7 @@ type RPCConfig struct {
// DefaultRPCConfig returns a default configuration for the RPC server // DefaultRPCConfig returns a default configuration for the RPC server
func DefaultRPCConfig() *RPCConfig { func DefaultRPCConfig() *RPCConfig {
return &RPCConfig{ return &RPCConfig{
ListenAddress: "tcp://0.0.0.0:26657",
ListenAddress: "tcp://127.0.0.1:26657",
CORSAllowedOrigins: []string{}, CORSAllowedOrigins: []string{},
CORSAllowedMethods: []string{"HEAD", "GET", "POST"}, CORSAllowedMethods: []string{"HEAD", "GET", "POST"},
CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"}, CORSAllowedHeaders: []string{"Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time"},


+ 1
- 1
networks/local/localnode/Dockerfile View File

@ -13,4 +13,4 @@ CMD ["node", "--proxy_app", "kvstore"]
STOPSIGNAL SIGTERM STOPSIGNAL SIGTERM
COPY wrapper.sh /usr/bin/wrapper.sh COPY wrapper.sh /usr/bin/wrapper.sh
COPY config-template.toml /etc/tendermint/config-template.toml

+ 2
- 0
networks/local/localnode/config-template.toml View File

@ -0,0 +1,2 @@
[rpc]
laddr = "tcp://0.0.0.0:26657"

+ 6
- 1
test/docker/Dockerfile View File

@ -27,7 +27,12 @@ RUN make install_abci
# install Tendermint # install Tendermint
RUN make install RUN make install
RUN tendermint testnet --node-dir-prefix="mach" --v=4 --populate-persistent-peers=false --o=$REPO/test/p2p/data
RUN tendermint testnet \
--config $REPO/test/docker/config-template.toml \
--node-dir-prefix="mach" \
--v=4 \
--populate-persistent-peers=false \
--o=$REPO/test/p2p/data
# Now copy in the code # Now copy in the code
# NOTE: this will overwrite whatever is in vendor/ # NOTE: this will overwrite whatever is in vendor/


+ 2
- 0
test/docker/config-template.toml View File

@ -0,0 +1,2 @@
[rpc]
laddr = "tcp://0.0.0.0:26657"

Loading…
Cancel
Save