mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 14:40:30 +01:00
config: enforce safe auth of gRPC/REST listeners after parsing
This commit is contained in:
parent
c0141a7bc1
commit
88aafe5c91
1 changed files with 16 additions and 16 deletions
32
config.go
32
config.go
|
@ -919,22 +919,6 @@ func loadConfig() (*config, error) {
|
||||||
cfg.RawListeners = append(cfg.RawListeners, addr)
|
cfg.RawListeners = append(cfg.RawListeners, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For each of the RPC listeners (REST+gRPC), we'll ensure that users
|
|
||||||
// have specified a safe combo for authentication. If not, we'll bail
|
|
||||||
// out with an error.
|
|
||||||
err = lncfg.EnforceSafeAuthentication(
|
|
||||||
cfg.RPCListeners, !cfg.NoMacaroons,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
err = lncfg.EnforceSafeAuthentication(
|
|
||||||
cfg.RESTListeners, !cfg.NoMacaroons,
|
|
||||||
)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add default port to all RPC listener addresses if needed and remove
|
// Add default port to all RPC listener addresses if needed and remove
|
||||||
// duplicate addresses.
|
// duplicate addresses.
|
||||||
cfg.RPCListeners, err = lncfg.NormalizeAddresses(
|
cfg.RPCListeners, err = lncfg.NormalizeAddresses(
|
||||||
|
@ -955,6 +939,22 @@ func loadConfig() (*config, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For each of the RPC listeners (REST+gRPC), we'll ensure that users
|
||||||
|
// have specified a safe combo for authentication. If not, we'll bail
|
||||||
|
// out with an error.
|
||||||
|
err = lncfg.EnforceSafeAuthentication(
|
||||||
|
cfg.RPCListeners, !cfg.NoMacaroons,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
err = lncfg.EnforceSafeAuthentication(
|
||||||
|
cfg.RESTListeners, !cfg.NoMacaroons,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Remove the listening addresses specified if listening is disabled.
|
// Remove the listening addresses specified if listening is disabled.
|
||||||
if cfg.DisableListen {
|
if cfg.DisableListen {
|
||||||
ltndLog.Infof("Listening on the p2p interface is disabled!")
|
ltndLog.Infof("Listening on the p2p interface is disabled!")
|
||||||
|
|
Loading…
Add table
Reference in a new issue