skip to navigation
skip to content

dns-lexicon 2.1.24

Manipulate DNS records on various DNS providers in a standardized/agnostic way

[![Circle CI](](
[![Coverage Status](](
[![Docker Pulls](](
[![GitHub license](](

# lexicon
Manipulate DNS records on various DNS providers in a standardized/agnostic way.

## Introduction
Lexicon provides a way to manipulate DNS records on multiple DNS providers in a standardized way.
Lexicon has a CLI but it can also be used as a python library.

Lexicon was designed to be used in automation, specifically letsencrypt.

- [Generating Intranet & Private Network SSL Certificates using Lets Encrypt & Lexicon](

## Providers
Only DNS providers who have an API can be supported by `lexicon`.

The current supported providers are:

- AuroraDNS ([docs](
- AWS Route53 ([docs](
- Cloudflare ([docs](
- ClouDNS ([docs](
- CloudXNS ([docs](
- DigitalOcean ([docs](
- DNSimple ([docs](
- DnsMadeEasy ([docs](
- DNSPark ([docs](
- DNSPod ([docs](
- EasyDNS ([docs](
- Gandi ([docs](
- Gehirn Infrastructure Service ([docs](
- Glesys ([docs](
- GoDaddy ([docs](
- Linode ([docs](
- LuaDNS ([docs](
- Memset ([docs](
- Namecheap ([docs](
- Namesilo ([docs](
- NS1 ([docs](
- OVH ([docs](
- PointHQ ([docs](
- PowerDNS ([docs](
- Rackspace ([docs](
- Rage4 ([docs](
- Sakura Cloud by SAKURA Internet Inc. ([docs](
- SoftLayer ([docs](
- Transip ([docs](
- Yandex ([docs](
- Vultr ([docs](
- Zonomi ([docs](

Potential providers are as follows. If you would like to contribute one, please open a pull request.

- AHNames ([docs](
- ~~BuddyDNS ([docs](
- ~~DurableDNS ([docs]( <sub>Can't set TXT records</sub>
- ~~Dyn ([docs]( <sub>Unable to test, requires paid account</sub>
- ~~EntryDNS ([docs]( <sub>Unable to test, requires paid account</sub>
- Google Cloud DNS ([docs](
- ~~Host Virtual DNS ([docs]( <sub>Unable to test, requires paid account</sub>
- HostEurope
- ~~ironDNS ([docs](;jsessionid=02A1029AA9FB8BACD2048A60F54668C0))~~ <sub>Unable to test, requires paid account</sub>
- INWX ([docs](
- ~~Liquidweb ([docs]( <sub>Unable to test, requires paid account</sub>
- Mythic Beasts([docs](
- ~~NFSN (NearlyFreeSpeech) ([docs]( <sub>Unable to test, requires paid account</sub>
- ~~OnApp DNS ([docs]( <sub>Unable to test, requires paid account</sub>
- RFC2136 ([docs](
- ~~UltraDNS ([docs]( <sub>Unable to test, requires paid account</sub>
- ~~WorldWideDns ([docs]( <sub>Unable to test, requires paid account</sub>
- Zeit ([docs](
- ~~Zerigo ([docs]( <sub>Unable to test, requires paid account</sub>
- Zoneedit ([docs](
- __Any others I missed__

## Setup
To use lexicon as a CLI application, do the following:

pip install dns-lexicon

Some providers (like Route53 and TransIP) require additional dependencies. You can install provider specific dependencies separately:

pip install dns-lexicon[route53]

You can also install the latest version from the repository directly.

pip install git+

and with Route 53 provider dependencies:

pip install git+[route53]

## Usage

$ lexicon -h
usage: lexicon [-h] [--version] [--delegated DELEGATED]

Create, Update, Delete, List DNS entries

positional arguments:
specify the DNS provider to use
cloudflare cloudflare provider
cloudxns cloudxns provider
digitalocean digitalocean provider
rage4 rage4 provider
route53 route53 provider
vultr vultr provider
yandex yandex provider
zonomi zonomi provider

optional arguments:
-h, --help show this help message and exit
--version show the current version of lexicon
--delegated DELEGATED
specify the delegated domain

$ lexicon cloudflare -h
usage: lexicon cloudflare [-h] [--name NAME] [--content CONTENT] [--ttl TTL]
[--priority PRIORITY] [--identifier IDENTIFIER]
[--auth-username AUTH_USERNAME]
[--auth-token AUTH_TOKEN]
{create,list,update,delete} domain

positional arguments:
specify the action to take
domain specify the domain, supports subdomains as well
specify the entry type

optional arguments:
-h, --help show this help message and exit
--name NAME specify the record name
--content CONTENT specify the record content
--ttl TTL specify the record time-to-live
--priority PRIORITY specify the record priority
--identifier IDENTIFIER
specify the record for update or delete actions
--auth-username AUTH_USERNAME
specify email address used to authenticate
--auth-token AUTH_TOKEN
specify token used authenticate

Using the lexicon CLI is pretty simple:

# setup provider environmental variables:

# list all TXT records on cloudflare
lexicon cloudflare list TXT

# create a new TXT record on cloudflare
lexicon cloudflare create TXT --name="" --content="challenge token"

# delete a TXT record on cloudflare
lexicon cloudflare delete TXT --name="" --content="challenge token"
lexicon cloudflare delete TXT --identifier="cloudflare record id"

## Authentication
Most supported DNS services provide an API token, however each service implements authentication differently.
Lexicon attempts to standardize authentication around the following CLI flags:

- `--auth-username` - For DNS services that require it, this is usually the account id or email address
- `--auth-password` - For DNS services that do not provide an API token, this is usually the account password
- `--auth-token` - This is the most common auth method, the API token provided by the DNS service

You can see all the `--auth-*` flags for a specific service by reading the DNS service specific help: `lexicon cloudflare -h`

### Environmental Variables
Instead of providing Authentication information via the CLI, you can also specify them via Environmental Variables.
Every DNS service and auth flag maps to an Environmental Variable as follows: `LEXICON_{DNS Provider Name}_{Auth Type}`

So instead of specifying `--auth-username` and `--auth-token` flags when calling `lexicon cloudflare ...`,
you could instead set the `LEXICON_CLOUDFLARE_USERNAME` and `LEXICON_CLOUDFLARE_TOKEN` environmental variables.

### Letsencrypt Instructions
Lexicon has an example [dehydrated hook file](examples/ that you can use for any supported provider.
All you need to do is set the PROVIDER env variable.

PROVIDER=cloudflare dehydrated --cron --hook --challenge dns-01

Lexicon can also be used with [Certbot]( and the included [Certbot hook file](examples/ (requires configuration).

## TroubleShooting & Useful Tools
There is an included example Dockerfile that can be used to automatically generate certificates for your website.

## ToDo list

- [x] Create and Register a lexicon pip package.
- [ ] Write documentation on supported environmental variables.
- [x] Wire up automated release packaging on PRs.
- [x] Check for additional dns hosts with apis (from [fog]( [dnsperf]( [libcloud](
- [ ] Get a list of Letsencrypt clients, and create hook files for them ([letsencrypt clients](

## Contributing Changes.
If the DNS provider you use is not already available, please consider contributing by opening a pull request.

## License

## References

File Type Py Version Uploaded on Size
dns-lexicon-2.1.24.tar.gz (md5) Source 2018-03-10 42KB