WireGuard Archive on lore.kernel.org
 help / Atom feed
* wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard
@ 2019-01-29 21:12 Gawen ARAB
  2019-01-29 23:55 ` Steve Gilberd
  0 siblings, 1 reply; 6+ messages in thread
From: Gawen ARAB @ 2019-01-29 21:12 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1.1: Type: text/plain, Size: 3518 bytes --]

Hello,

I've been giving my free time on a side project called WireHub
(https://github.com/gawen/wirehub), which is a simple tool to build
decentralized, peer-to-peer and secure overlay networks. It dynamically
configures WireGuard tunnels, discoverying peers' endpoints via a
authenticated
DHT, going through NATs, and relaying the WireGuard traffic if no P2P
communication is possible.

Overlay networks are defined by a single human-readable file which lists the
hostname and public key for each nodes of the network. Here's an example:

    name test               # network name is 'test'
    subnet 10.0.42.0/24     # overlay subnetwork is 10.0.42.0/24
    workbit 8               # PoW parameter for DHT security

    # a public bootstrap node
    boot P17zMwXJFbBdJEn05RFIMADw9TX5_m2xgf31OgNKX3w bootstrap.wirehub.io

    # Add trusted node 'a.test' to the overlay network.
    # Each trusted node are at least identified by an human-readable
hostname
    # and a base64 public key.
    trust a.test KJ7YGrBeqLLm_JJ1huIS26OnqAVFy57z5UJqjyMagW4

    # If the endpoint of a peer is static, it might be set after the public
key.
    # Note that this is optional, as endpoints can be dynamically found in
the
    # DHT.
    trust b.test eIix5ldvqDzOIrG9ViKTe9TSBlF4g9nUwKi20C06hFM 12.34.56.78

    # By default WireHub assigns nodes an (overlay) private IP, but a static
    # private IP might be defined
    trust c.test 10.0.42.254 kKZzuIm11zkBSHL9ETRwEthIBbLTvz840F_k4mhI_Hs
    ...

To start a peer,

    # wh up ./config private-key ./sk

When a network is up, the node's hostnames are resolved in userland.

    # ping b.test
    PING 10.0.42.2 (10.0.42.2): 56 data bytes
    64 bytes from 10.0.42.2: seq=0 ttl=64 time=106.801 ms
    64 bytes from 10.0.42.2: seq=1 ttl=64 time=49.778 ms

WireGuard and WireHub uses the same Curve25519 key. WireHub keys must be
generated with `wh genkey`, which adds a Proof-of-Work to the generation of
the
Curve25519 key, in order to mitigate Sybil attacks on the DHT. A high
workbit
will require more work to generate a valid key.

    # wh genkey workbit 8       # fast
    MFaqLuutFvNs79Xc9zhOUofIbL3xSLz1uo+RB1xB73s=
    # wh genkey workbit 8 | wh pubkey | wh workbit
    8
    # wh genkey workbit 16      # will take more time to generate
    kLfotsCIfB/7OcDGeLenptfy2Dzav9wmVZjVQ0Gvnk0=
    # wh genkey workbit 16 | wh pubkey | wh workbit
    16

    # wg genkey | wh pubkey | wh workbit    # WireGuard keys have 0 workbit
    0

Under the hood, WireHub runs its own UDP protocol, binding the same UDP port
than the WireGuard interface (for NAT trasversal technique reasons). It
does so using
libpcap. The first byte of a WireHub packet is 0xff, which corresponds to an
invalid WireGuard packet with message type outside the valid range
0x00-0x03.

WireHub currently authenticates its packets with a custom cryptographic
scheme
based on the node's keys. In the future, it might be better to tunnel
WireHub
packets through WireGuard, yet I'm not sure how to do that simply at the
moment,
as WireHub packets are not IP packets but more like authenticated messages.

There's much room for improvement (security, allowed-ips management, more
UDP
hole punching techniques, faster relaying), but it's usable. Docker images
are
provided to ease quick starting.

Feel free to test and give some feedbacks!

Also, I'll be at FOSDEM 2019 next week-end, so see you there! 🍺

Gawen

[-- Attachment #1.2: Type: text/html, Size: 4120 bytes --]

<div dir="ltr"><div dir="ltr">Hello,<br><br>I&#39;ve been giving my free time on a side project called WireHub<br>(<a href="https://github.com/gawen/wirehub">https://github.com/gawen/wirehub</a>), which is a simple tool to build<br>decentralized, peer-to-peer and secure overlay networks. It dynamically<br>configures WireGuard tunnels, discoverying peers&#39; endpoints via a authenticated<br>DHT, going through NATs, and relaying the WireGuard traffic if no P2P<br>communication is possible.<br><br>Overlay networks are defined by a single human-readable file which lists the<br>hostname and public key for each nodes of the network. Here&#39;s an example:<br><br>    name test               # network name is &#39;test&#39;<br>    subnet <a href="http://10.0.42.0/24">10.0.42.0/24</a>     # overlay subnetwork is <a href="http://10.0.42.0/24">10.0.42.0/24</a><br>    workbit 8               # PoW parameter for DHT security<br><br>    # a public bootstrap node<br>    boot P17zMwXJFbBdJEn05RFIMADw9TX5_m2xgf31OgNKX3w <a href="http://bootstrap.wirehub.io">bootstrap.wirehub.io</a><br><br>    # Add trusted node &#39;a.test&#39; to the overlay network.<br>    # Each trusted node are at least identified by an human-readable hostname<br>    # and a base64 public key.<br>    trust a.test KJ7YGrBeqLLm_JJ1huIS26OnqAVFy57z5UJqjyMagW4<br><br>    # If the endpoint of a peer is static, it might be set after the public key.<br>    # Note that this is optional, as endpoints can be dynamically found in the<br>    # DHT.<br>    trust b.test eIix5ldvqDzOIrG9ViKTe9TSBlF4g9nUwKi20C06hFM 12.34.56.78<br><br>    # By default WireHub assigns nodes an (overlay) private IP, but a static<br>    # private IP might be defined<br>    trust c.test 10.0.42.254 kKZzuIm11zkBSHL9ETRwEthIBbLTvz840F_k4mhI_Hs<br>    ...<br><br>To start a peer,<br><br>    # wh up ./config private-key ./sk<br><br>When a network is up, the node&#39;s hostnames are resolved in userland.<br><br>    # ping b.test<br>    PING 10.0.42.2 (10.0.42.2): 56 data bytes<br>    64 bytes from <a href="http://10.0.42.2">10.0.42.2</a>: seq=0 ttl=64 time=106.801 ms<br>    64 bytes from <a href="http://10.0.42.2">10.0.42.2</a>: seq=1 ttl=64 time=49.778 ms<br><br>WireGuard and WireHub uses the same Curve25519 key. WireHub keys must be<br>generated with `wh genkey`, which adds a Proof-of-Work to the generation of the<br>Curve25519 key, in order to mitigate Sybil attacks on the DHT. A high workbit<br>will require more work to generate a valid key.<br><br>    # wh genkey workbit 8       # fast<br>    MFaqLuutFvNs79Xc9zhOUofIbL3xSLz1uo+RB1xB73s=<br>    # wh genkey workbit 8 | wh pubkey | wh workbit<br>    8<br>    # wh genkey workbit 16      # will take more time to generate<br>    kLfotsCIfB/7OcDGeLenptfy2Dzav9wmVZjVQ0Gvnk0=<br>    # wh genkey workbit 16 | wh pubkey | wh workbit<br>    16<br><br>    # wg genkey | wh pubkey | wh workbit    # WireGuard keys have 0 workbit<br>    0<br><br>Under the hood, WireHub runs its own UDP protocol, binding the same UDP port<br>than the WireGuard interface (for NAT trasversal technique reasons). It does so using<br>libpcap. The first byte of a WireHub packet is 0xff, which corresponds to an<br>invalid WireGuard packet with message type outside the valid range 0x00-0x03.<br><br>WireHub currently authenticates its packets with a custom cryptographic scheme<br>based on the node&#39;s keys. In the future, it might be better to tunnel WireHub<br>packets through WireGuard, yet I&#39;m not sure how to do that simply at the moment,<br>as WireHub packets are not IP packets but more like authenticated messages.<br><br>There&#39;s much room for improvement (security, allowed-ips management, more UDP<br>hole punching techniques, faster relaying), but it&#39;s usable. Docker images are<br>provided to ease quick starting.<br><br>Feel free to test and give some feedbacks!<br><br>Also, I&#39;ll be at FOSDEM 2019 next week-end, so see you there! 🍺<br><br>Gawen</div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard
  2019-01-29 21:12 wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard Gawen ARAB
@ 2019-01-29 23:55 ` Steve Gilberd
  2019-01-30 11:35   ` Rene 'Renne' Bartsch, B.Sc. Informatics
  2019-01-30 15:25   ` Gawen ARAB
  0 siblings, 2 replies; 6+ messages in thread
From: Steve Gilberd @ 2019-01-29 23:55 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1.1: Type: text/plain, Size: 5762 bytes --]

I very much like the idea of this project - I've been looking for a decent
full-mesh L3 VPN for ages, and have never found a solution I've been
properly happy with. Thanks for your work in developing this solution :-).

However - I'm concerned about some of the potential increased attack
surface that your architecture introduces:
 - uses extra crypto functionality which is not already part of wireguard;
and
 - passes messages across public networks using that functionality; and
 - clamps the wireguard keys in some unspecified way to embed a
proof-of-work (in fairness, I haven't read the code, so please correct me
if I have misunderstood).

For what it's worth, if it would be possible to also encapsulate your
control protocol inside wireguard, that would be vastly preferable: it
allows the transport cryptography to be implemented in one place, once
(i.e. in wireguard), and lets wirehub be a purely organisational overlay
for managing links, rather than touching the crypto and introducing
troubling extra complexities.

I would also love to see some sort of PKI option with this project, to
avoid having to explicitly trust all the peers. I'd prefer to be able to
simply provide the peers with a signature they can present to other peers
that proves they can be trusted (or even better, have that signature
generated by a nominated host at connect / setup time for each peer, which
avoids much of the shenanigans involved with handling expiry, revocations
etc.) Having the ability to tell all peers on the network to immediately
terminate all connections with a specific compromised peer would also be
handy.

Cheers,
Steve

On Wed, 30 Jan 2019 at 10:15 Gawen ARAB <g@wenarab.com> wrote:

> Hello,
>
> I've been giving my free time on a side project called WireHub
> (https://github.com/gawen/wirehub), which is a simple tool to build
> decentralized, peer-to-peer and secure overlay networks. It dynamically
> configures WireGuard tunnels, discoverying peers' endpoints via a
> authenticated
> DHT, going through NATs, and relaying the WireGuard traffic if no P2P
> communication is possible.
>
> Overlay networks are defined by a single human-readable file which lists
> the
> hostname and public key for each nodes of the network. Here's an example:
>
>     name test               # network name is 'test'
>     subnet 10.0.42.0/24     # overlay subnetwork is 10.0.42.0/24
>     workbit 8               # PoW parameter for DHT security
>
>     # a public bootstrap node
>     boot P17zMwXJFbBdJEn05RFIMADw9TX5_m2xgf31OgNKX3w bootstrap.wirehub.io
>
>     # Add trusted node 'a.test' to the overlay network.
>     # Each trusted node are at least identified by an human-readable
> hostname
>     # and a base64 public key.
>     trust a.test KJ7YGrBeqLLm_JJ1huIS26OnqAVFy57z5UJqjyMagW4
>
>     # If the endpoint of a peer is static, it might be set after the
> public key.
>     # Note that this is optional, as endpoints can be dynamically found in
> the
>     # DHT.
>     trust b.test eIix5ldvqDzOIrG9ViKTe9TSBlF4g9nUwKi20C06hFM 12.34.56.78
>
>     # By default WireHub assigns nodes an (overlay) private IP, but a
> static
>     # private IP might be defined
>     trust c.test 10.0.42.254 kKZzuIm11zkBSHL9ETRwEthIBbLTvz840F_k4mhI_Hs
>     ...
>
> To start a peer,
>
>     # wh up ./config private-key ./sk
>
> When a network is up, the node's hostnames are resolved in userland.
>
>     # ping b.test
>     PING 10.0.42.2 (10.0.42.2): 56 data bytes
>     64 bytes from 10.0.42.2: seq=0 ttl=64 time=106.801 ms
>     64 bytes from 10.0.42.2: seq=1 ttl=64 time=49.778 ms
>
> WireGuard and WireHub uses the same Curve25519 key. WireHub keys must be
> generated with `wh genkey`, which adds a Proof-of-Work to the generation
> of the
> Curve25519 key, in order to mitigate Sybil attacks on the DHT. A high
> workbit
> will require more work to generate a valid key.
>
>     # wh genkey workbit 8       # fast
>     MFaqLuutFvNs79Xc9zhOUofIbL3xSLz1uo+RB1xB73s=
>     # wh genkey workbit 8 | wh pubkey | wh workbit
>     8
>     # wh genkey workbit 16      # will take more time to generate
>     kLfotsCIfB/7OcDGeLenptfy2Dzav9wmVZjVQ0Gvnk0=
>     # wh genkey workbit 16 | wh pubkey | wh workbit
>     16
>
>     # wg genkey | wh pubkey | wh workbit    # WireGuard keys have 0 workbit
>     0
>
> Under the hood, WireHub runs its own UDP protocol, binding the same UDP
> port
> than the WireGuard interface (for NAT trasversal technique reasons). It
> does so using
> libpcap. The first byte of a WireHub packet is 0xff, which corresponds to
> an
> invalid WireGuard packet with message type outside the valid range
> 0x00-0x03.
>
> WireHub currently authenticates its packets with a custom cryptographic
> scheme
> based on the node's keys. In the future, it might be better to tunnel
> WireHub
> packets through WireGuard, yet I'm not sure how to do that simply at the
> moment,
> as WireHub packets are not IP packets but more like authenticated messages.
>
> There's much room for improvement (security, allowed-ips management, more
> UDP
> hole punching techniques, faster relaying), but it's usable. Docker images
> are
> provided to ease quick starting.
>
> Feel free to test and give some feedbacks!
>
> Also, I'll be at FOSDEM 2019 next week-end, so see you there! 🍺
>
> Gawen
> _______________________________________________
> WireGuard mailing list
> WireGuard@lists.zx2c4.com
> https://lists.zx2c4.com/mailman/listinfo/wireguard
>
-- 

Cheers,

*Steve Gilberd*
Erayd LTD *·* Consultant
*Phone: +64 4 974-4229 **·** Mob: +64 27 565-3237*
*PO Box 10019, The Terrace, Wellington 6143, NZ*

[-- Attachment #1.2: Type: text/html, Size: 7328 bytes --]

<div dir="ltr">I very much like the idea of this project - I&#39;ve been looking for a decent full-mesh L3 VPN for ages, and have never found a solution I&#39;ve been properly happy with. Thanks for your work in developing this solution :-).<div><br></div><div>However - I&#39;m concerned about some of the potential increased attack surface that your architecture introduces:<div> - uses extra crypto functionality which is not already part of wireguard; and</div><div> - passes messages across public networks using that functionality; and</div><div> - clamps the wireguard keys in some unspecified way to embed a proof-of-work (in fairness, I haven&#39;t read the code, so please correct me if I have misunderstood).</div><div><br></div><div>For what it&#39;s worth, if it would be possible to also encapsulate your control protocol inside wireguard, that would be vastly preferable: it allows the transport cryptography to be implemented in one place, once (i.e. in wireguard), and lets wirehub be a purely organisational overlay for managing links, rather than touching the crypto and introducing troubling extra complexities.</div><div><br></div><div>I would also love to see some sort of PKI option with this project, to avoid having to explicitly trust all the peers. I&#39;d prefer to be able to simply provide the peers with a signature they can present to other peers that proves they can be trusted (or even better, have that signature generated by a nominated host at connect / setup time for each peer, which avoids much of the shenanigans involved with handling expiry, revocations etc.) Having the ability to tell all peers on the network to immediately terminate all connections with a specific compromised peer would also be handy.<br><div><br></div><div>Cheers,</div><div>Steve<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 30 Jan 2019 at 10:15 Gawen ARAB &lt;<a href="mailto:g@wenarab.com">g@wenarab.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">Hello,<br><br>I&#39;ve been giving my free time on a side project called WireHub<br>(<a href="https://github.com/gawen/wirehub" target="_blank">https://github.com/gawen/wirehub</a>), which is a simple tool to build<br>decentralized, peer-to-peer and secure overlay networks. It dynamically<br>configures WireGuard tunnels, discoverying peers&#39; endpoints via a authenticated<br>DHT, going through NATs, and relaying the WireGuard traffic if no P2P<br>communication is possible.<br><br>Overlay networks are defined by a single human-readable file which lists the<br>hostname and public key for each nodes of the network. Here&#39;s an example:<br><br>    name test               # network name is &#39;test&#39;<br>    subnet <a href="http://10.0.42.0/24" target="_blank">10.0.42.0/24</a>     # overlay subnetwork is <a href="http://10.0.42.0/24" target="_blank">10.0.42.0/24</a><br>    workbit 8               # PoW parameter for DHT security<br><br>    # a public bootstrap node<br>    boot P17zMwXJFbBdJEn05RFIMADw9TX5_m2xgf31OgNKX3w <a href="http://bootstrap.wirehub.io" target="_blank">bootstrap.wirehub.io</a><br><br>    # Add trusted node &#39;a.test&#39; to the overlay network.<br>    # Each trusted node are at least identified by an human-readable hostname<br>    # and a base64 public key.<br>    trust a.test KJ7YGrBeqLLm_JJ1huIS26OnqAVFy57z5UJqjyMagW4<br><br>    # If the endpoint of a peer is static, it might be set after the public key.<br>    # Note that this is optional, as endpoints can be dynamically found in the<br>    # DHT.<br>    trust b.test eIix5ldvqDzOIrG9ViKTe9TSBlF4g9nUwKi20C06hFM 12.34.56.78<br><br>    # By default WireHub assigns nodes an (overlay) private IP, but a static<br>    # private IP might be defined<br>    trust c.test 10.0.42.254 kKZzuIm11zkBSHL9ETRwEthIBbLTvz840F_k4mhI_Hs<br>    ...<br><br>To start a peer,<br><br>    # wh up ./config private-key ./sk<br><br>When a network is up, the node&#39;s hostnames are resolved in userland.<br><br>    # ping b.test<br>    PING 10.0.42.2 (10.0.42.2): 56 data bytes<br>    64 bytes from <a href="http://10.0.42.2" target="_blank">10.0.42.2</a>: seq=0 ttl=64 time=106.801 ms<br>    64 bytes from <a href="http://10.0.42.2" target="_blank">10.0.42.2</a>: seq=1 ttl=64 time=49.778 ms<br><br>WireGuard and WireHub uses the same Curve25519 key. WireHub keys must be<br>generated with `wh genkey`, which adds a Proof-of-Work to the generation of the<br>Curve25519 key, in order to mitigate Sybil attacks on the DHT. A high workbit<br>will require more work to generate a valid key.<br><br>    # wh genkey workbit 8       # fast<br>    MFaqLuutFvNs79Xc9zhOUofIbL3xSLz1uo+RB1xB73s=<br>    # wh genkey workbit 8 | wh pubkey | wh workbit<br>    8<br>    # wh genkey workbit 16      # will take more time to generate<br>    kLfotsCIfB/7OcDGeLenptfy2Dzav9wmVZjVQ0Gvnk0=<br>    # wh genkey workbit 16 | wh pubkey | wh workbit<br>    16<br><br>    # wg genkey | wh pubkey | wh workbit    # WireGuard keys have 0 workbit<br>    0<br><br>Under the hood, WireHub runs its own UDP protocol, binding the same UDP port<br>than the WireGuard interface (for NAT trasversal technique reasons). It does so using<br>libpcap. The first byte of a WireHub packet is 0xff, which corresponds to an<br>invalid WireGuard packet with message type outside the valid range 0x00-0x03.<br><br>WireHub currently authenticates its packets with a custom cryptographic scheme<br>based on the node&#39;s keys. In the future, it might be better to tunnel WireHub<br>packets through WireGuard, yet I&#39;m not sure how to do that simply at the moment,<br>as WireHub packets are not IP packets but more like authenticated messages.<br><br>There&#39;s much room for improvement (security, allowed-ips management, more UDP<br>hole punching techniques, faster relaying), but it&#39;s usable. Docker images are<br>provided to ease quick starting.<br><br>Feel free to test and give some feedbacks!<br><br>Also, I&#39;ll be at FOSDEM 2019 next week-end, so see you there! 🍺<br><br>Gawen</div></div>
_______________________________________________<br>
WireGuard mailing list<br>
<a href="mailto:WireGuard@lists.zx2c4.com" target="_blank">WireGuard@lists.zx2c4.com</a><br>
<a href="https://lists.zx2c4.com/mailman/listinfo/wireguard" rel="noreferrer" target="_blank">https://lists.zx2c4.com/mailman/listinfo/wireguard</a><br>
</blockquote></div></div></div></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><p dir="ltr">Cheers,</p>
<p dir="ltr"><b>Steve Gilberd</b><br>
<span style="color:rgb(102,102,102)">Erayd LTD </span><span style="color:rgb(102,102,102)"><b>·</b></span><span style="color:rgb(102,102,102)"> Consultant</span><br>
<span style="color:rgb(102,102,102)"><i>Phone: +64 4 974-4229 </i></span><span style="color:rgb(102,102,102)"><i><b>·</b></i></span><span style="color:rgb(102,102,102)"><i> Mob: +64 27 565-3237</i></span><br>
<span style="color:rgb(102,102,102)"><i>PO Box 10019, The Terrace, Wellington 6143, NZ</i></span></p>
</div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard
  2019-01-29 23:55 ` Steve Gilberd
@ 2019-01-30 11:35   ` Rene 'Renne' Bartsch, B.Sc. Informatics
  2019-01-30 15:25   ` Gawen ARAB
  1 sibling, 0 replies; 6+ messages in thread
From: Rene 'Renne' Bartsch, B.Sc. Informatics @ 2019-01-30 11:35 UTC (permalink / raw)
  To: wireguard



Am 30.01.19 um 00:55 schrieb Steve Gilberd:
> I very much like the idea of this project - I've been looking for a decent full-mesh L3 VPN for ages, and have never found a solution I've been properly happy with. Thanks for your work in developing this solution :-).

Me, too - Thanks! :-)

> However - I'm concerned about some of the potential increased attack surface that your architecture introduces:
>   - uses extra crypto functionality which is not already part of wireguard; and
>   - passes messages across public networks using that functionality; and
>   - clamps the wireguard keys in some unspecified way to embed a proof-of-work (in fairness, I haven't read the code, so please correct me if I have misunderstood).
> 
> For what it's worth, if it would be possible to also encapsulate your control protocol inside wireguard, that would be vastly preferable: it allows the transport cryptography to be implemented in one place, once (i.e. in wireguard), and lets wirehub be a 
purely organisational overlay for managing links, rather than touching the crypto and introducing troubling extra complexities.

I agree. Piggybacking Wirehub communication on Wireguard encryption instead of custom UDP saves an additional layer of encryption an thus superfluous code.
Wirehub should only use ZINC functions to sign/validate the DHT entries with the Wireguard private/public key.

I suggest to use a cryptographically generated IPv6 address (128-bit hash of Wiregurad public key with first n bits replaced by a Wireguard-specific IPv6 prefix)
for routing and management purposes. Adding a reverse-lookup IPv6-address -> Wireguard public key via DHT would allow a public IPv6 overlay network
with authorization via firewall rules. Nodes should also be able to announce their subnets via DHT.

> 
> I would also love to see some sort of PKI option with this project, to avoid having to explicitly trust all the peers. I'd prefer to be able to simply provide the peers with a signature they can present to other peers that proves they can be trusted (or even better, have that signature generated by a nominated host at connect / setup time for each peer, which avoids much of the shenanigans involved with handling expiry, revocations etc.) Having the ability to tell all peers on the network to immediately terminate all connections with a specific compromised peer would also be handy.

A PKI increases complexity a lot. I suggest using the cryptographically generated IPv6 address approach with distributed firewall rules.

Regards,

Renne
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard
  2019-01-29 23:55 ` Steve Gilberd
  2019-01-30 11:35   ` Rene 'Renne' Bartsch, B.Sc. Informatics
@ 2019-01-30 15:25   ` Gawen ARAB
  2019-01-30 15:46     ` Gawen ARAB
  1 sibling, 1 reply; 6+ messages in thread
From: Gawen ARAB @ 2019-01-30 15:25 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1.1: Type: text/plain, Size: 4178 bytes --]

Hey Steve,

Thank you for your feedback.

> - uses extra crypto functionality which is not already part of wireguard;
and
> - passes messages across public networks using that functionality; and
>
> For what it's worth, if it would be possible to also encapsulate your
control protocol inside wireguard, that would be vastly preferable: it
allows the transport cryptography to be implemented in one place, once
(i.e. in wireguard), and lets wirehub be a purely organisational overlay
for managing links, rather than touching the crypto and introducing
troubling extra complexities.

I agree.

The main issue to implement this is to accept message_handshake_initiation
packet from unknown initiators. WireHub peers discover themselves through
the
DHT. One peer does not know in advance what peers will communicate with it.
The
current implementation of WireGuard drops packets from unset peers.

I plan to implement a replay mechanism of the message_handshake_initiation
packet, where WireHub peeks it, decrypts the initiator's public key, and if
unknown and has enough workbit, will add it to WireGuard's peers before
replaying the packet. The main advantage is to avoid adding usage-specific
features to WireGuard, but I need to re-implement part of the WireGuard
crypto
scheme (plus the replay mechanism might be a little dirty).

Another approach might be to modify WireGuard to add a hook called when a
unknown peer initiates a session. When it happens, a userland app (here,
WireHub) is called to accept or reject dynamically the initiator. This
reduces
the overhead of processing twice the message_handshake_initiation packet
from
the previous solution, but it would add complexity to the WireGuard's code.

    on_message_handshake_initiation(m) {
        // decrypt static_public

        if (unknown_peer(static_public)) {
            if (hook) {
                r = hook(static_public)     // call dynamically WireHub
            }

            // if no hook or hook rejects initiator, drop packet
            if (!hook or !r.accept_initiator) {
                return drop();
            }

            // else add iniatiator to peers
            set_peer(iniator.static_public,
                allowed_ips=r.allowed_ips,
                endpoint=iniator.endpoint,
                preshared_key=r.preshared_key,
                persistent_keep_alive=r.persistent_keep_alive)
        }

        // process message_handshake_initiation
    }

> - clamps the wireguard keys in some unspecified way to embed a
proof-of-work (in fairness, I haven't read the code, so please correct me
if I have misunderstood).

The workbit of a Curve25519 key is the count of trailing zeros of a
derivation
of the public key.

    workbit(sk, namespace='public') {
        k = pub(sk)
        h = blake2b(k ⊕ namespace)
        wb = trailing_0s(h) // see __builtin_clz
        return wb
    }

WireHub peers only accept peers which public key has enough workbits. This
makes
identity expensive to generate, which mitigates Sybil attacks.

When workbit is incremented by one, the count of possible Curve25519 keys is
divided by 2. I don't know if it's a problem? I explored other PoW scheme,
but
the current implementation is the simplest one I found.

> I would also love to see some sort of PKI option with this project, to
avoid having to explicitly trust all the peers. I'd prefer to be able to
simply provide the peers with a signature they can present to other peers
that proves they can be trusted (or even better, have that signature
generated by a nominated host at connect / setup time for each peer, which
avoids much of the shenanigans involved with handling expiry, revocations
etc.) Having the ability to tell all peers on the network to immediately
terminate all connections with a specific compromised peer would also be
handy.

I plan to build this on top of WireHub, once it will be more mature.

A PKI daemon may read peer's certificates, signed by a given authority,
keeps a
list of the trusted peers and updates in live the wirehub's conf file.

Cheers,
Gawen

[-- Attachment #1.2: Type: text/html, Size: 4702 bytes --]

<div dir="ltr"><div dir="ltr">Hey Steve,<br><br>Thank you for your feedback.<br><br>&gt; - uses extra crypto functionality which is not already part of wireguard; and<br>&gt; - passes messages across public networks using that functionality; and<br>&gt;<br>&gt; For what it&#39;s worth, if it would be possible to also encapsulate your control protocol inside wireguard, that would be vastly preferable: it allows the transport cryptography to be implemented in one place, once (i.e. in wireguard), and lets wirehub be a purely organisational overlay for managing links, rather than touching the crypto and introducing troubling extra complexities.<br><br>I agree.<br><br>The main issue to implement this is to accept message_handshake_initiation<br>packet from unknown initiators. WireHub peers discover themselves through the<br>DHT. One peer does not know in advance what peers will communicate with it. The<br>current implementation of WireGuard drops packets from unset peers.<br><br>I plan to implement a replay mechanism of the message_handshake_initiation<br>packet, where WireHub peeks it, decrypts the initiator&#39;s public key, and if<br>unknown and has enough workbit, will add it to WireGuard&#39;s peers before<br>replaying the packet. The main advantage is to avoid adding usage-specific<br>features to WireGuard, but I need to re-implement part of the WireGuard crypto<br>scheme (plus the replay mechanism might be a little dirty).<br><br>Another approach might be to modify WireGuard to add a hook called when a<br>unknown peer initiates a session. When it happens, a userland app (here,<br>WireHub) is called to accept or reject dynamically the initiator. This reduces<br>the overhead of processing twice the message_handshake_initiation packet from<br>the previous solution, but it would add complexity to the WireGuard&#39;s code.<br><br>    on_message_handshake_initiation(m) {<br>        // decrypt static_public<br><br>        if (unknown_peer(static_public)) {<br>            if (hook) {<br>                r = hook(static_public)     // call dynamically WireHub<br>            }<br><br>            // if no hook or hook rejects initiator, drop packet<br>            if (!hook or !r.accept_initiator) {<br>                return drop();<br>            }<br><br>            // else add iniatiator to peers<br>            set_peer(iniator.static_public,<br>                allowed_ips=r.allowed_ips,<br>                endpoint=iniator.endpoint,<br>                preshared_key=r.preshared_key,<br>                persistent_keep_alive=r.persistent_keep_alive)<br>        }<br><br>        // process message_handshake_initiation<br>    }<br><br>&gt; - clamps the wireguard keys in some unspecified way to embed a proof-of-work (in fairness, I haven&#39;t read the code, so please correct me if I have misunderstood).<br><br>The workbit of a Curve25519 key is the count of trailing zeros of a derivation<br>of the public key.<br><br>    workbit(sk, namespace=&#39;public&#39;) {<br>        k = pub(sk)<br>        h = blake2b(k ⊕ namespace)<br>        wb = trailing_0s(h) // see __builtin_clz<br>        return wb<br>    }<br><br>WireHub peers only accept peers which public key has enough workbits. This makes<br>identity expensive to generate, which mitigates Sybil attacks.<br><br>When workbit is incremented by one, the count of possible Curve25519 keys is<br>divided by 2. I don&#39;t know if it&#39;s a problem? I explored other PoW scheme, but<br>the current implementation is the simplest one I found.<br><br>&gt; I would also love to see some sort of PKI option with this project, to avoid having to explicitly trust all the peers. I&#39;d prefer to be able to simply provide the peers with a signature they can present to other peers that proves they can be trusted (or even better, have that signature generated by a nominated host at connect / setup time for each peer, which avoids much of the shenanigans involved with handling expiry, revocations etc.) Having the ability to tell all peers on the network to immediately terminate all connections with a specific compromised peer would also be handy.<br><br>I plan to build this on top of WireHub, once it will be more mature.<br><br>A PKI daemon may read peer&#39;s certificates, signed by a given authority, keeps a<br>list of the trusted peers and updates in live the wirehub&#39;s conf file.<br></div><div dir="ltr"><br></div><div dir="ltr">Cheers,<br>Gawen</div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard
  2019-01-30 15:25   ` Gawen ARAB
@ 2019-01-30 15:46     ` Gawen ARAB
  2019-01-30 16:55       ` Rene 'Renne' Bartsch, B.Sc. Informatics
  0 siblings, 1 reply; 6+ messages in thread
From: Gawen ARAB @ 2019-01-30 15:46 UTC (permalink / raw)
  To: wireguard

[-- Attachment #1.1: Type: text/plain, Size: 533 bytes --]

Hey Rene,

> I suggest to use a cryptographically generated IPv6 address (128-bit hash
of Wiregurad public key with first n bits replaced by a Wireguard-specific
IPv6 prefix)
> for routing and management purposes. Adding a reverse-lookup IPv6-address
-> Wireguard public key via DHT would allow a public IPv6 overlay network
> with authorization via firewall rules. Nodes should also be able to
announce their subnets via DHT.

I agree. I plan to use the subnet ORCHID as defined by RFC 4843.
See command `wh orchid`.

Cheers,
Gawen

[-- Attachment #1.2: Type: text/html, Size: 635 bytes --]

<div dir="ltr"><div dir="ltr">Hey Rene,<br><br>&gt; I suggest to use a cryptographically generated IPv6 address (128-bit hash of Wiregurad public key with first n bits replaced by a Wireguard-specific IPv6 prefix)<br>&gt; for routing and management purposes. Adding a reverse-lookup IPv6-address -&gt; Wireguard public key via DHT would allow a public IPv6 overlay network<br>&gt; with authorization via firewall rules. Nodes should also be able to announce their subnets via DHT.<br><br>I agree. I plan to use the subnet ORCHID as defined by RFC 4843.</div><div dir="ltr">See command `wh orchid`.<br><br>Cheers,<br>Gawen</div></div>

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard
  2019-01-30 15:46     ` Gawen ARAB
@ 2019-01-30 16:55       ` Rene 'Renne' Bartsch, B.Sc. Informatics
  0 siblings, 0 replies; 6+ messages in thread
From: Rene 'Renne' Bartsch, B.Sc. Informatics @ 2019-01-30 16:55 UTC (permalink / raw)
  To: wireguard



Am 30.01.19 um 16:46 schrieb Gawen ARAB:
> Hey Rene,
> 
>  > I suggest to use a cryptographically generated IPv6 address (128-bit hash of Wiregurad public key with first n bits replaced by a Wireguard-specific IPv6 prefix)
>  > for routing and management purposes. Adding a reverse-lookup IPv6-address -> Wireguard public key via DHT would allow a public IPv6 overlay network
>  > with authorization via firewall rules. Nodes should also be able to announce their subnets via DHT.
> 
> I agree. I plan to use the subnet ORCHID as defined by RFC 4843.
> See command `wh orchid`.
> 

Great! :-)

RFC 4843 has been obsoleted by RFC 7343. Please use RFC 7343 instead and re-use as much cryptographic code of Wireguard as possible to reduce possible bugs and weaknesses.

I suggest to omit the custom UDP protocol and libpcap by adding an ORCHIDv2 address to the wireguard network device and run the DHT via a port of the ORCHIDv2 address.
That way you can easily calculate the ORCHIDv2 address of a peer from the public key and connect the DHT.


Regards,

Renne
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 21:12 wirehub - decentralized, peer-to-peer and secure overlay networks built with WireGuard Gawen ARAB
2019-01-29 23:55 ` Steve Gilberd
2019-01-30 11:35   ` Rene 'Renne' Bartsch, B.Sc. Informatics
2019-01-30 15:25   ` Gawen ARAB
2019-01-30 15:46     ` Gawen ARAB
2019-01-30 16:55       ` Rene 'Renne' Bartsch, B.Sc. Informatics

WireGuard Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/wireguard/0 wireguard/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 wireguard wireguard/ https://lore.kernel.org/wireguard \
		wireguard@lists.zx2c4.com zx2c4-wireguard@archiver.kernel.org
	public-inbox-index wireguard


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/com.zx2c4.lists.wireguard


AGPL code for this site: git clone https://public-inbox.org/ public-inbox