Skip to content

Smolkar/WireGuard_Surf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WireGuard_Surf

It is not ready yet! I haven’t implemented the configuration of the DNS’s, Authentication etc.

This project has been tested on Ubuntu! As well as make sure UDP port 51820 is open

SETTIN UP SERVER

How to:

On a Ubuntu server:

sudo -s

apt-get update

apt-get upgrade

Installing latest Go tools:

wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz

`tar -C /usr/local -xzf go1.14.2.linux-amd64.tar.gz'

'rm go1.14.2.linux-amd64.tar.gz`

Set-up Go global variables

Edit .bashrc

nano ~/.bashrc

Add those lines, at the bottom of the file:

#Go

export PATH=$PATH:/usr/local/go/bin

export GOBIN=$GOPATH/bin

Save and exit.

source ~/.bashrc

Test if go is successfully installed by executing:

'go version'

Getting WireGuard

sudo add-apt-repository ppa:wireguard/wireguard

sudo apt-get update

sudo apt-get install wireguard

Test if WireGuard is successfully installed.

wg version

Clone WireGuard_Surf

git clone https://github.com/Smolkar/WireGuard_Surf.git

Navigate to the project folder and install dependencies

cd WireGuard_Surf

go get

Building and running

go build

./WireGuard_Surf

And you can stop it: ctrl+c

Set up NAT (manually, as much as i would want to do that automatically for conveninence it is not working yet )

!!! "ens3" is my primary network interface. Make sure you modify it with your primary network name ( you can check this by typing the command - ifconfig - the first result is your interface. !!!

iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o ens3 -j MASQUERADE

Write down server pubic key. Or you can check it up later in “conf” file in the main folder.

On your PC/MAC:

Download WireGuard Client

MAC —-> https://apps.apple.com/bg/app/wireguard/id1451685025?mt=12

Windows ——>https://www.wireguard.com/install/

In the client create a new empty tunnel with the following script.

[Interface]

PrivateKey = xxxxxxxxxxxxxx=

Address = 10.0.0.2/32

DNS = 8.8.8.8

[Peer]

PublicKey = <server_public_key>

AllowedIPs = 0.0.0.0/0

Endpoint = <server_ip>:51820

Save your client public key. And close the tunnel configuration dialog.

Now when everything is done- open the config file on the server and edit it by adding the first user(you). I am providing the format of the configuration file. The first two parameters are the SERVER PRIVATE AND PUBLIC KEY so don't change that, except if you want to use different once. You just need to add the "public_key" (which can be found benaeth "name" and "private_key") which you have saved previously from the client. Also, you can keep "private_key" of the client empty.

{ "PrivateKey": "xxxxxxxxxxxxxxxx=",

"PublicKey": "xxxxxxxxxxxxxxxx=",

"Users": {

"anonymous": {

"Name": "anonymous",

"Clients": {

"1": {

"name": "Some_name",

"private_key": "",

"public_key": "xxxxxxxxxxx=",

"ip": "10.0.0.2",

"created": "2020-05-26T18:40:59Z",

"modified": "2020-05-26T18:40:59Z",

"info": ""

}

}

}

}

}

Save the configuration and exit. Run the application:

./WireGaurd_Surf

Set up NAT (manually, as much as i would want to do that automatically for conveninence it is not working yet )

!!! "ens3" is my primary network interface. Make sure you modify it with your primary network name ( you can check this by typing the command - ifconfig - the first result is your interface. !!!

iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o ens3 -j MASQUERADE

Write down server pubic key. Or you can check it up later in “conf” file in the main folder.

Activate your tunnel from the application on your PC.

And you are connected!

I have commented in the source code the endpoints for getting clients or creating such because they don’t work properly……yet.

List of API endpoints

Method URI

[GET] 10.0.0.1/identify

[GET] 10.0.0.1/WG/API/anonymous/clients - Lists all of the clients of the user.

[GET] 10.0.0.1/WG/API/anonymous/clients/1 - Shows the first client of the user. ("1" is the id of the client)

[POST] 10.0.0.1/WG/API/anonymous/clients <----BODY(json): {"Name": "Some_name", "Info": "Some_info"} - Creates client config with some name and some info. For now it genereates both the private key and the public as well as it assignes an IP.

[PUT] 10.0.0.1/WG/API/anonymous/clients/1 <----BODY(json): {"Name": "Some_name", "Info": "Some_info"} - Updates client config with some_name and some info.

[DELETE] 10.0.0.1/WG/API/anonymous/clients/1 - Deletes an user.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages