8000 GitHub - cpjet64/CurtsDDNS
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cpjet64/CurtsDDNS

Repository files navigation

Curt's Dynamic DNS Updater

Curt's Dynamic DNS Updater is a Python script designed to update DNS records automatically for dynamic IP addresses. This solution supports multiple DNS providers including Cloudflare.

Features

  • Automatic IP detection and DNS record update
  • Support for multiple DNS providers
  • Configurable via an INI file
  • Runs continuously with a configurable check interval

Requirements

  • Python 3.12
  • requests library

Installation

Installing Python 3.12 on Debian-based Systems

  1. Update your package list:

    sudo apt update
  2. Install dependencies:

    sudo apt install -y software-properties-common
  3. Add the deadsnakes PPA:

    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt update
  4. Install Python 3.12:

    sudo apt install -y python3.12 python3.12-venv python3.12-dev

Setting Up the Project

  1. Clone the repository:

    git clone https://github.com/cpjet64/curtsddns.git
    cd curtsddns
  2. Create a virtual environment:

    python3.12 -m venv venv
  3. Activate the virtual environment:

    source venv/bin/activate
  4. Install the required dependencies:

    pip install requests
  5. Configure your DNS settings in the config.ini file using config.ini.example as a template:

    cp config.ini.example config.ini

Configuration

The config.ini file should be structured as follows:

[settings]
DNS_PROVIDER = cloudflare
CHECK_INTERVAL = 60

[cloudflare]
CLOUDFLARE_API_TOKEN = your_cloudflare_api_token
CLOUDFLARE_ZONE_ID = your_cloudflare_zone_id
CLOUDFLARE_RECORD_NAME = your_dns_record_name

Usage

To start the script, simply run:

python curtsddns.py

Systemd Service

For continuous operation, you can set up a systemd service:

Copy the curtsddns.service file to /etc/systemd/system/ and then modify as needed:

sudo cp curtsddns.service /etc/systemd/system/
sudo nano /etc/systemd/system/curtsddns.service

OR

Have the file created for you using the current user and file location:

echo "[Unit]
Description=Curt's Dynamic DNS Updater Service
After=network.target

[Service]
Type=simple
User=$(whoami)
WorkingDirectory=$(pwd)
ExecStart=$(pwd)/venv/bin/python $(pwd)/curtsddns.py
Restart=on-failure

[Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/curtsddns.service

Reload the systemd daemon:

sudo systemctl daemon-reload

Enable and start the service:

sudo systemctl enable curtsddns
sudo systemctl start curtsddns

Files

  • curtsddns.py: Main script for updating DNS records.
  • cloudflare_module.py: Module for handling Cloudflare DNS updates.
  • config.ini: Configuration file (create from config.ini.example).
  • config.ini.example: Example configuration file.
  • curtsddns.service: Systemd service file for running the script as a service.
  • Dockerfile:Docker configuration file.

Dockerizing the App

To run Curt's Dynamic DNS Updater in a Docker container, follow these steps:

Prerequisites

  • Docker installed on your system

Docker Setup

  1. Clone the repository:

    git clone https://github.com/cpjet64/curtsddns.git
    cd curtsddns
  2. Configure your DNS settings in the config.ini file using config.ini.example as a template:

    cp config.ini.example config.ini

    Modify your config.ini according to your environment:

    nano config.ini

    The config.ini file should be structured as follows:

    [settings]
    DNS_PROVIDER = cloudflare
    CHECK_INTERVAL = 60
    
    [cloudflare]
    CLOUDFLARE_API_TOKEN = your_cloudflare_api_token
    CLOUDFLARE_ZONE_ID = your_cloudflare_zone_id
    CLOUDFLARE_RECORD_NAME = your_dns_record_name
  3. Build the Docker image:

    docker build -t curtsddns .
  4. Run the Docker container:

    docker run -d --restart unless-stopped --name curtsddns -v $(pwd)/config.ini:/app/config.ini curtsddns
    • -d runs the container in detached mode.
    • --name curtsddns gives the container a name.
    • -v $(pwd)/config.ini:/app/config.ini mounts the config.ini file from the host to the container.

Managing the Docker Container

  • To stop the container:

    docker stop curtsddns
  • To start the container:

    docker start curtsddns
  • To view the container logs:

    docker logs curtsddns
  • To remove the container:

    docker rm curtsddns

Notes

  • Ensure that the config.ini file is properly configured before running the container.
  • You can customize the Dockerfile and Docker run command to suit your specific needs.

By following these steps, you can easily run Curt's Dynamic DNS Updater in a Docker container, simplifying deployment and management.

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

Contact

For support or inquiries, please contact Curt at curt@curtpme.com.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0