Skip to content
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

Support super macaroon in remote lnd mode #319

Merged
merged 10 commits into from
Feb 17, 2022
Merged

Conversation

guggero
Copy link
Member

@guggero guggero commented Feb 4, 2022

Part of lightninglabs/lightning-node-connect#17.

Depends on #294 and #292, only the last 9 commits are new.

Can be tested locally by baking a super macaroon with:

lncli bakemacaroon --save_to /tmp/readonly.supermacaroon --root_key_id 18441921392371826688 --allow_external_permissions offchain:read swap:read insights:read suggestions:read auth:read rates:read order:read peers:read message:read recommendation:read info:read report:read auction:read onchain:read account:read invoices:read terms:read macaroon:read audit:read

And then interact with one of the daemons:

pool --rpcserver localhost:8443 --tlscertpath ~/.lit/tls.cert --macaroonpath /tmp/readonly.supermacaroon getinfo

@guggero guggero requested a review from ellemouton February 4, 2022 15:53
@guggero guggero force-pushed the macaroon-remote-mode branch 2 times, most recently from 067b184 to 4769c74 Compare February 7, 2022 15:13
@guggero guggero marked this pull request as ready for review February 7, 2022 15:14
Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

Did a first pass, will do a better pass tomorrow but leaving some questions in the mean time

rpc_proxy.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
itest/litd_mode_integrated_test.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
@guggero guggero force-pushed the macaroon-remote-mode branch from 4769c74 to 4929f60 Compare February 8, 2022 15:09
@guggero guggero requested a review from ellemouton February 8, 2022 15:14
Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

tACK! looking gooooood! left some comments. Most are just questions to better my understanding of everything

terminal.go Show resolved Hide resolved
itest/litd_mode_integrated_test.go Outdated Show resolved Hide resolved
itest/litd_mode_remote_test.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
itest/litd_mode_integrated_test.go Show resolved Hide resolved
README.md Show resolved Hide resolved
@guggero guggero force-pushed the macaroon-remote-mode branch from 4929f60 to ee26fd2 Compare February 14, 2022 15:23
@guggero
Copy link
Member Author

guggero commented Feb 14, 2022

Thanks a lot for the review, @ellemouton! I rebased and fixed the things you mentioned.

@guggero guggero force-pushed the macaroon-remote-mode branch from ee26fd2 to 705af86 Compare February 15, 2022 16:27
@guggero guggero requested a review from ellemouton February 15, 2022 17:21
Copy link
Member

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

LGTM! 🔥

terminal.go Show resolved Hide resolved
rpc_proxy.go Show resolved Hide resolved
@guggero guggero force-pushed the macaroon-remote-mode branch from 705af86 to 7a31a57 Compare February 17, 2022 14:00
To avoid the macaroon parsing to fail in session.IsSuperMacaroon(), we
want the dummy macaroon to be formally valid (meaning, it can be parsed)
but not actually valid (meaning, it will fail the signature verification
since we don't have the root key for it anywhere).
If a daemon is running in remote mode, we need to convert a super
macaroon into the daemon specific macaroon before sending it to the
remote daemon, since the super macaroon is issued by lnd and can only
be validated by lnd's macaroon root key.
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.

2 participants