Skip to content
/ Dyn53 Public

Dynamic DNS R53 Record setting through serverless application; Unifi compatible

License

Notifications You must be signed in to change notification settings

AV-IO/Dyn53

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dyn53

Dyn53 is a serverless application for dynamic DNS.

What

API Gateway exposes two identical api calls (POST and PUT to /ddns) under the ddns. sub domain name. This will permit updating any record in the specified hosted zone.

flowchart LR
	subgraph API_Gateway[API Gateway]
		direction TB
		subgraph /ddns
			direction RL
			POST
			PUT
		end
	end

	subgraph Lambda
		direction TB
		Authorizer
		Record_Setter[Record Setter]
	end

	subgraph Route53
		subgraph HostedZone
			ddns.example.com
			dyn.example.com
		end
	end

	subgraph Certificate Manager
		ddns.example.com_Certificate[ddns.example.com]
	end

	subgraph Secret Manager
		Secret
	end

	ddns.example.com_Certificate --> ddns.example.com --> API_Gateway
	API_Gateway --> Authorizer --> Secret
	POST --> Record_Setter
	PUT --> Record_Setter
	Record_Setter ---> dyn.example.com
Loading

Deploy

This application is fully SAM compatible and can be deployed with the following:

sam deploy --config-file ./samconfig.toml --config-env prod --region {region} --profile {profile} --parameter-overrides 'HostedZoneId=Z1234' 'DomainName=example.com' 'DynamicSubDomain=dyn'

Why

Unifi Dynamic DNS options don't natively support Route53 (understandably), and there seems to be some terrible solutions out there so I made my own.

How

Basic sequence is as follows:

sequenceDiagram
    participant User
    participant API Gateway
	participant Authorizer Lambda
	participant Setting Lambda
	participant Route53

    User ->>+ API Gateway: POST /ddns?hostname=dyn.example.com&ip=1.2.3.4
	API Gateway ->>+ Authorizer Lambda: Authorization: Basic dXNlcjpwYXNzd29yZA==
	Authorizer Lambda -->>- API Gateway: true
	API Gateway ->>+ Setting Lambda: {request data}
	Setting Lambda ->>+ Route53: UPSERT dyn.example.com A: 1.2.3.4
	Route53 -->>- Setting Lambda: 200
	Setting Lambda -->>- API Gateway: 200
    API Gateway-->>-User: HTTP 200
Loading

Contributing

It's GNU GPLv3, feel free to send pull requests or file issues.

Planned contributions

  • Option to opt-out of secret manager (#2)
    • While proper, it is by far the most expensive part of this deployment, and should be up to the user's choice
  • Restrict Permissions to a set of sub domain names instead of to an entire hosted zone (#3)