Git Product home page Git Product logo

radvpn's Introduction

Decentralized VPN

Build Status Go Report Card GoDoc

Alt text

The RadVPN doesn't need any central point as it connects to other nodes directly (full mesh) it has built-in router that helps packets to route to the approperate destinations. there are two options for configuration: yaml file and if you want to have central configuration management it supports etcd. for the time being it supports symmetric encryptions and Linux platform.

Build

Given that the Go Language compiler (version 1.11 or greater is required) is installed, you can build it with:

go get github.com/mehrdadrad/radvpn
cd $GOPATH/src/github.com/mehrdadrad/radvpn
go build .

Docker

docker pull mehrdadrad/radvpn:latest
docker run --privileged -d -p 8085:8085 -v $(pwd)/radvpn.yaml:/etc/radvpn.yaml -e RADVPN_NODE_NAME=node1 mehrdadrad/radvpn:latest

Basic Config

With the default it tries to load config.yaml file individually at each node, but it can be configured to use same configuration through etcd. Once the configuration is changed, it loads and applies new changes by itself. Below yaml is a sample configuration:

Alt text

revision: 1

crypto:
  type: gcm
  key: 6368616e676520746869732070617373776f726420746f206120736563726574

nodes:
  - node:
      name: node1
      address: 8.121.55.10
      privateAddresses:
        - 10.0.1.1/24
      privateSubnets:
        - 10.0.1.0/24
  - node:
      name: node2
      address: 84.12.92.45
      privateAddresses:
        - 10.0.2.1/24
      privateSubnets:
        - 10.0.2.0/24        

Run

radvpn -config radvpn.conf 

Configuration keys

  • revision - the watcher works based on the revision number; once it increased, the configuration will be loaded immediately
  • server
    • keepalive - frequency duration of radvpn-to-radvpn ping to check if a connection is alive (default is 10 seconds)
    • insecure - disable encryption (default is false)
    • mtu - sets the mtu of the tunnel interface
    • maxworkers - sets number of concurrent workers (read/write to/from tunnel concurrently)
    • address - sets ip address and ports (format : ip:port)
    • name - sets the name of the current node
  • crypto
    • type
      • gcm - galois/counter mode
      • cbc - cipher block chaining
    • key - secret key
  • etcd
    • endpoints - sets the etcd endpoints
    • timeout - sets etcd endpoints timeout
  • nodes
    • node
      • name - node's name
      • address - node's external ip address
      • privateAddresses - sets private address(es) on the tunnel interface
      • privateSubnets - sets reachable subnet(s) from currect node

Configuration with etcd

Alt text

sample configuration

Run with etcd

radvpn -config radvpn.conf -etcd

Update etcd from yaml file

radvpn -update etcd -config radvpn.yaml

License

This project is licensed under MIT license. Please read the LICENSE file.

Contribute

Welcomes any kind of contribution, please follow the next steps:

  • Fork the project on github.com.
  • Create a new branch.
  • Commit changes to the new branch.
  • Send a pull request.

radvpn's People

Contributors

mehrdadrad avatar ukd1 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  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

radvpn's Issues

Status of the project

What is the status of this project?

It was not clear to me whether is it a spike or an already functioning code, maybe in production without any specific problems.

I was wondering whether you would like to accept some code changes & bug fixes, or the project is abandoned?

FreeBSD Support?

Trying to compile on FreeBSD results in:

root@testrouter1:~/radvpn # go build .
go: downloading github.com/vishvananda/netlink v1.0.0
go: downloading go.etcd.io/etcd v3.3.17+incompatible
go: downloading github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b
go: downloading golang.org/x/sys v0.0.0-20191104094858-e8c54fb511f6
go: downloading gopkg.in/yaml.v2 v2.2.4
go: extracting github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b
go: extracting gopkg.in/yaml.v2 v2.2.4
go: extracting golang.org/x/sys v0.0.0-20191104094858-e8c54fb511f6
go: extracting github.com/vishvananda/netlink v1.0.0
go: downloading github.com/vishvananda/netns v0.0.0-20190625233234-7109fa855b0f
go: extracting github.com/vishvananda/netns v0.0.0-20190625233234-7109fa855b0f
go: extracting go.etcd.io/etcd v3.3.17+incompatible
go: downloading github.com/coreos/etcd v3.3.17+incompatible
go: downloading github.com/google/uuid v1.1.1
go: downloading go.uber.org/zap v1.12.0
go: extracting go.uber.org/zap v1.12.0
go: extracting github.com/google/uuid v1.1.1
go: downloading google.golang.org/grpc v1.24.0
go: extracting google.golang.org/grpc v1.24.0
go: downloading go.uber.org/multierr v1.3.0
go: extracting go.uber.org/multierr v1.3.0
go: downloading golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: extracting golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: extracting github.com/coreos/etcd v3.3.17+incompatible
go: downloading go.uber.org/atomic v1.5.0
go: downloading github.com/golang/protobuf v1.3.2
go: downloading google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: downloading github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: downloading github.com/gogo/protobuf v1.3.1
go: downloading github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
go: extracting github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: downloading golang.org/x/text v0.3.0
go: extracting github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
go: extracting golang.org/x/text v0.3.0
go: extracting github.com/gogo/protobuf v1.3.1
go: extracting go.uber.org/atomic v1.5.0
go: extracting github.com/golang/protobuf v1.3.2
go: extracting google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding github.com/songgao/water v0.0.0-20190725173103-fd331bda3f4b
go: finding github.com/vishvananda/netlink v1.0.0
go: finding go.etcd.io/etcd v3.3.17+incompatible
go: finding gopkg.in/yaml.v2 v2.2.4
go: finding golang.org/x/sys v0.0.0-20191104094858-e8c54fb511f6
go: finding github.com/vishvananda/netns v0.0.0-20190625233234-7109fa855b0f
go: finding github.com/coreos/etcd v3.3.17+incompatible
go: finding google.golang.org/grpc v1.24.0
go: finding github.com/gogo/protobuf v1.3.1
go: finding github.com/google/uuid v1.1.1
go: finding github.com/golang/protobuf v1.3.2
go: finding go.uber.org/zap v1.12.0
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
go: finding go.uber.org/atomic v1.5.0
go: finding github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
go: finding go.uber.org/multierr v1.3.0
go: finding golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: finding golang.org/x/text v0.3.0
# github.com/mehrdadrad/radvpn/config
config/config.go:178:40: undefined: netlink.FAMILY_ALL
root@testrouter1:~/radvpn # 

Possible Padding Oracle vulnerability

The unpadding function treats wrong and correct padding differently. Because the CBC mode is malleable an attacker can change the decrypted plaintext when modifying the IV (or the block before the targeted block). The order of blocks can be changed, too.

If an attacker is able to distinguish these two cases (e.g. via timing channels or length of returned array) of valid and invalid padding it is possible to decrypt ciphertexts without knowing the key.

For more information see TLS-Padding-Oracles from RUB or this question on crypto.stackexchange

There are options to make the CBC mode more secure against this kind of POA, but to mitigate this an authenticated encryption scheme should be used.

radvpn/crypto/cbc.go

Lines 90 to 96 in b5bb965

if padLen > bLen || padLen > aes.BlockSize {
return b, errors.New("invalid padding size")
}
for _, p := range b[bLen-padLen : bLen-1] {
if p != pad {
return b, errors.New("invalid padding")

Issue while trying to compile

Getting:

dreadnought:~ david$ go get github.com/mehrdadrad/radvpn/
# github.com/mehrdadrad/radvpn/config
go/src/github.com/mehrdadrad/radvpn/config/config.go:178:40: undefined: netlink.FAMILY_ALL

Under macOS.

Go get fail.

[root@yisu-5eaa4bd3d3d82 ~]# go get https://github.com/mehrdadrad/radvpn
package https:/github.com/mehrdadrad/radvpn: https:/github.com/mehrdadrad/radvpn: invalid import path: malformed import path "https:/github.com/mehrdadrad/radvpn": invalid char ':'
[root@yisu-5eaa4bd3d3d82 ~]# go version
go version go1.13.6 linux/amd64

Missing docker image

Looks like the image radvp is not available in the dockerhub registry:

# sudo docker run --privileged -d -p 8085:8085 -v $(pwd)/radvpn.yaml:/etc/radvpn.yaml -e RADVPN_NODE_NAME=node1 radvp
Unable to find image 'radvp:latest' locally
docker: Error response from daemon: pull access denied for radvp, repository does not exist or may require 'docker login'.

The radvpn image also does not exist (assuming a typo there) ๐Ÿ˜„

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.