Giter Club home page Giter Club logo

yashodhank / cloudflare-plesk-dns-sync Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 72 KB

Autonomous SSL Certificate Renewal and DNS Record Cleanup functionalities, ensuring the overall process remains robust and efficient.

Home Page: https://github.com/yashodhank/Cloudflare-Plesk-DNS-Sync

License: MIT License

JavaScript 97.76% Dockerfile 2.24%
cloudflare cloudflare-api cloudflare-dns cloudflare-dns-api cloudflare-dns-records docker plesk plesk-api plesk-automation plesk-extension plesk-obsidian plesk-panel self-hosted

cloudflare-plesk-dns-sync's Introduction

!!DO NOT USE THIS PROJECT IT HAS NEVER BEEN TESTED!!


Cloudflare-Plesk-DNS-Sync

This project synchronizes ACME TXT records between Cloudflare and Plesk, renews SSL certificates, and cleans up stale DNS records. It is designed to run autonomously and can be executed either directly or within a Docker container.

Features

  • Synchronizes ACME TXT records between Cloudflare and Plesk
  • Automatically renews SSL certificates for Plesk domains
  • Cleans up stale or outdated DNS records on Cloudflare without affecting records created or updated manually by human operators or by other automation
  • Monitors domain health and sends alerts for any issues
  • Manages domain redirection and DDoS protection settings
  • Backs up and restores DNS configurations for autonomous operations and archiving for human-aided troubleshooting

Installation

Prerequisites

  • Node.js (v16 or later)
  • npm
  • Docker (optional, for containerized deployment)

Setup

  1. Clone the repository:

    git clone https://github.com/yashodhank/Cloudflare-Plesk-DNS-Sync.git
    cd Cloudflare-Plesk-DNS-Sync
  2. Install dependencies:

    npm install
  3. Create a .env file based on the .env.example:

    cp .env.example .env
  4. Fill in the .env file with your configuration details:

    PLESKKEY=<your-plesk-api-key>
    CLOUDKEY=<your-cloudflare-api-key>
    CLOUDEMAIL=<your-cloudflare-email>
    CLOUDACCOUNTID=<your-cloudflare-account-id>
    PLESKURL=<your-plesk-url>
    EMAIL=<your-email>
    SENDER=<sender-email>
    SPASS=<sender-password>
    HOST=<email-host>

Usage

Running Directly

To run the DNS synchronization process directly:

node cli.js run

To renew SSL certificates:

node cli.js renew-ssl

To clean up stale DNS records:

node cli.js cleanup

To monitor domain health:

node cli.js monitor-health

To manage redirection and DDoS protection:

node cli.js manage-settings

To back up DNS configurations:

node cli.js backup

To restore DNS configurations:

node cli.js restore

Running in Docker

Building the Docker Image

  1. Build the Docker image:

    docker build -t cloudflare-plesk-dns-sync .
  2. Run the Docker container:

    docker run --env-file .env cloudflare-plesk-dns-sync

Pulling the Docker Image from GitHub Packages

  1. Authenticate to GitHub Packages:

    echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
  2. Pull the Docker image:

    docker pull ghcr.io/yashodhank/cloudflare-plesk-dns-sync:latest
  3. Run the Docker container:

    docker run --env-file .env ghcr.io/yashodhank/cloudflare-plesk-dns-sync:latest

Testing

Run the tests using Jest:

npm test

Continuous Integration

This project uses GitHub Actions for continuous integration and deployment. The workflow is defined in .github/workflows/docker.yml and performs the following tasks:

  • Checks out the repository
  • Sets up Node.js
  • Installs dependencies
  • Runs tests
  • Builds and pushes a Docker image to GitHub Container Registry

GitHub Actions Workflow

name: Build, Test, and Publish Docker Image

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

permissions:
  contents: read
  packages: write

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout repository
      uses: actions/checkout@v2

    - name: Set up Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '16'

    - name: Install dependencies


      run: npm install

    - name: Run tests
      run: npm test

    - name: Set up QEMU
      uses: docker/setup-qemu-action@v2

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v2

    - name: Log in to GitHub Container Registry
      run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

    - name: Build and push Docker image
      uses: docker/build-push-action@v3
      with:
        push: true
        tags: ghcr.io/${{ github.repository_owner }}/cloudflare-plesk-dns-sync:latest

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

cloudflare-plesk-dns-sync's People

Contributors

yashodhank avatar

Stargazers

Felipe avatar

Watchers

 avatar

Forkers

ais1175

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.