df6c8744ed0b164f02275841cf2add8aeba5a518
nscli
A quickly hacked together CLI Client for the NameSilo API.
Letsencrypt allows for wildcard and certificates for servers that are not accessible on the web, through a DNS Challenge. This tool makes automation possible for domains on the NameSilo registrar. It does not cover the entirety of the NameSilo API.
Getting started • LetsEncrypt • Roadmap
Getting Started
Build
# compile
cargo build --package nscli --release
# run
./target/release/nscli --help
# development
cargo run --package nscli --bin nscli -- help
Command Line Interface
The command line interface of nscli is build with clap:
Usage: nscli [OPTIONS] <COMMAND>
Commands:
listdomains A list of all active domains within your account
getdomaininfo Get essential information on a domain within your account
dnslistrecords View all DNS records associated with your domain
dnsaddrecord Add a new DNS resource record or update existing
dnsupdaterecord Update an existing DNS resource record
dnsdeleterecord Delete an existing DNS resource record
dnsrecordid [Custom] Get DNS record id if it exists
help Print this message or the help of the given subcommand(s)
Options:
-a, --api-key <FILE> [default: .api_key]
-h, --help Print help information
Process finished with exit code 0
Note: As duplicate resource records are out of scope for this tool, the following commands deviate from their NameSilo API counterpart:
dnsaddrecord: does not create duplicate entries, but instead updates a matching record if it already existsdnsdeleterecord: takes a subdomain and record type as parameter and will delete the first matching onednsrecordid: is not part of the NameSilo API
LetsEncrypt
The pre and post validation hook of certbot can be used to add nscli to the certification process.
certbot certonly --manual --preferred-challenges=dns --manual-auth-hook /path/to/pre.sh --manual-cleanup-hook /path/to/post.sh -d example.com
#!/bin/bash
# pre hook example
./nscli dnsaddrecord --domain $CERTBOT_DOMAIN \
--rrtype txt \
--rrhost _acme-challenge \
--rrvalue $CERTBOT_VALIDATION
# wait for the change to propagate
sleep 60
#!/bin/bash
# post hook example
./nscli dnsdeleterecord --domain $CERTBOT_DOMAIN \
--rrtype txt \
--rrhost _acme-challenge
Roadmap
- Add optional
rridparam todnsdeleterecord - Properly parse response
xmland make output available in digestible form onstdout - Add more API calls
Description
Languages
Rust
100%