Library and Tool to handle reading & writing files to & from DNS TXT records hosted via AWS Route53
- Go 91.3%
- Makefile 8.7%
| retrieval_api | ||
| .gitignore | ||
| aws.go | ||
| create.go | ||
| delete.go | ||
| download.go | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| Makefile | ||
| README.md | ||
| root.go | ||
cdn53
Tool and library to store arbitrary files in DNS TXT records
Features
- Allows piping a "file" into DNS TXT records on AWS route53
- Allows deleting "file"s from route53 DNS TXT record sets
- Cross-platform golang lib to download files from DNS TXT records created by this tool
- Utility download command for downloading files from DNS TXT records created by this command
Specifying AWS API Credentials
The credential chain looks for credentials in the following order:
- Environment variables.
- Static Credentials (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN) - Web Identity Token (
AWS_WEB_IDENTITY_TOKEN_FILE)
- Static Credentials (
- Shared configuration files. These are for boxes that have the
awscommand installed and configured.credentialsfile under.awsfolder that is in the users home folder.configfile under.awsfolder that is in the users home folder.
- IAM role for tasks. If running as a 'Task'.
- When running on an Amazon EC2 instance; IAM role for Amazon EC2.
- In this scenario, simply having the binary on the EC2 instance will allow the binary to automagically retrieve the appropriate access credentials provided the EC2 instance is assigned appropriate privileges through IAM roles.
Getting a binary
Prerequisites
- You need to have golang installed
Build Process
- Clone
git clone https://git.byte.farm/AWildBeard/cdn53.git && cd cdn53
- Compile for your platform
make release build
- Binary will be a executable located in
$PWD/build
Usage
This tooling has the ability to;
1) Transfer a local file with encoding into DNS TXT records on route53
2) Delete those TXT records from route53 (cleanup)
3) Download the file and decode it via DNS
Usage:
cdn53 [command]
Available Commands:
aws Create or Delete "cdn"s on route53.
completion Generate the autocompletion script for the specified shell
download Download the file from the provided "cdn"
help Help about any command
Flags:
-d, --domain [create delete download] The domain to use for various options ([create delete download]). With the `create` subcommand, this is the FQDN to create a "cdn" with. With the `delete` subcommand, this is the FQDN to delete a "cdn". With the `download` subcommand, this is the FQDN of the "cdn" just as you would've supplied it to the other subcommands. If you created the "cdn" with x.y.z.com then the value should be x.y.z.com
-f, --file string File to read or write content to/from depending on subcommand. If using the create subcommand, this file is read from to create the dns cdn after applying encoding. If using the download subcommand, this file is written to with decoding applied. (default "-")
-h, --help help for cdn53
Use "cdn53 [command] --help" for more information about a command.
Examples
cdn53 download -d my.domain.com- Download the file stored in
my.domain.com's TXT record set by this tool
- Download the file stored in
cat file.txt | cdn53 aws create -d my.domain.com- Store file.txt in TXT records for my.domain.com
cdn53 aws create -d my.domain.com -f file.txt- Same as above
cdn53 aws delete -d my.domain.com- Delete all the TXT records associated with my.domain.com that were create by this tool to store a file
Author(s)
- Michael Mitchell
ToDo:
- Support base85 encoding (actual base85, not ascii85). Allows for slightly better data usage on TXT records.