Skip to content
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

[33] Make dhcpd process run as the dhcpd user and group #34

Merged
merged 1 commit into from
Jul 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions util/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,8 @@ if [ -n "$IFACE" ]; then

uid=$(stat -c%u "$data_dir")
gid=$(stat -c%g "$data_dir")
if [ $gid -ne 0 ]; then
groupmod -g $gid dhcpd
fi
if [ $uid -ne 0 ]; then
usermod -u $uid dhcpd
fi
groupmod -og $gid dhcpd
usermod -ou $uid dhcpd

[ -e "$data_dir/dhcpd.leases" ] || touch "$data_dir/dhcpd.leases"
chown dhcpd:dhcpd "$data_dir/dhcpd.leases"
Expand All @@ -69,7 +65,7 @@ if [ -n "$IFACE" ]; then
echo "You must add the 'docker run' option '--net=host' if you want to provide DHCP service to the host network."
fi

$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" $IFACE
$run /usr/sbin/dhcpd -$DHCPD_PROTOCOL -f -d --no-pid -cf "$data_dir/dhcpd.conf" -lf "$data_dir/dhcpd.leases" -user dhcpd -group dhcpd $IFACE
else
# Run another binary
$run "$@"
Expand Down