Scroll to navigation

DESEC(1) User Commands DESEC(1)

NAME

desec - a simple deSEC.io API client

SYNOPSIS

desec [global-options] action [action-options]

DESCRIPTION

desec is a command-line client to manage domains hosted by deSEC.io using the deSEC.io API. It supports domain management, DNS record management, authentication token and token policy management, import and export of records in zone file and JSON format, and generation of TLSA records from certificate files. It also handles the API's rate limits and pagination transparently.

The functionality is split into subcommands (referred to as actions). Each action takes its own set of options; run desec action --help for details on a specific action.

GLOBAL OPTIONS

These options apply to desec itself and must be given before the action.

Show a help message and exit.
Show the program's version number and exit.
API authentication token. Defaults to the value of the DESEC_TOKEN environment variable. Mutually exclusive with --token-file.
--token-file TOKEN_FILE
File containing the API authentication token. The file may also be a script that prints the API authentication token to stdout. Scripts are distinguished from plain files by the executable permission bit on the file system. Defaults to $XDG_CONFIG_HOME/desec/token. Mutually exclusive with --token.
When the API's rate limit is reached, return an appropriate error instead of waiting.
When the API's rate limit is reached, wait and retry the request. This is the default behaviour.
Print details about HTTP requests and responses.

AUTHENTICATION

The deSEC API requires a token for authentication, which can be created on the deSEC.io website or through the API using an existing token. The token is looked up from the following sources, in order of decreasing precedence:

1.
The --token argument.
2.
The DESEC_TOKEN environment variable.
3.
The file given by the --token-file argument.
4.
The file $XDG_CONFIG_HOME/desec/token.

TOKEN MANAGEMENT ACTIONS

List all authentication tokens.
Create and return a new authentication token. Options:
Token name.
Create a token that can manage tokens.
Create a token that can create new domains.
Create a token that can delete domains.
IPv4/IPv6 addresses or subnets from which clients may authenticate with this token. May be given multiple times.
Automatically set up a permissive policy for any domains created with this token.
Maximum token age. When set, the token gets invalidated this interval after its creation. Must be formatted as [DD] [HH:[MM:]]ss[.uuuuuu].
Maximum allowed time period of disuse without invalidating the token. When set, the token gets invalidated this duration after its last use. Must be formatted as [DD] [HH:[MM:]]ss[.uuuuuu].
Modify the existing authentication token id. Options:
Token name.
Allow or disallow this token to manage tokens.
Allow or disallow this token to create new domains.
Allow or disallow this token to delete domains.
IPv4/IPv6 addresses or subnets from which clients may authenticate with this token. May be given multiple times.
Enable or disable automatically setting up a permissive policy for any domains created with this token.
Maximum token age. When set, the token gets invalidated this interval after its creation. Must be formatted as [DD] [HH:[MM:]]ss[.uuuuuu]. The empty string removes a previously set duration.
Maximum allowed time period of disuse without invalidating the token. When set, the token gets invalidated this duration after its last use. Must be formatted as [DD] [HH:[MM:]]ss[.uuuuuu]. The empty string removes a previously set duration.
Delete the authentication token id.

TOKEN POLICY ACTIONS

List all policies of the authentication token id.
Add a policy for the authentication token id. Options:
Domain to which the policy applies.
Record type to which the policy applies. See RECORD TYPES below.
Subname to which the policy applies.
Allow write access.
Modify the existing policy policy_id of the authentication token token_id. Options:
Domain to which the policy applies.
Record type to which the policy applies. See RECORD TYPES below.
Subname to which the policy applies.
Allow or disallow write access.
Delete the policy policy_id of the authentication token token_id.

DOMAIN ACTIONS

List all registered domains.
domain-info domain
Get information about domain.
Create the new domain domain.
Delete domain.

RECORD ACTIONS

The following options are common to several record actions:

Record type. See RECORD TYPES below.
Subname; omit to operate on the zone apex.
A DNS record. May be given multiple times.
The record's TTL in seconds (default: 3600).
List all records of domain, optionally restricted to a record type and/or subname.
Add a record set to domain. -t and -r are required.
Change an existing record set of domain. -t is required.
Add entries, possibly to an existing record set of domain. -t and -r are required.
Delete a record set of domain. -t is required. If no records are given with -r, all records of the given type and subname are deleted.

TLSA ACTIONS

These actions require the optional cryptography dependency.

Add a TLSA record for an X.509 certificate (DANE), keeping any existing records.
Set the TLSA record for an X.509 certificate (DANE), removing any existing records for the same port, protocol and subname.

Options for add-tlsa and set-tlsa:

Subname that the record is valid for; omit for the zone apex.
Port that uses the certificate. Required. May be given multiple times.
Protocol that the given ports use (default: tcp).
File name of the X.509 certificate for which to set TLSA records (DER or PEM format). Required.
TLSA certificate usage. Accepts numeric values or RFC 7218 symbolic names (PKIX-TA, PKIX-EE, DANE-TA, DANE-EE; default: DANE-EE).
TLSA selector. Accepts numeric values or RFC 7218 symbolic names (Cert, SPKI; default: Cert).
TLSA matching type. Accepts numeric values or RFC 7218 symbolic names (Full, SHA2-256, SHA2-512; default: SHA2-256).
The record's TTL in seconds, if creating a new record set (default: 3600).
Skip any sanity checks and set the TLSA record as specified.

IMPORT AND EXPORT ACTIONS

Export all records of domain into FILE in JSON format.
Export all records of domain into FILE in zone file format.
Import records for domain from the JSON file FILE. With --clear, remove all existing records before import.
Import records for domain from the zone file FILE. Requires the optional dnspython dependency. With --clear, remove all existing records before import. With -d, --dry-run, just parse the zone data without writing it to the API.

RECORD TYPES

The -t / --type option accepts the following DNS record types:

A, AAAA, AFSDB, APL, CAA, CDNSKEY, CDS, CERT, CNAME, DHCID, DNAME, DNSKEY,
DLV, DS, EUI48, EUI64, HINFO, HTTPS, KX, L32, L64, LOC, LP, MX, NAPTR, NID,
NS, OPENPGPKEY, PTR, RP, SMIMEA, SPF, SRV, SSHFP, SVCB, TLSA, TXT, URI

ENVIRONMENT

API authentication token, used when --token is not given.
Base directory for the default token file location. Defaults to ~/.config if unset.

FILES

$XDG_CONFIG_HOME/desec/token
Default file from which the API token is read when neither --token nor DESEC_TOKEN is set.

EXIT STATUS

Returns 0 on success. On error, a message is printed and a non-zero, error-specific exit code is returned.

EXAMPLES

List all registered domains:

desec list-domains

Add an A record:

desec add-record example.com -t A -s www -r 203.0.113.1 --ttl 3600

Export a domain to a zone file:

desec export-zone example.com -f example.com.zone

SEE ALSO

Project home page: https://github.com/s-hamann/desec-dns

deSEC.io API documentation: https://desec.readthedocs.io/

AUTHOR

Written by desec-dns contributors.

2026-09-05 desec-dns 1.5.0