unbound-console


Nameunbound-console JSON
Version 0.6.4 PyPI version JSON
download
home_pagehttps://github.com/dmachard/unbound-console
SummaryPython console for unbound
upload_time2024-09-14 06:43:16
maintainerNone
docs_urlNone
authorDenis MACHARD
requires_pythonNone
licenseNone
keywords unbound console control remote client
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Build](https://github.com/dmachard/python-unbound-console/workflows/Build/badge.svg) ![Testing](https://github.com/dmachard/python-unbound-console/workflows/Testing/badge.svg) ![Pypi](https://github.com/dmachard/python-unbound-console/workflows/Publish/badge.svg)

# Python console for unbound server

## Table of contents
* [Installation](#installation)
* [Remote Control on Unbound](#remote-control-on-unbound)
* [Execute command](#execute-command)
* [Loading zone from YAML file](#loading-zone-from-yaml-file)
* [Loading zone from "LocalZone" object](#loading-zone-from-localzone-object)
* [Execute bulk command](#execute-bulk-command)

## Installation

![python 3.12.x](https://img.shields.io/badge/python%203.12.x-tested-blue) ![python 3.11.x](https://img.shields.io/badge/python%203.11.x-tested-blue) ![python 3.10.x](https://img.shields.io/badge/python%203.10.x-tested-blue) ![python 3.9.x](https://img.shields.io/badge/python%203.9.x-tested-blue) ![python 3.8.x](https://img.shields.io/badge/python%203.8.x-tested-blue)

This module can be installed from [pypi](https://pypi.org/project/unbound_console/) website.

This command will install the module with yaml support for loading zone data.

```python
pip install unbound_console[yaml]
```

If loading a zone using yaml is not required use the following command, zone data can instead be loaded through the `LocalZone` object:

```python
pip install unbound_console
```

## Remote Control on Unbound

![unbound 1.20.x](https://img.shields.io/badge/unbound%201.20.x-tested-green) ![unbound 1.19.x](https://img.shields.io/badge/unbound%201.19.x-tested-green)  ![unbound 1.18.x](https://img.shields.io/badge/unbound%201.18.x-tested-green) ![unbound 1.17.x](https://img.shields.io/badge/unbound%201.17.x-tested-green) ![unbound 1.16.x](https://img.shields.io/badge/unbound%201.16.x-tested-green) ![unbound 1.15.x](https://img.shields.io/badge/unbound%201.15.x-tested-green) ![unbound 1.14.x](https://img.shields.io/badge/unbound%201.14.x-tested-green)  ![unbound 1.13.x](https://img.shields.io/badge/unbound%201.13.x-tested-green) ![unbound 1.12.x](https://img.shields.io/badge/unbound%201.12.x-tested-green)

Before to use this utility. You must activate the remote control on your unbound server.
See [config file](https://github.com/dmachard/python-unbound-console/blob/master/testsdata/unbound_tls.conf) example.

### Execute command

You can execute commands with the function `send_command`. See [nlnetlabs documentations](https://www.nlnetlabs.nl/documentation/unbound/unbound-control/) for the full list of available commands.

- Import the module in your code

```python
from unbound_console import RemoteControl
```

> An asyncio implementation is available, use `RemoteControlAsync` instead.

- Configure the remote control client with tls support. You can also provide a unix socket `unix_sock="/var/run/unbound-console.sock"`.

```python
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

```python
o = rc.send_command(cmd="status")
print(o)
```

### Loading zone from YAML file

YAML zone definition example:

> This requires installing unbound_console with yaml support

```
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.

```python
o = rc.load_zone(zone_data='<yaml content>')
print(o)
```

### Loading zone from "LocalZone" object

Example loading from a `LocalZone` object:

```python
from unbound_console import LocalZone

zone = LocalZone(
    name="home",
    type="static",
    records=[
      "router.home. 86400 IN A 192.168.0.1",
      "192.168.0.1 86400 IN PTR router.test.",
    ],
)
o = rc.load_zone(zone_data=zone)
print(o)
```

### Execute bulk command

```python
domains_bulk = []
domains_bulk.append( "www.google.com always_nxdomain")

o = rc.send_command(cmd="local_zones", data_list=domains_bulk)
print(o)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dmachard/unbound-console",
    "name": "unbound-console",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "unbound console control remote client",
    "author": "Denis MACHARD",
    "author_email": "d.machard@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5a/ef/07735326409eb96ddedce2369462881ee943f149f5de81ff002a22471cbe/unbound_console-0.6.4.tar.gz",
    "platform": "any",
    "description": "![Build](https://github.com/dmachard/python-unbound-console/workflows/Build/badge.svg) ![Testing](https://github.com/dmachard/python-unbound-console/workflows/Testing/badge.svg) ![Pypi](https://github.com/dmachard/python-unbound-console/workflows/Publish/badge.svg)\n\n# Python console for unbound server\n\n## Table of contents\n* [Installation](#installation)\n* [Remote Control on Unbound](#remote-control-on-unbound)\n* [Execute command](#execute-command)\n* [Loading zone from YAML file](#loading-zone-from-yaml-file)\n* [Loading zone from \"LocalZone\" object](#loading-zone-from-localzone-object)\n* [Execute bulk command](#execute-bulk-command)\n\n## Installation\n\n![python 3.12.x](https://img.shields.io/badge/python%203.12.x-tested-blue) ![python 3.11.x](https://img.shields.io/badge/python%203.11.x-tested-blue) ![python 3.10.x](https://img.shields.io/badge/python%203.10.x-tested-blue) ![python 3.9.x](https://img.shields.io/badge/python%203.9.x-tested-blue) ![python 3.8.x](https://img.shields.io/badge/python%203.8.x-tested-blue)\n\nThis module can be installed from [pypi](https://pypi.org/project/unbound_console/) website.\n\nThis command will install the module with yaml support for loading zone data.\n\n```python\npip install unbound_console[yaml]\n```\n\nIf loading a zone using yaml is not required use the following command, zone data can instead be loaded through the `LocalZone` object:\n\n```python\npip install unbound_console\n```\n\n## Remote Control on Unbound\n\n![unbound 1.20.x](https://img.shields.io/badge/unbound%201.20.x-tested-green) ![unbound 1.19.x](https://img.shields.io/badge/unbound%201.19.x-tested-green)  ![unbound 1.18.x](https://img.shields.io/badge/unbound%201.18.x-tested-green) ![unbound 1.17.x](https://img.shields.io/badge/unbound%201.17.x-tested-green) ![unbound 1.16.x](https://img.shields.io/badge/unbound%201.16.x-tested-green) ![unbound 1.15.x](https://img.shields.io/badge/unbound%201.15.x-tested-green) ![unbound 1.14.x](https://img.shields.io/badge/unbound%201.14.x-tested-green)  ![unbound 1.13.x](https://img.shields.io/badge/unbound%201.13.x-tested-green) ![unbound 1.12.x](https://img.shields.io/badge/unbound%201.12.x-tested-green)\n\nBefore to use this utility. You must activate the remote control on your unbound server.\nSee [config file](https://github.com/dmachard/python-unbound-console/blob/master/testsdata/unbound_tls.conf) example.\n\n### Execute command\n\nYou can execute commands with the function `send_command`. See [nlnetlabs documentations](https://www.nlnetlabs.nl/documentation/unbound/unbound-control/) for the full list of available commands.\n\n- Import the module in your code\n\n```python\nfrom unbound_console import RemoteControl\n```\n\n> An asyncio implementation is available, use `RemoteControlAsync` instead.\n\n- Configure the remote control client with tls support. You can also provide a unix socket `unix_sock=\"/var/run/unbound-console.sock\"`.\n\n```python\nrc = RemoteControl(host=\"127.0.0.1\", port=8953,\n                   server_cert = \"/etc/unbound/unbound_server.pem\",\n                   client_cert= \"/etc/unbound/unbound_control.pem\",\n                   client_key= \"/etc/unbound/unbound_control.key\")\n```\n\n- Execute a command and get output\n\n```python\no = rc.send_command(cmd=\"status\")\nprint(o)\n```\n\n### Loading zone from YAML file\n\nYAML zone definition example:\n\n> This requires installing unbound_console with yaml support\n\n```\nzone:\n  name: home.\n  type: static\n  records:\n    - \"router.home. 86400 IN A 192.168.0.1\"\n    - \"192.168.0.1 86400 IN PTR router.test.\"\n```\n\nCall `load_zone` with the yaml file to load-it in your unbound server.\n\n```python\no = rc.load_zone(zone_data='<yaml content>')\nprint(o)\n```\n\n### Loading zone from \"LocalZone\" object\n\nExample loading from a `LocalZone` object:\n\n```python\nfrom unbound_console import LocalZone\n\nzone = LocalZone(\n    name=\"home\",\n    type=\"static\",\n    records=[\n      \"router.home. 86400 IN A 192.168.0.1\",\n      \"192.168.0.1 86400 IN PTR router.test.\",\n    ],\n)\no = rc.load_zone(zone_data=zone)\nprint(o)\n```\n\n### Execute bulk command\n\n```python\ndomains_bulk = []\ndomains_bulk.append( \"www.google.com always_nxdomain\")\n\no = rc.send_command(cmd=\"local_zones\", data_list=domains_bulk)\nprint(o)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python console for unbound",
    "version": "0.6.4",
    "project_urls": {
        "Homepage": "https://github.com/dmachard/unbound-console"
    },
    "split_keywords": [
        "unbound",
        "console",
        "control",
        "remote",
        "client"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "681a38a57e15729df502e2a2da1b66445e2e916b88056e2e0f4c6832ca8552dc",
                "md5": "86fbb65c2af43cf2acb6c330753e8657",
                "sha256": "f32fe6a74293cfec3b5caa19ebdb2352b9d600e3124fc474b6e29390161ca161"
            },
            "downloads": -1,
            "filename": "unbound_console-0.6.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "86fbb65c2af43cf2acb6c330753e8657",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7812,
            "upload_time": "2024-09-14T06:43:14",
            "upload_time_iso_8601": "2024-09-14T06:43:14.857046Z",
            "url": "https://files.pythonhosted.org/packages/68/1a/38a57e15729df502e2a2da1b66445e2e916b88056e2e0f4c6832ca8552dc/unbound_console-0.6.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5aef07735326409eb96ddedce2369462881ee943f149f5de81ff002a22471cbe",
                "md5": "7b59cf1e60e40e5e768bfee743dd3ae0",
                "sha256": "39992635a2d5a579f1de72cbc57b86d78f196449040dc336627afb244eaf13d8"
            },
            "downloads": -1,
            "filename": "unbound_console-0.6.4.tar.gz",
            "has_sig": false,
            "md5_digest": "7b59cf1e60e40e5e768bfee743dd3ae0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7132,
            "upload_time": "2024-09-14T06:43:16",
            "upload_time_iso_8601": "2024-09-14T06:43:16.271759Z",
            "url": "https://files.pythonhosted.org/packages/5a/ef/07735326409eb96ddedce2369462881ee943f149f5de81ff002a22471cbe/unbound_console-0.6.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-14 06:43:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dmachard",
    "github_project": "unbound-console",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "unbound-console"
}
        
Elapsed time: 1.02709s