An open API service indexing awesome lists of open source software.

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~

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.