- Java 98.8%
- Dockerfile 0.7%
- Shell 0.5%
| .github/workflows | ||
| config | ||
| sample | ||
| src | ||
| .gitignore | ||
| build.sh | ||
| clean.sh | ||
| Dockerfile | ||
| pom.xml | ||
| Readme.MD | ||
| run.sh | ||
"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.