Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

madflojo/cfdns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cfdns

CLI tool for manipulating DNS of CloudFlare hosted domains. This tool uses CloudFlare's v4 API to add, remove, list, or modify DNS records.

Installation

Install using pip.

$ pip install cfdns

Usage

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Enable verbosity

Actions:
  {add,remove,modify,list}
    add                 Add DNS Records
    remove              Remove DNS records
    modify              Modify existing records
    list                List existing records

Listing records

List DNS records or a set of DNS records by calling the list action.

Syntax:

$ cfdns list <email> <api_key> <domain>

Additional arguments:

  • --name - Match records with the specified name
  • --type - Match records with the specified type A, AAAA, CNAME, or MX
  • --content - Match records with the specified content

Examples:

$ cfdns list email@example.com 12345api
$ cfdns list email@example.com 12345api --name www.example.com
$ cfdns list email@example.com 12345api --name www.example.com --type A
$ cfdns list email@example.com 12345api --name www.example.com --type A --content 10.0.0.1
$ cfdns list email@example.com 12345api --type A
$ cfdns list email@example.com 12345api --type A --content 10.0.0.1
$ cfdns list email@example.com 12345api --content 10.0.0.1

Adding a Record

Add DNS records with the add action.

Syntax:

$ cfdns add <email> <api_key> <domain> <record_name> <record_type> <record_content>

Supported record types are: A, AAAA, CNAME, & MX

Additional Arguments:

  • --ttl - Specify the TTL value (default: 0)
  • --noproxy - Disable CloudFlare's proxying

Examples:

$ cfdns add email@example.com 12345api example.com www.example.com A 10.0.0.1
$ cfdns add email@example.com 12345api example.com www.example.com A 10.0.0.1 --ttl 20
$ cfdns add email@example.com 12345api example.com www.example.com A 10.0.0.1 --noproxy

Removing a Record

Remove one or more DNS records with the remove action.

Syntax:

$ cfdns remove <email> <api_key> <domain> --name <record_name> --content <record_content>

The --name or --content flags can be used together or on their own to limit the number of records to be deleted. At least one flag must be used or no records will be deleted.

  • --name - Match records with a specified name
  • --content - Match records with a specified content

Examples:

$ cfdns remove email@example.com 12345api example.com --name test.example.com --content 10.0.0.1
$ cfdns remove email@example.com 12345api example.com --name test.example.com
$ cfdns remove email@example.com 12345api example.com --content 10.0.0.1

Modify a Record

Modify DNS records using the modify action.

Syntax:

$ cfdns modify <email> <api_key> <domain> <old_record_content> <new_record_type> <new_record_content>

You can add the --name flag to restrict updates to only the named record. By default all records with the matching "old content" will be updated.

Examples:

$ cfdns modify email email@example.com 12345api example.com 10.0.0.1 A 10.0.0.2
$ cfdns modify email email@example.com 12345api example.com 10.0.0.1 A 10.0.0.2 --name www.example.com

About

Command line tool for manipulating DNS of CloudFlare hosted domains

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages