Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Germano Massullo <germano.massullo@gmail.com>
To: WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: WireGuard connecting hosts WAN->LAN
Date: Sat, 14 Mar 2020 16:33:44 +0100	[thread overview]
Message-ID: <c3b5c2e5-d77b-1984-107d-6f6a56b67f84@gmail.com> (raw)

A simple question to Wireguard developers, since while asking for help
in OpenWRT forum[1] I have been told that I am asking a thing that
Wireguard cannot do, so I want to ask upstream if it is possible or not

Scenario:
A = internet (WAN) host (WireGuard IP 10.1.1.3)
B = OpenWRT router (WireGuard IP 10.1.1.1)
C = LAN host (WireGuard IP 10.1.1.2)

I want to:
1) connect A to C passing through B. I don't want to expose C to
internet at all, (so no things like port forwarding)
2) A must have C public key (and viceversa), so in case of B being
compromised, the A<->C VPN will not be compromised.

In a few words, I want B to just route forwards packages from A to C.

I have been told:
=====
In your scenario A is not connected to C. Having peer entries for A and
C at each end are completely pointless because they're not doing
anything. The keys you have in those entries will only ever be used if A
and C are connected directly. As long as you have B in the middle then
packets will be sent from A (or C) to B which will decrypt then with the
appropriate public key. B will then re-encrypt them with it's own
private key before sending them on to C (or A). If you don't want that
to happen then you'll need to connect A and C directly.
=====

What do you think about?
For information completeness, below I attach the configuration of the
three hosts
In past I had a similar configuration with 3 Fedora/CentOS machines,
where A had just the B public key and I could connect to C because in A
configuration, the allowed IPs of B had a /24 mask. Now I would like to
setup a more strict configuration

Thank you for your time

[1]: https://forum.openwrt.org/t/wireguard-connecting-hosts-wan-lan/



**Host A - WireGuard configuration file (Fedora)**

```
[Interface]
Address = 10.1.1.3/24
PrivateKey = censored
ListenPort = 51820

# Host B
[Peer]
PublicKey = censored
Endpoint = tom.foo.bar:51820
AllowedIPs = 10.1.1.1/32

# Host C
[Peer]
PublicKey = censored
AllowedIPs = 10.1.1.2/32
```

**Host B - OpenWRT /etc/config/network configuration file**

```
root@OpenWrt:/etc# cat config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'censored::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0.1'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth0.2'
        option proto 'pppoe'
        option username 'censored'
        option password 'censored'
        option ipv6 'auto'

config device 'wan_dev'
        option name 'eth0.2'
        option macaddr 'censored'

config interface 'wan6'
        option ifname 'eth0.2'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '2 3 4 5 0t'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 0t'

config interface 'wg0'
        option proto 'wireguard'
        option private_key 'censored'
        option listen_port '51820'
        option route_allowed_ips '1'
        list addresses '10.1.1.1/24'
# Host A
config wireguard_wg0 'wg_client_host_A'
        option public_key 'censored'
        list allowed_ips '10.1.1.3/32'
# Host C
config wireguard_wg0 'wg_client_host_C'
        option public_key 'censored'
        list allowed_ips '10.1.1.2/32'
```

**Host C - WireGuard configuration file (CentOS)**
```
[Interface]
Address = 10.1.1.2/24
ListenPort = 51820
PrivateKey = censored

# Host B
[Peer]
PublicKey = censored
Endpoint = 192.168.1.1:51820
AllowedIPs = 10.1.1.1/32

# Host A
[Peer]
PublicKey = censored
AllowedIPs = 10.1.1.3/32
```


             reply	other threads:[~2020-03-14 15:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-14 15:33 Germano Massullo [this message]
2020-03-14 18:16 ` Luis Ressel
2020-03-14 20:43   ` Germano Massullo
2020-03-14 19:56 ` Kent Friis
2020-03-18 21:50 ` Bruno Wolff III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3b5c2e5-d77b-1984-107d-6f6a56b67f84@gmail.com \
    --to=germano.massullo@gmail.com \
    --cc=wireguard@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).