-
-
Notifications
You must be signed in to change notification settings - Fork 20
Fixes pentest issue DG25-27 from 2025-09-02 #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2a9ca15
adjust socket file permissions
wojcik91 c4b4c98
run daemon service under defguard group
wojcik91 b0bf69e
setup group in postinstall script
wojcik91 f8eb018
adjust service handling in postinstall script
wojcik91 e460d53
also handle cleanup when removing package
wojcik91 4ce574a
add missing dependency
wojcik91 c0aa39f
adjust daemon group
wojcik91 75da7d8
macOS: change group to staff
moubctez 54c9864
enforce group ownership on macos
wojcik91 0f0955a
adapt to macos
t-aleksander e1412b3
add more explicit message on group membership change
wojcik91 88d0b16
also set group explicitly on linux
wojcik91 9f624a3
add more detailed description for linux bundles
wojcik91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,70 @@ | ||
systemctl daemon-reload | ||
systemctl enable defguard-service | ||
systemctl start defguard-service | ||
#!/bin/sh | ||
set -e | ||
|
||
GROUP_NAME="defguard" | ||
SERVICE_NAME="defguard-service" | ||
|
||
case "$1" in | ||
configure) | ||
# Create the group if it doesn't exist | ||
if ! getent group "$GROUP_NAME" >/dev/null; then | ||
addgroup --system "$GROUP_NAME" | ||
echo "Created group $GROUP_NAME" | ||
fi | ||
|
||
# Determine target user | ||
TARGET_USER="" | ||
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then | ||
TARGET_USER="$SUDO_USER" | ||
elif [ -n "$USER" ] && [ "$USER" != "root" ]; then | ||
TARGET_USER="$USER" | ||
fi | ||
|
||
# Add user to group if we found a valid target | ||
if [ -n "$TARGET_USER" ]; then | ||
if getent passwd "$TARGET_USER" >/dev/null; then | ||
# Try to add user to group and check if it succeeded | ||
if usermod -a -G "$GROUP_NAME" "$TARGET_USER"; then | ||
echo "Added user $TARGET_USER to group $GROUP_NAME" | ||
|
||
# Only show reboot message if user was actually added | ||
echo "================================================" | ||
echo " IMPORTANT: Reboot or Re-login Required" | ||
echo "================================================" | ||
echo "The user has been added to the defguard group." | ||
echo "Please reboot or log out and back in for the" | ||
echo "group membership changes to take effect." | ||
echo "================================================" | ||
else | ||
echo "Warning: Failed to add user $TARGET_USER to group $GROUP_NAME" | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
# Handle systemd service | ||
if [ -d /run/systemd/system ]; then | ||
# Reload systemd to recognize new service file | ||
systemctl daemon-reload | ||
|
||
# Enable service to start on boot | ||
systemctl enable "$SERVICE_NAME" | ||
|
||
# Start the service now | ||
systemctl start "$SERVICE_NAME" | ||
fi | ||
;; | ||
|
||
abort-upgrade|abort-remove|abort-deconfigure) | ||
# On failed operations, ensure service is running if it should be | ||
if [ -d /run/systemd/system ]; then | ||
systemctl daemon-reload | ||
if systemctl is-enabled "$SERVICE_NAME" >/dev/null 2>&1; then | ||
systemctl start "$SERVICE_NAME" || true | ||
fi | ||
fi | ||
;; | ||
esac | ||
|
||
#DEBHELPER# | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,24 @@ | ||
systemctl daemon-reload | ||
#!/bin/sh | ||
set -e | ||
|
||
GROUP_NAME="defguard" | ||
SERVICE_NAME="defguard-service" | ||
|
||
case "$1" in | ||
remove) | ||
# Service file still exists, just disable it | ||
if [ -d /run/systemd/system ]; then | ||
systemctl disable "$SERVICE_NAME" || true | ||
systemctl daemon-reload | ||
fi | ||
;; | ||
|
||
purge) | ||
# Complete removal - clean up group too | ||
if getent group "$GROUP_NAME" >/dev/null; then | ||
delgroup "$GROUP_NAME" || true | ||
fi | ||
;; | ||
esac | ||
|
||
#DEBHELPER# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
systemctl stop defguard-service | ||
systemctl disable defguard-service | ||
#!/bin/sh | ||
set -e | ||
|
||
SERVICE_NAME="defguard-service" | ||
|
||
case "$1" in | ||
remove|upgrade|deconfigure) | ||
if [ -d /run/systemd/system ]; then | ||
# Stop the service before removal/upgrade | ||
systemctl stop "$SERVICE_NAME" || true | ||
fi | ||
;; | ||
esac | ||
|
||
#DEBHELPER# |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"bundle": { | ||
"longDescription": "IMPORTANT: Reboot or Re-login Required\nOn initial install the user is added to the defguard group.\nA reboot or logging out and back in is required for group membership changes to take effect.\nThis is not required on subsequent updates." | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.