Skip to content

Instantly share code, notes, and snippets.

@hvindin
Last active April 22, 2018 13:49
Show Gist options
  • Save hvindin/969ac05f1e3181d3caf0f49e4403bb6a to your computer and use it in GitHub Desktop.
Save hvindin/969ac05f1e3181d3caf0f49e4403bb6a to your computer and use it in GitHub Desktop.
pihole-FTL.service systemd
[Unit]
Description=Pi-hole FTLDNS
After=network.target
Wants=lighttpd.service
[Service]
Type=forking
User=pihole
Group=pihole
PIDFile=/run/pihole-FTL.pid
ExecStartPre=/bin/touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
ExecStartPre=/bin/mkdir -p /var/run/pihole /var/log/pihole
ExecStartPre=/bin/rm -f /var/run/pihole/FTL.sock
ExecStartPre=/bin/chown -R pihole:pihole /var/run/pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log /var/log/pihole
ExecStartPre=/bin/chmod u=rwX,go=rX /var/run/pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log /var/log/pihole /var/run/pihole
ExecStartPre=/sbin/setcap cap_net_bind_service,cap_net_raw,cap_net_admin=+eip /usr/bin/pihole-FTL
ExecStartPre=/bin/bash -c "/bin/echo 'nameserver 127.0.0.1' | /sbin/resolvconf -a lo.piholeFTL"
ExecStart=/usr/bin/pihole-FTL
ExecReload=/bin/kill -USR1 $MAINPID
Restart=on-failure
TimeoutStopSec=5s
PermissionsStartOnly=true
#AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_NET_ADMIN
[Install]
WantedBy=multi-user.target
root@pi-local:~# getcap /usr/bin/pihole-FTL
root@pi-local:~# systemctl cat pihole-FTL
# /lib/systemd/system/pihole-FTL.service
[Unit]
Description=Pi-hole FTLDNS
After=network.target
Wants=lighttpd.service
[Service]
Type=forking
User=pihole
Group=pihole
PIDFile=/run/pihole-FTL.pid
ExecStartPre=/bin/touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
ExecStartPre=/bin/mkdir -p /var/run/pihole /var/log/pihole
ExecStartPre=/bin/rm -f /var/run/pihole/FTL.sock
ExecStartPre=/bin/chown -R pihole:pihole /var/run/pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log /var/log/pihole
ExecStartPre=/bin/chmod u=rwX,go=rX /var/run/pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log /var/log/pihole /var/run/
ExecStartPre=/bin/bash -c "/bin/echo 'nameserver 127.0.0.1' | /sbin/resolvconf -a lo.piholeFTL"
ExecStart=/usr/bin/pihole-FTL
ExecReload=/bin/kill -USR1 $MAINPID
Restart=on-failure
TimeoutStopSec=5s
PermissionsStartOnly=true
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_NET_ADMIN
[Install]
WantedBy=multi-user.target
root@pi-local:~# systemctl status pihole-FTL.service
● pihole-FTL.service - Pi-hole FTLDNS
Loaded: loaded (/lib/systemd/system/pihole-FTL.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sun 2018-04-22 23:26:50 AEST; 3min 11s ago
Main PID: 31148 (code=exited, status=0/SUCCESS)
Apr 22 23:26:40 pi-local.pyrmont.home-v.ind.in systemd[1]: Starting Pi-hole FTLDNS...
Apr 22 23:26:47 pi-local.pyrmont.home-v.ind.in systemd[1]: Started Pi-hole FTLDNS.
root@pi-local:~# ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 5 127.0.0.1:631 *:*
LISTEN 0 128 :::22 :::*
LISTEN 0 5 ::1:631 :::*
root@pi-local:~# sudo systemctl start pihole-FTL.service
root@pi-local:~# ss -tln
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 5 127.0.0.1:4711 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 32 *:53 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 5 127.0.0.1:631 *:*
LISTEN 0 5 ::1:4711 :::*
LISTEN 0 128 :::80 :::*
LISTEN 0 32 :::53 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 5 ::1:631 :::*
root@pi-local:~#
[Unit]
Description=Pi-hole FTLDNS
After=network.target
Wants=lighttpd.service
[Service]
Type=forking
User=pihole
Group=pihole
PIDFile=/run/pihole-FTL.pid
ExecStartPre=/bin/touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
ExecStartPre=/bin/mkdir -p /var/run/pihole /var/log/pihole
ExecStartPre=/bin/rm -f /var/run/pihole/FTL.sock
ExecStartPre=/bin/chown -R pihole:pihole /var/run/pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log /var/log/pihole
ExecStartPre=/bin/chmod u=rwX,go=rX /var/run/pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole /etc/pihole/dhcp.leases /var/log/pihole.log /var/log/pihole /var/run/
ExecStartPre=/bin/bash -c "/bin/echo 'nameserver 127.0.0.1' | /sbin/resolvconf -a lo.piholeFTL"
ExecStart=/usr/bin/pihole-FTL
ExecReload=/bin/kill -USR1 $MAINPID
Restart=on-failure
TimeoutStopSec=5s
PermissionsStartOnly=true
AmbientCapabilities=CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_NET_ADMIN
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment