Skip to content

Commit

Permalink
deb packaging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtoobii committed May 6, 2021
1 parent d641245 commit b942219
Show file tree
Hide file tree
Showing 14 changed files with 131 additions and 1,794 deletions.
8 changes: 7 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
wg-wrangler (0.1.2) unstable; urgency=medium

* package: added config options for the --listen argument
* development: Allow development without having wireguard installed

-- Tobias Bossert <bossert@oetiker.ch> Thu, 06 Apr 2021 15:56:58 +0200

wg-wrangler (0.1.1) unstable; urgency=medium

* Initial deb release
Expand All @@ -9,4 +16,3 @@ wg-wrangler (0.1.0) unstable; urgency=medium
* Initial release

-- Tobias Bossert <bossert@oetiker.ch> Thu, 16 Apr 2021 09:02:58 +0200

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ using the built-in Mojo webserver.

You can now connect to the CallBackery app with your web browser.



If you need any additional perl modules, write their names into the PERL_MODULES
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`

Installation
------------

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1
0.1.2
2 changes: 2 additions & 0 deletions bin/wgwrangler-source-mode.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/sh
export MOJO_MODE=development
export MOJO_LOG_LEVEL=debug
export WGwrangler_NO_WG=1
export WGwrangler_CONFIG=t/etc/wgwrangler.yaml
exec $(dirname $0)/wgwrangler.pl prefork --listen 'http://*:7192'
5 changes: 3 additions & 2 deletions cpanfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requires 'CallBackery', '>= 0.35.5';
requires 'CallBackery', '>= 0.36.9';
requires 'Mojo::SQLite';
requires 'Wireguard::WGmeta', '>= 0.2.3';
requires 'Net::IP', '>=1.26';
Expand All @@ -7,4 +7,5 @@ requires 'Email::Sender';
requires 'Text::QRCode';
requires 'YAML::XS';
requires 'SVG::Barcode';
requires 'SVG::Barcode::QRCode';
requires 'SVG::Barcode::QRCode';
requires 'YAML::PP';
8 changes: 7 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
wg-wrangler (0.1.2) unstable; urgency=medium

* package: added config options for the --listen argument
* development: Allow development without having wireguard installed

-- Tobias Bossert <bossert@oetiker.ch> Thu, 06 Apr 2021 15:56:58 +0200

wg-wrangler (0.1.1) unstable; urgency=medium

* Initial deb release
Expand All @@ -9,4 +16,3 @@ wg-wrangler (0.1.0) unstable; urgency=medium
* Initial release

-- Tobias Bossert <bossert@oetiker.ch> Thu, 16 Apr 2021 09:02:58 +0200

6 changes: 5 additions & 1 deletion debian/wg-wrangler.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ Description=wg-wranger wireguard manager

[Service]
Type=simple
Environment=LISTEN_ON=http://127.0.0.1:7171
Environment=MOJO_MODE=production
# Environment variables defined in this file (if it exists) override previously defined ones
EnvironmentFile=opt/wg-wrangler/etc/env.conf
User=wg-wrangler_manager
Group=wg-wrangler_manager
ExecStart=/usr/bin/perl opt/wg-wrangler/bin/wgwrangler.pl prefork --listen 'http://127.0.0.1:7171'
ExecStart=/usr/bin/perl opt/wg-wrangler/bin/wgwrangler.pl prefork --listen $LISTEN_ON

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions etc/env.dist.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LISTEN_ON=http://127.0.0.1:7171
MOJO_MODE=production
8 changes: 6 additions & 2 deletions lib/WGwrangler/Model/WireguardDataAdapter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ has 'not_applied_suffix' => sub {
return '.not_applied';
};

has 'wg_not_installed' => sub {
return defined $ENV{'WGwrangler_NO_WG'}
};

has 'wg_meta' => sub ($self) {
my $custom_attr_config = {
'email' => {
Expand Down Expand Up @@ -171,7 +175,7 @@ Takes a private key and returns the derived public key. Throws an exception on c
=cut
sub get_public_key ($self, $private_key) {
return get_pub_key($private_key);
return $self->wg_not_installed ? 'dummy_pub_key' : get_pub_key($private_key);
}

=head3 gen_key_pair()
Expand All @@ -180,7 +184,7 @@ Generates a key pair and returns them embedded in a hash reference
=cut
sub gen_key_pair ($self) {
my @keypair = gen_keypair();
my @keypair = $self->wg_not_installed ? ('dummy_priv_key', 'dummy_pub_key') : gen_keypair();
return { 'private-key' => $keypair[0], 'public-key' => $keypair[1] }
}

Expand Down
4 changes: 4 additions & 0 deletions t/dummy_home/show_dummy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wg0 eOSNqjwOrtIQMOaVxOXXdGjvgQ6gIzS09ltKJMjAPl8= MN6ipoevVEFdsQ+vciTdsgeD30e9w0qT2jPZOFotmHQ= 51861 off
wg0 2mO59ijYCvfJUi6pnNO0H697xiZHTzs4mLA5da5m13w= (none) 89.333.25.1:5589 10.0.2.1/32 0 1234 5985 off
wg0 KpXASgjXPh5xtIxFclQUZzq4PuqbDfHT1CaU8shTsVE= (none) 8.8.8.8:42 10.0.2.1/32 0 4242 4242 off
wg0 Mu46ORALOMuD/T/uyuBiJNecOps4q80TB6BH6F2W9SA= (none) 45.68.254.22:6633 10.0.2.1/32 0 5 10 off
43 changes: 43 additions & 0 deletions t/dummy_home/wg0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This config is generated and maintained by wg-meta.
# It is strongly recommended to edit this config only through a supporting wg-meta
# implementation (e.g the wg-meta cli interface)
#
# Changes to this header are always overwritten, you can add normal comments in [Peer] and [Interface] section though.
#
# Support and issue tracker: https://github.com/sirtoobii/wg-meta
#+Checksum = 229354359

[Interface]
Address = 10.0.10.0/24, fdc9:281f:04d7:9ee9::0/64
ListenPort = 51888
PrivateKey = MN6ipoevVEFdsQ+vciTdsgeD30e9w0qT2jPZOFotmHQ=
#+FQDN = wireguard1.example.com

[Peer]
#+Name = CCCCC
PublicKey = 2mO59ijYCvfJUi6pnNO0H697xiZHTzs4mLA5da5m13w=
AllowedIPs = 10.0.10.1/32
#+Alias = tes

#-[Peer]
#-#+Name = DDDDD
#-PublicKey = KpXASgjXPh5xtIxFclQUZzq4PuqbDfHT1CaU8shTsVE=
#-AllowedIPs = 10.0.10.2/32
#-#+Email = wefwefwef@ttt.com
#-#+Description = zöziöwaqdwqdqwdwadqwdqwd
#-#+Disabled = 1

[Peer]
#+Name = Tester
PublicKey = Mu46ORALOMuD/T/uyuBiJNecOps4q80TB6BH6F2W9SA=
AllowedIPs = 10.0.10.6/32,fdc9:281f:04d7:9ee9:0000:0000:0000:0006/128
#+Email = hans@bla.com
#+Description = iu.i.uä0äu90

[Peer]
#+Name = OOOOOOOO
PublicKey = mUkItQOH7RkFNod+fT3glxilssdj79MSoXtBS4Ip/3M=
AllowedIPs = 10.0.10.7/32
#+Description = Hallo das ist ein Testwefwef
#+Email = hallo@test.com

43 changes: 43 additions & 0 deletions t/dummy_home/wg1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This config is generated and maintained by wg-meta.
# It is strongly recommended to edit this config only through a supporting wg-meta
# implementation (e.g the wg-meta cli interface)
#
# Changes to this header are always overwritten, you can add normal comments in [Peer] and [Interface] section though.
#
# Support and issue tracker: https://github.com/sirtoobii/wg-meta
#+Checksum = 229354359

[Interface]
Address = 10.0.0.0/24, fdc9:281f:04d7:9ee9::0/64
ListenPort = 51888
PrivateKey = MN6ipoevVEFdsQ+vciTdsgeD30e9w0qT2jPZOFotmHQ=
#+FQDN = wireguard1.example.com

[Peer]
#+Name = CCCCC
PublicKey = 2mO59ijYCvfJUi6pnNO0H697xiZHTzs4mLA5da5m13w=
AllowedIPs = 10.0.0.1/32
#+Alias = tes

#-[Peer]
#-#+Name = DDDDD
#-PublicKey = KpXASgjXPh5xtIxFclQUZzq4PuqbDfHT1CaU8shTsVE=
#-AllowedIPs = 10.0.0.2/32
#-#+Email = wefwefwef@ttt.com
#-#+Description = zöziöwaqdwqdqwdwadqwdqwd
#-#+Disabled = 1

[Peer]
#+Name = Tester
PublicKey = Mu46ORALOMuD/T/uyuBiJNecOps4q80TB6BH6F2W9SA=
AllowedIPs = 10.0.0.6/32,fdc9:281f:04d7:9ee9:0000:0000:0000:0006/128
#+Email = hans@bla.com
#+Description = iu.i.uä0äu90

[Peer]
#+Name = OOOOOOOO
PublicKey = mUkItQOH7RkFNod+fT3glxilssdj79MSoXtBS4Ip/3M=
AllowedIPs = 10.0.0.7/32
#+Description = Hallo das ist ein Testwefwef
#+Email = hallo@test.com

6 changes: 3 additions & 3 deletions t/etc/wgwrangler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ BACKEND:
enable_git: false
no_apply: true
not_applied_suffix: .not_applied
wireguard_home: /dummy_home/
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
wireguard_home: t/dummy_home/
wg_apply_command: echo "applied for %interface%"
wg_show_command: cat t/dummy_home/show_dummy

FRONTEND:
# logo = ../resource/wgwrangler/logo.png
Expand Down
Loading

0 comments on commit b942219

Please sign in to comment.