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

Update and rebase stateless-init #5

Draft
wants to merge 286 commits into
base: guggero/stateless-init
Choose a base branch
from

Conversation

gkrizek
Copy link
Owner

@gkrizek gkrizek commented Jun 12, 2020

Description

This updates the Stateless Initialization implementation to allow stateless_init to be set on the daemon. This moves control of the initialization to the server side instead of from the client. This adds a --stateless_init flag to LND. This flag controls whether a stateless initialization will happen or not. If it is set, no macaroons will be written to disk. It also allows LND to return a macroon through RPC if the user requests it. The --stateless_init flag on LNCLI is now used to request the macaroon to be returned in the RPC response only. If LNCLI (or other) requests --stateless_init and it is not set in LND, then an empty list of bytes is returned. If --stateless_init is set on LND and the user doesn't specify it on the CLI, then they would affectively be locked out until they did an unlock with stateless_init set.

I think its important to set it stateless_init on the server side because someone could accidentally write macaroons to an untrusted environment by forgetting to set it client side. I also think this is important to disallow the admin macaroon to be returned in the RPC response if the user doesn't want it to be. With only client side setting if someone knew a user's password they could get the macaroon too.

Pull Request Checklist

  • If this is your first time contributing, we recommend you read the Code
    Contribution Guidelines
  • All changes are Go version 1.12 compliant
  • The code being submitted is commented according to Code Documentation and Commenting
  • For new code: Code is accompanied by tests which exercise both
    the positive and negative (error paths) conditions (if applicable)
  • For bug fixes: Code is accompanied by new tests which trigger
    the bug being fixed to prevent regressions
  • Any new logging statements use an appropriate subsystem and
    logging level
  • Code has been formatted with go fmt
  • Protobuf files (lnrpc/**/*.proto) have been formatted with
    make rpc-format and compiled with make rpc
  • For code and documentation: lines are wrapped at 80 characters
    (the tab character should be counted as 8 characters, not 4, as some IDEs do
    per default)
  • Running make check does not fail any tests
  • Running go vet does not report any issues
  • Running make lint does not report any new issues that did not
    already exist
  • All commits build properly and pass tests. Only in exceptional
    cases it can be justifiable to violate this condition. In that case, the
    reason should be stated in the commit message.
  • Commits have a logical structure according to Ideal Git Commit Structure

cryptagoras and others added 30 commits May 10, 2020 01:52
REST saga 1/3: Cleanup proto files, generate Swagger docs
…cess

htlcswitch/switch: log successfully forwarded HTLCs
This fixes an issue where the contract court could leave a completely
swept commit tx unresolved if it was swept by the remote party.

This could happen if (our) commit tx just published was actually a
previously revoked state, in which case the remote party would claim the
funds via a justice transaction.

This manifested itself in the testRevokedCloseRetribution integration
test where at the end of the test Bob was left with a pending channel
that never resolved itself.
This adds a test to the commit sweeper resolver to ensure it behaves
properly if the local node breaches a channel.

In this situation the remote party is expected to sweep the breached
output to itself and therefore the local party won't be able to recover
any funds.
This improves readability since both instances of the test are very
similar.
…ng-chan-restriction

routing+routerrpc: add multiple outgoing channel restriction
The continue-on-error was added to make sure the log files of the
failed itests would always be uploaded. But this has the side effect
of marking the whole job successful, even if the itest job itself
failed. The failure condition in the log file steps already solve
that, so the continue-on-error is not needed anymore.
Unify data structure with SendPayment/ListPayments.
…ing-contract

contractcourt: fix lingering contract after local breach
@gkrizek gkrizek marked this pull request as draft June 12, 2020 21:12
Roasbeef and others added 13 commits June 16, 2020 16:25
build: update travis to build against go 1.14
…ements

REST saga 3/3: REST API for subservers, websocket for streaming responses
…locker

This commit adds the --stateless_init flag to all three wallet unlocker
operations. Once you initialize a wallet stateless, you need to set
this flag for every further wallet unlocker operation. Otherwise you
risk non-encrypted macaroon information to leak to the underlying
system.
Because we'll need to return the macaroon through the wallet unlocker
we cannot shut down its service before we have done so, otherwise
we'll end up in a deadlock. That's why we collect all shutdown
tasks and return them as a function that can be called after we've
initialized the macaroon service.
@gkrizek gkrizek force-pushed the gkrizek/stateless-init branch 4 times, most recently from 2ec9a9f to ab7d7b8 Compare August 25, 2020 23:40
…s set

This will prevent the subservers from writing macaroons to disk when the stateless_init flag is set to true. It accomplishes this by storing the StatelessInit value in the Macaroon Service. Then each subserver inspects the StatelessInit value because writing macaroons.
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.