# bikram990/certbot-dns-dynu architecture

> Architecture diagram of the GitHub repository bikram990/certbot-dns-dynu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bikram990/certbot-dns-dynu
- Repository: https://github.com/bikram990/certbot-dns-dynu

## Overview

##### Project type and purpose
- This is an open-source Certbot DNS Authenticator plugin, written in Python, that enables Certbot to fulfill ACME DNS-01 challenges via the Dynu DNS provider.

##### File structure
- Top-level files:
- setup.py, requirements.txt, version.txt – packaging and versioning.
- release.sh, CI workflow (/.github/workflows/python-publish.yml) – release automation.
- .devcontainer/*, .vscode/* – development environment configuration (VS Code Dev Container).
- test/run_certonly.sh – integration helper to invoke Certbot with the plugin.
- src/certbot_dns_dynu/dns_dynu.py – the core Authenticator implementation.
- src/tests/dns_dynu_test.py – unit tests for the plugin’s DNS logic.
- Credentials template under test/ or user-provided .ini files.

##### README for additional insights
- The plugin exposes an entry point `dns-dynu = certbot_dns_dynu.dns_dynu:Authenticator`.
- Usage pattern: Certbot invokes the plugin, which reads a credentials .ini, then makes REST calls to the Dynu DNS API to create/delete TXT records.

a. Main components
- User / CLI (Certbot)
- Plugin Module (Authenticator implementation)
- Credentials Store (.ini file)
- Dynu DNS API (external HTTPS service)
- ACME CA Server (Let's Encrypt)
- (Optional) Test Harness / CI
b. Relationships and interactions
1. User runs `certbot certonly --authenticator dns-dynu --dns-dynu-credentials creds.ini`.
2. Certbot core loads the plugin via the `entry_point` mechanism.
3. Plugin reads credentials from `creds.ini`.
4. Plugin performs “present” challenge: issues an HTTPS call to Dynu API to create a TXT record under the target domain.
5. ACME CA polls the public DNS to verify the TXT record.
6. Upon success, Certbot proceeds to certificate issuance.
7. Plugin performs “cleanup”: issues another HTTPS call to Dynu API to remove the TXT record.
c. Architectural patterns / design principles
- Plugin-based architecture: plugin conforms to Certbot’s Authenticator interface.
- Single responsibility: dns_dynu.py focuses purely on DNS operations (create/delete).
- Configuration via simple INI file.
- Test-driven development: pytest tests simulate the DNS calls.
d. Key technologies / libraries
- Python 3, setuptools entry points.
- Certbot plugin API.
- Requests (or httpx) for HTTP calls.
- pytest for unit tests.
- Dev Container (Docker) for reproducible development.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Local Components"
        CLI["Certbot Core (CLI)"]:::local
        Plugin["certbot-dns-dynu Plugin\n(dns_dynu.py)"]:::local
        Entry["Entry Point\n(setup.py)"]:::local
        Cred["Credentials INI File"]:::local
        subgraph "Config Files"
            VerTxt["version.txt"]:::local
            Req["requirements.txt"]:::local
            TestReq["test requirements\n(src/tests/requirements.txt)"]:::local
        end
    end

    subgraph "External Services"
        Dynu["Dynu DNS API\n(HTTPS/REST)"]:::external
        PublicDNS["Public DNS"]:::external
        ACME["ACME CA Server\n(Let's Encrypt)"]:::external
    end

    subgraph "Development & Testing"
        Test["Unit Tests\n(dns_dynu_test.py)"]:::dev
        PyIni["pytest.ini"]:::dev
        CIWF["CI Workflow\n(python-publish.yml)"]:::dev
        Release["release.sh"]:::dev
        subgraph "Dev Container"
            DevCont1["devcontainer.json"]:::dev
            DevCont2["docker-compose.yaml"]:::dev
            DevReq["requirements.txt"]:::dev
        end
    end

    CLI -->|"load/invoke"| Plugin
    Plugin -->|"reads"| Cred
    Plugin -->|"authenticate()/cleanup()"| Dynu
    Dynu -->|"updates TXT record"| PublicDNS
    ACME -->|"polls"| PublicDNS
    PublicDNS -->|"record found"| ACME
    CLI -->|"cleanup"| Plugin

    classDef local fill:#D6EAF8,stroke:#1F618D,color:#1B2631;
    classDef external fill:#D5F5E3,stroke:#239B56,color:#1B2631;
    classDef dev fill:#FCF3CF,stroke:#B7950B,color:#1B2631;

    click CLI "https://github.com/bikram990/certbot-dns-dynu/blob/main/test/run_certonly.sh"
    click Plugin "https://github.com/bikram990/certbot-dns-dynu/blob/main/src/certbot_dns_dynu/dns_dynu.py"
    click Entry "https://github.com/bikram990/certbot-dns-dynu/blob/main/setup.py"
    click Cred "https://github.com/bikram990/certbot-dns-dynu/blob/main/README.md"
    click VerTxt "https://github.com/bikram990/certbot-dns-dynu/blob/main/version.txt"
    click Req "https://github.com/bikram990/certbot-dns-dynu/blob/main/requirements.txt"
    click TestReq "https://github.com/bikram990/certbot-dns-dynu/blob/main/src/tests/requirements.txt"
    click Test "https://github.com/bikram990/certbot-dns-dynu/blob/main/src/tests/dns_dynu_test.py"
    click PyIni "https://github.com/bikram990/certbot-dns-dynu/blob/main/src/pytest.ini"
    click CIWF "https://github.com/bikram990/certbot-dns-dynu/blob/main/.github/workflows/python-publish.yml"
    click Release "https://github.com/bikram990/certbot-dns-dynu/blob/main/release.sh"
    click DevCont1 "https://github.com/bikram990/certbot-dns-dynu/blob/main/.devcontainer/devcontainer.json"
    click DevCont2 "https://github.com/bikram990/certbot-dns-dynu/blob/main/.devcontainer/docker-compose.yaml"
    click DevReq "https://github.com/bikram990/certbot-dns-dynu/blob/main/.devcontainer/requirements.txt"
```
