Skip to main content

file-server-auto-https

A CLI tool for creating file servers with automatic HTTPS using Cloudflare DNS. This tool automatically generates subdomains on your domain and configures Cloudflare's Flexible SSL for secure access.

Features

  • Automatic subdomain generation for your domain
  • Cloudflare DNS management
  • Public and local IP detection
  • Flexible SSL through Cloudflare
  • Rich CLI interface with detailed feedback

Prerequisites

  • Python 3.8 or higher
  • A Cloudflare account
  • A domain managed by Cloudflare
  • Cloudflare API credentials

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/file-server-auto-https.git
cd file-server-auto-https
  1. Install dependencies:
pip install -e .

Configuration

Create a .env file in the project root with your Cloudflare credentials:

CLOUDFLARE_EMAIL=your-email@example.com
CLOUDFLARE_API_KEY=your-api-key
CLOUDFLARE_ZONE_ID=your-zone-id  # Zone ID for your domain
BASE_DOMAIN=your-domain.com

To find your Zone ID:

  1. Log into your Cloudflare dashboard
  2. Select your domain
  3. The Zone ID is shown in the Overview tab's API section

Usage

The tool provides a CLI interface with various commands:

Create DNS Record

Create a new subdomain pointing to your server:

# Basic usage (auto-detects public IP)
file-server dns create

# Specify custom IP
file-server dns create --ip 1.2.3.4

# Use local IP instead of public
file-server dns create --no-use-public-ip

# Specify custom subdomain
file-server dns create --subdomain myserver

# Custom subdomain length (for random generation)
file-server dns create --length 12

# Disable Cloudflare proxying
file-server dns create --no-proxied

List DNS Records

View existing DNS records:

# List records created by this tool
file-server dns list-records

# List all DNS records in the zone
file-server dns list-records --show-all

Delete DNS Record

Delete a DNS record by its ID:

# Delete a record (get ID from list-records command)
file-server dns delete RECORD_ID

Command Options

Create

  • --ip: Specify IP address manually
  • --use-public-ip: Use public IP (default: True)
  • --subdomain: Specify custom subdomain
  • --length: Length of random subdomain (default: 8)
  • --proxied: Enable/disable Cloudflare proxying (default: True)

List

  • --show-all: Show all records, not just those created by this tool

Development

Running Tests

The project uses pytest for testing. To run the tests:

# Install development dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run tests with coverage
pytest --cov=file_server_auto_https

# Run specific test file
pytest tests/test_generate_dns_record.py

Test Structure

  • test_generate_dns_record.py: Tests for DNS record generation
    • Subdomain generation
    • DNS record creation
    • Error handling
    • Configuration validation

SSL/TLS

This project uses Cloudflare's Flexible SSL:

  • HTTPS between visitors and Cloudflare
  • HTTP between Cloudflare and your server
  • No need to generate/manage SSL certificates
  • Enabled automatically when proxied=True

Troubleshooting

DNS Record Not Appearing

If your DNS record isn't appearing in Cloudflare:

  1. Check your credentials:

    # List existing records to verify API access
    file-server dns list-records --show-all
    
  2. Verify the API response: The create command now shows the raw API response for debugging.

  3. Common issues:

    • Incorrect Zone ID
    • API key permissions (needs DNS Write access)
    • Rate limiting
    • Invalid subdomain format

If you're still having issues, check the error messages in the command output for more details.

License

GPL-3.0

Metadata

Release files for file-server-auto-https 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for file-server-auto-https 0.2.0
File Size Uploaded Provenance
file_server_auto_https-0.2.0.tar.gz 24.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for file-server-auto-https 0.2.0
File Interpreter ABI Platform
file_server_auto_https-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.7 kB

Release files / file_server_auto_https-0.2.0.tar.gz

Download URL file_server_auto_https-0.2.0.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cc994ad326aea1631425d53af8afc54e1a814e15a7c13471c178705f6bb3e3cb
BLAKE2b-256 checksum
How to use checksums
5f07cccc6af5a2ca647029a26c90e1981c7106a56ca6735eac69180b40af7b55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.8

Release files / file_server_auto_https-0.2.0-py3-none-any.whl

Download URL file_server_auto_https-0.2.0-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9d327a5747a6a354000bfb01f31d2caf0c73bf2c760adaecd0e6fae467e72fa4
BLAKE2b-256 checksum
How to use checksums
5273e56647c73c5f472ab34c443786dd73c126445bf9f3b8863c38f1edd0f7d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.8

Security for file-server-auto-https 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page