| 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.
- -h, --help
- Show a help message and exit.
- -V, --version
- Show the program's version number and exit.
- --token TOKEN
- 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.
- --non-blocking
- When the API's rate limit is reached, return an appropriate error instead of waiting.
- --blocking
- When the API's rate limit is reached, wait and retry the request. This is the default behaviour.
- --debug-http
- 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-tokens
- List all authentication tokens.
- create-token [options]
- Create and return a new authentication token. Options:
- --name NAME
- Token name.
- --manage-tokens
- Create a token that can manage tokens.
- --create-domain
- Create a token that can create new domains.
- --delete-domain
- Create a token that can delete domains.
- --allowed-subnets SUBNET
- IPv4/IPv6 addresses or subnets from which clients may authenticate with this token. May be given multiple times.
- --auto-policy
- Automatically set up a permissive policy for any domains created with this token.
- --max-age DURATION
- Maximum token age. When set, the token gets invalidated this interval after its creation. Must be formatted as [DD] [HH:[MM:]]ss[.uuuuuu].
- --max-unused-period 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].
- modify-token id [options]
- Modify the existing authentication token id. Options:
- --name NAME
- Token name.
- --manage-tokens, --no-manage-tokens
- Allow or disallow this token to manage tokens.
- --create-domain, --no-create-domain
- Allow or disallow this token to create new domains.
- --delete-domain, --no-delete-domain
- Allow or disallow this token to delete domains.
- --allowed-subnets SUBNET
- IPv4/IPv6 addresses or subnets from which clients may authenticate with this token. May be given multiple times.
- --auto-policy, --no-auto-policy
- Enable or disable automatically setting up a permissive policy for any domains created with this token.
- --max-age DURATION
- 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.
- --max-unused-period 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-token id
- Delete the authentication token id.
TOKEN POLICY ACTIONS¶
- list-token-policies id
- List all policies of the authentication token id.
- add-token-policy id [options]
- Add a policy for the authentication token id. Options:
- --domain DOMAIN
- Domain to which the policy applies.
- -t, --type TYPE
- Record type to which the policy applies. See RECORD TYPES below.
- -s, --subname SUBNAME
- Subname to which the policy applies.
- --write
- Allow write access.
- modify-token-policy token_id policy_id [options]
- Modify the existing policy policy_id of the authentication token token_id. Options:
- --domain DOMAIN
- Domain to which the policy applies.
- -t, --type TYPE
- Record type to which the policy applies. See RECORD TYPES below.
- -s, --subname SUBNAME
- Subname to which the policy applies.
- --write, --no-write
- Allow or disallow write access.
- delete-token-policy token_id policy_id
- Delete the policy policy_id of the authentication token token_id.
DOMAIN ACTIONS¶
- list-domains
- List all registered domains.
- domain-info domain
- Get information about domain.
- new-domain domain
- Create the new domain domain.
- delete-domain domain
- Delete domain.
RECORD ACTIONS¶
The following options are common to several record actions:
- -t, --type TYPE
- Record type. See RECORD TYPES below.
- -s, --subname SUBNAME
- Subname; omit to operate on the zone apex.
- -r, --records RECORD
- A DNS record. May be given multiple times.
- --ttl TTL
- The record's TTL in seconds (default: 3600).
- get-records domain [-t TYPE] [-s SUBNAME]
- List all records of domain, optionally restricted to a record type and/or subname.
- add-record domain -t TYPE -r RECORD... [-s SUBNAME] [--ttl TTL]
- Add a record set to domain. -t and -r are required.
- change-record domain -t TYPE [-r RECORD...] [-s SUBNAME] [--ttl TTL]
- Change an existing record set of domain. -t is required.
- update-record domain -t TYPE -r RECORD... [-s SUBNAME] [--ttl TTL]
- Add entries, possibly to an existing record set of domain. -t and -r are required.
- delete-record domain -t TYPE [-r RECORD...] [-s SUBNAME]
- 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-tlsa domain -p PORT... -c CERT [options]
- Add a TLSA record for an X.509 certificate (DANE), keeping any existing records.
- set-tlsa domain -p PORT... -c CERT [options]
- 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:
- -s, --subname SUBNAME
- Subname that the record is valid for; omit for the zone apex.
- -p, --ports PORT
- Port that uses the certificate. Required. May be given multiple times.
- --protocol { tcp | udp | sctp }
- Protocol that the given ports use (default: tcp).
- -c, --certificate CERT
- File name of the X.509 certificate for which to set TLSA records (DER or PEM format). Required.
- --usage USAGE
- TLSA certificate usage. Accepts numeric values or RFC 7218 symbolic names (PKIX-TA, PKIX-EE, DANE-TA, DANE-EE; default: DANE-EE).
- --selector SELECTOR
- TLSA selector. Accepts numeric values or RFC 7218 symbolic names (Cert, SPKI; default: Cert).
- --match-type MATCH_TYPE
- TLSA matching type. Accepts numeric values or RFC 7218 symbolic names (Full, SHA2-256, SHA2-512; default: SHA2-256).
- --ttl TTL
- The record's TTL in seconds, if creating a new record set (default: 3600).
- --no-check
- Skip any sanity checks and set the TLSA record as specified.
IMPORT AND EXPORT ACTIONS¶
- export domain -f FILE
- Export all records of domain into FILE in JSON format.
- export-zone domain -f FILE
- Export all records of domain into FILE in zone file format.
- import domain -f FILE [--clear]
- Import records for domain from the JSON file FILE. With --clear, remove all existing records before import.
- import-zone domain -f FILE [--clear] [-d]
- 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¶
- DESEC_TOKEN
- API authentication token, used when --token is not given.
- XDG_CONFIG_HOME
- 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:
Add an A record:
Export a domain to a zone file:
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 |