Browse Source

Merge pull request #25 from perara/master

Update subnet support to master
pull/26/head
Per-Arne Andersen 5 years ago
committed by GitHub
parent
commit
ece916ddef
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 31
      README.md
  2. 1
      docs/guides/docker_configuration.md
  3. 12
      wg_dashboard_backend/routers/v1/server.py
  4. 2
      wg_dashboard_backend/script/wireguard.py

31
README.md

@ -33,11 +33,12 @@ The features of wg-manager includes:
wireguard: wireguard:
container_name: wg-manager container_name: wg-manager
image: perara/wg-manager image: perara/wg-manager
restart: always
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
#network_mode: host # Alternatively #network_mode: host # Alternatively
ports: ports:
- 51800:51900/udp - 51800-51900:51800-51900/udp
- 8888:8888 - 8888:8888
volumes: volumes:
- ./wg-manager:/config - ./wg-manager:/config
@ -53,6 +54,14 @@ or [plain docker here](./docs/guides/docker_configuration.md)
# Method #2: Bare Metal # Method #2: Bare Metal
- [Installation on Debian/Ubuntu/RPI4](./docs/install.md) - [Installation on Debian/Ubuntu/RPI4](./docs/install.md)
# Using the development branch
As there is no builds for the development branch, you have to do the following:
Change `image: perara/wg-manager` to
```
build:
context: https://github.com/perara/wg-manager.git#dev
```
# Guides # Guides
- [Importing Existing configuration](./docs/guides/import_existing_server.md) - [Importing Existing configuration](./docs/guides/import_existing_server.md)
- [Reverse Proxy](./docs/guides/reverse_proxy.md) - [Reverse Proxy](./docs/guides/reverse_proxy.md)
@ -62,16 +71,16 @@ When docker container/server has started, go to http://localhost:8888
# Environment variables # Environment variables
| Environment | Description | Recommended | | Environment | Description | Recommended |
|------------------|--------------------------------------------------------------------------|-------------| |------------------|---------------------------------------------------------------------------|-------------|
| GUNICORN_CONF | Location of custom gunicorn configuration | default | | GUNICORN_CONF | Location of custom gunicorn configuration | default |
| WORKERS_PER_CORE | How many concurrent workers should there be per available core (Gunicorn | default | | WORKERS_PER_CORE | How many concurrent workers should there be per available core (Gunicorn) | default |
| WEB_CONCURRENCY | The number of worker processes for handling requests. (Gunicorn) | 1 | | WEB_CONCURRENCY | The number of worker processes for handling requests. (Gunicorn) | 1 |
| HOST | 0.0.0.0 or unix:/tmp/gunicorn.sock if reverse proxy. Remember to mount | 0.0.0.0 | | HOST | 0.0.0.0 or unix:/tmp/gunicorn.sock if reverse proxy. Remember to mount | 0.0.0.0 |
| PORT | The port to use if running with IP host bind | 80 | | PORT | The port to use if running with IP host bind | 80 |
| LOG_LEVEL | Logging level of gunicorn/python | info | | LOG_LEVEL | Logging level of gunicorn/python | info |
| ADMIN_USERNAME | Default admin username on database creation | admin | | ADMIN_USERNAME | Default admin username on database creation | admin |
| ADMIN_PASSWORD | Default admin password on database creation | admin | | ADMIN_PASSWORD | Default admin password on database creation | admin |
# Showcase # Showcase
![Illustration](docs/images/0.png) ![Illustration](docs/images/0.png)

1
docs/guides/docker_configuration.md

@ -7,6 +7,7 @@ docker run -d \
-p "51800-51900:51800-51900/udp" \ -p "51800-51900:51800-51900/udp" \
-p "8888:8888" \ -p "8888:8888" \
-v wg-manager:/config \ -v wg-manager:/config \
-e HOST="0.0.0.0" \
-e PORT="8888" \ -e PORT="8888" \
-e ADMIN_USERNAME="admin" \ -e ADMIN_USERNAME="admin" \
-e ADMIN_PASSWORD="admin" \ -e ADMIN_PASSWORD="admin" \

12
wg_dashboard_backend/routers/v1/server.py

@ -73,12 +73,14 @@ def add_interface(
@router.post("/stop", response_model=schemas.WGServer) @router.post("/stop", response_model=schemas.WGServer)
def start_server( def stop_server(
form_data: schemas.WGServer server: schemas.WGServer,
sess: Session = Depends(middleware.get_db)
): ):
script.wireguard.stop_interface(form_data) script.wireguard.stop_interface(server)
form_data.is_running = script.wireguard.is_running(form_data) server.is_running = script.wireguard.is_running(server)
return form_data server.sync(sess)
return server
@router.post("/start", response_model=schemas.WGServer) @router.post("/start", response_model=schemas.WGServer)

2
wg_dashboard_backend/script/wireguard.py

@ -108,7 +108,7 @@ def restart_interface(server: schemas.WGServer):
def is_running(server: schemas.WGServer): def is_running(server: schemas.WGServer):
try: try:
output = _run_wg(server, ["show", server.interface]) output = _run_wg(server, ["show", server.interface])
if output is None: if output is None or b'Unable to access interface: No such device' in output:
return False return False
except Exception as e: except Exception as e:
if b'No such device' in e.output: if b'No such device' in e.output:

Loading…
Cancel
Save