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

multi: Add support for dcrwallet client auth #110

Merged
merged 6 commits into from
Oct 16, 2020

Conversation

matheusd
Copy link
Member

@matheusd matheusd commented Oct 14, 2020

rebased on top of #109

This adds support for authenticating using client certificates when
connecting to a remote dcrwallet instance that requires them.

dcrwallet now requires client certificates for authentication when
connecting to its gRPC interface, so this PR modifies the wallet
unlocker service to use an appropriate combination of key and cert when
connecting to the wallet.

There are two possible sources for the key+cert pair: either specified
via CLI args or directly during an Unlock() call to the WalletUnlocker
service.

The first alternative is used on dcrlnd instances that have been
manually configured to use the remote wallet mode.

The second alternative is used on Decrediton-initialized wallets, where
an ephemeral key+cert pair is generated and passed from dcrwallet to
Decrediton via IPC messages and is then relayed to dcrlnd during
startup.

The itest harness was also updated to reflect the need for client certs
when testing the remotewallet implementation. For simplicity, the
existing rpc.key and rpc.cert are used for client authentication as
well.

This will allow dcrlnd instances running in remote wallet mode to be
unlocked by providing an appropriate client key and certificate via the
WalletUnlocker service's Unlock() method.
This adds CLI options to configure the client key and certificate files
for use with dcrlnd instances running in remote wallet mode.

These will be needed when connecting to a remote wallet that requires
client authentication.
@matheusd matheusd marked this pull request as ready for review October 16, 2020 18:47
This adds support for authenticating using client certificates when
connecting to a remote dcrwallet instance that requires them.

dcrwallet now requires client certificates for authentication when
connecting to its gRPC interface, so this commit modifies the wallet
unlocker service to use an appropriate combination of key and cert when
connecting to the wallet.

There are two possible sources for the key+cert pair: either specified
via CLI args or directly during an Unlock() call to the WalletUnlocker
service.

The first alternative is used on dcrlnd instances that have been
manually configured to use the remote wallet mode.

The second alternative is used on Decrediton-initialized wallets, where
an ephemeral key+cert pair is generated and passed from dcrwallet to
Decrediton via IPC messages and is then relayed to dcrlnd during
startup.

The itest harness was also updated to reflect the need for client certs
when testing the remotewallet implementation. For simplicity, the
existing rpc.key and rpc.cert are used for client authentication as
well.
This fixes itest flakes that happen when a payment is attempted that
ends up causing a channel closure.

completePaymentRequests() attempts to monitor the open channels after a
payment is attempted in order to identify that payment was actually
dispatched to a remote node before returning.

However, when the payment actually causes a channel closure (for
example, because the receiver sent an incorrect preimage) this logic
fails in that the channel will no longer the found in the list of open
channels. This could cause a flake when there was enough time for the
channel to close before performing the check.

One example of such a flaky test is failing_link.

This fixes the issue by also checking whether the total number of
channels was reduced, which indicates (assuming itest operations are
being executed serially) that one of the attempted payments affected at
least one channel.
This prevents fast nodes from being banned from eachother.
@matheusd matheusd merged commit 2d6d340 into decred:master Oct 16, 2020
@matheusd matheusd deleted the wallet-client-auth branch October 16, 2020 22:04
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