From 30fe82725306bf48128abab7f0e862fb08a0199b Mon Sep 17 00:00:00 2001 From: Mohammad Mahdi Afshar Date: Thu, 24 Apr 2025 18:51:26 +0330 Subject: [PATCH 01/15] feat: Supporting "table" directive in the configuration --- src/dashboard.py | 7 ++++--- .../configurationComponents/editConfiguration.vue | 11 +++++++++++ src/static/app/src/views/newConfiguration.vue | 14 ++++++++++++++ src/static/locale/language_template.json | 1 + 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/dashboard.py b/src/dashboard.py index 91d9444..42c9c53 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -945,7 +945,8 @@ class WireguardConfiguration: }, "ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))), "TotalPeers": len(self.Peers), - "Protocol": self.Protocol + "Protocol": self.Protocol, + "Table": self.Table, } def backupConfigurationFile(self) -> tuple[bool, dict[str, str]]: @@ -1047,7 +1048,7 @@ class WireguardConfiguration: dataChanged = False with open(self.configPath, 'r') as f: original = [l.rstrip("\n") for l in f.readlines()] - allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort"] + allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"] if self.Protocol == 'awg': allowEdit += ["Jc", "Jmin", "Jmax", "S1", "S2", "H1", "H2", "H3", "H4"] start = original.index("[Interface]") @@ -3191,4 +3192,4 @@ def startThreads(): if __name__ == "__main__": startThreads() - app.run(host=app_ip, debug=False, port=app_port) \ No newline at end of file + app.run(host=app_ip, debug=False, port=app_port) diff --git a/src/static/app/src/components/configurationComponents/editConfiguration.vue b/src/static/app/src/components/configurationComponents/editConfiguration.vue index e41e2f0..6ed3562 100644 --- a/src/static/app/src/components/configurationComponents/editConfiguration.vue +++ b/src/static/app/src/components/configurationComponents/editConfiguration.vue @@ -171,6 +171,17 @@ const deleteConfigurationModal = ref(false) id="configuration_listen_port"> +
+ + +
+
+
+ +
+
+ +
+
{{this.errorMessage}}
+
+
+

diff --git a/src/static/locale/language_template.json b/src/static/locale/language_template.json index b1839c9..c6442e4 100644 --- a/src/static/locale/language_template.json +++ b/src/static/locale/language_template.json @@ -59,6 +59,7 @@ "Turning Off\\.\\.\\.": "", "Address": "", "Listen Port": "", + "Table": "", "Public Key": "", "Connected Peers": "", "Total Usage": "", From 8830ebe34fcbd8a8aa538afd057d0d6b8f40fcff Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Thu, 1 May 2025 16:15:55 +0200 Subject: [PATCH 02/15] AmneziaWG Fix for Docker --- docker/Dockerfile | 64 +++++++++++++++----------------------------- docker/compose.yaml | 4 ++- docker/entrypoint.sh | 4 +++ 3 files changed, 28 insertions(+), 44 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 97a1481..0364a32 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,60 +1,38 @@ -FROM golang:1.24 AS compiler -WORKDIR /go +FROM golang:1.24 AS awg -RUN apt-get update && apt-get install -y --no-install-recommends \ - git make bash build-essential \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* +RUN git clone https://github.com/amnezia-vpn/amneziawg-go /awg +WORKDIR /awg +RUN go mod download && \ + go mod verify && \ + go build -ldflags '-linkmode external -extldflags "-fno-PIC -static"' -v -o /usr/bin -RUN git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-tools.git \ - && git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-go.git - -RUN cd /go/amneziawg-tools/src \ - && make - -RUN cd /go/amneziawg-go && \ - go get -u ./... && \ - go mod tidy && \ - make && \ - chmod +x /go/amneziawg-go/amneziawg-go /go/amneziawg-tools/src/wg /go/amneziawg-tools/src/wg-quick/linux.bash -RUN echo "DONE AmneziaWG" - -### INTERMEDIATE STAGE -FROM scratch AS bins -COPY --from=compiler /go/amneziawg-go/amneziawg-go /amneziawg-go -COPY --from=compiler /go/amneziawg-tools/src/wg /awg -COPY --from=compiler /go/amneziawg-tools/src/wg-quick/linux.bash /awg-quick - -# FINAL STAGE FROM alpine:latest LABEL maintainer="dselen@nerthus.nl" -COPY --from=bins /amneziawg-go /usr/bin/amneziawg-go -COPY --from=bins /awg /usr/bin/awg -COPY --from=bins /awg-quick /usr/bin/awg-quick +RUN apk update && apk add \ + iproute2 iptables bash curl wget unzip procps sudo \ + tzdata wireguard-tools python3 py3-psutil py3-bcrypt openresolv \ + && cd /usr/bin/ \ + && wget $(curl -s https://api.github.com/repos/amnezia-vpn/amneziawg-tools/releases/latest | grep 'alpine' | cut -d : -f 2,3 | tr -d '", ' | tail -n 1) \ + && unzip -j alpine-3.19-amneziawg-tools.zip \ + && chmod +x /usr/bin/awg /usr/bin/awg-quick \ + && rm alpine-3.19-amneziawg-tools.zip + +COPY --from=awg /usr/bin/amneziawg-go /usr/bin/amneziawg-go # Declaring environment variables, change Peernet to an address you like, standard is a 24 bit subnet. ARG wg_net="10.0.0.1" \ - wg_port="51820" + wg_port="51820" # Following ENV variables are changable on container runtime because /entrypoint.sh handles that. See compose.yaml for more info. ENV TZ="Europe/Amsterdam" \ - global_dns="9.9.9.9" \ - wgd_port="10086" \ - public_ip="" - -# Doing package management operations, such as upgrading -RUN apk update \ - && apk add --no-cache bash git tzdata \ - iptables ip6tables openrc curl wireguard-tools \ - sudo py3-psutil py3-bcrypt \ - && apk upgrade + global_dns="9.9.9.9" \ + wgd_port="10086" \ + public_ip="" # Using WGDASH -- like wg_net functionally as a ARG command. But it is needed in entrypoint.sh so it needs to be exported as environment variable. ENV WGDASH=/opt/wgdashboard -# Removing the Linux Image package to preserve space on the image, for this reason also deleting apt lists, to be able to install packages: run apt update. - # Doing WireGuard Dashboard installation measures. Modify the git clone command to get the preferred version, with a specific branch for example. RUN mkdir /data \ && mkdir /configs \ @@ -89,4 +67,4 @@ COPY ./docker/entrypoint.sh /entrypoint.sh EXPOSE 10086 WORKDIR $WGDASH -ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/docker/compose.yaml b/docker/compose.yaml index 6d96665..4a362d3 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -1,6 +1,6 @@ services: wireguard-dashboard: - image: donaldzou/wgdashboard:latest + image: dselen/wgdashboard:alpine restart: unless-stopped container_name: wgdashboard #environment: @@ -11,11 +11,13 @@ services: - 10086:10086/tcp - 51820:51820/udp volumes: + - aconf:/etc/amnezia/amnesiawg - conf:/etc/wireguard - data:/data cap_add: - NET_ADMIN volumes: + aconf: conf: data: diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index da3f585..6396525 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -131,6 +131,10 @@ set_envvars() { start_core() { printf "\n---------------------- STARTING CORE -----------------------\n" + mkdir -p /dev/net + mknod /dev/net/tun c 10 200 + chmod 600 /dev/net/tun + echo "Activating Python venv and executing the WireGuard Dashboard service." bash ./wgd.sh start } From 3268cc30eae7ae0682acbd4a9a03b190d65bc34a Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Thu, 1 May 2025 16:20:20 +0200 Subject: [PATCH 03/15] Donald --- docker/compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/compose.yaml b/docker/compose.yaml index 4a362d3..2033290 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -1,6 +1,6 @@ services: wireguard-dashboard: - image: dselen/wgdashboard:alpine + image: donaldzou/wgdashboard:alpine restart: unless-stopped container_name: wgdashboard #environment: From 8d7d78db4632314455c7a573e6572efa60dfd14f Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Thu, 1 May 2025 16:21:30 +0200 Subject: [PATCH 04/15] Not alpine, latest --- docker/compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/compose.yaml b/docker/compose.yaml index 2033290..088f35b 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -1,6 +1,6 @@ services: wireguard-dashboard: - image: donaldzou/wgdashboard:alpine + image: donaldzou/wgdashboard:latest restart: unless-stopped container_name: wgdashboard #environment: From 33942945d0188c3384b36f951f45cafb12025d37 Mon Sep 17 00:00:00 2001 From: Donald Zou Date: Thu, 1 May 2025 22:28:43 +0800 Subject: [PATCH 05/15] commit --- .../editConfiguration.vue | 359 +++++++++--------- src/static/app/src/views/newConfiguration.vue | 16 +- 2 files changed, 187 insertions(+), 188 deletions(-) diff --git a/src/static/app/src/components/configurationComponents/editConfiguration.vue b/src/static/app/src/components/configurationComponents/editConfiguration.vue index 6ed3562..b09ccbc 100644 --- a/src/static/app/src/components/configurationComponents/editConfiguration.vue +++ b/src/static/app/src/components/configurationComponents/editConfiguration.vue @@ -63,190 +63,201 @@ const editRawConfigurationFileModal = ref(false) const backupRestoreModal = ref(false) const deleteConfigurationModal = ref(false) + \ No newline at end of file diff --git a/src/static/app/src/css/dashboard.css b/src/static/app/src/css/dashboard.css index 7a0b006..44112c6 100644 --- a/src/static/app/src/css/dashboard.css +++ b/src/static/app/src/css/dashboard.css @@ -35,39 +35,6 @@ } } -/* - * Sidebar - */ - -/*.sidebar {*/ -/* position: fixed;*/ -/* top: 0;*/ -/* bottom: 0;*/ -/* left: 0;*/ -/* z-index: 100;*/ -/* !* Behind the navbar *!*/ -/* padding: 48px 0 0;*/ -/* !* Height of navbar *!*/ -/* box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);*/ -/*}*/ - -/*.sidebar-sticky {*/ -/* position: relative;*/ -/* top: 0;*/ -/* height: calc(100vh - 48px);*/ -/* padding-top: .5rem;*/ -/* overflow-x: hidden;*/ -/* overflow-y: auto;*/ -/* !* Scrollable contents if viewport is shorter than content. *!*/ -/*}*/ - -/*@supports ((position: -webkit-sticky) or (position: sticky)) {*/ -/* .sidebar-sticky {*/ -/* position: -webkit-sticky;*/ -/* position: sticky;*/ -/* }*/ -/*}*/ - @property --brandColor1 { syntax: ''; initial-value: #009dff; @@ -1273,7 +1240,6 @@ samp{ } .wireguardBg{ - background: rgb(125,32,32); background: linear-gradient(90deg, rgba(125,32,32,1) 0%, rgba(255,56,56,1) 100%); }