Skip to content

Commit defe05b

Browse files
committed
subserver_permissions: add URIs for white-listed RPCs
There are some lnd RPCs that don't require any authentication. Those weren't included in the main server RPC permission list, so we needed to add them separately to allow such calls to be made through the LiT RPC proxy.
1 parent 8e75a04 commit defe05b

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

subserver_permissions.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@ var (
1616
"/litrpc.Sessions/ListSessions": {{}},
1717
"/litrpc.Sessions/RevokeSession": {{}},
1818
}
19+
20+
// whiteListedMethods is a map of all lnd RPC methods that don't require
21+
// any macaroon authentication.
22+
whiteListedMethods = map[string][]bakery.Op{
23+
"/lnrpc.WalletUnlocker/GenSeed": {},
24+
"/lnrpc.WalletUnlocker/InitWallet": {},
25+
"/lnrpc.WalletUnlocker/UnlockWallet": {},
26+
"/lnrpc.WalletUnlocker/ChangePassword": {},
27+
28+
// The State service must be available at all times, even
29+
// before we can check macaroons, so we whitelist it.
30+
"/lnrpc.State/SubscribeState": {},
31+
"/lnrpc.State/GetState": {},
32+
}
1933
)
2034

2135
// getSubserverPermissions returns a merged map of all subserver macaroon
@@ -44,14 +58,18 @@ func getSubserverPermissions() map[string][]bakery.Op {
4458
func getAllMethodPermissions() map[string][]bakery.Op {
4559
subserverPermissions := getSubserverPermissions()
4660
lndPermissions := lnd.MainRPCServerPermissions()
47-
mapSize := len(subserverPermissions) + len(lndPermissions)
61+
mapSize := len(subserverPermissions) + len(lndPermissions) +
62+
len(whiteListedMethods)
4863
result := make(map[string][]bakery.Op, mapSize)
4964
for key, value := range lndPermissions {
5065
result[key] = value
5166
}
5267
for key, value := range subserverPermissions {
5368
result[key] = value
5469
}
70+
for key, value := range whiteListedMethods {
71+
result[key] = value
72+
}
5573
return result
5674
}
5775

0 commit comments

Comments
 (0)