Skip to content

Instantly share code, notes, and snippets.

@AdroitAdorKhan
Last active January 25, 2025 11:08
Show Gist options
  • Save AdroitAdorKhan/c5335b7113c90aac653ef7b4e07da647 to your computer and use it in GitHub Desktop.
Save AdroitAdorKhan/c5335b7113c90aac653ef7b4e07da647 to your computer and use it in GitHub Desktop.

Download Binary and place at /op/blocky (as per config) https://github.com/0xERR0R/blocky/releases/latest

Set up config.yml - https://github.com/AdroitAdorKhan/dnsServerLists/blob/main/configs/blocky.config.yml + google + cloudflare

sudo useradd -M blocky && sudo usermod -L blocky && sudo usermod -a -G blocky blocky

sudo chown blocky:blocky /opt/blocky/

default nano /etc/systemd/system/blocky.service

[Unit]
Description=Blocky is a DNS proxy and ad-blocker
ConditionPathExists=/opt/blocky
After=local-fs.target
[Service]
User=blocky
Group=blocky
Type=simple
WorkingDirectory=/opt/blocky
ExecStart=/opt/blocky/blocky --config /opt/blocky/config.yml
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=blocky
[Install]
WantedBy=multi-user.target

cloudflare nano /etc/systemd/system/blocky-cloudflare.service

[Unit]
Description=Blocky via Cloudflare
ConditionPathExists=/opt/blocky
After=local-fs.target
[Service]
User=blocky
Group=blocky
Type=simple
WorkingDirectory=/opt/blocky
ExecStart=/opt/blocky/blocky --config /opt/blocky/config-cloudflare.yml
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=blocky
[Install]
WantedBy=multi-user.target

google nano /etc/systemd/system/blocky-google.service

[Unit]
Description=Blocky via Google
ConditionPathExists=/opt/blocky
After=local-fs.target
[Service]
User=blocky
Group=blocky
Type=simple
WorkingDirectory=/opt/blocky
ExecStart=/opt/blocky/blocky --config /opt/blocky/config-google.yml
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=blocky
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable blocky blocky-cloudflare blocky-google
systemctl start blocky blocky-cloudflare blocky-google
@dabeeeenster
Copy link

I needed setcap cap_net_bind_service=ep /opt/blocky/blocky to allow the user to bind to port 53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment