{"id":19840973,"url":"https://github.com/dmachard/python-unbound-console","last_synced_at":"2025-05-01T19:30:50.875Z","repository":{"id":40686432,"uuid":"299036374","full_name":"dmachard/python-unbound-console","owner":"dmachard","description":"python client for unbound server","archived":false,"fork":false,"pushed_at":"2024-11-10T17:57:30.000Z","size":164,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T06:00:54.614Z","etag":null,"topics":["client","console","dns","remote-control","unbound"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmachard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-27T13:18:57.000Z","updated_at":"2025-01-23T02:21:24.000Z","dependencies_parsed_at":"2024-07-06T09:46:26.267Z","dependency_job_id":"5a012ef8-0ab4-4f5e-9295-294eb0ae11c3","html_url":"https://github.com/dmachard/python-unbound-console","commit_stats":null,"previous_names":["dmachard/unbound-console"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmachard%2Fpython-unbound-console","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmachard%2Fpython-unbound-console/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmachard%2Fpython-unbound-console/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmachard%2Fpython-unbound-console/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmachard","download_url":"https://codeload.github.com/dmachard/python-unbound-console/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251932604,"owners_count":21667178,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["client","console","dns","remote-control","unbound"],"created_at":"2024-11-12T12:28:53.450Z","updated_at":"2025-05-01T19:30:49.710Z","avatar_url":"https://github.com/dmachard.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![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.13.x](https://img.shields.io/badge/python%203.13.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)\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.22.x](https://img.shields.io/badge/unbound%201.22.x-tested-green) ![unbound 1.21.x](https://img.shields.io/badge/unbound%201.21.x-tested-green) ![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)\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\u003e 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\u003e 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='\u003cyaml content\u003e')\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmachard%2Fpython-unbound-console","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmachard%2Fpython-unbound-console","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmachard%2Fpython-unbound-console/lists"}