cloudflare-request-cert 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cloudflare_request_cert-0.1.1/.env.example +12 -0
- cloudflare_request_cert-0.1.1/.github/dependabot.yml +35 -0
- cloudflare_request_cert-0.1.1/.github/workflows/ci.yml +201 -0
- cloudflare_request_cert-0.1.1/.gitignore +70 -0
- cloudflare_request_cert-0.1.1/LICENSE +21 -0
- cloudflare_request_cert-0.1.1/Makefile +92 -0
- cloudflare_request_cert-0.1.1/PKG-INFO +424 -0
- cloudflare_request_cert-0.1.1/README.md +391 -0
- cloudflare_request_cert-0.1.1/pyproject.toml +87 -0
- cloudflare_request_cert-0.1.1/src/cloudflare_request_cert/__init__.py +0 -0
- cloudflare_request_cert-0.1.1/src/cloudflare_request_cert/main.py +175 -0
- cloudflare_request_cert-0.1.1/tests/__init__.py +1 -0
- cloudflare_request_cert-0.1.1/tests/test_config.py +42 -0
- cloudflare_request_cert-0.1.1/tests/test_credentials.py +12 -0
- cloudflare_request_cert-0.1.1/tests/test_main.py +38 -0
- cloudflare_request_cert-0.1.1/tests/test_request.py +37 -0
- cloudflare_request_cert-0.1.1/uv.lock +1411 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Cloudflare API Token
|
|
2
|
+
# Get this from: https://dash.cloudflare.com/profile/api-tokens
|
|
3
|
+
# Required permissions: Zone:DNS:Edit, Zone:Zone:Read
|
|
4
|
+
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token_here
|
|
5
|
+
|
|
6
|
+
# Domain and Email (optional - can also be passed as command line arguments)
|
|
7
|
+
DOMAIN=example.com
|
|
8
|
+
EMAIL=admin@example.com
|
|
9
|
+
|
|
10
|
+
# Optional settings
|
|
11
|
+
STAGING=0
|
|
12
|
+
PROPAGATION_SECONDS=10
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Dependabot configuration for cloudflare-request-cert
|
|
2
|
+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
3
|
+
|
|
4
|
+
version: 2
|
|
5
|
+
updates:
|
|
6
|
+
# Monitor Python dependencies in pyproject.toml
|
|
7
|
+
- package-ecosystem: "pip"
|
|
8
|
+
directory: "/"
|
|
9
|
+
schedule:
|
|
10
|
+
interval: "weekly"
|
|
11
|
+
day: "monday"
|
|
12
|
+
time: "09:00"
|
|
13
|
+
open-pull-requests-limit: 10
|
|
14
|
+
labels:
|
|
15
|
+
- "dependencies"
|
|
16
|
+
- "python"
|
|
17
|
+
commit-message:
|
|
18
|
+
prefix: "deps"
|
|
19
|
+
prefix-development: "deps-dev"
|
|
20
|
+
include: "scope"
|
|
21
|
+
|
|
22
|
+
# Monitor GitHub Actions
|
|
23
|
+
- package-ecosystem: "github-actions"
|
|
24
|
+
directory: "/"
|
|
25
|
+
schedule:
|
|
26
|
+
interval: "weekly"
|
|
27
|
+
day: "monday"
|
|
28
|
+
time: "09:00"
|
|
29
|
+
open-pull-requests-limit: 5
|
|
30
|
+
labels:
|
|
31
|
+
- "dependencies"
|
|
32
|
+
- "github-actions"
|
|
33
|
+
commit-message:
|
|
34
|
+
prefix: "ci"
|
|
35
|
+
include: "scope"
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
name: CI/CD
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: write
|
|
5
|
+
id-token: write
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [main]
|
|
10
|
+
pull_request:
|
|
11
|
+
branches: [main]
|
|
12
|
+
release:
|
|
13
|
+
types: [published]
|
|
14
|
+
workflow_dispatch:
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
lint:
|
|
18
|
+
name: Lint
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
if: github.event_name != 'release'
|
|
21
|
+
steps:
|
|
22
|
+
- name: Checkout code
|
|
23
|
+
uses: actions/checkout@v6
|
|
24
|
+
|
|
25
|
+
- name: Install uv
|
|
26
|
+
uses: astral-sh/setup-uv@v7
|
|
27
|
+
with:
|
|
28
|
+
enable-cache: true
|
|
29
|
+
|
|
30
|
+
- name: Set up Python
|
|
31
|
+
uses: actions/setup-python@v6
|
|
32
|
+
with:
|
|
33
|
+
python-version: "3.10"
|
|
34
|
+
|
|
35
|
+
- name: Install dependencies
|
|
36
|
+
run: uv sync --all-extras
|
|
37
|
+
|
|
38
|
+
- name: Run ruff check
|
|
39
|
+
run: uv run ruff check .
|
|
40
|
+
|
|
41
|
+
- name: Run ruff format check
|
|
42
|
+
run: uv run ruff format --check .
|
|
43
|
+
|
|
44
|
+
test:
|
|
45
|
+
name: Test (Python ${{ matrix.python-version }})
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
if: github.event_name != 'release'
|
|
48
|
+
strategy:
|
|
49
|
+
fail-fast: false
|
|
50
|
+
matrix:
|
|
51
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- name: Checkout code
|
|
55
|
+
uses: actions/checkout@v6
|
|
56
|
+
|
|
57
|
+
- name: Install uv
|
|
58
|
+
uses: astral-sh/setup-uv@v7
|
|
59
|
+
with:
|
|
60
|
+
enable-cache: true
|
|
61
|
+
|
|
62
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
63
|
+
uses: actions/setup-python@v6
|
|
64
|
+
with:
|
|
65
|
+
python-version: ${{ matrix.python-version }}
|
|
66
|
+
|
|
67
|
+
- name: Install dependencies
|
|
68
|
+
run: uv sync --all-extras
|
|
69
|
+
|
|
70
|
+
- name: Run tests with coverage
|
|
71
|
+
run: |
|
|
72
|
+
uv run pytest tests/ \
|
|
73
|
+
--verbose \
|
|
74
|
+
--cov=. \
|
|
75
|
+
--cov-report=xml \
|
|
76
|
+
--cov-report=term-missing \
|
|
77
|
+
--cov-fail-under=80
|
|
78
|
+
|
|
79
|
+
- name: Upload coverage to Codecov
|
|
80
|
+
if: matrix.python-version == '3.14'
|
|
81
|
+
uses: codecov/codecov-action@v5
|
|
82
|
+
with:
|
|
83
|
+
files: ./coverage.xml
|
|
84
|
+
flags: unittests
|
|
85
|
+
name: codecov-umbrella
|
|
86
|
+
fail_ci_if_error: false
|
|
87
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
88
|
+
|
|
89
|
+
sbom:
|
|
90
|
+
name: SBOM
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
if: github.event_name != 'release'
|
|
93
|
+
steps:
|
|
94
|
+
- name: Checkout code
|
|
95
|
+
uses: actions/checkout@v6
|
|
96
|
+
|
|
97
|
+
- name: Install uv
|
|
98
|
+
uses: astral-sh/setup-uv@v7
|
|
99
|
+
with:
|
|
100
|
+
enable-cache: true
|
|
101
|
+
|
|
102
|
+
- name: Set up Python
|
|
103
|
+
uses: actions/setup-python@v6
|
|
104
|
+
with:
|
|
105
|
+
python-version: "3.10"
|
|
106
|
+
|
|
107
|
+
- name: Install dependencies
|
|
108
|
+
run: uv sync --all-extras
|
|
109
|
+
|
|
110
|
+
- name: Generate SBOM
|
|
111
|
+
run: make sbom
|
|
112
|
+
|
|
113
|
+
- name: Upload SBOM artifact
|
|
114
|
+
uses: actions/upload-artifact@v4
|
|
115
|
+
with:
|
|
116
|
+
name: sbom
|
|
117
|
+
path: bom.json
|
|
118
|
+
|
|
119
|
+
- name: GitHub Dependency Submission
|
|
120
|
+
uses: anchore/sbom-action@v0
|
|
121
|
+
with:
|
|
122
|
+
path: .
|
|
123
|
+
format: cyclonedx-json
|
|
124
|
+
output-file: anchore-bom.json
|
|
125
|
+
dependency-snapshot: true
|
|
126
|
+
|
|
127
|
+
all-checks:
|
|
128
|
+
name: All Checks Passed
|
|
129
|
+
if: always() && github.event_name != 'release'
|
|
130
|
+
needs: [lint, test, sbom]
|
|
131
|
+
runs-on: ubuntu-latest
|
|
132
|
+
steps:
|
|
133
|
+
- name: Check all jobs
|
|
134
|
+
run: |
|
|
135
|
+
if [[ "${{ needs.lint.result }}" != "success" ]] || [[ "${{ needs.test.result }}" != "success" ]] || [[ "${{ needs.sbom.result }}" != "success" ]]; then
|
|
136
|
+
echo "One or more checks failed"
|
|
137
|
+
exit 1
|
|
138
|
+
fi
|
|
139
|
+
echo "All checks passed!"
|
|
140
|
+
|
|
141
|
+
draft-release:
|
|
142
|
+
name: Draft Release
|
|
143
|
+
runs-on: ubuntu-latest
|
|
144
|
+
needs: [all-checks]
|
|
145
|
+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
146
|
+
steps:
|
|
147
|
+
- name: Checkout code
|
|
148
|
+
uses: actions/checkout@v6
|
|
149
|
+
with:
|
|
150
|
+
fetch-depth: 0
|
|
151
|
+
|
|
152
|
+
- name: Get version
|
|
153
|
+
id: get_version
|
|
154
|
+
run: |
|
|
155
|
+
VERSION=$(grep '^version =' pyproject.toml | cut -d '"' -f 2)
|
|
156
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
157
|
+
|
|
158
|
+
- name: Check if tag exists
|
|
159
|
+
id: check_tag
|
|
160
|
+
run: |
|
|
161
|
+
if git rev-parse "v${{ steps.get_version.outputs.version }}" >/dev/null 2>&1; then
|
|
162
|
+
echo "exists=true" >> $GITHUB_OUTPUT
|
|
163
|
+
else
|
|
164
|
+
echo "exists=false" >> $GITHUB_OUTPUT
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
- name: Create Release Draft
|
|
168
|
+
if: steps.check_tag.outputs.exists == 'false'
|
|
169
|
+
uses: softprops/action-gh-release@v2
|
|
170
|
+
with:
|
|
171
|
+
tag_name: v${{ steps.get_version.outputs.version }}
|
|
172
|
+
name: v${{ steps.get_version.outputs.version }}
|
|
173
|
+
draft: true
|
|
174
|
+
generate_release_notes: true
|
|
175
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
176
|
+
|
|
177
|
+
publish:
|
|
178
|
+
name: Build and Publish
|
|
179
|
+
runs-on: ubuntu-latest
|
|
180
|
+
if: github.event_name == 'release' && github.event.action == 'published'
|
|
181
|
+
steps:
|
|
182
|
+
- name: Checkout code
|
|
183
|
+
uses: actions/checkout@v6
|
|
184
|
+
|
|
185
|
+
- name: Install uv
|
|
186
|
+
uses: astral-sh/setup-uv@v7
|
|
187
|
+
with:
|
|
188
|
+
enable-cache: true
|
|
189
|
+
|
|
190
|
+
- name: Set up Python
|
|
191
|
+
uses: actions/setup-python@v6
|
|
192
|
+
with:
|
|
193
|
+
python-version: "3.10"
|
|
194
|
+
|
|
195
|
+
- name: Build package
|
|
196
|
+
run: make build
|
|
197
|
+
|
|
198
|
+
- name: Publish to PyPI
|
|
199
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
200
|
+
with:
|
|
201
|
+
packages-dir: dist/
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
.venv/
|
|
25
|
+
venv/
|
|
26
|
+
ENV/
|
|
27
|
+
env/
|
|
28
|
+
|
|
29
|
+
# uv
|
|
30
|
+
.uv/
|
|
31
|
+
|
|
32
|
+
# Testing
|
|
33
|
+
.pytest_cache/
|
|
34
|
+
.coverage
|
|
35
|
+
htmlcov/
|
|
36
|
+
.tox/
|
|
37
|
+
|
|
38
|
+
# Linting
|
|
39
|
+
.ruff_cache/
|
|
40
|
+
.mypy_cache/
|
|
41
|
+
.dmypy.json
|
|
42
|
+
dmypy.json
|
|
43
|
+
|
|
44
|
+
# IDE
|
|
45
|
+
.vscode/
|
|
46
|
+
.idea/
|
|
47
|
+
*.swp
|
|
48
|
+
*.swo
|
|
49
|
+
*~
|
|
50
|
+
|
|
51
|
+
# Environment variables
|
|
52
|
+
.env
|
|
53
|
+
.env.local
|
|
54
|
+
.env.*.local
|
|
55
|
+
|
|
56
|
+
# Certificates (don't commit private keys!)
|
|
57
|
+
*.pem
|
|
58
|
+
*.key
|
|
59
|
+
*.crt
|
|
60
|
+
*.csr
|
|
61
|
+
|
|
62
|
+
# OS
|
|
63
|
+
.DS_Store
|
|
64
|
+
Thumbs.db
|
|
65
|
+
|
|
66
|
+
# Logs
|
|
67
|
+
*.log
|
|
68
|
+
|
|
69
|
+
# SBOM
|
|
70
|
+
bom.json
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Olof Hellqvist
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
.PHONY: help venv install sync dev run clean lint format check test build publish
|
|
2
|
+
|
|
3
|
+
# Default target
|
|
4
|
+
help:
|
|
5
|
+
@echo "Cloudflare Certificate Request Tool"
|
|
6
|
+
@echo ""
|
|
7
|
+
@echo "Available targets:"
|
|
8
|
+
@echo " venv - Create virtual environment"
|
|
9
|
+
@echo " install - Install uv and sync dependencies (alias for venv)"
|
|
10
|
+
@echo " sync - Sync dependencies with uv"
|
|
11
|
+
@echo " dev - Install development dependencies"
|
|
12
|
+
@echo " run - Run the certificate request tool"
|
|
13
|
+
@echo " lint - Lint code with ruff"
|
|
14
|
+
@echo " format - Format code with ruff"
|
|
15
|
+
@echo " check - Run all checks (lint + format check)"
|
|
16
|
+
@echo " test - Run tests"
|
|
17
|
+
@echo " sbom - Generate SBOM (Software Bill of Materials)"
|
|
18
|
+
@echo " build - Build source and wheel distributions"
|
|
19
|
+
@echo " publish - Publish package to PyPI"
|
|
20
|
+
@echo " clean - Remove virtual environment and cache files"
|
|
21
|
+
@echo ""
|
|
22
|
+
@echo "Usage examples:"
|
|
23
|
+
@echo " make run DOMAIN=example.com EMAIL=admin@example.com"
|
|
24
|
+
@echo " make run DOMAIN=example.com EMAIL=admin@example.com STAGING=1"
|
|
25
|
+
|
|
26
|
+
# Create virtual environment and install dependencies
|
|
27
|
+
venv:
|
|
28
|
+
@command -v uv >/dev/null 2>&1 || { \
|
|
29
|
+
echo "Installing uv..."; \
|
|
30
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh; \
|
|
31
|
+
}
|
|
32
|
+
@echo "Creating virtual environment and syncing dependencies..."
|
|
33
|
+
uv sync
|
|
34
|
+
|
|
35
|
+
# Alias for venv
|
|
36
|
+
install: venv
|
|
37
|
+
|
|
38
|
+
# Sync dependencies
|
|
39
|
+
sync:
|
|
40
|
+
uv sync
|
|
41
|
+
|
|
42
|
+
# Install development dependencies
|
|
43
|
+
dev:
|
|
44
|
+
uv sync --all-extras
|
|
45
|
+
|
|
46
|
+
# Run the tool
|
|
47
|
+
# Run the tool, forwarding DOMAIN, EMAIL, STAGING, etc. to Python
|
|
48
|
+
run:
|
|
49
|
+
uv run python -m cloudflare_request_cert.main \
|
|
50
|
+
$(if $(DOMAIN),-d $(DOMAIN)) \
|
|
51
|
+
$(if $(EMAIL),-e $(EMAIL)) \
|
|
52
|
+
$(if $(STAGING),--staging)
|
|
53
|
+
|
|
54
|
+
# Lint with ruff
|
|
55
|
+
lint:
|
|
56
|
+
uv run ruff check .
|
|
57
|
+
|
|
58
|
+
# Format code
|
|
59
|
+
format:
|
|
60
|
+
uv run ruff format .
|
|
61
|
+
|
|
62
|
+
# Run all checks
|
|
63
|
+
check: lint
|
|
64
|
+
uv run ruff format --check .
|
|
65
|
+
|
|
66
|
+
# Run tests
|
|
67
|
+
test:
|
|
68
|
+
uv run pytest tests/ -v
|
|
69
|
+
|
|
70
|
+
# Generate SBOM
|
|
71
|
+
sbom:
|
|
72
|
+
uv run cyclonedx-py environment --output-file bom.json
|
|
73
|
+
|
|
74
|
+
# Build package
|
|
75
|
+
build:
|
|
76
|
+
uv build
|
|
77
|
+
|
|
78
|
+
# Publish package
|
|
79
|
+
publish: build
|
|
80
|
+
uv publish
|
|
81
|
+
|
|
82
|
+
# Clean up
|
|
83
|
+
clean:
|
|
84
|
+
rm -rf .venv/
|
|
85
|
+
rm -rf .ruff_cache/
|
|
86
|
+
rm -rf .pytest_cache/
|
|
87
|
+
rm -rf __pycache__/
|
|
88
|
+
rm -rf *.egg-info/
|
|
89
|
+
rm -rf dist/
|
|
90
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
91
|
+
find . -type f -name "*.pyc" -delete
|
|
92
|
+
@echo "Cleaned up cache and virtual environment"
|