Skip to content

Commit b36f8ae

Browse files
committed
multi: update lnd, loop and faraday
With this commit we update lnd, loop and faraday to the newest versions that include TLS and macaroon authentication.
1 parent 5afdf20 commit b36f8ae

File tree

5 files changed

+52
-89
lines changed

5 files changed

+52
-89
lines changed

config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/jessevdk/go-flags"
1515
"github.com/lightninglabs/faraday"
16+
"github.com/lightninglabs/faraday/frdrpc"
1617
"github.com/lightninglabs/lndclient"
1718
"github.com/lightninglabs/loop/loopd"
1819
"github.com/lightningnetwork/lnd"
@@ -53,6 +54,8 @@ type Config struct {
5354
Lnd *lnd.Config `group:"lnd" namespace:"lnd"`
5455
Faraday *faraday.Config `group:"faraday" namespace:"faraday"`
5556
Loop *loopd.Config `group:"loop" namespace:"loop"`
57+
58+
frdrpcCfg *frdrpc.Config
5659
}
5760

5861
// lndConnectParams returns the connection parameters to connect to the local

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ require (
66
github.com/grpc-ecosystem/grpc-gateway v1.14.3
77
github.com/improbable-eng/grpc-web v0.12.0
88
github.com/jessevdk/go-flags v1.4.0
9-
github.com/lightninglabs/faraday v0.2.0-alpha.0.20200901065614-d72fdaeff888
9+
github.com/lightninglabs/faraday v0.2.1-alpha.0.20200918072230-7ec3f67ed2f0
1010
github.com/lightninglabs/lndclient v0.11.0-0
11-
github.com/lightninglabs/loop v0.8.1-beta.0.20200831113239-d4d9aa102455
12-
github.com/lightningnetwork/lnd v0.11.0-beta
13-
github.com/lightningnetwork/lnd/cert v1.0.2
11+
github.com/lightninglabs/loop v0.9.0-beta.0.20200918101140-4bb59f87bf95
12+
github.com/lightningnetwork/lnd v0.11.1-beta.rc3
13+
github.com/lightningnetwork/lnd/cert v1.0.3
1414
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
1515
github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76
1616
github.com/prometheus/client_golang v1.5.1 // indirect

go.sum

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2ut
3838
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
3939
github.com/btcsuite/btcutil/psbt v1.0.2 h1:gCVY3KxdoEVU7Q6TjusPO+GANIwVgr9yTLqM+a6CZr8=
4040
github.com/btcsuite/btcutil/psbt v1.0.2/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ=
41+
github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0 h1:3Zumkyl6PWyHuVJ04me0xeD9CnPOhNgeGpapFbzy7O4=
42+
github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ=
4143
github.com/btcsuite/btcwallet v0.11.1-0.20200814001439-1d31f4ea6fc5 h1:1We7EuizBnX/17Q6O2dkeToyehxzUHo62Wv1c0ncr7c=
4244
github.com/btcsuite/btcwallet v0.11.1-0.20200814001439-1d31f4ea6fc5/go.mod h1:YkEbJaCyN6yncq5gEp2xG0OKDwus2QxGCEXTNF27w5I=
45+
github.com/btcsuite/btcwallet v0.11.1-0.20200904022754-2c5947a45222 h1:rh1FQAhh+BeR29twIFDM0RLOFpDK62tsABtUkWctTXw=
46+
github.com/btcsuite/btcwallet v0.11.1-0.20200904022754-2c5947a45222/go.mod h1:owv9oZqM0HnUW+ByF7VqOgfs2eb0ooiePW/+Tl/i/Nk=
4347
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 h1:KGHMW5sd7yDdDMkCZ/JpP0KltolFsQcB973brBnfj4c=
4448
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0/go.mod h1:VufDts7bd/zs3GV13f/lXc/0lXrPnvxD/NvmpG/FEKU=
4549
github.com/btcsuite/btcwallet/wallet/txrules v1.0.0 h1:2VsfS0sBedcM5KmDzRMT3+b6xobqWveZGvjb+jFez5w=
@@ -198,25 +202,27 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
198202
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
199203
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
200204
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
201-
github.com/lightninglabs/faraday v0.2.0-alpha.0.20200901065614-d72fdaeff888 h1:kKruI0ZGCW0Ky4q2pt6jO7oSArNBgE+Ps3k6n7j/J6Y=
202-
github.com/lightninglabs/faraday v0.2.0-alpha.0.20200901065614-d72fdaeff888/go.mod h1:tFhh0ScstVI9GgYpJ4Tp+1Bw/DjUOJxlfIuZnfvThe8=
205+
github.com/lightninglabs/faraday v0.2.1-alpha.0.20200918072230-7ec3f67ed2f0 h1:uTOep9wjoQsaYAo2cYI4Ze2HrollwSKQkPpJrkyVw6c=
206+
github.com/lightninglabs/faraday v0.2.1-alpha.0.20200918072230-7ec3f67ed2f0/go.mod h1:lcUCN2tzfYydxjGQATRx32kFthr+36nsxYUv8QAhb8g=
203207
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc=
204208
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk=
205209
github.com/lightninglabs/lndclient v0.11.0-0 h1:tCvhlN/NNC/PeCjifONq/f8vU/6ZJS1ivXhpIfw6JfY=
206210
github.com/lightninglabs/lndclient v0.11.0-0/go.mod h1:8/cTKNwgL87NX123gmlv3Xh6p1a7pvzu+40Un3PhHiI=
207-
github.com/lightninglabs/loop v0.8.1-beta.0.20200831113239-d4d9aa102455 h1:RWIxymisZYA02aqEAIunvZxNgcSu+hS3LG4KAxvk2SU=
208-
github.com/lightninglabs/loop v0.8.1-beta.0.20200831113239-d4d9aa102455/go.mod h1:b1cG1mLbPUjWEN5ZQi6pfNeNWCYm5H48NdjkycyifS8=
211+
github.com/lightninglabs/loop v0.9.0-beta.0.20200918101140-4bb59f87bf95 h1:LepMeUc7zJWkgqQK8EHcpXy/G74fny45rd4tT75+Lm4=
212+
github.com/lightninglabs/loop v0.9.0-beta.0.20200918101140-4bb59f87bf95/go.mod h1:xRwAE8TIaU4sqVrqFUPvGvdMaKNZz3489jjRjN7BwqE=
209213
github.com/lightninglabs/neutrino v0.11.0/go.mod h1:CuhF0iuzg9Sp2HO6ZgXgayviFTn1QHdSTJlMncK80wg=
210214
github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200 h1:j4iZ1XlUAPQmW6oSzMcJGILYsRHNs+4O3Gk+2Ms5Dww=
211215
github.com/lightninglabs/neutrino v0.11.1-0.20200316235139-bffc52e8f200/go.mod h1:MlZmoKa7CJP3eR1s5yB7Rm5aSyadpKkxqAwLQmog7N0=
212216
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d h1:QWD/5MPnaZfUVP7P8wLa4M8Td2DI7XXHXt2vhVtUgGI=
213217
github.com/lightninglabs/protobuf-hex-display v1.3.3-0.20191212020323-b444784ce75d/go.mod h1:KDb67YMzoh4eudnzClmvs2FbiLG9vxISmLApUkCa4uI=
214218
github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea h1:oCj48NQ8u7Vz+MmzHqt0db6mxcFZo3Ho7M5gCJauY/k=
215219
github.com/lightningnetwork/lightning-onion v1.0.2-0.20200501022730-3c8c8d0b89ea/go.mod h1:rigfi6Af/KqsF7Za0hOgcyq2PNH4AN70AaMRxcJkff4=
216-
github.com/lightningnetwork/lnd v0.11.0-beta h1:pUAT7FMHqS+iarNxyRtgj96XKCGAWwmb6ZdiUBy78ts=
217220
github.com/lightningnetwork/lnd v0.11.0-beta/go.mod h1:CzArvT7NFDLhVyW06+NJWSuWFmE6Ea+AjjA3txUBqTM=
218-
github.com/lightningnetwork/lnd/cert v1.0.2 h1:g2rEu+sM2Uyz0bpfuvwri/ks6R/26H5iY1NcGbpDJ+c=
221+
github.com/lightningnetwork/lnd v0.11.1-beta.rc3 h1:f5xXgMiOx+3ez/dOTdRqZfYMtqqoz/+5kjwk5hdzAWk=
222+
github.com/lightningnetwork/lnd v0.11.1-beta.rc3/go.mod h1:PGIgxy8aH70Li33YVYkHSaCM8m8LjEevk5h1Dpldrr4=
219223
github.com/lightningnetwork/lnd/cert v1.0.2/go.mod h1:fmtemlSMf5t4hsQmcprSoOykypAPp+9c+0d0iqTScMo=
224+
github.com/lightningnetwork/lnd/cert v1.0.3 h1:/K2gjzLgVI8we2IIPKc0ztWTEa85uds5sWXi1K6mOT0=
225+
github.com/lightningnetwork/lnd/cert v1.0.3/go.mod h1:3MWXVLLPI0Mg0XETm9fT4N9Vyy/8qQLmaM5589bEggM=
220226
github.com/lightningnetwork/lnd/clock v1.0.1 h1:QQod8+m3KgqHdvVMV+2DRNNZS1GRFir8mHZYA+Z2hFo=
221227
github.com/lightningnetwork/lnd/clock v1.0.1/go.mod h1:KnQudQ6w0IAMZi1SgvecLZQZ43ra2vpDNj7H/aasemg=
222228
github.com/lightningnetwork/lnd/queue v1.0.1/go.mod h1:vaQwexir73flPW43Mrm7JOgJHmcEFBWWSl9HlyASoms=

subserver_permissions.go

Lines changed: 8 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,21 @@
11
package terminal
22

3-
import "gopkg.in/macaroon-bakery.v2/bakery"
4-
5-
var (
6-
// faradayPermissions is a map of all faraday RPC methods and their
7-
// required macaroon permissions.
8-
//
9-
// TODO(guggero): Move to faraday repo once macaroons are enabled there
10-
// and use more application specific permissions.
11-
faradayPermissions = map[string][]bakery.Op{
12-
"/frdrpc.FaradayServer/OutlierRecommendations": {{
13-
Entity: "offchain",
14-
Action: "read",
15-
}},
16-
"/frdrpc.FaradayServer/ThresholdRecommendations": {{
17-
Entity: "offchain",
18-
Action: "read",
19-
}},
20-
"/frdrpc.FaradayServer/RevenueReport": {{
21-
Entity: "offchain",
22-
Action: "read",
23-
}},
24-
"/frdrpc.FaradayServer/ChannelInsights": {{
25-
Entity: "offchain",
26-
Action: "read",
27-
}},
28-
}
29-
30-
// loopPermissions is a map of all loop RPC methods and their required
31-
// macaroon permissions.
32-
//
33-
// TODO(guggero): Move to loop repo once macaroons are enabled there
34-
// and use more application specific permissions.
35-
loopPermissions = map[string][]bakery.Op{
36-
"/looprpc.SwapClient/LoopOut": {{
37-
Entity: "offchain",
38-
Action: "read",
39-
}},
40-
"/looprpc.SwapClient/LoopIn": {{
41-
Entity: "offchain",
42-
Action: "read",
43-
}},
44-
"/looprpc.SwapClient/Monitor": {{
45-
Entity: "offchain",
46-
Action: "read",
47-
}},
48-
"/looprpc.SwapClient/ListSwaps": {{
49-
Entity: "offchain",
50-
Action: "read",
51-
}},
52-
"/looprpc.SwapClient/SwapInfo": {{
53-
Entity: "offchain",
54-
Action: "read",
55-
}},
56-
"/looprpc.SwapClient/LoopOutTerms": {{
57-
Entity: "offchain",
58-
Action: "read",
59-
}},
60-
"/looprpc.SwapClient/LoopOutQuote": {{
61-
Entity: "offchain",
62-
Action: "read",
63-
}},
64-
"/looprpc.SwapClient/GetLoopInTerms": {{
65-
Entity: "offchain",
66-
Action: "read",
67-
}},
68-
"/looprpc.SwapClient/GetLoopInQuote": {{
69-
Entity: "offchain",
70-
Action: "read",
71-
}},
72-
"/looprpc.SwapClient/GetLsatTokens": {{
73-
Entity: "offchain",
74-
Action: "read",
75-
}},
76-
}
3+
import (
4+
"github.com/lightninglabs/faraday/frdrpc"
5+
"github.com/lightninglabs/loop/loopd"
6+
"gopkg.in/macaroon-bakery.v2/bakery"
777
)
788

799
// getSubserverPermissions returns a merged map of all subserver macaroon
8010
// permissions.
8111
func getSubserverPermissions() map[string][]bakery.Op {
82-
mapSize := len(faradayPermissions) + len(loopPermissions)
12+
mapSize := len(frdrpc.RequiredPermissions) +
13+
len(loopd.RequiredPermissions)
8314
result := make(map[string][]bakery.Op, mapSize)
84-
for key, value := range faradayPermissions {
15+
for key, value := range frdrpc.RequiredPermissions {
8516
result[key] = value
8617
}
87-
for key, value := range loopPermissions {
18+
for key, value := range loopd.RequiredPermissions {
8819
result[key] = value
8920
}
9021
return result

terminal.go

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import (
1919
restProxy "github.com/grpc-ecosystem/grpc-gateway/runtime"
2020
"github.com/improbable-eng/grpc-web/go/grpcweb"
2121
"github.com/jessevdk/go-flags"
22+
"github.com/lightninglabs/faraday"
23+
"github.com/lightninglabs/faraday/chain"
2224
"github.com/lightninglabs/faraday/frdrpc"
2325
"github.com/lightninglabs/lndclient"
2426
"github.com/lightninglabs/loop/loopd"
@@ -149,11 +151,15 @@ func (g *LightningTerminal) Run() error {
149151

150152
// Create the instances of our subservers now so we can hook them up to
151153
// lnd once it's fully started.
152-
g.faradayServer = frdrpc.NewRPCServer(&frdrpc.Config{})
154+
g.cfg.frdrpcCfg = &frdrpc.Config{}
155+
g.faradayServer = frdrpc.NewRPCServer(g.cfg.frdrpcCfg)
153156
g.loopServer = loopd.New(g.cfg.Loop, nil)
154157

155158
// Hook interceptor for os signals.
156-
signal.Intercept()
159+
err = signal.Intercept()
160+
if err != nil {
161+
return fmt.Errorf("could not intercept signals: %v", err)
162+
}
157163

158164
// Call the "real" main in a nested manner so the defers will properly
159165
// be executed in the case of a graceful shutdown.
@@ -242,6 +248,23 @@ func (g *LightningTerminal) startSubservers() error {
242248
return err
243249
}
244250

251+
g.cfg.Faraday.Network = string(network)
252+
if err := faraday.ValidateConfig(g.cfg.Faraday); err != nil {
253+
return err
254+
}
255+
g.cfg.frdrpcCfg.FaradayDir = g.cfg.Faraday.FaradayDir
256+
g.cfg.frdrpcCfg.MacaroonPath = g.cfg.Faraday.MacaroonPath
257+
258+
// If the client chose to connect to a bitcoin client, get one now.
259+
if g.cfg.Faraday.ChainConn {
260+
g.cfg.frdrpcCfg.BitcoinClient, err = chain.NewBitcoinClient(
261+
g.cfg.Faraday.Bitcoin,
262+
)
263+
if err != nil {
264+
return err
265+
}
266+
}
267+
245268
// The main RPC listener of lnd might need some time to start, it could
246269
// be that we run into a connection refused a few times. We use the
247270
// basic client connection to find out if the RPC server is started yet

0 commit comments

Comments
 (0)