Skip to content

Commit

Permalink
Merge pull request #5 from oposs/ip_manager_fix
Browse files Browse the repository at this point in the history
IP Manager++
  • Loading branch information
sirtoobii authored Mar 22, 2023
2 parents 42e5ec1 + a57fb6b commit a55cbc7
Show file tree
Hide file tree
Showing 28 changed files with 521 additions and 274 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
branches:
- '**'
pull_request:
types: [opened, reopened]
paths-ignore:
- '**.md'

Expand Down Expand Up @@ -60,21 +61,10 @@ jobs:
run: ./configure --prefix=$HOME/test-install
- name: Make
run: make
- name: Test
- name: Test & dist & install
run: |
cp etc/wgwrangler.dist.yaml etc/wgwrangler.yaml
make test
- name: Check Dist
run: |
make dist
tar xf *-$(cat VERSION).tar.gz
cd *-$(cat VERSION)
./configure --prefix=$HOME/test-install
make
make install
cd $HOME/test-install
cp etc/wgwrangler.dist.yaml etc/wgwrangler.yaml
./bin/wgwrangler
- name: Cache Prep
run: |
rm thirdparty/Makefile* thirdparty/cpan*snapshot
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ share/messages.pot: $(PM) $(CALLBACKERY_PM)
for lang in $(LANGUAGES); do ( test -f $$lang || cp share/messages.pot $$lang ); $(MSGMERGE) -s --force-po -U $$lang share/messages.pot; done

test:
$(MJ_CLASS)_CONFIG=t/etc/wgwrangler.yaml prove -w
$(MJ_CLASS)_CONFIG_HOME=t/etc prove -w
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ sudo apt install libqrencode-dev
make
```

**Minimum Node.js: `v14` -> If no compatible node version is found, the frontend is not built!**

Configure will check if all requirements are met and give
hints on how to fix the situation if something is missing.

Expand Down Expand Up @@ -79,6 +81,12 @@ Currently supported ubuntu versions:
- 20.04 LTS
- 22.04 LTS

Configuration
-------------

Do get started, rename `/etc/opt/wg-wrangler/wgwrangler.dist.yaml` to `/etc/opt/wg-wrangler/wgwrangler.yaml` and adjust
according your needs.

Development
-----------

Expand All @@ -98,7 +106,7 @@ file and run ./bootstrap.
**Honored Environment Variables**

- `WGwrangler_NO_WG` If defined, we do not call any wg* command from code (e.g. to generate pub/private-keys)
- `WGwrangler_CONFIG` Use this variable to set the path to the main `wgwrangler.yaml` file, defaults to `etc/wgrangler.yaml`
- `WGwrangler_CONFIG_HOME` Use this variable to set the path to the main configuration files (email template + main config)

Packaging
---------
Expand Down
2 changes: 1 addition & 1 deletion bin/wgwrangler-source-mode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
export MOJO_MODE=development
export MOJO_LOG_LEVEL=debug
export WGwrangler_NO_WG=1
export WGwrangler_CONFIG=t/etc/wgwrangler.yaml
export WGwrangler_CONFIG_HOME=t/etc
exec $(dirname $0)/wgwrangler prefork --listen 'http://*:7192'
2 changes: 1 addition & 1 deletion debian/wg-wrangler.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Type=simple
Environment=LISTEN_ON=http://127.0.0.1:7171
Environment=MOJO_MODE=production
Environment=MOJO_LOG_LEVEL=info
Environment=WGwrangler_CONFIG=/etc/opt/wg-wrangler/wgwrangler.yaml
Environment=WGwrangler_CONFIG_HOME=/etc/opt/wg-wrangler

# Environment variables defined in this file (if it exists) override previously defined ones
EnvironmentFile=-/etc/opt/wg-wrangler/env.conf
Expand Down
2 changes: 1 addition & 1 deletion etc/env.dist.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
LISTEN_ON=http://127.0.0.1:7171
MOJO_MODE=production
MOJO_LOG_LEVEL=info
WGwrangler_CONFIG=/etc/opt/wg-wrangler/wgwrangler.yaml
WGwrangler_CONFIG_HOME=/etc/opt/wg-wrangler
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Subject: Wireguard VPN Configuration
Reply-To: rt@oetiker.ch
Reply-To: <%= $sender_email %>
----
Dear <%= $name %>
This is your vpn configuration for your device "<%= $device_name %>" to access <%= $endpoint %>.
Expand All @@ -8,18 +8,19 @@ Add the config file attached to this message

enjoy!
----
<html>
<html lang="en">
<head><title></title></head>
<body>
<p>Dear <%= $name %></p>
<p>This is your vpn configuration for your device "<%= $device_name %>" to access <%= $endpoint %>.</p>
<p>This is your vpn configuration for your device "<%= $device_name %>" to access <%= $endpoint %>.</p>
<ol>
<li>Install a Wireguard <a href="https://www.wireguard.com/install">client</a>.</li>
<li>Add the config file attached to this message</li>
<li>Install a Wireguard <a href="https://www.wireguard.com/install">client</a>.</li>
<li>Add the config file attached to this message</li>
</ol>
<p>Your Wireguard Configuration as a QR Code, readable by mobile Wireguard clients</p>
<div>
<img style="image-rendering: crisp-edges;width: 300px;max-width: 100%"src="data:image/svg+xml;base64,<%= $qr %>" alt="qr_config"/>
<img style="image-rendering: crisp-edges;width: 300px;max-width: 100%" src="data:image/svg+xml;base64,<%= $qr %>"
alt="qr_config"/>
</div>
<p>enjoy!</p>
</body>
Expand Down
32 changes: 23 additions & 9 deletions etc/wgwrangler.dist.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@

BACKEND:
cfg_db: /var/opt/wg-wrangler/wgwrangler.db
sesame_user: adfadsfasdf4ee3r
# perl -MDigest::SHA -e 'print Digest::SHA::hmac_sha1_hex("access"),"\n"'
sesame_pass: 393afhkjhffjj
vpn_name: your_vpn_name
# A name for your VPN service, available as tag in the email template
vpn_name: 'Awesome Wireguard VPN'
# Enable versioning for wireguard configurations
enable_git: false
no_apply: true
# Instead of applying the configuration automatically after every edit, show a button to apply the configuration manually
no_apply: false
not_applied_suffix: .not_applied
wireguard_home: /dummy_home/
# Where does your wireguard configuration reside? (trailing slash expected)
wireguard_home: /etc/wireguard/
wg_apply_command: sudo -n wg-quick strip %interface% > /tmp/wg_tmp && sudo -n wg syncconf %interface% /tmp/wg_tmp && rm /tmp/wg_tmp
wg_show_command: sudo -n wg show all dump
# Ranges defined here are not possible to acquire
# Note: Make sure your subnet calculations are correct, e.g 192.168.1.1/24 is not a valid network _per se_, the
# correct notation is 192.168.1.0/24 (!)
reserved_ranges:
wg0:
- 10.0.0.0/29
default_dns:
wg1: 192.168.2.1
default_allowed_ips:
wg0:
- 192.168.0.0/24
wg1:
- 192.168.0.0/24
sender_email: support@oetiker.ch

FRONTEND:
# logo = ../resource/wgwrangler/logo.png
# logo_small = ../resource/wgwrangler/logo-small.png
# logo = ../resource/wgwrangler/logo.png
# logo_small = ../resource/wgwrangler/logo-small.png
title: WGwrangler
initial_plugin: WireguardShow
company_name: OETIKER+PARTNER AG
Expand All @@ -31,9 +48,6 @@ PLUGIN:
- WireguardShow:
module: WireguardShow
tab-name: Wireguard
default-dns: 192.168.0.1
default-allowed-ips: 192.168.0.0/24
sender-email: support@oetiker.ch

- WireguardVersions:
module: WireguardVersions
Expand Down
Loading

0 comments on commit a55cbc7

Please sign in to comment.