https://github.com/jonepl/namecheap-ddns-updater
Dynamic DNS (DDNS) service based on Namecheap! Access your home network remotely via a custom domain name without a static IP! Written in pure BASH~
https://github.com/jonepl/namecheap-ddns-updater
api bash ddns-updater dns namecheap
Last synced: 2 months ago
JSON representation
Dynamic DNS (DDNS) service based on Namecheap! Access your home network remotely via a custom domain name without a static IP! Written in pure BASH~
- Host: GitHub
- URL: https://github.com/jonepl/namecheap-ddns-updater
- Owner: jonepl
- Created: 2025-04-02T02:51:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-02T22:25:28.000Z (about 1 year ago)
- Last Synced: 2025-04-02T23:26:28.029Z (about 1 year ago)
- Topics: api, bash, ddns-updater, dns, namecheap
- Language: Shell
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Namecheap DDNS Updater (w/ Mock Server)
This is a lightweight Docker-based mock server that simulates how your home server updates its public IP using Namecheap's [Dynamic DNS (DDNS)](https://www.namecheap.com/support/knowledgebase/article.aspx/29/11/how-do-i-dynamically-update-my-hosts-ip-with-an-http-request/) API.
It's designed to **test and validate** your DDNS update script logic in a containerized environment β without depending on your actual home server.
---
## π Project Structure
```bash
βββ Dockerfile # Builds the testing container
βββ namecheap-ddns.sh # The DDNS update script (entrypoint)
βββ .env.example # Template for your environment variables
```
## π Getting Started
### 1. π§ Setup Your Environment File
Copy the example environment file and customize it with your own Namecheap credentials and subdomain:
```bash
cp .env.example .env
```
Edit .env:
```
DOMAIN=yourdomain.com
SUBDOMAIN=vpn
PASSWORD=your_ddns_password
DRY_RUN=true
```
β οΈ Never commit your .env file with real credentials. Only .env.example should go in version control.
### 2. π οΈ Build the Docker Image
```bash
docker build -t mock-namecheap-ddns .
```
### 3. π§ͺ Run the Container (Mock Test)
```bash
docker run --rm \
--env-file .env \
--name ddns-test \
mock-namecheap-ddns
```
The script will:
* Load your .env file
* Fetch your current public IP
* Compare it to the DNS record for your subdomain
* Attempt to update the DNS record using Namecheapβs API. If the DRY_RUN environment variable is removed your Namecheap A record will be updated.
## π Notes
* This container does not run persistently β it simply executes the script and exits.
* It's intended for mock testing only (not for production DDNS updates).
* If you plan to automate this on your home server, you can use the systemd script [HERE](./scheduler/namecheap-setup.sh). Be sure to read through it to ensure your files are moved to the desire locations.
* Automatic log rotation is built-in:
If the log file (/var/log/namecheap-ddns.log) grows beyond 1MB, it will be backed up to namecheap-ddns.log.bak and a new log file will be created. This ensures long-running setups wonβt accumulate unbounded log files.
## π‘οΈ Disclaimer
This project is for educational and testing purposes. Be cautious with API credentials and avoid running this in short intervals to prevent being rate-limited by Namecheap.