Skip to content

Commit

Permalink
Start pihole-FTL as root if capabilities are not supported by the system
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Aug 19, 2018
1 parent 74008d2 commit 5cd3b11
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions advanced/Templates/pihole-FTL.service
Expand Up @@ -34,9 +34,13 @@ start() {
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port
chown pihole:pihole /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"
echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.piholeFTL
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
if setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+eip "$(which pihole-FTL)"; then
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
else
echo "Warning: Starting pihole-FTL as root because setting capabilities is not supported on this system"
pihole-FTL
fi
echo
fi
}
Expand Down Expand Up @@ -78,7 +82,7 @@ status() {
echo "[ ] pihole-FTL is not running"
exit 1
fi
}
}


### main logic ###
Expand Down

1 comment on commit 5cd3b11

@pralor-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Pi-hole Userspace. There might be relevant details there:

https://discourse.pi-hole.net/t/dnsmasq-service-could-not-be-found/13922/9

Please sign in to comment.