Skip to content

Commit 05ffd89

Browse files
committed
Update document
1 parent ce56d35 commit 05ffd89

File tree

9 files changed

+391
-294
lines changed

9 files changed

+391
-294
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ netifaces = "*"
1414
google-cloud-dns = "*"
1515

1616
[requires]
17-
python_version = "3.8"
17+
python_version = "3"

Pipfile.lock

Lines changed: 120 additions & 97 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,27 @@
3030
- [x] `openresolv`
3131
- [x] `connman`
3232

33+
### How to use
34+
35+
Please read [VPNC README](./cli/python/src/client/README.md)
36+
3337
## VPNC Deployer
3438

3539
![Docker Image Version (latest semver)](https://img.shields.io/docker/v/playio/vpnc-deployer?sort=semver)
3640
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/playio/vpnc-deployer?sort=semver)
3741

42+
The `CLI` tool based on `ansible` and `docker` to mass deploy VPN client on one or many devices/computers.
43+
3844
## VPN DDNS
3945

4046
![Docker Image Version (latest semver)](https://img.shields.io/docker/v/playio/vpnddns?sort=semver)
4147
![Docker Image Size (latest semver)](https://img.shields.io/docker/image-size/playio/vpnddns?sort=semver)
48+
49+
The `CLI` application syncs every 2 minutes VPN client IP addresses to private Google Cloud DNS:
50+
51+
- DNS zone name for each customer: `device.<customer-code>`
52+
- Device DNS name: `<device-hostname>.device.<customer-code>`
53+
54+
## How to contribute
55+
56+
Please read [SETUP.md](SETUP.md) to setup your environment.

DEV.md renamed to SETUP.md

Lines changed: 85 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,45 @@
1-
# Development
1+
# Setup Development Environment
22

3-
- [scripts](./scripts) folder contains some linux script to build/run `vpnserver`/`vpnc`/`vpnddns` and shared artifact to `vagrant`
3+
- [scripts](./scripts) folder contains some linux script to build/run `vpnserver`/`vpnc`/`vpnddns` and shared artifact
4+
to `vagrant`
45
- [docker](./docker) folder contains a list of `vpnserver`/`vpnc`/`vpnddns` `dockerfile` and `docker-compose`
56

6-
## SoftEther VPN server
7+
## Vagrant
8+
9+
It is used for test VPN client CLI in the specific environment/`OS`.
10+
11+
Use [./scripts/vagrant.sh](./scripts/vagrant.sh) to `up`/`halt`/`destroy`/`status`/`port`/`ssh` one or
12+
multiple `vagrant` boxes. The `vagrant` box parameter is one of folder name in [./vagrant](vagrant)
13+
14+
For example:
15+
16+
```bash
17+
# Up multiple boxes
18+
./scripts/vagrant.sh up ubuntu20 fedora32 debian10
19+
# ssh to one box
20+
./scripts/vagrant.sh ssh ubuntu20
21+
```
22+
23+
## Docker multi arches
24+
25+
- Use `docker` [buildx](https://github.com/docker/buildx/#installing)
26+
- Use `docker` [registry](https://github.com/zero88/gh-registry) to distribute image in local registry
27+
28+
```bash
29+
# Create buildx instance
30+
docker buildx create --append --name multiarch --buildkitd-flags --use '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
31+
docker buildx ls
32+
33+
# Create docker registry as service
34+
docker run -v docker-registry-data:/var/lib/registry -p 5000:5000 --privileged --network host -d --restart always
35+
```
36+
37+
## VPN server
738

839
### Docker
940

41+
[Dockerfile](./docker/dockerfile)
42+
1043
#### Build
1144

1245
2 edition repositories:
@@ -55,52 +88,76 @@ curl -k -X POST -H 'Content-Type: application/json' \
5588
https://localhost:8443/api/
5689
```
5790

58-
## VPN client CLI
91+
## VPN CLI
5992

60-
### Vagrant
93+
### Setup python environment
6194

6295
```bash
96+
## Install pipenv
97+
# By pip/or pip3
98+
pip3 install pipenv
99+
# Debian Buster+:
100+
sudo apt install pipenv
101+
# Fedora/Redhat/centos
102+
sudo dnf install pipenv
103+
104+
# In root project dir
105+
pipenv install
106+
# Join pipenv in virtualenv
107+
pipenv shell
108+
```
109+
110+
### VPN client
111+
112+
#### Build and test
113+
114+
[vpnclient.Dockerfile](cli/python/docker/vpnc.Dockerfile)
115+
116+
```bash
117+
#==========================================================
118+
#### USE VAGRANT ------------------------------------------
63119
# Build VPN Client CLI then copy to vagrant/shared
64120
./scripts/build.vpnc_2_vagrant.sh
65121
# go to any box in vagrant folder then up. Binary file will be synced to /vagrant/playio-vpnc
66122
# with ubuntu20
67-
cd vagrant/ubuntu20 && vagrant up && vagrant ssh
123+
./scripts/vagrant.sh up ubuntu20 && ./scripts/vagrant.sh ssh ubuntu20
68124
# now, it is inside vagrant guest machine, and binary already symlink to /usr/local/bin/playio-vpnc
69125
playio-vpnc version
70-
```
71-
72-
### Docker
73-
74-
#### Setup multiple arch
75-
76-
- Use `docker` [buildx](https://github.com/docker/buildx/#installing)
77-
- Use `docker` [registry](https://github.com/zero88/gh-registry) to distribute image in local registry
78126

79-
```bash
80-
# Create buildx instance
81-
docker buildx create --append --name multiarch --buildkitd-flags --use '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host'
82-
docker buildx ls
127+
#==========================================================
128+
#### USE DOCKER -------------------------------------------
129+
# build amd64 arch
130+
./scripts/docker.vpntool.sh c
83131

84-
# Create docker registry as service
85-
docker run -v docker-registry-data:/var/lib/registry -p 5000:5000 --privileged --network host -d --restart always
132+
# build multiple arch (amd64/armv7)
133+
./scripts/docker.vpntool.sh c true
86134
```
87135

88-
#### Build
89136

90-
[vpnclient.Dockerfile](cli/python/docker/vpnc.Dockerfile)
137+
### VPNC Deployer
91138

92-
```bash
93-
# build amd64 arch
94-
./scripts/docker.vpntool.sh c
139+
[vpnc-deployer.Dockerfile](cli/ansible/docker/vpnc-deployer.Dockerfile)
95140

96-
# build multiple arch (amd64/armv7)
97-
./scripts/docker.vpntool.sh c true
141+
```bash
142+
./scripts/docker.vpntool.sh ddns
98143
```
99144

100-
## VPN DDNS
145+
Please read [VPNC Deployer](./cli/ansible/README.md) to see how it works based on `ansible` and `docker`
146+
147+
### VPN DDNS
101148

102149
[vpnddns.Dockerfile](cli/python/docker/vpnddns.Dockerfile)
103150

104151
```bash
105152
./scripts/docker.vpntool.sh ddns
106153
```
154+
155+
Please read [VPN DDNS k8s](./cli/k8s/ddns/README.md) to see sample `k8s` deployment
156+
157+
### Implementation
158+
159+
Please consume [vpnc-dev](./cli/python/DEV.md)
160+
161+
## VPN manager
162+
163+
TBD

cli/python/DEV.md

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,12 @@
11
# Development
22

3-
## Install pipenv
4-
5-
```bash
6-
# By pip/or pip3
7-
pip3 install pipenv
8-
9-
# Debian Buster+:
10-
sudo apt install pipenv
11-
12-
# Fedora/Redhat/centos
13-
sudo dnf install pipenv
14-
```
15-
16-
## Install dependencies
17-
18-
```bash
19-
pipenv install
20-
# Join pipenv in virtualenv
21-
pipenv shell
22-
```
23-
243
## Develop VPN client tool
254

265
### Run in dev
276

287
```bash
8+
# Navigate to python source
9+
cd cli/python
2910
# After pipenv shell
3011
python -m src.client.cmd_client -h
3112
# OR
Lines changed: 6 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,6 @@
11
# PlayiO VPN overview
22

3-
## Index script
4-
5-
- Install `pipenv`
6-
7-
```sh
8-
pip install pipenv
9-
```
10-
11-
- Invoke `index.py` will show available commands
12-
13-
```sh
14-
python index.py --help
15-
Usage: index.py [OPTIONS] COMMAND [ARGS]...
16-
17-
Options:
18-
--help Show this message and exit.
19-
20-
Commands:
21-
hub HUB tool to add/modify SoftEther VPN users and groups.
22-
secret Secret utils
23-
server Server tool
24-
```
25-
26-
More detail in `README` in each sub folders.
27-
28-
### External connection
3+
## External connection
294

305
Note
316

@@ -42,15 +17,15 @@ This is collection of script to bootstrap, manage, setup softether-vpn server.
4217
- Use `TLS 1.2`
4318
- [Cipher suite](https://en.wikipedia.org/wiki/Cipher_suite): `ECDHE-RSA-AES256-GCM-SHA384`
4419

45-
### Internal communication
20+
## Internal communication
4621

4722
- VPN connection type: [Remote Access VPN](https://www.softether.org/4-docs/1-manual/1._SoftEther_VPN_Overview/1.4_VPN_Processing_Principle_and_Communication_Method#1.4.7_Remote_Access_VPN)
4823
- Separate customers to `Virtual Hubs`.
4924
- `Virtual Hubs` are isolated to each other.
5025

51-
### Virtual Hub setup
26+
## Virtual Hub setup
5227

53-
#### IP network
28+
### IP network
5429

5530
Enable `secureNAT`
5631

@@ -68,7 +43,7 @@ Enable `secureNAT`
6843

6944
\*And all necessary routes to `internal resource subnets` defined for each customer.
7045

71-
#### User authentication
46+
### User authentication
7247

7348
- Define groups and users for each customer
7449
- Authentication method
@@ -78,33 +53,10 @@ Enable `secureNAT`
7853
- Each device has each `ssh` public/private key
7954
- (Optional) Interactive user: `basic password`
8055

81-
#### Virtual hub security policy
56+
### Virtual Hub security policy
8257

8358
Status: `WIP`
8459

8560
- [ ] Define hub admin security policy
8661
- [ ] Define security policy and apply to group
8762
- [ ] Define hub extended options
88-
89-
### Cloud sync
90-
91-
Cronjob on Cloud `Production GKE` run every 2 minutes to sync client IP addresses to private Google Cloud DNS:
92-
93-
- DNS zone name for each customer: `<customer-code>.device`
94-
- Device DNS name: `<device-hostname>.<customer-code>.device`
95-
96-
## VPN Client overview
97-
98-
**More details** in [Client](./src/client/README.md)
99-
100-
An automated setup and configuration for `IoT` devices using client scripts.
101-
102-
Standard configuration:
103-
104-
- Installation path: `/app/vpnclient`
105-
- Virtual network interface: `vpn_playio`
106-
- SoftEther VPN client account name: `playio`
107-
- Linux services auto start on system boot up: `playio-vpn`
108-
- VPN username: (follow naming convention)
109-
- Authentication: `client certificate` (signed certificate and corresponding private key)
110-
- Server certificate verification(`WIP`)

0 commit comments

Comments
 (0)