[lbry] config: allow non-localhost connections with TLS disabled
This commit is contained in:
parent
d5922cd725
commit
bb93a49349
2 changed files with 2 additions and 18 deletions
16
config.go
16
config.go
|
@ -977,13 +977,8 @@ func loadConfig() (*config, []string, error) {
|
||||||
// Only allow TLS to be disabled if the RPC is bound to localhost
|
// Only allow TLS to be disabled if the RPC is bound to localhost
|
||||||
// addresses.
|
// addresses.
|
||||||
if !cfg.DisableRPC && cfg.DisableTLS {
|
if !cfg.DisableRPC && cfg.DisableTLS {
|
||||||
allowedTLSListeners := map[string]struct{}{
|
|
||||||
"localhost": {},
|
|
||||||
"127.0.0.1": {},
|
|
||||||
"::1": {},
|
|
||||||
}
|
|
||||||
for _, addr := range cfg.RPCListeners {
|
for _, addr := range cfg.RPCListeners {
|
||||||
host, _, err := net.SplitHostPort(addr)
|
_, _, err := net.SplitHostPort(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
str := "%s: RPC listen interface '%s' is " +
|
str := "%s: RPC listen interface '%s' is " +
|
||||||
"invalid: %v"
|
"invalid: %v"
|
||||||
|
@ -992,15 +987,6 @@ func loadConfig() (*config, []string, error) {
|
||||||
fmt.Fprintln(os.Stderr, usageMessage)
|
fmt.Fprintln(os.Stderr, usageMessage)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
if _, ok := allowedTLSListeners[host]; !ok {
|
|
||||||
str := "%s: the --notls 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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
doc.go
4
doc.go
|
@ -102,9 +102,7 @@ Application Options:
|
||||||
server is disabled by default if no
|
server is disabled by default if no
|
||||||
rpcuser/rpcpass or rpclimituser/rpclimitpass is
|
rpcuser/rpcpass or rpclimituser/rpclimitpass is
|
||||||
specified
|
specified
|
||||||
--notls Disable TLS for the RPC server -- NOTE: This is
|
--notls Disable TLS for the RPC server
|
||||||
only allowed if the RPC server is bound to
|
|
||||||
localhost
|
|
||||||
--onion= Connect to tor hidden services via SOCKS5 proxy
|
--onion= Connect to tor hidden services via SOCKS5 proxy
|
||||||
(eg. 127.0.0.1:9050)
|
(eg. 127.0.0.1:9050)
|
||||||
--onionpass= Password for onion proxy server
|
--onionpass= Password for onion proxy server
|
||||||
|
|
Loading…
Reference in a new issue