Browse Source

Merge branch 'main' of github.com:perara/wireguard-manager into dev

# Conflicts:
#	wg_dashboard_backend/main.py
#	wg_dashboard_backend/migrations/versions/006_create_v6_subnet.py
pull/109/head
Per-Arne Andersen 4 years ago
parent
commit
c7d858723b
  1. 32
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 20
      .github/ISSUE_TEMPLATE/feature_request.md
  3. 25
      .github/workflows/image.yml
  4. 5
      .travis.yml
  5. 59
      Dockerfile
  6. 7
      README.md
  7. 113
      docs/install.md
  8. 59
      docs/install_docker_github.md
  9. 0
      scripts/ci.sh
  10. 1
      wg_dashboard_backend/main.py
  11. 37
      wg_dashboard_backend/script/obfuscate/__init__.py
  12. 173
      wg_dashboard_backend/script/obfuscate/shapeshifter.py
  13. 13
      wg_dashboard_frontend/angular.json
  14. 28766
      wg_dashboard_frontend/package-lock.json
  15. 90
      wg_dashboard_frontend/package.json
  16. 2
      wg_dashboard_frontend/src/app/app-routing.module.ts
  17. 18
      wg_dashboard_frontend/src/app/validators/ip-address.validator.ts
  18. 5
      wg_dashboard_frontend/src/theme/styles.scss
  19. 2
      wg_dashboard_frontend/tsconfig.json
  20. 3
      wg_dashboard_frontend/tslint.json

32
.github/ISSUE_TEMPLATE/bug_report.md

@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Platform:**
- OS: RPI/Ubuntu/Windows/Docker ...etc
- Browser [e.g. chrome, safari]
- Version git-commit (If you updated and got error please try to record from -> to version
**Stacktrace/error output**
Add any other context about the problem here.
**Additional context**
Add any other context about the problem here.
**Screenshots**
If applicable, add screenshots to help explain your problem.

20
.github/ISSUE_TEMPLATE/feature_request.md

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

25
.github/workflows/image.yml

@ -0,0 +1,25 @@
name: build wg-dashboard
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: install buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: login to docker hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: build the image
run: |
docker buildx build --push \
--tag perara/wg-manager:latest \
--platform linux/amd64 .

5
.travis.yml

@ -1,5 +1,6 @@
dist: xenial
sudo: required
dist: focal
os: linux
language: python
env:
global:
- DOCKER_REPO=perara/wg-manager

59
Dockerfile

@ -1,27 +1,54 @@
FROM node:14-alpine
FROM ubuntu:20.04
ENV TZ=Europe/Minsk
ENV DEBIAN_FRONTEND=noninteractive
COPY ./wg_dashboard_frontend /tmp/build
WORKDIR /tmp/build
RUN apk add --no-cache build-base python3-dev && \
npm cache clean --force && npm install && npm install -g @angular/cli && \
ng build --configuration="production" && \
rm -rf node_modules && \
apk del build-base python3-dev
FROM alpine:3.12
MAINTAINER per@sysx.no
RUN apt-get update && apt-get install -y \
nodejs \
npm \
&& rm -rf /var/lib/apt/lists/*
RUN npm cache clean --force
RUN npm install
RUN npm install @angular/cli
RUN node_modules/@angular/cli/bin/ng build --configuration="production"
RUN rm -rf node_modules
RUN apt-get purge nodejs npm -y
FROM ubuntu:20.04
LABEL maintainer="per@sysx.no"
ENV IS_DOCKER True
WORKDIR /app
ENV LIBRARY_PATH=/lib:/usr/lib
ENV TZ=Europe/Oslo
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
COPY wg_dashboard_backend /app
# Install dependencies
RUN apk add --no-cache --update wireguard-tools py3-gunicorn python3 py3-pip ip6tables
#RUN apk add --no-cache --update wireguard-tools py3-gunicorn python3 py3-pip ip6tables
RUN apt-get update && apt-get install -y \
wireguard-tools \
iptables \
iproute2 \
python3 \
python3-pip \
python3-dev \
python3-gunicorn \
python3-uvicorn \
gunicorn \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install -r requirements.txt
COPY wg_dashboard_backend /app
ENV LIBRARY_PATH=/lib:/usr/lib
# Install dependencies
RUN apk add --no-cache build-base python3-dev libffi-dev jpeg-dev zlib-dev && \
pip3 install uvicorn && \
pip3 install -r requirements.txt && \
apk del build-base python3-dev libffi-dev jpeg-dev zlib-dev
#RUN apk add --no-cache build-base python3-dev libffi-dev jpeg-dev zlib-dev && \
#pip3 install uvicorn && \
#pip3 install -r requirements.txt && \
#apk del build-base python3-dev libffi-dev jpeg-dev zlib-dev
# Copy startup scripts
COPY docker/ ./startup

7
README.md

@ -23,7 +23,7 @@ The features of wg-manager includes:
* Create and manage API-Keys
# Dependencies
* Linux >= 5.6 *(Alternatively: wireguard-dkms)*
* Linux Kernel >= 5.6 *(Alternatively: wireguard-dkms)*
# Common Installation Steps
1. Enable ip forwarding:
@ -41,7 +41,7 @@ The features of wg-manager includes:
3. It is recommended to have a firewall protecting your servers
## Notes
* A few people has experienced issues with running the dockerized method using bridged networking. To fix this, you can use `network_mode: host`. Note that you can no longer reverse-proxy the web interface from reverse proxies such as [jwilder/nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy/).
* A few people has experienced issues with running the dockerized method using bridged networking. To workaround this, you can use `network_mode: host`. Note that you can no longer reverse-proxy the web interface from reverse proxies such as [jwilder/nginx-proxy](https://hub.docker.com/r/jwilder/nginx-proxy/).
## Method #1: Docker-compose
```yaml
@ -69,8 +69,9 @@ services:
WEB_CONCURRENCY: 1
```
or [plain docker here](./docs/guides/docker_configuration.md)
or [build docker image from github](./docs/install_docker_github.md)
# Method #2: Bare Metal
## Method #2: Bare Metal
- [Installation on Debian/Ubuntu/RPI4](./docs/install.md)
# Using the development branch

113
docs/install.md

@ -1,31 +1,56 @@
# Installation for raspberry-pi 4
These instructions are untested, and should be verified by someone. Please create a ticket :)
# Installation for Linux (Ubuntu, Debian, Raspberry Pi)
These instructions are tested working on:\
:heavy_check_mark: Ubuntu 20.04\
:heavy_check_mark: Ubuntu 18.04\
:x: Ubuntu 16.04 (fails when starting the http server `uvicorn main:app --host=0.0.0.0`)\
:heavy_check_mark: Debian 10\
:x: Debian 9
  (fails at `pip install -r requirements.txt` error: `Could not find a version that satisfies the requirement fastapi (from -r requirements.txt (line 2)) (from versions: `)
## 1. Setup required environment variables
```
export <ENV> <VALUE>
export <ENV>=<VALUE>
```
You will need the following:
```
export ADMIN_USERNAME=admin
export ADMIN_PASSWORD=admin
```
Make it permanent with putting it in bashrc
Refer to the list in the main readme file.
## 2. Install Depedencies
### Python
```
sudo apt-get update && sudo apt-get install git python3 python3-pip python3-venv -y
```
### Node.JS
### Node.JS: Ubuntu
```
curl -sL https://deb.nodesource.com/setup_13.x | sudo bash -
sudo apt-get install -y nodejs
```
### Node.JS: Debian
```
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_13.x | sudo bash -
sudo apt-get install -y nodejs
```
### WireGuard: Ubuntu
#### 18.04 and later
```
sudo apt update
sudo apt install wireguard wireguard-tools -y
```
#### 16.04 and earlier
```
sudo add-apt-repository ppa:wireguard/wireguard -y
sudo apt install wireguard wireguard-tools -y
```
### WireGuard: Debian/RPI
### WireGuard: Debian 10/Raspberry Pi (with Raspbian 10)
```
# Get signing keys to verify the new packages, otherwise they will not install
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138
@ -37,14 +62,26 @@ sudo apt update
sudo apt install wireguard wireguard-tools -y
```
### WireGuard: Debian 9/Raspberry Pi (with Raspbian 9)
```
# Get signing keys to verify the new packages, otherwise they will not install
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138
echo "deb http://deb.debian.org/debian/ unstable main" | sudo tee -a /etc/apt/sources.list.d/unstable.list
sudo apt update
sudo apt install wireguard wireguard-tools -y
```
## 3. Building front-end
```
# Building frontend
sudo git clone https://github.com/perara/wg-manager.git /opt/wg-manager
cd /opt/wg-manager/wg_dashboard_frontend
sudo npm install > /dev/null && sudo npm install @angular/cli > /dev/null
sudo node_modules/@angular/cli/bin/ng build --configuration="production" > /dev/null
sudo node_modules/@angular/cli/bin/ng build --configuration="production"
```
One thing to be aware of is that when issuing the `sudo node_modules/@angular/cli/bin/ng build --configuration="production"` command, if you do not have enough memory on your server, the process will get "Killed". This happens when trying to compile on the lowest tier DIgital Ocean droplet. To get around this you can either add more memory or create a swap file. Here is a great guide on [creating a swap file](https://linuxize.com/post/create-a-linux-swap-file/).
## 4. Setup back-end
```
@ -64,10 +101,68 @@ You should now see the following
#INFO: Application startup complete.
#INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
```
## 6. Default routing not working?
## 6. Troubleshooting tips
### Default routing not working?
Try these.
PostUp `iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE; ip6tables -A FORWARD -i %i -j ACCEPT; ip6tables -t nat -A POSTROUTING -o eth0 -j MASQUERADE`
PostDown `iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE; ip6tables -D FORWARD -i %i -j ACCEPT; ip6tables -t nat -D POSTROUTING -o eth0 -j MASQUERADE`
### Debain 10 wg0 won't start
When you try to start wg0 from the web interface, you may see on your terminal session:
`RNETLINK answers: Operation not supported. Unable to access interface: Protocol not supported`
This can sometimes be fixed with ```sudo apt upgrade```
To fix this, we need to reconfigure the Kernel module. In some cases, the following commands will fix your issue:
```
dpkg-reconfigure wireguard-dkms
modprobe wireguard
```
You may get an error on the first command
```
Module build for kernel 4.19.0-10-cloud-amd64 was skipped since the
kernel headers for this kernel does not seem to be installed.
```
We'll need to install the Kernel headers.
Find out which Kernel we are already on
```
uname -r
```
Search if your Kernel headers are in the repositories.
```
apt search linux-headers-$(uname -r)
```
If so then install them:
```
apt install linux-headers-$(uname -r)
```
If not, we'll need to upgrade your Kernel. My Kernel was 4.19.0.10 so I did a search for 4.19.0 and found 4.19.0.11. This will be a minnor release so nothing to be too worried about.
```
apt search linux-headers-*
```
Install the new Kernel and Reboot
```
apt install linux-image-4.19.0-11-cloud-amd64
reboot
```
Install the headers for your Kernel
```
apt install linux-headers-4.19.0-11-cloud-amd64
```
Reconfigure your dkms module and load it.
```
dpkg-reconfigure wireguard-dkms
modprobe wireguard
```

59
docs/install_docker_github.md

@ -0,0 +1,59 @@
# Build Docker Image from Github Repo
The steps below will walk you through installing the application in a docker container from the latest github version.
---
First thing we need to do is clone the github repository
```bash
git clone https://github.com/perara/wg-manager.git
```
Next we need to build the image. This will take some time.
```bash
docker build -t wg-manager .
```
Now that our image is built, we can either launch the container via _docker-compose_ or through the _docker CLI_.
## Docker Compose
```yaml
version: "2.1"
services:
wireguard:
container_name: wg-manager
image: wg-manager
restart: always
sysctls:
net.ipv6.conf.all.disable_ipv6: 0 # Required for IPV6
cap_add:
- NET_ADMIN
network_mode: host
ports:
- 51802:51802/udp
- 8888:8888
volumes:
- ./wg-manager:/config
environment:
HOST: 0.0.0.0
PORT: 8888
ADMIN_USERNAME: admin
ADMIN_PASSWORD: admin
WEB_CONCURRENCY: 1
```
## Docker CLI
```bash
docker run -d \
--sysctl net.ipv6.conf.all.disable_ipv6=0 \
--cap-add NET_ADMIN \
--name wg-manager \
--net host \
-p "51802:51802/udp" \
-p "8888:8888" \
-v wg-manager:/config \
-e HOST="0.0.0.0" \
-e PORT="8888" \
-e ADMIN_USERNAME="admin" \
-e ADMIN_PASSWORD="admin" \
wg-manager
```

0
scripts/ci.sh

1
wg_dashboard_backend/main.py

@ -16,7 +16,6 @@ import database.util
app = FastAPI()
app.add_middleware(BaseHTTPMiddleware, dispatch=middleware.db_session_middleware)
# Configure web routers
app.include_router(
user.router,
prefix="/api/v1",

37
wg_dashboard_backend/script/obfuscate/__init__.py

@ -4,12 +4,16 @@ import subprocess
import shlex
class NotInstalledError(Exception):
pass
class BaseObfuscation(abc.ABC):
def __init__(self, binary_name=None, binary_path=None, algorithm=None):
assert binary_name is not None or binary_path is not None
self.binary_name = binary_name if binary_name is not None else Path(self.binary_path).name
self.binary_name = binary_name if binary_name is not None else Path(binary_path).name
self.binary_path = binary_path if binary_path else ""
self.algorithm = algorithm
@ -23,11 +27,13 @@ class BaseObfuscation(abc.ABC):
data = [x.decode().strip() for x in proc_which.communicate() if x != b''][0]
if proc_which.returncode != 0:
raise RuntimeError("Could not find binary '%s'" % data)
raise NotInstalledError("Could not find binary '%s'" % data)
self.binary_path = data
def execute(self, *args, kill_first=False, override_command=None):
def execute(self, *args, kill_first=False, override_command=None, stream=False, prefix=""):
if prefix != "":
prefix += ": "
if kill_first:
# TODO try to delete by full name as we dont want to kill other processes.
@ -38,16 +44,27 @@ class BaseObfuscation(abc.ABC):
#kill_output, kill_code = self.execute(*[pattern], override_command="pkill")
command = override_command if override_command is not None else self.binary_path
print(shlex.join([command] + list(args)))
proc_which = subprocess.Popen([command] + list(args), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
raw_data = proc_which.communicate()
data = [x.decode().strip() for x in raw_data if x != b'']
if len(data) == 0:
data = ""
if not stream:
raw_data = proc_which.communicate()
data = [x.decode().strip() for x in raw_data if x != b'']
if len(data) == 0:
data = ""
else:
data = data[0]
return data, proc_which.returncode
else:
data = data[0]
return data, proc_which.returncode
while True:
output = proc_which.stdout.readline()
if output == '' and proc_which.poll() is not None:
break
if output:
print(prefix + output.strip().decode())
rc = proc_which.poll()
return rc

173
wg_dashboard_backend/script/obfuscate/shapeshifter.py

@ -0,0 +1,173 @@
import os
from threading import Thread
from script.obfuscate import BaseObfuscation, NotInstalledError
import re
import pathlib
import shutil
current_dir = pathlib.Path(__file__).parent.absolute()
shapeshifter_path = current_dir.joinpath("binary/shapeshifter-dispatcher")
shapeshifter_binary = shapeshifter_path.joinpath("shapeshifter-dispatcher")
class GoNotFound(Exception):
pass
class GoVersionIncompatible(Exception):
pass
class GitNotInstalled(Exception):
pass
class ShapeShifterBase(BaseObfuscation):
MODES_SUPPORTED = ["server", "client"]
ALGORITHMS_SUPPORTED = ["obfs4"]
def __init__(self, mode, algorithm, wireguard_port=None, listen_port=None, client_replicant_port=None, client_options=None):
super().__init__(
binary_path=shapeshifter_binary,
algorithm=algorithm
)
assert mode in ShapeShifterBase.MODES_SUPPORTED, "%s is not a supported mode. Supported: %s" % (
mode, ShapeShifterBase.MODES_SUPPORTED
)
self._wireguard_port = wireguard_port
self._listen_port = listen_port
self._client_replicant_port = client_replicant_port
self._mode = mode
self._client_options = client_options
self._go_version_min = (1, 14, 0)
self.ensure_installed()
def _verify_go_installed(self):
output, code = self.execute("version", override_command="go")
try:
match = re.findall("go([0-9]+.[0-9]+.[0-9]+)", output)
match = match[0]
except IndexError:
raise GoNotFound("Go was not found on the system.")
major, minor, patch = match.split(".")
if int(major) < self._go_version_min[0] or int(minor) < self._go_version_min[1] or \
int(patch) < self._go_version_min[2]:
raise GoVersionIncompatible("Go version is incompatible. %s < %s" % (self._go_version_min, match))
def _verify_git_installed(self):
output, code = self.execute("version", override_command="git")
if code == 0:
return
raise GitNotInstalled("Git does not seem to be installed. Code: %s, Output: %s" % (code, output))
def _verify_shapeshifter_installed(self):
output, code = self.execute("version", override_command=shapeshifter_binary)
print(output, code)
def _install_shapeshifter(self):
if shapeshifter_path.is_dir():
shutil.rmtree(shapeshifter_path)
output, code = self.execute(
"clone",
"https://github.com/OperatorFoundation/shapeshifter-dispatcher.git",
shapeshifter_path,
override_command="git")
assert code == 0, "Git exited with error. %s" % (output,)
current_working_dir = os.getcwd()
os.chdir(shapeshifter_path)
output, code = self.execute("build", override_command="go")
os.chdir(current_working_dir)
assert code == 0, "Building shapeshifter failed with output: %s" % (output,)
def ensure_installed(self):
try:
super().ensure_installed()
except NotInstalledError:
self._verify_go_installed()
self._verify_git_installed()
try:
self._verify_shapeshifter_installed()
except FileNotFoundError:
self._install_shapeshifter()
def start(self):
bind_command = "bindaddr" if self._mode == "server" else "proxylistenaddr"
bind_port = self._listen_port if self._mode == "server" else self._client_replicant_port
bind_value = f"127.0.0.1:{bind_port}" # TODO
if self._mode == "server":
bind_value = self.algorithm + "-" + bind_value
connect_command = "orport" if self._mode == "server" else "target"
connect_port = self._wireguard_port if self._mode == "server" else self._listen_port
cmd = [
"-transparent",
"-udp",
f"-{self._mode}",
"-state", f"state",
f"-{connect_command}", f"127.0.0.1:{connect_port}",
"-transports", self.algorithm,
f"-{bind_command}", bind_value
]
if self._mode == "client":
cmd.extend([
"-options", f"{self._client_options}"
])
cmd.extend([
"-logLevel", "DEBUG",
"-enableLogging",
])
print(*cmd)
output, code = self.execute(*cmd, stream=True, prefix=self._mode)
print(output, code)
def start_threaded(self):
t = Thread(target=self.start, args=())
t.start()
return t
if __name__ == "__main__":
import time
x = ShapeShifterBase(
mode="server",
algorithm="obfs2",
wireguard_port=3333,
listen_port=2222,
)
x.start_threaded()
time.sleep(1)
x = ShapeShifterBase(
mode="client",
algorithm="obfs2",
listen_port=2222,
client_replicant_port=1443,
client_options='{"cert": "BWvGMVn3C8daXai2Xo+If23XS94eztZE9Kbtykvy9x5ADWc6YCHdGlWQfDh1fzu7AhuTIA", "iat-mode": "0"}'
)
x.start_threaded()
while True:
time.sleep(1)

13
wg_dashboard_frontend/angular.json

@ -3,7 +3,7 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"material-angular-dashboard": {
"wg-manager": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
@ -38,7 +38,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
@ -56,19 +55,19 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "material-angular-dashboard:build",
"browserTarget": "wg-manager:build",
"proxyConfig": "proxy.conf.json"
},
"configurations": {
"production": {
"browserTarget": "material-angular-dashboard:build:production"
"browserTarget": "wg-manager:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "material-angular-dashboard:build"
"browserTarget": "wg-manager:build"
}
},
"lint": {
@ -84,13 +83,13 @@
}
}
},
"material-angular-dashboard-e2e": {
"wg-manager-e2e": {
"root": "",
"sourceRoot": "",
"projectType": "application"
}
},
"defaultProject": "material-angular-dashboard",
"defaultProject": "wg-manager",
"cli": {
"packageManager": "yarn"
},

28766
wg_dashboard_frontend/package-lock.json

File diff suppressed because it is too large

90
wg_dashboard_frontend/package.json

@ -16,71 +16,73 @@
"tlint:fix": "ng lint --fix",
"slint": "stylelint --syntax scss ./**/*.scss",
"slint:fix": "stylelint --syntax scss --fix ./**/*.scss",
"lint": "ng lint && stylelint --syntax scss ./**/*.scss"
"lint": "ng lint && stylelint --syntax scss ./**/*.scss",
"postinstall": "ngcc"
},
"pre-commit": "lint",
"private": true,
"private": false,
"repository": {
"type": "git",
"url": "https://github.com/CreativeIT/material-angular-dashboard"
"url": "https://github.com/perara/wg-manager"
},
"bugs": {
"url": "https://github.com/CreativeIT/material-angular-dashboard/issues"
"url": "https://github.com/perara/wg-manager/issues"
},
"homepage": "https://github.com/CreativeIT/material-angular-dashboard",
"homepage": "https://github.com/perara/wg-manager",
"dependencies": {
"@angular/animations": "9.1.0",
"@angular/cdk": "^9.2.0",
"@angular/common": "9.1.0",
"@angular/compiler": "9.1.0",
"@angular/core": "9.1.0",
"@angular/flex-layout": "^9.0.0-beta.29",
"@angular/forms": "9.1.0",
"@angular/localize": "9.1.0",
"@angular/material": "^9.2.0",
"@angular/platform-browser": "9.1.0",
"@angular/platform-browser-dynamic": "9.1.0",
"@angular/router": "9.1.0",
"@jedmao/ini-parser": "^0.2.4",
"angular-material-dynamic-themes": "^1.0.4",
"angular-notifier": "^6.0.1",
"angularx-qrcode": "^2.1.0",
"@angular/animations": "11.0.5",
"@angular/cdk": "11.0.3",
"@angular/common": "11.0.5",
"@angular/compiler": "11.0.5",
"@angular/core": "11.0.5",
"@angular/flex-layout": "11.0.0-beta.33",
"@angular/forms": "11.0.5",
"@angular/localize": "11.0.5",
"@angular/material": "11.0.3",
"@angular/platform-browser": "11.0.5",
"@angular/platform-browser-dynamic": "11.0.5",
"@angular/router": "11.0.5",
"@jedmao/ini-parser": "0.2.4",
"angular-material-dynamic-themes": "1.0.4",
"angular-notifier": "6.0.1",
"angularx-qrcode": "10.0.11",
"classlist.js": "1.1.20150312",
"core-js": "3.6.4",
"file-saver": "^2.0.2",
"hammerjs": "^2.0.8",
"install": "^0.13.0",
"ip-cidr": "^2.0.10",
"js-file-download": "^0.4.11",
"jszip": "^3.3.0",
"material-icons": "^0.3.1",
"ngx-cookie-service": "^3.0.4",
"npm": "^6.14.4",
"remove": "^0.1.5",
"file-saver": "2.0.5",
"hammerjs": "2.0.8",
"install": "0.13.0",
"ip-address": "^7.1.0",
"ip-cidr": "2.1.1",
"js-file-download": "0.4.12",
"jszip": "3.5.0",
"material-icons": "0.5.1",
"ngx-cookie-service": "11.0.2",
"npm": "6.14.6",
"remove": "0.1.5",
"rxjs": "6.5.5",
"tslib": "^1.10.0",
"web-animations-js": "^2.3.2",
"widdershins": "^4.0.1",
"zone.js": "^0.10.3"
"tslib": "2.0.3",
"web-animations-js": "2.3.2",
"widdershins": "4.0.1",
"zone.js": "0.10.3"
},
"devDependencies": {
"@angular-devkit/schematics": "^9.1.1",
"@angular-devkit/build-angular": "~0.901.0",
"@angular/cli": "9.1.0",
"@angular/compiler-cli": "9.1.0",
"@angular/language-service": "9.1.0",
"@angular-devkit/schematics": "^11.0.5",
"@angular-devkit/build-angular": "~0.1100.5",
"@angular/cli": "11.0.5",
"@angular/compiler-cli": "11.0.5",
"@angular/language-service": "11.0.5",
"@types/node": "^13.11.0",
"codelyzer": "^5.1.2",
"node-sass": "4.14.1",
"codelyzer": "^6.0.0",
"sass": "1.32.0",
"pre-commit": "1.2.2",
"stylelint": "13.3.0",
"stylelint-config-recommended-scss": "4.2.0",
"stylelint-config-standard": "20.0.0",
"stylelint-scss": "3.16.0",
"ts-node": "8.8.2",
"tslint": "6.1.1",
"tslint": "~6.1.0",
"tslint-angular": "3.0.2",
"tslint-config-airbnb": "5.11.2",
"typescript": "3.8.3"
"typescript": "4.0.5"
}
}

2
wg_dashboard_frontend/src/app/app-routing.module.ts

@ -29,7 +29,7 @@ import { ErrorComponent } from './page/error';
{ path: '**', redirectTo: '/page/404' },
],
{ useHash: true },
{ useHash: true, relativeLinkResolution: 'legacy' },
),
LayoutModule,
],

18
wg_dashboard_frontend/src/app/validators/ip-address.validator.ts

@ -1,12 +1,22 @@
import { AbstractControl, ValidationErrors } from '@angular/forms';
import * as IPCIDR from 'ip-cidr';
import {Address4, Address6} from 'ip-address'
export class IPValidator {
static isIPAddress(control: AbstractControl): ValidationErrors | null {
if (!control.value || !(new IPCIDR(control.value).isValid())) {
return { validIP: true };
}
return null;
try {
new Address4(control.value)
return null
} catch (e) {}
try{
new Address6(control.value)
return null
} catch (e) {}
return { validIP: true };
}
}

5
wg_dashboard_frontend/src/theme/styles.scss

@ -78,3 +78,8 @@ body {
.red{
color:red;
}
.mat-form-field{
// TODO this is a sleezy fix for cutting text in input boxes. need to figure out the root cause eventually.
line-height: 1.5;
}

2
wg_dashboard_frontend/tsconfig.json

@ -2,7 +2,7 @@
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./src",
"module": "esnext",
"module": "es2020",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,

3
wg_dashboard_frontend/tslint.json

@ -14,6 +14,9 @@
"ignore-pattern": "(\"|'|`).*?\\1"
}
],
"deprecation": {
"severity": "warning"
},
"function-name": [
true,
{

Loading…
Cancel
Save