Skip to content

Macaroon and log fixes#123

Merged
guggero merged 3 commits intolightninglabs:masterfrom
guggero:macaroon-and-log-fixes
Jun 2, 2021
Merged

Macaroon and log fixes#123
guggero merged 3 commits intolightninglabs:masterfrom
guggero:macaroon-and-log-fixes

Conversation

@guggero
Copy link
Copy Markdown
Contributor

@guggero guggero commented May 31, 2021

Fixes #84.
Allows faraday to only use the readonly.macaroon (or a custom baked one)
to connect to lnd instead of needing to copy all macaroons (including
the subserver ones).

We also fix an issue that popped up during testing of the latest LiT release where the faraday log level would overwrite any other log level set beforehand.

Pull Request Checklist

  • Update release_notes.md if your PR contains major features, breaking changes or bugfixes

guggero added 3 commits May 31, 2021 13:38
Fixes lightninglabs#84.
Allows faraday to only use the readonly.macaroon (or a custom baked one)
to connect to lnd instead of needing to copy all macaroons (including
the subserver ones).
We need to move the call that sets all log levels out of the config
validation. Otherwise this will overwrite all subsystem log levels in
LiT where we call the faraday.ValidateConfig() function but have already
set up our loggers.

At the same time we remove the unnecessary global logWriter variable.
@guggero guggero requested a review from carlaKC May 31, 2021 11:58
Copy link
Copy Markdown
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.

LGTM!

@guggero guggero merged commit 0689661 into lightninglabs:master Jun 2, 2021
@guggero guggero deleted the macaroon-and-log-fixes branch June 2, 2021 07:41
@junderw
Copy link
Copy Markdown

junderw commented Jun 2, 2021

Just out of curiosity, what would be the least permissions (ie. which specific endpoints does it use from lnd) for this?

@guggero
Copy link
Copy Markdown
Contributor Author

guggero commented Jun 2, 2021

There is no definitive list yet. From a quick glance at where the lndclient.LndServices instance is used, it looks like GetInfo, ListChannels, ClosedChannels, PendingChannels, ListTransactions, ListSweeps, ListForwards, ListInvoices, ListPayments and DecodePayReq are used. So maybe you could bake a macaroon with onchain:read, offchain:read, info:read and you'd be fine.

We're planning on adding something like "macaroon recipes" to Faraday, Loop and Pool so you can bake exactly the macaroon you need. But for that to be as dynamic as possible, we first need to figure out a way to determine this list at build time somehow.

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.

Don't require all macaroons to use Faraday

3 participants