Giter Club home page Giter Club logo

naggie / dsnet Goto Github PK

View Code? Open in Web Editor NEW
674.0 13.0 33.0 5.57 MB

FAST command to manage a centralised wireguard VPN. Think wg-quick but quicker: key generation + address allocation.

Home Page: https://calbryant.uk/blog/how-to-set-up-a-wireguard-vpn-in-minutes-with-dsnet/

License: MIT License

Go 57.56% Makefile 0.27% Shell 1.47% Python 28.11% HTML 2.10% CSS 1.37% JavaScript 5.95% PHP 3.17%
wireguard vpn ubuntu linux vyatta edgeos edgerouter ipv6 ipv4 networking

dsnet's Introduction

Dsnet banner


Packaging status




Set up a VPN in one minute:

dsnet add

The server peer is listening, and a client peer config has been generated and added to the server peer:

wg

More client peers can be added with dsnet add. They can connect immediately after! Don't forget to enable IP forwarding to allow peers to talk to one another.

It works on AMD64 based linux and also ARMv5.

Usage:
    dsnet [command]

Available Commands:
  add         Add a new peer + sync
  down        Destroy the interface, run pre/post down
  help        Help about any command
  init        Create /etc/dsnetconfig.json containing default configuration + new keys without loading. Edit to taste.
  regenerate  Regenerate keys and config for peer
  remove      Remove a peer by hostname provided as argument + sync
  report      Generate a JSON status report to stdout
  sync        Update wireguard configuration from /etc/dsnetconfig.json after validating
  up          Create the interface, run pre/post up, sync
  version     Print version

Flags:
  -h, --help            help for this command
      --output string   config file format: vyatta/wg-quick/nixos (default "wg-quick")

Use "dsnet [command] --help" for more information about a command.

Quick start (AMD64 linux) -- install wireguard, then, after making sure /usr/local/bin is in your path:

sudo wget https://github.com/naggie/dsnet/releases/latest/download/dsnet-linux-amd64 -O /usr/local/bin/dsnet
sudo chmod +x /usr/local/bin/dsnet
sudo dsnet init
# edit /etc/dsnetconfig.json to taste
sudo dsnet up
sudo dsnet add banana > dsnet-banana.conf
sudo dsnet add apple > dsnet-apple.conf
# enable IP forwarding to allow peers to talk to one another
sudo sysctl -w net.ipv4.ip_forward=1   # edit /etc/sysctl.conf to make this persistent across reboots

Copy the generated configuration file to your device and connect!

To send configurations, here are a few suggestions.

  • ffsend, the most straightforward option;
  • magic wormhole, a more advanced option, where the file never passes through another server;
  • wormhole-william, a Go implementation of the above.

For the above options, one should transfer the password separately.

A local QR code generator, such as the popular qrencode may also be used to generate a QR code of the configuration. For instance: dsnet add | qrencode -t ansiutf8. This works because the dsnet prompts are on STDERR and not passed to qrencode.

The peer private key is generated on the server, which is technically not as secure as generating it on the client peer and then providing the server the public key; there is provision to specify a public key in the code when adding a peer to avoid the server generating the private key. The feature will be added when requested.

Note that named arguments can be specified on the command line as well as entered by prompt; this allows for unattended usage.

GUI

Dsnet does not include or require a GUI, however there is now a separate official monitoring GUI: https://github.com/botto/dsnet-gui.

Configuration overview

The configuration is a single JSON file. Beyond possible initial customisations, the file is managed entirely by dsnet.

dsnetconfig.json is the only file the server needs to run the VPN. It contains the server keys, peer public/shared keys and IP settings. A working version is automatically generated by dsnet init which can be modified as required.

Currently its location is fixed as all my deployments are for a single network. I may add a feature to allow setting of the location via environment variable in the future to support multiple networks on a single host.

Main (automatically generated) configuration example:

{
    "ExternalHostname": "",
    "ExternalIP": "198.51.100.2",
    "ExternalIP6": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
    "ListenPort": 51820,
    "Domain": "dsnet",
    "InterfaceName": "dsnet",
    "Network": "10.164.236.0/22",
    "Network6": "fd00:7b31:106a:ae00::/64",
    "IP": "10.164.236.1",
    "IP6": "fd00:d631:74ca:7b00:a28:11a1:b821:f013",
    "DNS": "",
    "Networks": [],
    "PrivateKey": "uC+xz3v1mfjWBHepwiCgAmPebZcY+EdhaHAvqX2r7U8=",
    "PostUp": "",
    "PostDown" "",
    "Peers": [
        {
            "Hostname": "test",
            "Owner": "naggie",
            "Description": "Home server",
            "IP": "10.164.236.2",
            "IP6": "fd00:7b31:106a:ae00:44c3:29c3:53b1:a6f9",
            "Added": "2020-05-07T10:04:46.336286992+01:00",
            "Networks": [],
            "PublicKey": "altJeQ/V52JZQrGcA9RiKcpZusYU6zMUJhl7Wbd9rX0=",
            "PresharedKey": "GcUtlze0BMuxo3iVEjpOahKdTf8xVfF8hDW3Ylw5az0="
        }
    ]
}

See CONFIG.md for an explanation of each field.

Report file overview

An example report file, generated by dsnet report. Suggested location: /var/lib/dsnetreport.json:

{
    "ExternalIP": "198.51.100.2",
    "InterfaceName": "dsnet",
    "ListenPort": 51820,
    "Domain": "dsnet",
    "IP": "10.164.236.1",
    "Network": "10.164.236.0/22",
    "DNS": "",
    "PeersOnline": 4,
    "PeersTotal": 13,
    "ReceiveBytes": 32517164,
    "TransmitBytes": 85384984,
    "ReceiveBytesSI": "32.5 MB",
    "TransmitBytesSI": "85.4 MB",
    "Peers": [
        {
            "Hostname": "test",
            "Owner": "naggie",
            "Description": "Home server",
            "Online": false,
            "Dormant": true,
            "Added": "2020-03-12T20:15:42.798800741Z",
            "IP": "10.164.236.2",
            "ExternalIP": "198.51.100.223",
            "Networks": [],
            "Added": "2020-05-07T10:04:46.336286992+01:00",
            "ReceiveBytes": 32517164,
            "TransmitBytes": 85384984,
            "ReceiveBytesSI": "32.5 MB",
            "TransmitBytesSI": "85.4 MB"
        }

        <...>
    ]
}

Fields mean the same as they do above, or are self explanatory. Note that some data is converted into human readable formats in addition to machine formats -- this is technically redundant but useful with Hugo shortcodes and other site generators.

The report can be converted, for instance, into a HTML table as below:

dsnet report table

See etc/README.md for hugo and PHP code for rendering a similar table.

Generating other config files

dsnet currently supports the generation of a wg-quick configuration by default. It can also generate VyOS/Vyatta configuration for EdgeOS/Unifi devices such as the Edgerouter 4 using the wireguard-vyatta package, as well as configuration for NixOS, ready to be added to configuration.nix environment definition. MikroTik RouterOS support is also available.

To change the config file format, set the following environment variables:

  • DSNET_OUTPUT=vyatta
  • DSNET_OUTPUT=wg-quick
  • DSNET_OUTPUT=nixos
  • DSNET_OUTPUT=routeros

Example vyatta output:

configure
set interfaces wireguard wg23 address 10.165.52.3/22
set interfaces wireguard wg23 address fd00:7b31:106a:ae00:f7bb:bf31:201f:60ab/64
set interfaces wireguard wg23 route-allowed-ips true
set interfaces wireguard wg23 private-key cAtj1tbjGGmVoxdY78q9Sv0EgNlawbzffGWjajQkLFw=
set interfaces wireguard wg23 description dsnet

set interfaces wireguard wg23 peer PjxQM7OwVYvOJfORA1EluLw8CchSu7jLq92YYJi5ohY= endpoint 123.123.123.123:51820
set interfaces wireguard wg23 peer PjxQM7OwVYvOJfORA1EluLw8CchSu7jLq92YYJi5ohY= persistent-keepalive 25
set interfaces wireguard wg23 peer PjxQM7OwVYvOJfORA1EluLw8CchSu7jLq92YYJi5ohY= preshared-key w1FtOKoMEdnhsjREtSvpg1CHEKFzFzJWaQYZwaUCV38=
set interfaces wireguard wg23 peer PjxQM7OwVYvOJfORA1EluLw8CchSu7jLq92YYJi5ohY= allowed-ips 10.165.52.0/22
set interfaces wireguard wg23 peer PjxQM7OwVYvOJfORA1EluLw8CchSu7jLq92YYJi5ohY= allowed-ips fd00:7b31:106a:ae00::/64
commit; save

The interface (in this case wg23) is deterministically chosen in the range wg0-wg999. This is such that you can use multiple dsnet configurations and the interface numbers will (probably) be different. The interface number is arbitrary, so if it is already assigned replace it with a number of your choice.

Example NixOS output:

networking.wireguard.interfaces = {
  dsnet = {
    ips = [
      "10.9.8.2/22"
      "fd00:80f8:af4a:4700:aaaa:bbbb:cccc:88ad/64"
      ];
    privateKey = "2PvML6bsmTCK+cBxpV9SfF261fsH6gICixtppfG6KFc=";
    peers = [
      {
        publicKey = "zCDo5yn7Muy3mPBXtarwm5S7JjNKM0IdIdGqoreWmSA=";
        presharedKey = "5Fa8Zc8gIkpfBPJUJn5OEVuE00iqmXnS34v4evv1MUM=";
        allowedIPs = [
          "10.56.72.0/22"
          "fd00:80f8:af4a:4700::/64"
          ];
        endpoint = "123.123.123.123:51820";
        persistentKeepalive = 25;
      }
    ];
  };
};

Example MikroTik RouterOS output:

/interface wireguard
add name=wg0 private-key="CDWdi0IcMZgla1hCYI41JejjuFaPCle+vPBxvX5OvVE=";
/interface list member
add interface=wg0 list=LAN
/ip address
add address=10.55.148.2/22 interface=wg0
/ipv6 address
add address=fd00:1965:946d:5000:5a88:878d:dc0:c777/64 advertise=no eui-64=no no-dad=no interface=wg0
/interface wireguard peers
add interface=wg0 \
    public-key="iE7dleTu34JOCC4A8xdIZcnbNE+aoji8i1JpP+gdt0M=" \
    preshared-key="Ch0BdZ6Um29D34awlWBSNa+cz1wGOUuHshjYIyqKxGU=" \
    endpoint-address=198.51.100.73 \
    endpoint-port=51820 \
    persistent-keepalive=25s \
    allowed-address=10.55.148.0/22,fd00:1965:946d:5000::/64,192.168.10.0/24,fe80::1/64

FAQ

Does dsnet support IPv6?

Yes! By default since version 0.2, a random ULA subnet is generated with a 0 subnet ID. Peers are allocated random addresses when added. Existing IPv4 configs will not be updated -- add a Network6 subnet to the existing config to allocate addresses to new peers.

Like IPv4, it's up to you if you want to provide NAT IPv6 access to the internet; alternatively (and preferably) you can allocate a a real IPv6 subnet such that all peers have a real globally routeable IPv6 address.

Upon initialisation, the server IPv4 and IPv6 external IP addresses are discovered on a best-effort basis. Clients will have configuration configured for the server IPv4 preferentially. If not IPv4 is configured, IPv6 is used; this is to give the best chance of the VPN working regardless of the dodgy network you're on.

Is dsnet production ready?

Absolutely, it's just a configuration generator so your VPN does not depend on dsnet after adding peers. I use it in production at 2 companies so far.

Note that before version 1.0, the config file schema may change. Changes will be made clear in release notes.

Client private keys are generated on the server. Can I avoid this?

Allowing generation of the pub/priv keypair on the client is not yet supported, but will be soon as provision exists within the code base. Note that whilst client peer private keys are generated on the server, they are never stored.

How do I get dsnet to bring the (server) interface up on startup?

Assuming you're running a systemd powered linux distribution (most of them are):

  1. Copy etc/dsnet.service to /etc/systemd/system/
  2. Run sudo systemctl daemon-reload to get systemd to see it
  3. Then run sudo systemctl enable dsnet to enable it at boot

How can I generate the report periodically?

Either with cron or a systemd timer. Cron is easiest:

echo '* * * * * root /usr/local/bin/dsnet report | sudo tee /etc/cron.d/dsnetreport'

Note that whilst report generation requires root, consuming the report does not as it's just a world-readable file. This is important for web interfaces that need to be secure.

This is also why dsnet loads its configuration from a file -- it's possible to set permissions such that dsnet synchronises the config generated by a non-root user. Combined with a periodic dsnet sync like above, it's possible to build a secure web interface that does not require root. A web interface is currently being created by a friend; it will not be part of dstask, rather a separate project.


The dsnet logo was kindly designed by @mirorauhala.

dsnet's People

Contributors

artizirk avatar axelsimon avatar baselsayeh avatar botto avatar f-koehler avatar frillip avatar fs111 avatar herzenschein avatar naggie avatar rbrt-weiler avatar snowb1ind avatar terryburton avatar xsteadfastx avatar xxxserxxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dsnet's Issues

quickstart guide

Cool project! Is there a dsnet quickstart guide? I'm relatively new with wireguard so this could easily be user error, but here are my steps:

Server: Debian Buster

apt -t buster-backports install -y git golang-go iptables iptables-persistent netfilter-persistent

update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

apt -t buster-backports -y install wireguard

mkdir /root/go && export GOPATH=/root/go

git clone https://github.com/naggie/dsnet.git

cd dsnet/cmd

go build dsnet.go

mv dsnet /usr/local/bin

cd /root

mv /root/dsnet/etc/dsnet.service /etc/systemd/system/

rm -rf /root/dsnet

echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/local.conf
sysctl -p /etc/sysctl.d/local.conf

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i dsnet -o eth0 -j ACCEPT

netfilter-persistent save

dsnet init

sed -i 's/"Networks.*/"Networks": ["0.0.0.0\/0"],/' /etc/dsnetconfig.json

systemctl daemon-reload

systemctl start dsnet && systemctl enable dsnet

Running systemctl status dsnet shows no errors. Good so far.

dsnet add banana > dsnet-banana.conf

I fill out the prompts and then copy the contents of dsnet-banana.conf

Client: Ubuntu 20.04

sudo su

apt install -y wireguard

cat > /etc/wireguard/wg0.conf <<EOF
{{{ PASTE CONTENTS OF DSNET-BANANA.CONF ABOVE HERE }}}
EOF

wg-quick up wg0

Wireguard loads the config and I see the wg0 interface in ip a but I can't connect to any internet site and I can't ping the server above.

Thoughts?

Use hostname instead of static IP/IPv6 in generated peer config

Hey there,

the generated peer configuration only contains the external IPv4 address and not the external IPv6 address of the server.
Some ISPs may have a better connectivity using IPv6 than IPv4, because of Carrier Grade NAT.

I think the best solution would be to add a configuration option "UseDomain", which uses the domain specified in the "Domain" configuration option as endpoint in the peer configuration. This way the client will automatically decide if it's using IPv6 or IPv4.

Keep up the great work!

Feature request: Flag for custom IP for "dsnet add"

Sure, one can edit /etc/dsnetconfig.json, set a custom IP address and run "dsnet sync". But it would be nice to have the ability to config a custom IP address when adding new peers. Because auto-assigning the lowest available IP address is not always wanted.

E.g. something like dsnet add myhost --ipv4 10.80.54.100 would be nice.

dsnet install-service

Could install and enable (--now) dsnet.service automatically, copy itself to /usr/local/bin, create a dsnet group with setuid root to enable users in the dsnet group to use it without root.

Acknowledgement of credits for original author

Hi,

In https://github.com/cirello-io/ezwg/commit/89b2f1710da9e680a6ce07e8f22f85ea345b0bdc#r39533635 it seems that you express discomfort with the fact that I forked and renamed my fork.

What I have in mind will make my fork deep differently than your original. Yet, I believe in giving credits to original authors is important and necessary.

I opened an issue to address the problem.

https://github.com/cirello-io/ezwg/issues/1

But, I think you should somehow express here through license changes or some other device what constitutes an acceptable fork or not. The MIT license is a bit vague regarding attribution to end-users. Perhaps, you could opt to slightly stricter license, like Apache v2 that has explicit attribution requirements written down.

Use hostname instead IP

Hello,

is it possible to workaround dynamic IP's by entering some (updated with ddclient) domain name in "ExternalIP" instead of actual IPv4 ?

Can't add networks

Hi, I'm trying to add 0.0.0.0/0 in Networks but it doesn't work. (I've tried with "Networks": "0.0.0.0/0", "Networks": "[0.0.0.0/0]", "Networks": 0.0.0.0/0)
Do you have any advice? Thanks in advance.

Add a packages section to the README

I just packaged dsnet for ArchLinux in the AUR. This builds from the main branch.
Maybe at some point it would be nice to add a section to README.md where we list all the available packaged versions of dsnet for various distributions.

I know due to go the binaries are very portable but sometimes its nice to just install it via a package manager and keep it up to date this way. I have not yet checked if there exist packages for other distributions.

ListenPort limitation

Hi. What are the ports that are allowed to be used in dsnetconfig.json?
I tried using known UDP ports (53,123,etc) but dnsnet errors out.

Due to some experiences ISP throttling wireguard traffic, there is a need to change the wireguard port to something that will not be throttled by ISP.

Is this limitation in dsnet be considered in the next future releases?

Thanks and kind regards.

armv8

Are there any plans for armv8 binaries? Tried to install this onto my odroid-n2 via AUR but said this software wasn't available for my architecture.

Non-interactive use

This could be great to automate setting up configuration for new endpoints, but from what I saw it only works in interactive mode, where it asks you things, and then uses those answers to generate config. Is there a way to run it from a script, without terminal?

dsnet up does nothing

Everything from the tutorial seems to have run without hickup, but dsnet up doesn't appear to do anything. The WG config generated for a peer was good, and the resulting wg-quick up <config> command looks good on the peer. However, on node 0 -- where all of the commands to generate the json config, and the peer WG config was created -- no routing is established:

# dsnet up
# echo $?
0
# dsnet sync
# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         m.n.o.p   0.0.0.0         UG        0 0          0 eth0
m.n.o.0   0.0.0.0         255.255.224.0   U         0 0          0 eth0
m.n.o.0   m.n.o.1   255.255.224.0   UG        0 0          0 eth0
# wg
interface: dsnet
  public key: censored
  private key: (hidden)
  listening port: 51820

peer: censored
  preshared key: (hidden)
  allowed ips: 10.79.56.2/32, censored

peer: censored
  preshared key: (hidden)
  allowed ips: 10.79.56.3/32, censored
# cat /proc/sys/net/ipv4/ip_forward
1

No error, but no network and no information for the wg interface, as if it was never set up. I tried dsnet down and up a few times -- always exit code 0, but no change to the routing that I could detect. The wireguard data toggles in and out. I've made sure the 51820 port is open in the firewall (both TCP and UDP).

As I said, the WG config for the peer imported into wg-quick beautifully and set up the routing correctly.

Node 0 is

  • Linux Arch, kernel 5.15, x86_64
  • wireguard 1.0
  • dsnet 226c61a (Tue May 17 20:52:01 2022)
  • compiled with Go 1.19

Move Config File

Please move the config file, like /etc/dsnet/server.json

For when you add featues (inevitable).

I also have the case where I have many configs to use, so in one path by default is handy for me.

I plan to send PR when not on mobile.

Wrong config output

If you try to use latest master version it creates broken user configs that looks like this :

[Interface]
Address=fd00:c6f2:a99b:d600:b3a1:e77f:2380:14a2/22
Address=<nil>/64
PrivateKey=8KkQ3rxeiP4/rZn9SLYtTelCrmM0DAvoN5bvjp0o6Fs=

[Peer]
PublicKey=knQBLoy6mWFDWL+XukG0MPOwHgGTSZwTFFmsM9MFnCI=
PresharedKey=eOUvrmUWVSy5SxtJ70UzxToRwwV5EuFtS/6HKiKvck4=
Endpoint=<Public IP is fine>:51820
PersistentKeepalive=0
AllowedIPs={{10.144.60.0 fffffc00}}
AllowedIPs={{fd00:c6f2:a99b:d600:: ffffffffffffffff0000000000000000}}

Cant say when it appeared but this commit works.

Checked a few more. Up to this still works.

Client machines can't talk to each other

I tried the following:

  • dsnet init
  • dsnet add x2
  • wg-quick up <my new config> on each client machine (ubuntu 20.04)

The machines connect to the server and can ping the server over the VPN address, and the server can ping the clients, but the clients can't ping each other. Is there something I missed?

automatic adding of routes when additional networks are specified

Currently adding extra routes via Networks is a manual step, unlike the automatically routed allocated IP. Adding (and removing) routes should be performed automatically on sync.

Note that wireguard is already told that a peer has a network via dsnetconfg - it then tells the kernel in turn. Routes must be manually added, for instance

sudo ip route add 10.182.0.0/16 dev dsnet

Unit tests wanted

dsnet has no tests at the moment. I'd really appreciate PRs that add unit tests.

Logo

Just opening this here for logo ideas. I'm no designer/icon kind of person, but would love if someone had ideas and or talent they would love to share.

Ideas I've had for logos so far:

  • A hash/net style (to represent dsnet)
  • Three nodes connected in a v shape

dsnet up fails because default config doesn't populate the ReportFile field

Full error:
Key: 'DsnetConfig.ReportFile' Error:Field validation for 'ReportFile' failed on the 'required' tag - failed to load configuration file
this is with dsnet v.0.7.2.

I'm pretty sure that field used to be filled with a default. In any case, simply making sure the config has something like:

    "ReportFile": "/tmp/dsnetreport.json",

is enough to stop dsnet from complaining and to issue dsnet up successfully.

template for shell script output

Could generate a bash script which internally uses the wg-quick template. The bash script could then delete itself.

Useful to install wireguard, openresolv, save config in correct place with correct permissions and then activate/enable via systemd.

ubuntu-bash-wg-quick

Host aliases

In addition to the hostname, aliases would be useful to support virtual hosting when integrated with dns. The parser should simply check for uniqueness.

Peer name validation to RFC 1123

Peer names should be validated to RFC 1123, as these should be considered hostnames.

Suggest that characters that are not [a-zA-Z0-9\-\.] be either removed entirely or replaced with -, and anything over 63 characters be truncated, and dsnet prompt to confirm the modified name (as default by pressing enter) or user to enter a new one.

DNS doesn't work properly

So I've set up a configuration and have added 0.0.0.0/0 to the networks array. However, when I connect DNS doesn't work -- I can't ping google.com. I've enabled IP forwarding on both IPv4 and IPv6 and have set up unbound as a DNS server, and have pointed my config at that DNS server. But it still doesn't work. I've even tried 8.8.8.8 as a DNS server and no go. What am I doing wrong?

Launch at boot ?

Hi,

I discovered this tools on HN and decided to move all my current config on it.
Everything is working great and smooth. Unfortunately my old /etc/wireguard/wg0.conf is up and running at boot, how can i set it to launch 'dsnet up' at boot instead ?

Thanks.

MOAR IPv6

As wireguard supports IPv6 out the box, so should dsnet... And it does! Sort of...

Currently, a single /128 IPv6 can be added in as a 'Network', and then any IPv6 networks available via that host can be added after that:

{
    "ExternalIP": "DOOOOOOOOOOOOM",
    "ListenPort": 51820,
    "Domain": "root2.news",
    "InterfaceName": "sqrt2news",
    "Network": "172.18.16.0/24",
    "IP": "172.18.16.1",
    "DNS": "172.18.0.1",
    "Networks": [
        "172.18.0.0/16",
        "fdca:9217:f2de:00b1::/64",
    ],
    "ReportFile": "/var/lib/dsnetreport.json",
    "PrivateKey": "WhydoyoualwaysgettoreadthetopstoryMorbo?",
    "Peers": [
        {
        "Hostname": "MORBOS-TELEPROMPTER",
        "Owner": "MORBO",
        "Description": "I WILL DESTROY YOU",
        "IP": "172.18.16.9",
        "Added": "2020-03-12T20:15:42.798800741Z",
        "Networks": [
            "172.18.1.0/24",
            "fdca:9217:f2de:00b1::9/128",
            "fdca:9217:f2de:cf86::/64"
        ],
        "PublicKey": "WORTHLESSHUMANSARENOTPERMITTEDTOVIEWMORBOSMIGHTYPUBLICKEY",
        "PresharedKey": "ALLHUMANSAREVERMININTHEEYESOFMORBO"
        }
    ]
}

To make it more 'official', I propose the adoption of a IP6 attribute, this should be a single /128 IPv6 address, and a Network6 attribute to define the network range.

{
    "ExternalIP": "DOOOOOOOOOOOOM",
    "ListenPort": 51820,
    "Domain": "root2.news",
    "InterfaceName": "sqrt2news",
    "Network": "172.18.16.0/24",
    "Network6": "fdca:9217:f2de:00b1::/64",
    "IP": "172.18.16.1",
    "IP6": "fdca:9217:f2de:00b1::1",
    "DNS": "172.18.0.1",
    "Networks": [
        "172.18.0.0/16",
        "fdca:9217:f2de::/48"
    ],
    "ReportFile": "/var/lib/dsnetreport.json",
    "PrivateKey": "WhydoyoualwaysgettoreadthetopstoryMorbo?",
    "Peers": [
        {
        "Hostname": "MORBOS-TELEPROMPTER",
        "Owner": "MORBO",
        "Description": "I WILL DESTROY YOU",
        "IP": "172.18.16.9",
        "IP6": "fdca:9217:f2de:00b1::9",
        "Added": "2020-03-12T20:15:42.798800741Z",
        "Networks": [
            "172.18.1.0/24",
            "fdca:9217:f2de:cf86::/64"
        ],
        "PublicKey": "WORTHLESSHUMANSARENOTPERMITTEDTOVIEWMORBOSMIGHTYPUBLICKEY",
        "PresharedKey": "ALLHUMANSAREVERMININTHEEYESOFMORBO"
        }
    ]
}

ARMv7 issue

Hello,

is dsnet tested to be working on RPi 4 ?

Currently I have this kernel: Linux wg 5.4.77-1-ARCH #1 SMP PREEMPT Tue Nov 17 20:56:33 UTC 2020 armv7l GNU/Linux

and upon dsnet init I get:

bash: /usr/local/bin/dsnet: cannot execute binary file: Exec format error

Not sure if this is because v7 is not supported or it could be something else..

Never had this issue on x86

Set allowed IP

It always generates configurations with local only allowed IP. Any way for it to default to 0.0.0.0/0?

Post-up and post-down for firewall rules?

Hi,
I may have missed something in the docs, but is there a way to specify either a command or a script to run when starting the wg interface with dsnet, similar to the PostUp and PostDown fields in the wireguard config files?

I'm thinking on the server side, when looking at a basic centralised VPN set-up with multiple clients.

Report file does not contain some newer value keys

Report file is missing the keys ExternalHostname and ExternalIP6 that were recently added to dsnetconfig.json

Sample outputs:
/etc/dsnetconfig.json:

{
    "ExternalHostname": "wireguard.example.com",
    "ExternalIP": "198.51.100.2",
    "ExternalIP6": "fd00:7b31:106a::1",
    "ListenPort": 51820,
    "Domain": "dsnet",
    "InterfaceName": "dsnet",
    "Network": "10.164.236.0/24",
    "Network6": "fd00:7b31:106a:ae00::/64",
    "IP": "10.164.236.1",
    "IP6": "fd00:7b31:106a:ae00::1",
    "DNS": "10.164.236.1",
    "Networks": [
    ],
    "ReportFile": "/var/lib/dsnetreport.json",
...

/var/lib/dsnetreport.json:

{
    "ExternalIP": "198.51.100.2",
    "InterfaceName": "dsnet",
    "ListenPort": 51820,
    "Domain": "dsnet",
    "IP": "10.164.236.1",
    "IP6": "fd00:7b31:106a:ae00::1",
    "Network": "10.164.236.0/24",
    "Network6": "fd00:7b31:106a:ae00::/64",
    "DNS": "10.164.236.1",
    "PeersOnline": 3,
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.