Skip to content

Commit e51a14e

Browse files
authored
Create index.md
1 parent ab42135 commit e51a14e

1 file changed

Lines changed: 196 additions & 0 deletions

File tree

docs/index.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
---
2+
layout: default
3+
title: ParspackCERT - Let's Encrypt SSL Certificates with Parspack DNS API
4+
description: Automatically issue and renew Let's Encrypt SSL certificates using Parspack DNS API and Certbot DNS-01 challenge.
5+
---
6+
7+
# ParspackCERT – Let's Encrypt SSL Certificates with Parspack DNS API
8+
9+
🔒 Producing and renewing SSL certificates for domains that use Parspack CDN.
10+
11+
...
12+
13+
# ParspackCERT – Let's Encrypt SSL Certificates with Parspack DNS API
14+
# ParspackCERT <a href="https://azolfagharj.github.io/donate/"><img src="https://img.shields.io/badge/Donate-Support%20Development-orange?style=for-the-badge" alt="Donate"></a>
15+
16+
🔒 Producing and renewing SSL certificates for domains that use [Parspack](https://parspack.com/) CDN. A simple, fast way to get them from Let's Encrypt using [Certbot](https://certbot.eff.org/) and the Parspack DNS API. One script, one command, no trouble.
17+
18+
Automatically obtain and renew Let's Encrypt SSL/TLS certificates using the Parspack DNS API and Certbot DNS-01 challenge.
19+
ParspackCERT is a Bash script for automatically creating and removing_acme-challenge TXT records through the Parspack CDN API.
20+
21+
## Description
22+
23+
parspackCERT is a single bash script that makes SSL certificate management simple. It uses the Parspack DNS API to automatically add the required `_acme-challenge` TXT records for domain validation—no manual DNS work needed.d
24+
25+
These days, with heavy internet restrictions in Iran, you often need certificates stored directly on your server. When you need to bypass CDN or turn off proxy mode temporarily, you want your site to work without stopping. This script handles that simply: download, configure once, and you're done. It works for both manual runs and automatic renewal with Certbot.
26+
27+
## Requirements
28+
29+
📋 Before you start:
30+
31+
- **[Parspack account](https://my.parspack.com/main/auth/log-in)**: Your domain must be added to the Parspack dashboard
32+
- **Parspack CDN API token**: You can get it from the Parspack dashboard, CDN section. The token must have these permissions: *List of Service*, *Store a DNS record*, *Delete a DNS record*
33+
- **Certbot**: Must be installed on the system (`sudo apt install certbot`)
34+
- **Python 3**: Required for JSON parsing (usually pre-installed)
35+
- **curl**: Required for API requests (usually pre-installed)
36+
37+
## Get & Use
38+
39+
⚡ Simple three steps:
40+
41+
1. Download the script and make it executable (one command):
42+
43+
```bash
44+
wget -O parspackCERT https://raw.githubusercontent.com/azolfagharj/parspackCERT/main/parspackCERT && \
45+
chmod +x parspackCERT
46+
```
47+
48+
2. Edit the script and set your Parspack CDN API token:
49+
```bash
50+
API_TOKEN="your-parspack-cdn-api-token"
51+
```
52+
53+
3. Run the command for your domain (e.g. yourdomain.ir):
54+
55+
```bash
56+
sudo ./parspackCERT -d "yourdomain.ir"
57+
```
58+
59+
### Help
60+
61+
Show usage information:
62+
63+
```bash
64+
./parspackCERT
65+
./parspackCERT --help
66+
./parspackCERT -h
67+
```
68+
69+
## Certificate Storage
70+
71+
📁 Certificates are saved automatically in the default Certbot location:
72+
73+
```
74+
/etc/letsencrypt/live/<cert_name>/fullchain.pem
75+
/etc/letsencrypt/live/<cert_name>/privkey.pem
76+
```
77+
78+
The certificate name is comes from the first domain you specify.
79+
80+
## How It Works
81+
82+
📖 Behind the scenes, it's simple:
83+
84+
1. **User runs script**: Execute `./parspackCERT -d "example.com"` with your domain(s)
85+
2. **Script runs Certbot**: The script invokes Certbot with manual DNS challenge mode
86+
3. **Auth hook**: For each domain, Certbot calls the script with `auth` argument
87+
4. **DNS record creation**: The script uses Parspack API to create `_acme-challenge` TXT record
88+
5. **Validation**: Let's Encrypt checks the TXT record
89+
6. **Cleanup hook**: Certbot calls the script with `cleanup` argument
90+
7. **DNS record removal**: The script deletes the temporary TXT record
91+
92+
## Advanced Usage
93+
94+
For advanced users and deeper control—wildcards, multiple domains, dry run, and more:
95+
96+
### Syntax
97+
98+
```bash
99+
./parspackCERT -d DOMAIN [-d DOMAIN ...] [CERTBOT_OPTIONS]
100+
```
101+
102+
### Domain Formats
103+
104+
The script accepts the same domain format as Certbot:
105+
106+
| Format | Example | Description |
107+
|-------------------|--------------------------------|--------------------------------------|
108+
| Single domain | `-d "example.com"` | Main domain only |
109+
| Wildcard | `-d "*.example.com"` | Covers all subdomains |
110+
| Multiple domains | `-d "a.com" -d "b.com"` | Add multiple domains with repeated -d|
111+
| Comma-separated | `-d "a.com,b.com,c.com"` | Alternative to multiple -d flags |
112+
113+
### Examples
114+
115+
**Main domain only:**
116+
```bash
117+
./parspackCERT -d "yourdomain.com"
118+
```
119+
120+
**Wildcard and main domain (covers example.com and *.example.com):**
121+
```bash
122+
./parspackCERT -d "*.example.com" -d "example.com"
123+
```
124+
125+
**Multiple domains:**
126+
```bash
127+
./parspackCERT -d "www.example.com" -d "api.example.com" -d "example.com"
128+
```
129+
130+
**Dry run (test without obtaining certificate):**
131+
```bash
132+
./parspackCERT -d "example.com" --dry-run
133+
```
134+
135+
**Force renewal (renew even if not expired):**
136+
```bash
137+
./parspackCERT -d "example.com" --force-renewal
138+
```
139+
140+
141+
## Automatic Renewal
142+
143+
🔄 Set it once and forget it. Certbot schedules automatic renewal (usually twice daily). The script stores the auth and cleanup hooks in the renewal configuration, so Certbot automatically uses parspackCERT—no repeat setup needed.
144+
145+
To test renewal without making changes:
146+
147+
```bash
148+
sudo certbot renew --dry-run
149+
```
150+
151+
For more details, see the [Certbot documentation on automated renewals](https://eff-certbot.readthedocs.io/en/stable/using.html#automated-renewals).
152+
153+
154+
## Error Messages
155+
156+
⚠️ The script provides clear error messages for common issues:
157+
158+
| Error | Cause | Solution |
159+
|---------------------------------|--------------------------------|-------------------------------------------|
160+
| API_TOKEN is empty | Token not set in script | Edit script and add your Parspack CDN API token |
161+
| Invalid or expired API token | Wrong or expired token | Generate new token from Parspack dashboard, CDN section |
162+
| Zone not found for domain | Domain not in Parspack | Add domain to Parspack dashboard first |
163+
| Connection failed | Network or API unreachable | Check network, firewall, API URL |
164+
| certbot is not installed | Certbot missing | Run `sudo apt install certbot` |
165+
| python3 not found | Python 3 missing | Run `sudo apt install python3` |
166+
167+
## Troubleshooting
168+
169+
🔧 Common fixes:
170+
171+
**Certificate not renewing automatically:**
172+
- Check Certbot timer: `sudo systemctl status certbot.timer`
173+
- Verify renewal config: `cat /etc/letsencrypt/renewal/yourdomain.com.conf`
174+
- Ensure `manual_auth_hook` and `manual_cleanup_hook` point to parspackCERT
175+
176+
**DNS propagation delay:**
177+
- The script waits 25 seconds after creating the TXT record
178+
- For slow DNS, you may need to increase the sleep time in the script
179+
180+
**Permission denied:**
181+
- Run with sudo when obtaining certificates: `sudo ./parspackCERT -d "example.com"`
182+
183+
## License
184+
185+
📄 MIT License. See [LICENSE](LICENSE) for details. Simple, fast, reliable.
186+
187+
---
188+
## Support this Project
189+
190+
191+
192+
🤝 **Enjoying this free project?** <a href="https://azolfagharj.github.io/donate/">Consider supporting</a> its development
193+
194+
<a href="https://azolfagharj.github.io/donate/"><img src="https://img.shields.io/badge/Donate-Support%20Development-orange?style=for-the-badge" alt="Donate"></a>
195+
196+
---

0 commit comments

Comments
 (0)