{"id":25144077,"url":"https://github.com/toolslib/caddy-domain-checker","last_synced_at":"2025-04-03T05:41:02.452Z","repository":{"id":272575092,"uuid":"917053765","full_name":"ToolsLib/caddy-domain-checker","owner":"ToolsLib","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-15T09:41:50.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T19:38:50.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ToolsLib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-15T09:10:24.000Z","updated_at":"2025-01-15T09:41:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"188808d1-4ee0-4459-a3ea-af9ac648badd","html_url":"https://github.com/ToolsLib/caddy-domain-checker","commit_stats":null,"previous_names":["toolslib/caddy-domain-checker"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolsLib%2Fcaddy-domain-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolsLib%2Fcaddy-domain-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolsLib%2Fcaddy-domain-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ToolsLib%2Fcaddy-domain-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ToolsLib","download_url":"https://codeload.github.com/ToolsLib/caddy-domain-checker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246944384,"owners_count":20858773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-08T19:36:39.301Z","updated_at":"2025-04-03T05:41:02.435Z","avatar_url":"https://github.com/ToolsLib.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Caddy Domain Checker - Lightweight HTTP Service for Caddy TLS Automation\n\nThis is a lightweight HTTP service designed to integrate with [Caddy](https://caddyserver.com/) for TLS automation. It provides a simple endpoint to check if a given domain is allowed for certificate issuance.\n\nNo external dependencies are required for this basic setup. The service reads a list of allowed domains from a file and dynamically updates the list without restarting the server.\n\nCaddy documentation: [Registered domains (on-demand)](https://caddy.community/t/serving-tens-of-thousands-of-domains-over-https-with-caddy/11179#registered-domains-on-demand-6)\n\n## Features\n\n- Query endpoint for domain validation.\n- Dynamic domain management through a file (`domains.txt`).\n- Logs requests and system activity.\n- Lightweight and easy to configure.\n\n## How It Works\n\n1. **Domain Validation**: The service checks whether a domain is allowed by consulting a list of domains stored in `domains.txt`.\n2. **Endpoint**: The service exposes an HTTP GET endpoint `/check_domain` for domain validation.\n3. **Dynamic Updates**: The service monitors the `domains.txt` file for changes every minute.\n\n## Installation\n\n### Prerequisites\n- Python 3.7 or higher\n\n### Steps\n1. Clone this repository.\n2. Navigate to the project directory.\n3. Install any required dependencies (none required for this basic setup).\n4. Create an empty `domains.txt` file in the project directory:\n   ```bash\n   touch domains.txt\n   ```\n\n## Usage\n\n### Running the Server\n1. Start the server:\n   ```bash\n   python3 server.py\n   ```\n2. The server runs on `http://127.0.0.1:8008` by default.\n\n### Querying the Service\n- Use the `/check_domain` endpoint to validate a domain.\n- Example request:\n  ```bash\n  curl \"http://127.0.0.1:8008/check_domain?domain=example.com\"\n  ```\n- Response:\n  - Allowed:\n    ```json\n    {\"domain\": \"example.com\", \"allowed\": true}\n    ```\n  - Not Allowed:\n    ```json\n    {\"domain\": \"example.com\", \"allowed\": false}\n    ```\n\n### Managing Domains\n- Add or remove domains in the `domains.txt` file.\n- Changes will be reflected within a minute without restarting the server.\n\n## Configuration\n\n| Parameter         | Default Value    | Description                     |\n|-------------------|------------------|---------------------------------|\n| `DOMAINS_FILE`    | `domains.txt`    | Path to the domains file.       |\n| `LOG_FILE`        | `domain_checker.log` | Path to the log file (optional). |\n| Server Address    | `127.0.0.1:8008` | IP and port for the HTTP server.|\n\n## Logging\n\nLogs system activity and domain queries to the console. You can configure it to log to a file by uncommenting the `FileHandler` line in the `logging` setup.\n\n## Systemd Service Setup\n\nTo set up the service to run automatically using `systemd`, follow these steps:\n\n1. Create a new service file:\n   ```bash\n   sudo nano /etc/systemd/system/caddy-domain-checker.service\n   ```\n\n2. Add the following content to the file:\n   ```ini\n   [Unit]\n   Description=Caddy Domain Checker Service\n   After=network.target\n\n   [Service]\n   ExecStart=/usr/bin/python3 /mnt/data/www/domain_checker/app.py\n   WorkingDirectory=/mnt/data/www/domain_checker\n   Restart=always\n   RestartSec=5\n   User=www-data\n   Group=www-data\n   StandardOutput=journal\n   StandardError=journal\n\n   [Install]\n   WantedBy=multi-user.target\n   ```\n\n3. Save and close the file.\n\n4. Reload the `systemd` daemon to recognize the new service:\n   ```bash\n   sudo systemctl daemon-reload\n   ```\n\n5. Enable the service to start on boot:\n   ```bash\n   sudo systemctl enable caddy-domain-checker\n   ```\n\n6. Start the service:\n   ```bash\n   sudo systemctl start caddy-domain-checker\n   ```\n\n7. Check the service status to ensure it is running:\n   ```bash\n   sudo systemctl status caddy-domain-checker\n   ```\n\n## Development\n\n### Testing\n- Use `curl` or any HTTP client to interact with the service.\n- Ensure the `domains.txt` file is updated correctly for testing.\n\n### Stopping the Server\n- Stop the server gracefully with `Ctrl+C`.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n---\n\n**Note:** This service is intended to work seamlessly with Caddy's TLS automation and is not designed for general-purpose use without modifications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoolslib%2Fcaddy-domain-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftoolslib%2Fcaddy-domain-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftoolslib%2Fcaddy-domain-checker/lists"}