Skip to content

Commit

Permalink
Deb test 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtoobii committed Apr 30, 2021
1 parent f31545e commit 04b97e8
Show file tree
Hide file tree
Showing 18 changed files with 267 additions and 7 deletions.
33 changes: 33 additions & 0 deletions .github/actions/build-release-action/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ARG IMAGE_VERSION_TAG

FROM ubuntu:$IMAGE_VERSION_TAG

LABEL maintainer="oetiker" \
description="WG-wrangler builder"


ENV DEBIAN_FRONTEND noninteractive

RUN apt-get -y update && \
apt-get -y install apt-utils curl && \
curl https://deb.nodesource.com/setup_12.x | bash && \
apt-get -u update && \
apt-get -y install perl \
make \
gcc \
devscripts \
openssl \
pkg-config \
libssl-dev \
debhelper \
automake \
nodejs \
libkrb5-dev \
libqrencode-dev \
g++

COPY make-deb.sh /make-deb.sh

RUN chmod 777 /make-deb.sh

ENTRYPOINT ["/make-deb.sh"]
36 changes: 36 additions & 0 deletions .github/actions/build-release-action/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'Docker release builder'
description: 'Build release packages using a docker image'

inputs:
docker_file:
description: Target Docker file to build package
required: true
image_version_tag:
description: Tag which is prepended on the FROM directive
required: false
default: latest

outputs:
package_name:
description: name of the generated package
value: ${{ steps.run.outputs.package_name }}

runs:
using: 'composite'
steps:
- id: build
name: Build Docker Image
run: |
docker build \
--build-arg IMAGE_VERSION_TAG=${{inputs.image_version_tag}} \
-f $(pwd)/.github/actions/build-release-action/${{inputs.docker_file}} \
$(pwd)/.github/actions/build-release-action/ \
-t deb_builder:latest
shell: bash
- id: run
name: Run Docker Image
run: docker run -v $(pwd):/github/workspace --workdir /github/workspace deb_builder:latest
shell: bash



10 changes: 10 additions & 0 deletions .github/actions/build-release-action/make-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -ex
cd /github/workspace/
dh_clean
dpkg-buildpackage -us -uc -nc
release_code_name=$(lsb_release --codename | sed 's/Codename:\s*//')
package_name=$(basename ../*.deb | sed 's/.deb$//')_$release_code_name.deb

mv ../*.deb $package_name
echo "::set-output name=package_name::$package_name"
35 changes: 35 additions & 0 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 'Build release'
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

jobs:
build_deb:
strategy:
matrix:
RELEASE:
- Ubuntu:
docker_file: Dockerfile
image_version_tag: '18.04'
- Ubuntu:
docker_file: Dockerfile
image_version_tag: '20.04'

runs-on: ubuntu-latest
name: Build package defined in ${{ matrix.RELEASE.docker_file }} for tag {{$matrix.RELEASE.image_version_tag}}
steps:
- uses: actions/checkout@v1
- name: Run docker build
id: build_package
uses: ./.github/actions/build-release-action
with:
docker_file: ${{ matrix.RELEASE.docker_file }}
image_version_tag: ${{ matrix.RELEASE.image_version_tag }}

- name: Release deb files
uses: softprops/action-gh-release@v1
with:
files: ${{ github.workspace }}/${{ steps.build_package.outputs.package_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 11 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
0.1.0 2021-04-16 Tobias Bossert (bossert _at_ oetiker _this_is_a_dot_ ch)
- Initial release
wg-wrangler (0.1.1) unstable; urgency=medium

* Initial deb release

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

wg-wrangler (0.1.0) unstable; urgency=medium

* Initial release

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

0.0.0 2021-01-12 Tobias Bossert (bossert _at_ oetiker _this_is_a_dot_ ch)
- started project
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:
prove -w
$(MJ_CLASS)_CONFIG=t/etc/wgwrangler.yaml prove -w
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.0
0.1.1
2 changes: 2 additions & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ requires 'Wireguard::WGmeta', '>= 0.2.3';
requires 'Net::IP', '>=1.26';
requires 'Email::MIME';
requires 'Email::Sender';
requires 'Text::QRCode';
requires 'YAML:XS';
requires 'SVG::Barcode';
requires 'SVG::Barcode::QRCode';
2 changes: 2 additions & 0 deletions debian/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
changelog: ../CHANGES:
cp ../CHANGES changelog
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
wg-wrangler (0.1.1) unstable; urgency=medium

* Initial deb release

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

wg-wrangler (0.1.0) unstable; urgency=medium

* Initial release

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

1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
10 changes: 10 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Source: wg-wrangler
Section: system
Priority: optional
Maintainer: Tobias Bossert <bossert@oetiker.ch>
Build-Depends: build-essential, debhelper (>= 9)

Package: wg-wrangler
Architecture: any
Depends: ${shlibs:Depends}, perl, wireguard, sudo
Description: An web-frontend for managing wireguard peer configuration
18 changes: 18 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

PKGNAME=wg-wrangler
USERNAME=wg-wrangler_manager
GROUPNAME=wg-wrangler_manager

# Create user and group
adduser --system --group --no-create-home $USERNAME

# set permissions and group membership on /etc/wireguard
chgrp --silent --recursive $GROUPNAME /etc/wireguard/

# set group permissions
chmod -R g+rw /etc/wireguard

# Whitelist wg* commands for us
echo "%$GROUPNAME ALL=NOPASSWD: /usr/bin/wg*" >> /etc/sudoers.d/wg-wrangler

22 changes: 22 additions & 0 deletions debian/postrm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

USERNAME=wg-wrangler_manager

# Revert group of /etc/wireguard
chgrp --silent --recursive root /etc/wireguard/

# remove sudoers entry
if [ ! -f /etc/sudoers.d/wg-wrangler ]
then
echo "File does not exist. Skipping..."
else
rm /etc/sudoers.d/wg-wrangler
fi

# and finally remove the wg-wrangler user
if [ -x "$(command -v deluser)" ]; then
deluser --quiet --system $USERNAME > /dev/null || true
else
echo >&2 "not removing $USERNAME system account because deluser command was not found"
fi

17 changes: 17 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

export DH_ALWAYS_EXCLUDE=CVS:.svn:.git:

override_dh_auto_configure:
./bootstrap
./configure --prefix=/opt/wg-wrangler

%:
dh $@
11 changes: 11 additions & 0 deletions debian/wg-wrangler.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=wg-wranger wireguard manager

[Service]
Type=simple
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'

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion frontend/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

AUTOMAKE_OPTIONS=foreign

EXTRA_DIST = compile.js compile.json Manifest.json package.json package-lock.json $(shell find source -not -name ".*" -a -not -name "*~" -a -not -name "*.tmp" -a -not -name "Makefile*" -a -type f -print )
EXTRA_DIST = compile.js compile.json Manifest.json package.json package-lock.json $(shell find source -not -name ".*" -a -not -name "*~" -a -not -name "*.tmp" -a -not -name "Makefile*" -a -type f -print )

if BUILD_QOOXDOO_APP

Expand Down
44 changes: 44 additions & 0 deletions t/etc/wgwrangler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

BACKEND:
cfg_db: /tmp/wgwrangler.db
sesame_user: qfqwfeqfeqf
# perl -MDigest::SHA -e 'print Digest::SHA::hmac_sha1_hex("access"),"\n"'
sesame_pass: wedfwfewqf
vpn_name: your_vpn_name
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

FRONTEND:
# logo = ../resource/wgwrangler/logo.png
# logo_small = ../resource/wgwrangler/logo-small.png
title: WGwrangler
initial_plugin: WireguardShow
company_name: OETIKER+PARTNER AG
company_url: http://www.oetiker.ch
# max_width = 800

PLUGIN:
- InitialUser:
module: UserForm
mode: init
type: add
tab-name: Create Initial User

- WireguardShow:
module: WireguardShow
tab-name: Wireguard
default-dns: 10.0.0.1
default-allowed-ips: 10.0.0.0/24
sender-email: support@oetiker.ch

- WireguardVersions:
module: WireguardVersions
tab-name: Config Versions

- AdminUser:
module: Users
tab-name: Admin User Manager

0 comments on commit 04b97e8

Please sign in to comment.