Skip to content

Commit

Permalink
[lbry] config: allow non-localhost connections with TLS disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
roylee17 committed Jul 11, 2022
1 parent b4a9f5f commit 9d812ab
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,17 +568,7 @@ func loadConfig() (*config, []string, error) {
if err != nil {
return nil, nil, err
}
if cfg.DisableClientTLS {
if _, ok := localhostListeners[RPCHost]; !ok {
str := "%s: the --noclienttls option may not be used " +
"when connecting RPC to non localhost " +
"addresses: %s"
err := fmt.Errorf(str, funcName, cfg.RPCConnect)
fmt.Fprintln(os.Stderr, err)
fmt.Fprintln(os.Stderr, usageMessage)
return nil, nil, err
}
} else {
if !cfg.DisableClientTLS {
// If CAFile is unset, choose either the copy or local lbcd cert.
if !cfg.CAFile.ExplicitlySet() {
cfg.CAFile.Value = filepath.Join(cfg.AppDataDir.Value, defaultCAFilename)
Expand Down Expand Up @@ -664,7 +654,7 @@ func loadConfig() (*config, []string, error) {
allListeners := append(cfg.LegacyRPCListeners,
cfg.ExperimentalRPCListeners...)
for _, addr := range allListeners {
host, _, err := net.SplitHostPort(addr)
_, _, err := net.SplitHostPort(addr)
if err != nil {
str := "%s: RPC listen interface '%s' is " +
"invalid: %v"
Expand All @@ -673,15 +663,6 @@ func loadConfig() (*config, []string, error) {
fmt.Fprintln(os.Stderr, usageMessage)
return nil, nil, err
}
if _, ok := localhostListeners[host]; !ok {
str := "%s: the --noservertls option may not be used " +
"when binding RPC to non localhost " +
"addresses: %s"
err := fmt.Errorf(str, funcName, addr)
fmt.Fprintln(os.Stderr, err)
fmt.Fprintln(os.Stderr, usageMessage)
return nil, nil, err
}
}
}

Expand Down

0 comments on commit 9d812ab

Please sign in to comment.