This is little crummy java 8 program i wrote to call the namecheap ddns api but i wrote it to be expandable to replace how i find the ip or what ddns(s) i call.
  • Java 98.8%
  • Dockerfile 0.7%
  • Shell 0.5%
Find a file
2024-03-30 18:07:37 -04:00
.github/workflows Create publish.yml 2024-03-30 18:07:37 -04:00
config Better readme for config 2024-03-29 23:06:20 -04:00
sample Merge branch 'master' of http://192.168.1.11:3000/FagFlix/trustlessddns 2024-03-30 03:50:24 +00:00
src Remove Todo 2024-03-29 23:55:40 -04:00
.gitignore Add readme 2024-03-29 21:55:44 -04:00
build.sh Merge branch 'master' of http://192.168.1.11:3000/FagFlix/trustlessddns 2024-03-30 03:50:24 +00:00
clean.sh Merge branch 'master' of http://192.168.1.11:3000/FagFlix/trustlessddns 2024-03-30 03:50:24 +00:00
Dockerfile Not using the sdk/jdk 2024-03-30 16:50:23 -04:00
pom.xml Cleanup naming 2024-03-29 23:30:22 -04:00
Readme.MD Cleanup naming 2024-03-29 23:30:22 -04:00
run.sh Cleanup naming 2024-03-29 23:31:53 -04:00

"Trustless" Dynamic DNS


This works by asking a variety of sources whats my ip and taking the most common then telling the configured dynamic dns servers to update their records on start up and on change.


Dynamic Dns Providers Supported

If you have a dynamic dns provider you want added just file an issue.

namecheap

# This adds an A record for the raw site at mysite.tld with ddns provided by namecheap
ddns.0.provider=namecheap
ddns.0.host=@
ddns.0.domain=mysite.tld
ddns.0.password=testpassword

My provider is not listed!?

If you have a dynamic dns provider you want added just file an issue.


Flaws

This still depends on you trusting dns and its not yet using secure dns; there are options available for secure dns in java. Secure dns, ex dns over http(s), in java 8 is available; its also available again in java 18. I will be adding this when I have the motivation, prs are always welcome though. This project is compiled in 8 and if you are running on 8 you can use

https://github.com/dnsjava/dnsjava?tab=readme-ov-file#validatingresolver

This calls several apis that return your ip address with the belief that someday someone will decide to be a little silly and mistakenly return the wrong ip address to you. Obviously if you're worried your dns is being spoofed this calling multiple urls is not enough for your use case. If you have suggestions for implementations beyond just secure dns, please reach out.

By default with looping mode (loop=true) the process stays open but waits some number of seconds then runs again. It can also be run in a non looping mode for more advanced scheduler setups such as cron or another scheduler that fits your needs better.


Setup

Common

Setup your config

Edit or Create ./config/config.properties

# if this is false this will run once, useful if you want to use cron or an external scheduler instead of the simple provided one.
loop=true

#This value is the number of seconds to wait before checking again.
wait=600

# this is your ddns config settings 
# This adds an A record for mysite.tld with ddns provided by namecheap
ddns.0.provider=namecheap
ddns.0.host=@
ddns.0.domain=mysite.tld
ddns.0.password=testpassword


# This adds an A record for mail.myothersite.tld with ddns provided by namecheap
ddns.1.provider=namecheap
ddns.1.host=mail
ddns.1.domain=myothersite.tld
ddns.1.password=passwordforothersite


# This writes a log saying what the program would set the ip address to for this siter without making any changes. useful for dryruns.
ddns.2.provider=mock
ddns.2.host=@
ddns.2.domain=myothersite.tld
ddns.2.password=sometestpassword

JAR

Build the jar

mvn clean install or download from releases

run the jar

java -jar ./target/dynamicdns-1.0-SNAPSHOT-shaded.jar or the jar you downloaded from releases

Docker

Build the image

./build.sh

Run the image

./run.sh


Improvements?

Feel free to submit any apis that offer ip addresses v4 or v6, I would love to add them or submit a pr.

If you have a dynamic dns service you want added feel free to submit a pr or issue with the api details.