Miniature is an vpn server and client written in go. Miniature uses songao's water library under the hood.
Setup
git clone https://github.com/devGenie/miniature
cd miniature
export GO111MODULE=on
go mod init github.com/devgenie/miniature
To build and run the VPN server
go build ./cmd/server
./server run -config=/etc/miniature/config.yml
-config
is the path to the VPN server's configuration file, the VPN server's configuration file looks like;
certificatesdirectory: /etc/miniature/certs
network: 10.2.0.0/24
listeningport: 4321
publicip: 172.18.0.2
dnsresolvers:
- 1.1.1.1
You can also start the server using ./server run
. This will use the default path to the configuration file (/etc/miniature/config.yml
)
To create a client configuration file
./server newclient --config=/etc/miniature/config.yml
-config
is the path to the server configuration file, you can also create the client configuration file using ./server newclient
, this uses the server's default path to the configuration file, in this case which is /etc/miniature/config.yml
To build and run the VPN client:
go build ./cmd/client
./client -config=/etc/miniature/config.yml
-config
is used to specify the path to the client configuration file. If this command line switch is not provided, the client will use the default path which is /etc/miniature/config.yml
. The config file looks like an example below:
serveraddress: 172.2.2.2
listeningport: 4321
certificate: |
-----BEGIN CERTIFICATE-----
MIIDwDCCAqigAwIBAgIIEt8f19aYOP4wDQYJKoZIhvcNAQELBQAwcDEPMA0GA1UE
BhMGVWdhbmRhMQkwBwYDVQQIEwAxCTAHBgNVBAcTADEJMAcGA1UECRMAMQkwBwYD
VQQREwAxEjAQBgNVBAoTCUdlbmllTGFiczEJMAcGA1UECxMAMRIwEAYDVQQDEwlH
ZW5pZUxhYnMwHhcNMTkwNzAyMjMyMjAwWhcNMjQxMjA3MjMyMjAwWjBwMQ8wDQYD
VQQGEwZVZ2FuZGExCTAHBgNVBAgTADEJMAcGA1UEBxMAMQkwBwYDVQQJEwAxCTAH
BgNVBBETADESMBAGA1UEChMJR2VuaWVMYWJzMQkwBwYDVQQLEwAxEjAQBgNVBAMT
CUdlbmllTGFiczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKsjiB4T
IZb5muzLVRCWf3Z1f7kub4l9/psyLL6FyOfdjvdbOP+fc1XxFd40G2fROFCAiZOw
2SFg/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TSm7e14KsnXHEeuJRPKtOrgqqrxcgfswQfcZJEwNaUFCa
npuJiEXMky3FutAbLPJJfKinWKoUAqSOAxdC/ra0AxQLJbSQ9AXll2tGVKxPxwQ0
lLjFxQKBgQCUkn1Y2yad4fLb+prcurtuIwBSqpXt/eX/SmT87b0G50VPR0vZQzNw
v7tHAZear2HgMdM8s4c2h6Ye+hBDssEqg9TP6JrXcmXUOG8UST4w3PF8DPtJH/Vr
bKLdmSN6GJJcT7lcwtXYNA6/ygkuMzySfBPLItkHQ+yPI9b2P8YKGA==
-----END RSA PRIVATE KEY-----
To generate a config file like the one above, run ./server newclient --config=/etc/miniature/config.yml
Note
At the moment, the VPN server runs on only linux, plans are to port it to windows sometime. At the moment, it is not possible to port it to OSX because of the limitations in configuring the tun interfaces
The client has only been tested only on linux at the moment.Plans are to port it to both osx and windows in the future.
Note
Development has been done on Linux, if you don"t have a linux machine, you can use docker containers to run a dev environment. Right now, it is not possible to develop the server on OSX. This has not been tested on windows yet.
The docker containers have to be run in privelege mode to make this work as expected.
docker network create miniature
docker build -t miniature .
docker run -dit --mount type=bind,source="$(pwd)",target=/miniature --privileged --name miniature-server --network miniature miniature
//mount the current working directory to so that the changes made in you code editor are available inside the docker containers
docker run -dit --mount type=bind,source="$(pwd)",target=/miniature --privileged --name miniature-client1 --network miniature miniature
docker run -dit --mount type=bind,source="$(pwd)",target=/miniature --privileged --name miniature-client2 --network miniature miniature
Todo
-
Encryption/ Decryption
-
Authentication
-
Compression using LZO
-
Data Fragmentation/ Defragmentation
-
DNS Forwarding