Coder Social home page Coder Social logo

mysteriumnetwork / node Goto Github PK

View Code? Open in Web Editor NEW
1.1K 77.0 306.0 23.28 MB

Mysterium Network Node - official implementation of distributed VPN network (dVPN) protocol

Home Page: https://mysterium.network

License: GNU General Public License v3.0

Go 98.98% Shell 0.91% Makefile 0.01% Dockerfile 0.06% Assembly 0.01% JavaScript 0.01% HTML 0.01% C 0.03%
vpn vpn-server vpn-client vpnfree distributed distributed-systems blockchain golang networking

node's Introduction

Mysterium Node - decentralized VPN built on blockchain

Go Report Card pipeline status codecov GoDoc

Cross-platform software to run a node in Mysterium Network. It contains Mysterium server (node), client API (tequila API) and client-cli (console client) for Mysterium Network.

Currently node supports WireGuard as its underlying VPN transport.

Getting Started

Installation options

Debian / Ubuntu / Raspbian

Install latest stable release:

sudo -E bash -c "$(curl -s https://raw.githubusercontent.com/mysteriumnetwork/node/master/install.sh)"

Or install latest snapshot (development build):

SNAPSHOT=true sudo -E bash -c "$(curl -s https://raw.githubusercontent.com/mysteriumnetwork/node/master/install.sh)"

Service logs:

sudo journalctl -u mysterium-node.service

Service status:

sudo systemctl status mysterium-node.service

Installation script tested on these OSes so far: Raspbian 10, Debian 9, Debian 10, Ubuntu 18.04 and Ubuntu 20.04.

Docker

Our docker images can be found in Docker hub.

To run a node in a docker container you will need docker. On Linux, to manage docker as a non-root user (execute commands without sudo), follow postinstall guide. You should be able to run a node on any OS that supports docker. We have tested it on these OSes so far:

  • Debian 9
  • Debian 10
  • Ubuntu 18.04
  • Ubuntu 20.04
  • Ubuntu 22.04
  • Yocto Linux (BalenaOS)

Run node:

docker run \
  --cap-add NET_ADMIN \
  --net host \
  --name myst -d \
  mysteriumnetwork/myst service --agreed-terms-and-conditions

Access service logs:

docker logs -f myst

Further information

More installation options are described in the installation guides. For possible issues while running a node refer to our Troubleshooting guides.

Built With

  • go - The Go Programming Language
  • gitlab - GitLab CI/CD
  • docker - Containerize applications
  • openvpn - Solid VPN solution
  • wireguard - Extremely simple yet fast and modern VPN
  • geth - Official Go implementation of the Ethereum protocol

Contributing

For a detailed guide, please visit our developer docs.

Core contributors

  • Valdas Petrulis - Lead developer, go evangelist, node bootstrapper - Waldz
  • Tadas Valiukas - Senior developer, experienced bug maker - tadovas
  • Donatas Kučinskas - Senior developer, clean code savvy - donce
  • Antanas Masevičius - Network engineer / developer, net guru - zolia
  • Ignas Bernotas - Senior developer, open source enthusiast - ignasbernotas
  • Dmitry Shihovtsev - Senior developer, devops ninja - soffokl
  • Viktoras Kuznecovas - Senior developer, supersonic typing specialist vkuznecovas
  • Tadas Krivickas - Senior fullstack engineer, CI boss, refactoring fairy tadaskay
  • Jaro Šatkevič - Senior developer, micro-payments researcher, crypto maniac chompomonim
  • Andzej Maciusovič - Senior developer, disciplined world changer anjmao
  • Mantas Domaševičius - Senior fullstack engineer, always ready for pair programming mdomasevicius
  • Tomas Mikalauskas - Backend developer, golang lover, payment guru tomasmik
  • Vlad Iarmak - Protocol architect, networking guru, inexhaustible RFC writer Snawoot

See also full list of contributors who participated in this project.

License

This project is licensed under the terms of the GNU General Public License v3.0 (see details).

node's People

Contributors

andrey-mysterium avatar anjmao avatar antaveiv avatar chompomonim avatar creotiv avatar dependabot[bot] avatar donatas-mn avatar donce avatar eugenegoncharuk avatar guillembonet avatar ignasbernotas avatar interro avatar mdomasevicius avatar otkd avatar redhatua avatar scruffypants avatar shroomist avatar snawoot avatar soffokl avatar tadaskay avatar tadovas avatar tcharding avatar tomasmik avatar tzununbekov avatar vkuznecovas avatar waldz avatar yeszhanov95 avatar zensey avatar zolia avatar zyfdegh 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  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

node's Issues

Ubuntu 16.04 Node Failing to Start

Some error seems to occur when starting the node via the service command. I get the following output from 'service mysterium-node status'.

`● mysterium-node.service - Server for decentralised VPN built on blockchain
Loaded: loaded (/lib/systemd/system/mysterium-node.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2017-05-17 20:17:26 UTC; 9min ago
Docs: https://mysterium.network/
Process: 1312 ExecStart=/usr/bin/mysterium_server ${DAEMON_OPTS} (code=exited, status=1/FAILURE)
Main PID: 1312 (code=exited, status=1/FAILURE)
CPU: 0

May 17 20:17:26 ip-10-0-1-183 systemd[1]: Started Server for decentralised VPN built on blockchain.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Main process exited, code=exited, status=1/FAILURE
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Unit entered failed state.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Failed with result 'exit-code'.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Service hold-off time over, scheduling restart.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: Stopped Server for decentralised VPN built on blockchain.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Start request repeated too quickly.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: Failed to start Server for decentralised VPN built on blockchain.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Unit entered failed state.
May 17 20:17:26 ip-10-0-1-183 systemd[1]: mysterium-node.service: Failed with result 'exit-code'.
`

Are there any log files I can look at so see if I can find the root of the failure. The status is not very descriptive.

Add a Makefile for convenience

Makefile will make it easier to build, run and test Mysterium, faster.

It may support subcommands with the following functions:

  • Build Mysterium client (golang binary)
  • Build Mysterium server (golang binary)
  • Run Mysterium client (golang binary)
  • Run Mysterium server (golang binary)
  • Build Mysterium client (Docker image)
  • Build Mysterium server (Docker image)
  • ...

What do you think?

400 BAD REQUEST ON macOS

Hello, some issues need help.

Node is running well, with Ubuntu 17.04.

Client is macOS 10.12.5, when I run this command

chmod +x mysterium_client_osx_amd64
sudo ./mysterium_client_osx_amd64 --node=[THE NODE KEY]

It responses:

Server response invalid: 400 BAD REQUEST

What's wrong with it?

Fix syntax error in Dockerfile

When I clone this repo and execute

docker-compose build

Output

Building mysterium-node
ERROR: Dockerfile parse error line 11: Unknown instruction: &&

So in file Dockerfile-mysterium-node and Dockerfile-mysterium-client, there are syntax mistakes.

I'll put a PR to fix this.

Docker host requires additional iptables NAT rule

Running mysterium-node as a Docker container will cause connected clients to be without WAN access if an additional iptables NAT rule is not specified.

Docker host should add the following NAT rule to iptables:
sudo iptables --table nat -A POSTROUTING -o eth0 -s 10.8.0.0/16 -j MASQUERADE

(Replace eth0 with your WAN interface if it differs)

The mysterium-node container should then be restarted and connected clients will now have WAN access.

Payments. Provider constantly notifies current Consumer's balance

IN ORDER TO be up-to-date
AS A Service Consumer
I WANT TO I want to know what is my remote balance

Acceptance Criteria:

  • Provider tells your Consumer's current Balance to Consumer
  • To calculate Consumer’s Balance(=Promised amount - Used amount) of usage Myst/second measurement unit is being used.

ARM64 build for node

Dear devs,

would it be possible to make and a deb package for arm64 available ?

The armhf achitecture raises and error when installed on an arm64 ubuntu:

root@sleepy:~# sudo dpkg --install mysterium-node_linux_armhf.deb 
dpkg: error processing archive mysterium-node_linux_armhf.deb (--install):
 package architecture (armhf) does not match system (arm64)
Errors were encountered while processing:
 mysterium-node_linux_armhf.deb

cheers,
Romain

Tequilapi. Add endpoints for service management

Acceptence criteria:

  • Tequilapi create service endpoint must start VPN server
  • Tequilapi endpoints returns status DTO after starting VPN server
  • myst service subcommand starts servise thru Tequilapi
  • CLI demo subcommand service start starts service thru Tequilapi

Tasks:

  • Refactor CLI flag bootstraping #329
  • Convert Service.Manager from CLI command to Service #730
  • Move myst service subcommand to Tequilapi endpoint POST /service #731
  • Tequilapi endpoints POST /service returns status DTO #732
  • CLI demo subcommand service start starts service thru Tequilapi #733

mysterium_client Windows support


1494404404828864400 [Info] [Mysterium.api] Created new session: yy0yhkwcxa
1494404405131598800 [Info] [client-managemnet] Connecting to socket:./openvpn-management-eylqda14ve.sock
1494404405168708100 [Error] [client-managemnet] listen unix ./openvpn-management-eylqda14ve.sock: socket: An address incompatible with the requested protocol was used.listen unix ./openvpn-management-eylqda14ve.sock: socket: An address incompatible with the requested protocol was used.

Payments. Consumer issues new promise

IN ORDER TO perform payment for service
AS A Service Consumer
I WANT TO send signed Promise to pay Provider for service

Acceptance Criteria:

  • Issue new signed(with PK) promise to start receiving data from Provider
  • Send promise to Provider via CommunicationChannel

Not included in this story’s scope:

  • Extending old Promise as the balance is depleted
  • Node accepts it without checking validity

Statistics. SPIKE - Define model for Session metering notifications

h2 User story
IN ORDER TO know how Provider is charging for Service
AS A Service Consumer
I WANT TO get all session metering & payment notifications from Provider

h2. Acceptance Criteria

  • Double-check white-paper architecture about metering notifications
  • Define data model/structure in code
  • Describe scope for story #352
  • Create other stories if needed

h2. Later

  • Consumer checks if he is knows same price for Service???

Mint MYST through Wallet

As a developer
In order to make MYST minting on Devnet and Testnet easier and faster
I want to have MYST minting in mysterium's Wallet website

Acceptance criteria:

  • show minting functionality in wallet.mysterium.network when it detects the main contract account(eth address) in Metamask was unlocked

Server response invalid: 400 BAD REQUEST

I start a node, but HOW CAN I USE IT in my client side??

[root@localhost mysterium]# ./mysterium_client  --node=<NODE_KEY>
Server response invalid: 400 BAD REQUEST

Fix a loop error

I think there is a loop error in file openvpn/utils.go,

for i := 0; i < 10000; i++ {
	filePath = directory + "/" + filePrefix + randomString(10, finenameCharset) + fileExtension
	if _, err := os.Stat(filePath); os.IsExist(err) {
		continue
	}
}

This will run 10000 times whenever the temp file exists or not.

I guess your original idea is generating a non-duplicated temp file path , is it?

If so, an else clause is needed and a break should be in the else case.

Or simply

for i := 0; i < 10000; i++ {
	filePath = directory + "/" + filePrefix + randomString(10, finenameCharset) + fileExtension
	if _, err := os.Stat(filePath); os.IsNotExist(err) {
		break
	}
}

Which ports are used by nodes?

Hi,

I need to setup port forwarding so my node (which is behind router) can be discovered and used. Unfortunatelly I couldn't find any information regarding which port(s) are used. So far I set up forwarding for 1194 (which I saw in docker setup). Is it enough or I need to have more (e.g. I saw that node is listening on 123)? Thank you!

Payments. Consumer replies to balance sent by Provider

IN ORDER TO responde to Service Provider’s balance message sent
AS A Consumer
I WANT TO reply with proper response

h2. Acceptance Criteria

  • Consumer replies with “balance recieved”
  • Constumer replies with “balance_error”

h2. Later
Myst-19 will do “Constumer replies with “updated promise”

Can I run a node from the US Virgin Islands?

Hi there, I just installed a mysterium node on a local debian virtual machine via docker. The installation went smooth, no errors. But when I try to run the node with sudo docker start mysterium-node I just get one line back, "mysterium-node", and I'm back to a prompt.

What should happen when I start a node? It would be helpful to know this for diagnostics.

Below is my log. The last line says "failed to resolve country" ...is this because I'm in the US Virgin Islands or should I change my vm's network settings (currently using Bridged Adapter)?

Tx :)

2018-07-19T17:21:03.595116791 [Info] User agreed with terms & conditions: true
2018-07-19T17:21:03.595475849 [Info] Starting Mysterium Server (source.dev-build)
2018-07-19T17:21:03.601879896 [Info] [Openvpn check] OpenVPN 2.4.4 x86_64-alpine-linux-musl [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Nov 23 2017
2018-07-19T17:21:03.6018917 [Info] [Openvpn check] library versions: LibreSSL 2.5.5, LZO 2.10
2018-07-19T17:21:03.60189482 [Info] [Openvpn check] Originally developed by James Yonan
2018-07-19T17:21:03.601897446 [Info] [Openvpn check] Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <[email protected]>
2018-07-19T17:21:03.601900222 [Info] [Openvpn check] Compile time defines: enable_async_push='no' enable_comp_stub='no' enable_crypto='yes' enable_crypto_ofb_cfb='yes' enable_debug='yes' enable_def_auth='yes' enable_dlopen='unknown' enable_dlopen_self='unknown' enable_dlopen_self_static='unknown' enable_fast_install='yes' enable_fragment='yes' enable_iproute2='yes' enable_libtool_lock='yes' enable_lz4='yes' enable_lzo='yes' enable_management='yes' enable_multihome='yes' enable_pam_dlopen='no' enable_pedantic='no' enable_pf='yes' enable_pkcs11='no' enable_plugin_auth_pam='yes' enable_plugin_down_root='yes' enable_plugins='yes' enable_port_share='yes' enable_selinux='no' enable_server='yes' enable_shared='yes' enable_shared_with_static_runtimes='no' enable_small='no' enable_static='yes' enable_strict='no' enable_strict_options='no' enable_systemd='no' enable_werror='no' enable_win32_dll='yes' enable_x509_alt_username='no' with_crypto_library='openssl' with_gnu_ld='yes' with_mem_check='no' with_sysroot='no'
2018-07-19T17:21:04.320029562 [Info] [NATS.DialogWaiter] Connecting to: &discovery.AddressNATS{servers:[]string{"nats://testnet-broker.mysterium.network:4222"}, topic:"0x43b613804824233579b2d0533306b8a90be68a00", connection:nats.Connection(nil)}
2018-07-19T17:21:06.071625642 [Info] [ipify.api] IP detected: ###.###.###.###
2018-07-19T17:21:06.071821028 [Info] [Detect Outbound IP] IP detected: 192.168.0.111
2018-07-19T17:21:06.074410632 [Info] [nat] Stopped forwarding packets from '10.8.0.0/24' to IP: 192.168.0.111
failed to resolve country

Node supports several clients at same time

@unicrus Slack:
Looks like now mysterium node uses the same certificate for all clients. Which makes impossible to handle more than 1 client since 'duplicate-cn' is not enabled.

I tried to connect on 2 devices via openvpn client using client.ovpn generated by mysterium client. They stucks when both are connected.

Then inspected mysterium sources and found it always uses the same certificates for client config (see command.go).

E2E tests. Creates provider identity before starting VPN server

This is unfinished work from #323

After we move move myst service -> to Tequilapi POST /service with evetyhing on API it will be more flexible.

And now it's hacks in E2E tests and needs to start VPN service node 2 times:

  1. mysterium run - start node with API
  2. Tequilapi.IdentityCreate() - create identity 0x1
  3. mysterium service --identity 0x1 - start serving with newly created identity 0x1

Acceptance criteria:

  • E2E tests creates identity thru Tequilapi
  • E2E tests unlocks identity thru Tequilapi
  • E2E tests paid for new identity
  • E2E tests starts providing service via endpoint POST /service

SPIKE kill switch

In order to for a customer to be sure that his traffic will not leak via unsecured (no vpn) link
As I customer, I want to be able to turn on kill switch effectively stopping all traffic if VPN connection becomes unavailable.

Opensource build scripts

How to build mysterium-node to *.deb packages and binaries like linux_arm?

Any idea on making those build scripts public?

SPIKE: protocols compatible with mobile

In order to deliver mysterium VPN on mobile platforms
As a developer
I want to have well supported VPN protocols on iOS and Android

Investigate existing mobile supported VPN protocols and suggest next protocol to implement on a node.
Investigate if they can be integrated (especially authorisation) with our framework.

Paid identity POC

  1. Lets do initial Payment flow
  2. Lets test UX of Paid ID idea with Users
  3. Lets have Sybil protection

In order to protect system from Sybil attacks
As a network
I want to force users create and pay for Identity

Acceptance criteria:

  • Check Identity is registered on blockchain
  • Generate registration data
  • Send transaction to register Identity(outside the network)

Promise engine

GOAL

IN ORDER to: Test Payments (in tokens) between VPN Providers and Consumers
WE, as an: Organization
WANT to: launch proof of concept of Mysterium Payment system

Steps:

  1. Consumer connects to Provider
  2. Provider promises (certain amount of traffic, cost, speed)
  3. Consumer promises (to pay for Node services certain cost)
  4. Client uses Provider's traffic
  5. Consumer pays to Provider
  6. Provider clears promises

GoLint?

Whats the project's stance on golint and comments?

So far from a casual glance I'm not seeing any comments or golint compliant source files. These things are much easier to add up front than backfilling and opens up the source to more devs who can follow along in the codebase.

thx

Payments. Provider closes session on empty balance

IN ORDER TO save bandwidth from dead/insolvent Consumers and provide it to others
AS A Service Provider
I WANT TO check if Consumer is alive and has sufficient balance for service, if not close the session.


h2. Acceptance Criteria

  • Provider closes session on empty balance
  • Provider closes session when no message “Balance_recieved” received from Consumer after sending Balance message
  • Provider gracefully shuts down session(“session_close”)

Can the addresses in .env be passed at runtime?

Question

Do the URL MYSTERIUM_API_URL and NATS address NATS_SERVER_IP be set at runtime like this?

docker run -e MYSTERIUM_API_URL=XXX -e NATS_SERVER_IP=XXX

Issue

Currently, if we set .env like below and build the server(Mysterium Node) image.

MYSTERIUM_API_URL=https://api.mysterium.network/
NATS_SERVER_IP=127.0.0.1

And then run the image on the server, an error will occur

2018-04-12T03:40:51.04043973 [Info] [openvpn binary check] Process exited with error: exit status 1
2018-04-12T03:40:53.998814509 [Error] [Mysterium.api] Post https://api.mysterium.network//identities: dial tcp: lookup api.mysterium.network on 8.8.8.8:53: no such host
Post https://api.mysterium.network//identities: dial tcp: lookup api.mysterium.network on 8.8.8.8:53: no such host

I know I should replace api.mysterium.network with my own API server, but I need to rebuild the server image after I create a Mysterium API server. How to solve it? Can we pass the addresses at the runtime?

Installation Link & Download

I can't find the download link for Ubuntu and all the installation guides have broken links.

Can this work with a standard vps or is true cloud needed?

Lots of spelling issues with online scanning

By using Go Report Card site scanning, there are lots of spelling issues in the source codes.

https://goreportcard.com/report/github.com/MysteriumNetwork/node

misspell96%
Misspell Finds commonly misspelled English words
node/cmd/commands/cli/command_cli.go
Line 327: warning: "occured" is a misspelling of "occurred" (misspell)
node/cmd/commands/server/factory.go
Line 122: warning: "overriden" is a misspelling of "overridden" (misspell)
Line 126: warning: "publicaly" is a misspelling of "publicly" (misspell)
Line 127: warning: "probaly" is a misspelling of "probably" (misspell)
node/client/connection/manager.go
Line 181: warning: "depencency" is a misspelling of "dependency" (misspell)
node/client/connection/manager_test.go
Line 206: warning: "instanse" is a misspelling of "instances" (misspell)
node/openvpn/management/connection_mock.go
Line 39: warning: "expectes" is a misspelling of "expects" (misspell)
node/openvpn/state.go
Line 41: warning: "successfuly" is a misspelling of "successfully" (misspell)
node/openvpn/discovery/dto/payment_method_per_bytes.go
Line 25: warning: "transfered" is a misspelling of "transferred" (misspell)
Line 28: warning: "transfered" is a misspelling of "transferred" (misspell)
node/metadata/build_info.go
Line 19: warning: "overriden" is a misspelling of "overridden" (misspell)
node/tequilapi/http_api_server.go
Line 44: warning: "addres" is a misspelling of "address" (misspell)
node/utils/cancelable.go
Line 37: warning: "succeded" is a misspelling of "succeeded" (misspell)
Line 64: warning: "immediatelly" is a misspelling of "immediately" (misspell)

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.