Skip to main content

A CLI for knotapi.

Project description

knotctl

This is a commandline tool for knotapi: https://gitlab.nic.cz/knot/knot-dns-rest

Build and install

The preffered method of installation is via pipx:

pipx install knotctl

To install using pip, run the following command in a virtual envrionment.

python -m pip install knotctl

To build and install as a deb-package

sudo apt install python3-stdeb
git clone https://code.smolnet.org/micke/knotctl
cd knotctl
python3 setup.py --command-packages=stdeb.command bdist_deb
sudo dpkg -i deb_dist/knotctl_*_all.deb

A prebuilt deb-package is also available from the release page: https://code.smolnet.org/micke/knotctl/releases/

Shell completion

For bash: add this to .bashrc

source <(knotctl completion)

For fish, run:

knotctl completion --shell fish > ~/.config/fish/completions/knotctl.fish

For tcsh: add this to .cshrc

complete "knotctl" 'p@*@`python-argcomplete-tcsh "knotctl"`@' ;

For zsh: add this to .zshrc

autoload -U bashcompinit
bashcompinit
source <(knotctl completion)

Usage

usage: knotctl [-h] [--json | --no-json]
               {add,auditlog,changelog,completion,config,delete,list,update}
               ...

Manage DNS records with knot dns rest api:
        * https://gitlab.nic.cz/knot/knot-dns-rest

positional arguments:
  {add,auditlog,changelog,completion,config,delete,list,update}

options:
  -h, --help            show this help message and exit
  --json, --no-json

    The Domain Name System specifies a database of information
    elements for network resources. The types of information
    elements are categorized and organized with a list of DNS
    record types, the resource records (RRs). Each record has a
    name, a type, an expiration time (time to live), and
    type-specific data.

    The following is a list of terms used in this program:
    ----------------------------------------------------------------
    | Vocabulary | Description                                     |
    ----------------------------------------------------------------
    | zone       | A DNS zone is a specific portion of the DNS     |
    |            | namespace in the Domain Name System (DNS),      |
    |            | which a specific organization or administrator  |
    |            | manages.                                        |
    ----------------------------------------------------------------
    | name       | In the Internet, a domain name is a string that |
    |            | identifies a realm of administrative autonomy,  |
    |            | authority or control. Domain names are often    |
    |            | used to identify services provided through the  |
    |            | Internet, such as websites, email services and  |
    |            | more.                                           |
    ----------------------------------------------------------------
    | rtype      | A record type indicates the format of the data  |
    |            | and it gives a hint of its intended use. For    |
    |            | example, the A record is used to translate from |
    |            | a domain name to an IPv4 address, the NS record |
    |            | lists which name servers can answer lookups on  |
    |            | a DNS zone, and the MX record specifies the     |
    |            | mail server used to handle mail for a domain    |
    |            | specified in an e-mail address.                 |
    ----------------------------------------------------------------
    | data       | A records data is of type-specific relevance,   |
    |            | such as the IP address for address records, or  |
    |            | the priority and hostname for MX records.       |
    ----------------------------------------------------------------

    This information was compiled from Wikipedia:
       * https://en.wikipedia.org/wiki/DNS_zone
       * https://en.wikipedia.org/wiki/Domain_Name_System
       * https://en.wikipedia.org/wiki/Zone_file

ADD

usage: knotctl add [-h] -d DATA -n NAME -r RTYPE [-t TTL] -z ZONE

Add a new record to the zone.

options:
  -h, --help            show this help message and exit
  -d DATA, --data DATA
  -n NAME, --name NAME
  -r RTYPE, --rtype RTYPE
  -t TTL, --ttl TTL
  -z ZONE, --zone ZONE

COMPLETION

usage: knotctl completion [-h] [-s SHELL]

Generate shell completion script.

options:
  -h, --help            show this help message and exit
  -s SHELL, --shell SHELL

AUDITLOG

usage: knotctl auditlog [-h]

Audit the log file for errors.

options:
  -h, --help  show this help message and exit

CHANGELOG

usage: knotctl changelog [-h] -z ZONE

View the changelog of a zone.

options:
  -h, --help            show this help message and exit
  -z ZONE, --zone ZONE

CONFIG

usage: knotctl config [-h] [-b BASEURL] [-c CONTEXT] [-p PASSWORD] [-u USERNAME]

Configure access to knot-dns-rest-api.

options:
  -h, --help            show this help message and exit
  -b BASEURL, --baseurl BASEURL
  -c CONTEXT, --context CONTEXT
  -p PASSWORD, --password PASSWORD
  -u USERNAME, --username USERNAME

DELETE

usage: knotctl delete [-h] [-d DATA] [-n NAME] [-r RTYPE] -z ZONE

Delete a record from the zone.

options:
  -h, --help            show this help message and exit
  -d DATA, --data DATA
  -n NAME, --name NAME
  -r RTYPE, --rtype RTYPE
  -z ZONE, --zone ZONE

LIST

usage: knotctl list [-h] [-d DATA] [-n NAME] [-r RTYPE] [-z ZONE]

List records.

options:
  -h, --help            show this help message and exit
  -d DATA, --data DATA
  -n NAME, --name NAME
  -r RTYPE, --rtype RTYPE
  -z ZONE, --zone ZONE

UPDATE

usage: knotctl update [-h] -a [ARGUMENT ...] -d DATA -n NAME -r RTYPE [-t TTL]
                      -z ZONE
Update a record in the zone. The record must exist in the zone.
In this case --data, --name, --rtype and --ttl switches are used
for searching for the appropriate record, while the --argument
switches are used for updating the record.

options:
  -h, --help            show this help message and exit
  -a [KEY=VALUE ...], --argument [KEY=VALUE ...]
                        Specify key - value pairs to be updated:
                        name=dns1.example.com. or data=127.0.0.1 for example.
                        --argument can be repeated
  -d DATA, --data DATA
  -n NAME, --name NAME
  -r RTYPE, --rtype RTYPE
  -t TTL, --ttl TTL
  -z ZONE, --zone ZONE

Available arguments are:
    data: New record data.
    name: New record domain name.
    rtype: New record type.
    ttl: New record time to live (TTL).

USER

usage: knotctl user [-h] [-u USERNAME]

View user information.

options:
  -h, --help            show this help message and exit
  -u USERNAME, --username USERNAME

ZONE

usage: knotctl zone 

List zones.

options:
  -h, --help            show this help message and exit

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

knotctl-0.1.3.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

knotctl-0.1.3-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file knotctl-0.1.3.tar.gz.

File metadata

  • Download URL: knotctl-0.1.3.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for knotctl-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ab3f7a1e8ab00c05931a09dff22f9b0d09504d0257673eabf4611e001cea7121
MD5 31bef4ee5a4f4768be233f394fa2886e
BLAKE2b-256 27a6974408af53bb999d2d9acd3938b0aae382ae3ec4e37cd10f1b953442f1e1

See more details on using hashes here.

File details

Details for the file knotctl-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: knotctl-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for knotctl-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d6aa42f240e58103e0d98520819725c1513821bfeba8d31035aaab04f19c3e4e
MD5 f55b16d8aa2aab63d8eaeacedf87fde0
BLAKE2b-256 58fe19a31d8b064887a2b1c6616d0caa035b4a3adcc0fcf17e917a65461c8313

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page