Skip to content

Commit 3a4b9e4

Browse files
committed
Use CAP_NET_BIND_SERVICE
1 parent b363d97 commit 3a4b9e4

8 files changed

Lines changed: 15 additions & 33 deletions

File tree

.github/workflows/release.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Make a new release
22
on:
33
push:
4+
branches:
5+
- pkg
46
tags:
57
- v*.*.*
68

@@ -55,6 +57,8 @@ jobs:
5557
with:
5658
draft: true
5759
generate_release_notes: true
60+
package_name: pkg
61+
tag_name: pkg
5862

5963
create-sbom:
6064
needs:
@@ -75,7 +79,8 @@ jobs:
7579
# Store the version, stripping any v-prefix
7680
- name: Write release version
7781
run: |
78-
VERSION=${GITHUB_REF_NAME#v}
82+
# VERSION=${GITHUB_REF_NAME#v}
83+
VERSION=2.0.0
7984
echo Version: $VERSION
8085
echo "VERSION=$VERSION" >> $GITHUB_ENV
8186
@@ -215,9 +220,7 @@ jobs:
215220
--version ${{ env.VERSION }}
216221
--package defguard-proxy-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
217222
--freebsd-osversion '*'
218-
--depends openssl
219-
--before-install freebsd/preinst
220-
--after-remove freebsd/postrm"
223+
--depends openssl"
221224

222225
- name: Upload Linux x86_64 archive
223226
uses: shogo82148/actions-upload-release-asset@v1

docs/header.png

-496 Bytes
Loading

freebsd/postrm

Lines changed: 0 additions & 9 deletions
This file was deleted.

freebsd/preinst

Lines changed: 0 additions & 13 deletions
This file was deleted.

linux/defguard-proxy.service

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ After=network-online.target
77
[Service]
88
User=defguard
99
Group=defguard
10+
AmbientCapabilities=CAP_NET_BIND_SERVICE
11+
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
1012
ExecReload=/bin/kill -HUP $MAINPID
1113
ExecStart=/usr/bin/defguard-proxy --config /etc/defguard/proxy.toml
1214
KillMode=process

linux/postinst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ case "${1}" in
1414
abort-upgrade | abort-remove | abort-deconfigure)
1515
if [ -x /usr/bin/systemctl ]; then
1616
/usr/bin/systemctl daemon-reload
17-
if /usr/bin/systemctl is-enabled ${SERVICE_NAME} >/dev/null 2>&1; then
18-
/usr/bin/systemctl start ${SERVICE_NAME} || true
17+
if /usr/bin/systemctl is-enabled --quiet ${SERVICE_NAME}; then
18+
/usr/bin/systemctl --no-block restart ${SERVICE_NAME}
1919
fi
2020
fi
2121
;;

linux/postrm

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ set -e
44
USERNAME=defguard
55

66
if [ -x /usr/bin/systemctl ]; then
7-
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || true
7+
/usr/bin/systemctl --quiet daemon-reload || true
88
fi
99

10-
if id -u ${USERNAME} >/dev/null 2>&1
11-
then
12-
echo "If no longer needed, remove ${USERNAME} manually: userdel ${USERNAME}"
10+
if id -u ${USERNAME} >/dev/null 2>&1; then
11+
echo "If no longer needed, remove ${USERNAME} manually: userdel ${USERNAME}"
1312
fi

linux/prerm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ set -e
44
SERVICE_NAME='defguard-proxy'
55

66
if [ -x /usr/bin/systemctl ]; then
7-
/usr/bin/systemctl --no-block stop ${SERVICE_NAME} >/dev/null 2>&1 || true
7+
/usr/bin/systemctl --no-block --quiet stop ${SERVICE_NAME} || true
88
fi

0 commit comments

Comments
 (0)