Skip to main content

Remote management of a pi.hole instance.

Project description


Control a Pi-hole installation from anywhere.

  • Manage blacklisted and whitelisted domains.
  • Create and remove custom domains for your internal services.
  • Tail the query log.
  • Remotely view the chronometer for realtime statistics.


pip install pyholecli


Create a SSH key and install on your Pi-hole installation as the root user. This key will be used to connect remotely to the instance.

You can use standard methods to declare the ssh key to be used by pyholecli.


eval `ssh-agent`
ssh-add ~/.ssh/keys/pi_hole


# ~/.ssh/config
Host pi.hole
    User root
    IdentityFile ~/.ssh/keys/pi_hole

Pass as an Argument

pyholecli -i ~/.ssh/keys/pi_hole status


Get help about a specific command.

pyholecli --help <command>

Get the status of the Pi-hole services.

pyholecli status
  [✓] DNS service is running
  [✓] Pi-hole blocking is Enabled

Add a custom hostname to be resolved by Pi.hole.

pyholecli hostname -h testing.local -i

Remove multiple custom hostnames.

pyholecli remove-hostnames -h redis.localhost -h psql.localhost


Usage: pyholecli [--core-opts] <subcommand> [--subcommand-opts] ...

Core options:

  --complete                        Print tab-completion candidates for given parse remainder.
  --hide=STRING                     Set default value of run()'s 'hide' kwarg.
  --prompt-for-login-password       Request an upfront SSH-auth password prompt.
  --prompt-for-passphrase           Request an upfront SSH key passphrase prompt.
  --prompt-for-sudo-password        Prompt user at start of session for the sudo.password config value.
  --write-pyc                       Enable creation of .pyc files.
  -d, --debug                       Enable debug output.
  -D INT, --list-depth=INT          When listing tasks, only show the first INT levels.
  -e, --echo                        Echo executed commands before running.
  -f STRING, --config=STRING        Runtime configuration file to use.
  -F STRING, --list-format=STRING   Change the display format used when listing tasks. Should be one of: flat (default), nested, json.
  -h [STRING], --help[=STRING]      Show core or per-task help and exit.
  -H STRING, --hosts=STRING         Comma-separated host name(s) to execute tasks against.
  -i, --identity                    Path to runtime SSH identity (key) file. May be given multiple times.
  -l [STRING], --list[=STRING]      List available tasks, optionally limited to a namespace.
  -p, --pty                         Use a pty when executing shell commands.
  -S STRING, --ssh-config=STRING    Path to runtime SSH config file.
  -V, --version                     Show version and exit.
  -w, --warn-only                   Warn, instead of failing, when shell commands fail.


  blacklist                   Blacklist a given domain.
  blacklisted-domains         Get all of the custom blacklisted domains.
  chronometer                 Continually print the stats using the chronometer.
  disable                     Disable the pi.hole blacklist.
  enable                      Enable the pi.hole blacklist.
  hostname                    Add a custom hostname which the pi.hole will resolve to the given IP address.
  hostnames                   Print the custom hostnames defined by the pi.hole instance.
  query                       Query the pi.hole instance for a given FQDN.
  remove-blacklisted-domain   Remove a given custom blacklisted domain.
  remove-hostname             Remove a custom hostname.
  remove-whitelisted-domain   Remove a given whitelisted domain.
  remove-wildcard-blacklist   Remove a given wildcard blacklist.
  status                      Query the status of the pi.hole instance.
  tail                        Tail the pi.hole resolver log file.
  whitelist                   Whitelist a given domain.
  whitelisted-domains         Get all of the custom whitelisted domains.
  wildcard-blacklist          Blacklist a given domain and its subdomains.
  wildcard-blacklists         Print the wildcard blacklist.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyholecli-0.0.1.tar.gz (5.5 kB view hashes)

Uploaded source

Built Distribution

pyholecli-0.0.1-py3-none-any.whl (7.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page