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

gRPC Operator: Macaroon Authentication #22

Closed
tiero opened this issue Sep 2, 2020 · 3 comments
Closed

gRPC Operator: Macaroon Authentication #22

tiero opened this issue Sep 2, 2020 · 3 comments
Assignees

Comments

@tiero
Copy link
Collaborator

tiero commented Sep 2, 2020

although we plan to add an encrypted transport on the trader interface (BOTD#2), we need to secure the operator interface, so remote CLIs or GUIs could be built.

We could implement some gRPC interceptors with very basic user and password (or API Key bearer token) or more advanced solutions like macaroons.
https://pkg.go.dev/github.com/lightningnetwork/lnd/macaroons
https://github.com/lightningnetwork/lnd/blob/master/macaroons/README.md

A bit of history on this choice by lnd to use macaroons lightningnetwork/lnd#20

@tiero tiero changed the title Operator: Authentication gRPC Operator: Authentication Sep 2, 2020
@tiero
Copy link
Collaborator Author

tiero commented Sep 4, 2020

I'm more oriented in going with simple perRPC authentication like API KEY

@tiero
Copy link
Collaborator Author

tiero commented Oct 20, 2020

A requirement we had is that we should not have a single "master" API key for doing everything, from critical stuff like managing wallet funds or withdrawing from market to basic stuff like updating the market price or getting fee report.

@tiero
Copy link
Collaborator Author

tiero commented Oct 22, 2020

We decided to go with macaroons, since it seems to fit our requirements:

The flow is the following:

  1. tdex-daemon starts and look into the datadir (maybe a specific folder). If no macaroons are in there, it will generate some from scratch using a root key. If the root key does not exist yet, 32 bytes of pseudo-random data is generated and used.
  2. the operator will copy/backup the macaroons created and provisionto clients (webapp, CLI, lambdas)
  3. There should be the following hardcoded policies: admin (can do everythig), price (shoudl only call the UpdateMarketPrice), market can only call the Market related RPCs like OpenMarket/CloseMarket/UpdateMarketStrategy and so on) and readonly (should only be able to access non-mutating calls and non critical, mostly used by analytics)

@tiero tiero changed the title gRPC Operator: Authentication gRPC Operator: Macaroon Authentication Oct 23, 2020
@tiero tiero assigned altafan and unassigned sekulicd Feb 15, 2021
@tiero tiero assigned sekulicd and unassigned altafan Mar 12, 2021
@tiero tiero closed this as completed Jun 11, 2021
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 a pull request may close this issue.

3 participants