Skip to content

Commit

Permalink
deb packaging improvements (file locations /var /etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtoobii committed May 7, 2021
1 parent cfdef4e commit 6c61449
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 15 deletions.
10 changes: 7 additions & 3 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ chmod g+rwx /etc/wireguard
chmod -R g+rw /etc/wireguard

# set permissions for /opt/wg-wrangler/etc dir
chgrp --silent --recursive $GROUPNAME /opt/wg-wrangler/etc
chgrp --silent --recursive $GROUPNAME /etc/opt/$PKGNAME/
# set group permissions
chmod -R g+rwx /opt/wg-wrangler/etc
chmod -R g+rwx /etc/opt/$PKGNAME/

# create var directory
mkdir -p /var/opt/$PKGNAME
chown --silent --recursive $USERNAME /var/opt/$PKGNAME

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

2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export DH_ALWAYS_EXCLUDE=CVS:.svn:.git:

override_dh_auto_configure:
./bootstrap
./configure --prefix=/opt/wg-wrangler
./configure --prefix=/opt/wg-wrangler --sysconfdir=/etc/opt/wg-wrangler --localstatedir=/var/opt/wg-wrangler

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

[Service]
Environment=MOJO_MODE=production
Environment=MOJO_LOG_LEVEL=info
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 variables defined in this file (if it exists) override previously defined ones
EnvironmentFile=opt/wg-wrangler/etc/env.conf
EnvironmentFile=-/etc/opt/wg-wrangler/env.conf

User=wg-wrangler_manager
Group=wg-wrangler_manager
ExecStart=/usr/bin/perl opt/wg-wrangler/bin/wgwrangler.pl prefork --listen $LISTEN_ON
Expand Down
7 changes: 1 addition & 6 deletions etc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@


ETC = wgwrangler.dist.yaml
ETC = wgwrangler.dist.yaml env.dist.conf
EXTRA_DIST = $(ETC)
sysconf_DATA = $(ETC)

wgwrangler.conf:
cp wgwrangler.dist.yaml wgwrangler.yaml

.PHONY: wgwrangler.conf
2 changes: 2 additions & 0 deletions etc/env.dist.conf
Original file line number Diff line number Diff line change
@@ -1,2 +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
2 changes: 1 addition & 1 deletion etc/wgwrangler.dist.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

BACKEND:
cfg_db: /tmp/wgwrangler.db
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
Expand Down

0 comments on commit 6c61449

Please sign in to comment.