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

Encryption and Authentication proposal #147

Closed
bddap opened this issue Jun 12, 2019 · 4 comments
Closed

Encryption and Authentication proposal #147

bddap opened this issue Jun 12, 2019 · 4 comments

Comments

@bddap
Copy link
Contributor

bddap commented Jun 12, 2019

Grin transactions are not encrypted by default, making them vulnerable to man in the middle attacks.

The proposed solution uses snow, an implementaion of the noise protocol framework, to provide mandatory encryption and mutual authentication for grin wallet communications. Both the connection initiator (client) and the responder (server) are authenticated by their public keys. Encrypted streams are implememented atop TCP. While the solution does not implement public key addressing, it is an incremental step towards that goal.

Readers are encouraged to provide feedback.

Proposed change

Encrypt OwnerApi and ForeignApi communications using noise protocol Noise_XX_25519_ChaChaPoly_BLAKE2s.

Considerations

Serving apis over http benefits usability. Do we depricate the http apis?

Should communications outside of grin-wallet be encrypted as well?

Encrypted streams are difficult to implement without async/await support. My current encrypted streams implementation relies on async/await. grin-wallet targets stable Rust so a merge won't be possible until mid-August when Rust 1.37 becomes stable.

For encrypted transactions to become the de-facto standard, other implementations like Grin++ will need to implement them. Luckily, the noise protocol framework is implemented in multiple languages, including C.

Future steps

  • Address lookups (perhaps using a DHT of type PUBKEY->(IP, PORT))
  • NAT workarounds

Alternatives

  • I2P
    • Provides a superset of the proposed functionality, including pubkey adresses and nat traversal.
    • I2P is a non-trivial dependency. Usage would require an I2P deamon running on target machines.
  • TOR
    • Provides a superset of the proposed functionality, including pubkey adresses and nat traversal.
    • TOR is a non-trivial dependency.
  • Tox
    • Provides a superset of the functionality of this change, including pubkey adresses and nat traversal.
    • Intended primarily for chat and other encrypted communication but plans to provide an interface for generic encrypted byte streams.
    • Rust port is WIP.
  • TLS
    • Current Public Key Infastructure does not fit Grin's use case.
    • Mutual authentication over TLS with self signed certificates is possible in theory but it is not TLS's primary intended use. This blog series shows current state of TLS client authentication in Rust. The author was able to authenticate clients but only when using openssl bindings.

Proposed conventions

Wallet URL format, bikeshedding welcome :)

<PUBLIC-KEY>@{IP,DOMAIN}[:PORT] has been proposed.

The convention may become popular outside of grin and used for general purpose adressing. In that case "@" becomes a problem for email servers. <PUBLIC-KEY>+{IP,DOMAIN}[:PORT] or similar may be used to avoid potential conflict with email, ssh, etc.

Potential usablility issue

Public keys are long: 5033dc859ac591cec7bc4a32a49db2c6c80794c334cb6e739eff74f5f4b9d20b@50.51.1.30:24345

Post-DHT upgrade

When it becomes possible to look up adresses by public key, IP becomes optional: <PUBLIC-KEY>@{IP,DOMAIN}[:PORT] -> <PUBLIC-KEY>[@{IP,DOMAIN}[:PORT]].

Related issues

Previous work

Request for feedback

If anyone wants to comment on these plans, please do. Make sure to tag @bddap on gitter or github.

I intend to start a WIP pr if this proposal is well accepted.

@0xmichalis
Copy link
Contributor

Alternatives
I2P

* Provides a superset of the proposed functionality, including pubkey adresses and nat traversal.

* I2P is a non-trivial dependency. Usage would require an I2P deamon running on target machines.

There is ongoing work to add I2P support in both the node and wallet comms - see mimblewimble/grin#2712

@lehnberg
Copy link
Collaborator

lehnberg commented Sep 6, 2019

@bddap are you still considering this? Could a similar approach be suitable for the p2p network as well? mimblewimble/grin#1420

@bddap
Copy link
Contributor Author

bddap commented Sep 6, 2019

I still think it's a useful addition and yes, it could work in p2p.

It may be possible now to use rustls (without PKI) for this instead of noise. unfinished work on wallet tls listener.

@yeastplume
Copy link
Member

Going to close this issue now, as we've selected TOR as an optional dependency to handle these issues.

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

No branches or pull requests

4 participants