Python console for unbound
Project description
Python console for unbound server
Table of contents
- Installation
- Remote Control on Unbound
- Execute command
- Loading zone from YAML file
- Execute bulk command
Installation
This module can be installed from pypi website
pip install unbound_console
Remote Control on Unbound
Before to use this utility. You must activate the remote control on your unbound server. See config file example.
Execute command
You can execute commands with the function send_command
. See nlnetlabs documentations for the full list of available commands.
- Import the module in your code
from unbound_console import RemoteControl
- Configure the remote control client with tls support. You can also provide a unix socket
unix_sock="/var/run/unbound-console.sock"
.
rc = RemoteControl(host="127.0.0.1", port=8953,
server_cert = "/etc/unbound/unbound_server.pem",
client_cert= "/etc/unbound/unbound_control.pem",
client_key= "/etc/unbound/unbound_control.key")
- Execute a command and get output
o = rc.send_command(cmd="status")
print(o)
Loading zone from YAML file
YAML zone definition example:
zone:
name: home.
type: static
records:
- "router.home. 86400 IN A 192.168.0.1"
- "192.168.0.1 86400 IN PTR router.test."
Call load_zone
with the yaml file to load-it in your unbound server.
o = rc.load_zone(data_yaml='<yaml content>')
print(o)
Execute bulk command
domains_bulk = []
domains_bulk.append( "www.google.com always_nxdomain")
o = rc.send_command(cmd="local_zones", data_list=domains_bulk)
print(o)
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
unbound_console-0.4.0.tar.gz
(6.1 kB
view hashes)
Built Distribution
Close
Hashes for unbound_console-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1625325631022ac1bb2c55226ac1ea39086583b9741987f6955dff33cc674b9b |
|
MD5 | 528db2baf83f2704df77c18de285b261 |
|
BLAKE2b-256 | 4347eaf4b5a38e924a71c59647068945aa0b0291d85cbb5c56c3054f93154c4e |