threefoldtech / zos

Autonomous operating system
https://threefold.io/host/
Apache License 2.0
84 stars 14 forks source link

Reintegrate wireguard in zos4 #2430

Open Eslam-Nawara opened 1 month ago

Eslam-Nawara commented 1 month ago

Is your feature request related to a problem? Please describe

we need to reintegrate wireguard again in zos4

Eslam-Nawara commented 1 month ago

WIP

Working on adding wireguard back to zos4.

Eslam-Nawara commented 1 month ago

WIP

[Peer] PublicKey = cYvKjMRBLj3o3e4lxWOK6bbSyHWtgLNHkEBxIv7Olm4= AllowedIPs = 10.1.1.0/24, 100.64.1.1/32 PersistentKeepalive = 25 Endpoint = 192.168.123.32:3011

- Used network light with this configurations
```go
zos.NetworkLight{
Subnet:         gridtypes.MustParseIPNet("10.1.1.0/24"),
NetworkIPRange: gridtypes.MustParseIPNet("10.1.0.0/16"),

WGPrivateKey: wgKey,
WGListenPort: 3011,

Peers: []zos.Peer{
    {
        Subnet:      gridtypes.MustParseIPNet("10.1.2.0/24"),
        WGPublicKey: "4KTvZS2KPWYfMr+GbiUUly0ANVg8jBC7xP9Bl79Z8zM=",

        AllowedIPs: []gridtypes.IPNet{
            gridtypes.MustParseIPNet("10.1.2.0/24"),
            gridtypes.MustParseIPNet("100.64.1.2/32"),
        },
    },
},
Mycelium: zos.Mycelium{
    Key: mycKey,
},

Now I'm able to join the network Image

And can ssh to the container using wg ip Image