|
16 | 16 | "/litrpc.Sessions/ListSessions": {{}},
|
17 | 17 | "/litrpc.Sessions/RevokeSession": {{}},
|
18 | 18 | }
|
| 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 | + } |
19 | 33 | )
|
20 | 34 |
|
21 | 35 | // getSubserverPermissions returns a merged map of all subserver macaroon
|
@@ -44,14 +58,18 @@ func getSubserverPermissions() map[string][]bakery.Op {
|
44 | 58 | func getAllMethodPermissions() map[string][]bakery.Op {
|
45 | 59 | subserverPermissions := getSubserverPermissions()
|
46 | 60 | lndPermissions := lnd.MainRPCServerPermissions()
|
47 |
| - mapSize := len(subserverPermissions) + len(lndPermissions) |
| 61 | + mapSize := len(subserverPermissions) + len(lndPermissions) + |
| 62 | + len(whiteListedMethods) |
48 | 63 | result := make(map[string][]bakery.Op, mapSize)
|
49 | 64 | for key, value := range lndPermissions {
|
50 | 65 | result[key] = value
|
51 | 66 | }
|
52 | 67 | for key, value := range subserverPermissions {
|
53 | 68 | result[key] = value
|
54 | 69 | }
|
| 70 | + for key, value := range whiteListedMethods { |
| 71 | + result[key] = value |
| 72 | + } |
55 | 73 | return result
|
56 | 74 | }
|
57 | 75 |
|
|
0 commit comments