From 7813290d43c1cfe0bc4652126a9cebf39307401f Mon Sep 17 00:00:00 2001 From: Chris Mckay Date: Tue, 26 Feb 2019 16:08:53 +1000 Subject: [PATCH] accept 127.0.0.1 as localhost for host whitelisting (#974) Signed-off-by: Adrian Sutton --- .../pantheon/ethereum/jsonrpc/JsonRpcConfiguration.java | 3 ++- .../pantheon/metrics/prometheus/MetricsConfiguration.java | 3 ++- .../main/java/tech/pegasys/pantheon/cli/PantheonCommand.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcConfiguration.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcConfiguration.java index a9daba20ce..d2eb46fe00 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcConfiguration.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcConfiguration.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; @@ -29,7 +30,7 @@ public class JsonRpcConfiguration { private String host; private Collection corsAllowedDomains = Collections.emptyList(); private Collection rpcApis; - private Collection hostsWhitelist = Collections.singletonList("localhost"); + private Collection hostsWhitelist = Arrays.asList("localhost", "127.0.0.1");; private boolean authenticationEnabled = false; private String authenticationCredentialsFile; diff --git a/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java b/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java index d7d2c3a4e1..f16dee479e 100644 --- a/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java +++ b/metrics/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java @@ -14,6 +14,7 @@ package tech.pegasys.pantheon.metrics.prometheus; import tech.pegasys.pantheon.metrics.MetricCategory; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.EnumSet; @@ -38,7 +39,7 @@ public class MetricsConfiguration { private String pushHost; private int pushInterval; private String prometheusJob; - private Collection hostsWhitelist = Collections.singletonList("localhost"); + private Collection hostsWhitelist = Arrays.asList("localhost", "127.0.0.1"); public static MetricsConfiguration createDefault() { final MetricsConfiguration metricsConfiguration = new MetricsConfiguration(); diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java index ae0fc9e5f6..98f0ebeeec 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java @@ -404,7 +404,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable { paramLabel = "[,...]... or * or all", description = "Comma separated list of hostnames to whitelist for JSON-RPC access, or * or all to accept any host (default: ${DEFAULT-VALUE})", - defaultValue = "localhost") + defaultValue = "localhost,127.0.0.1") private final JsonRPCWhitelistHostsProperty hostsWhitelist = new JsonRPCWhitelistHostsProperty(); @Option(