Skip to content

Stateless remote mode: Adds passing in macaroon and tls data, and a CheckMacaroonPermissions RPC #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 21, 2021

Conversation

orbitalturtle
Copy link
Contributor

@orbitalturtle orbitalturtle commented May 15, 2021

For Terminal's stateless-remote mode, as described in lightninglabs/lightning-terminal#160, we add a few changes in this PR:

  • Adds new configuration options to the lndclient, for passing in macaroon data and tls data directly in stateless remote mode.
  • Also adds these features to the "basic client." For stateless-remote, the Pool server uses the basic client for connecting to LND.
  • Adds a wrapper for the CheckMacaroonPermissions RPC in LND for checking the validity of a Macaroon, so that we can use it to check validity in the Lightning Terminal. (Will open a separate PR into LND for this soon.)

Relies on:
lightningnetwork/lnd#5304

@guggero guggero self-requested a review May 17, 2021 10:13
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the PR (and the one in lnd)!

I did a first quick pass and it looks really good. Going to look at the lnd PR next.

Just one main thing that needs to be changed:
Since this PR requires functionality that isn't yet even merged to lnd, we won't be able to merge it for a while. It'll be merged to a branch lnd-14-0 once we start working on that. For now, can you please open this against the lnd-13-0 branch? That way you also get a new type for the MacaroonPermission. You can edit the base of your PR by clicking the edit button of the title. A new drop down then appears where you can switch from master to lnd-13-0.

@orbitalturtle orbitalturtle changed the base branch from master to lnd-13-0 May 20, 2021 05:58
@orbitalturtle
Copy link
Contributor Author

Thanks for the initial review @guggero! Will get to these changes soon

@orbitalturtle orbitalturtle force-pushed the custom-macaroon-hex branch 4 times, most recently from 86b49c3 to 00860e1 Compare May 27, 2021 09:38
@orbitalturtle
Copy link
Contributor Author

I made those changes @guggero :)

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the rebase! Just a few more minor things, this PR is getting very close.

@orbitalturtle
Copy link
Contributor Author

Thanks @guggero! Made those changes

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Great addition, and nice to have some test coverage :)

Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

Once the lnd version here is updated and the dependent loop PR points to this I'll test some of these options out.

@guggero guggero removed their request for review August 31, 2021 07:52
@orbitalturtle
Copy link
Contributor Author

Made those changes @carlaKC ! FYI I also made a few small additional changes, since we're moving in a new direction for integrated mode in the Terminal (described here lightninglabs/lightning-terminal#160 (comment)). In short, needed to allow the option for passing in no tls creds, so I added another boolean parameter in GetTLSCredentials to enable that option.

Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, just a few more minor things. Great work pushing forward on this quite respectable chain of dependent PRs 👏

@orbitalturtle orbitalturtle force-pushed the custom-macaroon-hex branch 2 times, most recently from 6c31895 to 00cb063 Compare September 17, 2021 23:24
Copy link
Contributor

@carlaKC carlaKC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! Just need to bump deps to master to get around that kvdb issue.

I think we can bump lightninglabs/loop/pull/406 to depend on this version of lndclient just to test out everything works as expected then merge.

@orbitalturtle orbitalturtle force-pushed the custom-macaroon-hex branch 2 times, most recently from 8397233 to b06054f Compare September 20, 2021 20:28
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@guggero
Copy link
Member

guggero commented Sep 21, 2021

The linter is complaining:

lnd_services.go:805: G402: TLS InsecureSkipVerify set true. (gosec)
			InsecureSkipVerify: true,

Probably needs a // nolint:gosec comment on that line.

@orbitalturtle
Copy link
Contributor Author

@guggero made that linter change!

@carlaKC Looks like i was wrong about that loop PR requiring this lndclient change ~ will be submitting a terminal change soon that requires it though

@guggero guggero merged commit ab8634c into lightninglabs:lnd-13-0 Sep 21, 2021
@@ -70,54 +72,28 @@ func NewBasicClient(lndHost, tlsPath, macDir, network string,
// NewBasicConn creates a new basic gRPC connection to lnd. We call this
// connection "basic" as it falls back to expected defaults if the arguments
// aren't provided.
func NewBasicConn(lndHost, tlsPath, macDir, network string,
func NewBasicConn(lndHost string, tlsPath, macDir, tlsData, macData,
network string, insecure, systemCert bool,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive by comment, but rather than breaking the interface here, this should've just used a BasicClientOption as that's how the API is intended to evolve.

IMO we should likely follow this path, as otherwise updating will break every user of NewBasicConn as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants