远程管理pi.hole实例。
pyholecli的Python项目详细描述
说明
从任何地方控制圆孔安装。
- 管理黑名单和白名单域名。
- 为内部服务创建和删除自定义域。
- 结束查询日志。
- 远程查看计时表以获取实时统计数据。
安装
pip install pyholecli
设置
创建一个ssh密钥并作为根用户安装到pi hole安装中。 此密钥将用于远程连接到实例。
可以使用标准方法声明pyholecli要使用的ssh密钥。
ssh代理
eval`ssh-agent` ssh-add ~/.ssh/keys/pi_hole
ssh_配置
# ~/.ssh/config
Host pi.hole
User root
IdentityFile ~/.ssh/keys/pi_hole
作为参数传递
pyholecli -i ~/.ssh/keys/pi_hole status
示例
获取有关特定命令的帮助。
pyholecli --help <command>
获取pi hole服务的状态。
pyholecli status
[✓] DNS service is running
[✓] Pi-hole blocking is Enabled
添加要由pi.hole解析的自定义主机名。
pyholecli hostname -h testing.local -i 192.168.1.100
删除多个自定义主机名。
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.
Subcommands:
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.