Добавлены новые документы и инструкции по автоматизации SSL сертификатов Let's Encrypt для reg.ru, включая:
Синхронизация Wiki / Синхронизация Wiki (push) Successful in 3s

- Структура проекта и основные скрипты (PROJECT_STRUCTURE.md)
- Быстрый старт сборки исполняемых файлов (QUICKSTART_BUILD.md)
- Автоматические релизы через GitHub и Gitea (RELEASE_GUIDE.md)
- Подробная инструкция по использованию скриптов (SSL_SCRIPTS_README.md)
- Руководство по тестированию SSL сертификатов (TESTING_GUIDE.md)
- Инструкции по настройке Nginx Proxy Manager с SSL (Настройке Nginx Manager с SSL .md)
- Создание и продление wildcard сертификата в Nginx Proxy Manager (Создание и продление SSL сертификата.md)
This commit is contained in:
Dmitriy Fofanov
2026-02-25 01:42:29 +03:00
parent f3dd4a7d49
commit 44f7ab1f5c
47 changed files with 111 additions and 4104 deletions
+3 -8
View File
@@ -1,4 +1,4 @@
name: "Deploy scripts to remote server"
name: "Deploy scripts to remote server"
on:
workflow_dispatch:
@@ -10,7 +10,7 @@ on:
jobs:
deploy:
name: "Upload and deploy on 192.168.10.14"
name: "Upload and deploy on remote server"
runs-on: native
steps:
@@ -71,11 +71,6 @@ jobs:
: "${CFG_EMAIL:?CFG_EMAIL secret is required}"
: "${CFG_DOMAINS:?CFG_DOMAINS secret is required}"
if [ "${DEPLOY_HOST}" != "192.168.10.14" ]; then
echo "ERROR: DEPLOY_HOST must be 192.168.10.14 for this workflow"
exit 1
fi
echo ">>> Secrets validation passed"
- name: "Create deployment archive"
@@ -135,7 +130,7 @@ jobs:
domains_raw = os.environ.get("CFG_DOMAINS", "").strip()
if domains_raw.startswith("["):
# JSON array: каждый элемент может содержать запятые для SAN групп
# Пример: ["*.dfv24.com,dfv24.com", "github.dfv24.com"]
# Пример: ["*.example.com,example.com", "gitea.example.com"]
domains = json.loads(domains_raw)
else:
domains = [item.strip() for item in domains_raw.split(",") if item.strip()]
+13 -13
View File
@@ -1,4 +1,4 @@
# ==============================================================================
# ==============================================================================
# Makefile для установки и удаления скрипта управления SSL сертификатами
# Let's Encrypt с DNS-валидацией через API reg.ru
# ==============================================================================
@@ -42,9 +42,9 @@ BUILD_DIR_PY = build
SPEC_FILE = $(APP_NAME).spec
# Переменные для запуска Gitea Actions workflows
DFGIT_URL ?= https://github.dfv24.com
DFGIT_URL ?= https://gitea.example.com
WORKFLOW_DISPATCH_SCRIPT ?= scripts/wiki_sync_dispatch.py
DFGIT_REPO ?= fofanov.dmitry/configure_nginx_manager
DFGIT_REPO ?= your_username/configure_nginx_manager
GIT_TOKEN ?=
GITEA_TOKEN ?=
GITEA_ACCESS_TOKEN ?=
@@ -92,9 +92,9 @@ help:
@echo ""
@echo "$(GREEN)CI / Wiki:$(NC)"
@echo ""
@echo " $(YELLOW)make wiki-sync$(NC) - Запустить workflow wiki-sync.yml на github.dfv24.com"
@echo " $(YELLOW)make ci-release$(NC) - Запустить workflow release.yml на github.dfv24.com (нужен TAG или VERSION)"
@echo " $(YELLOW)make deploy-service$(NC) - Запустить workflow deploy-service.yml на github.dfv24.com"
@echo " $(YELLOW)make wiki-sync$(NC) - Запустить workflow wiki-sync.yml на gitea.example.com"
@echo " $(YELLOW)make ci-release$(NC) - Запустить workflow release.yml на gitea.example.com (нужен TAG или VERSION)"
@echo " $(YELLOW)make deploy-service$(NC) - Запустить workflow deploy-service.yml на gitea.example.com"
@echo ""
@echo " $(YELLOW)make help$(NC) - Показать эту справку"
@echo ""
@@ -450,11 +450,11 @@ logs:
@echo "$(YELLOW)→ Логи systemd:$(NC)"
@journalctl -u $(SERVICE_FILE) -n 50 --no-pager 2>/dev/null || echo "$(YELLOW)Логи systemd не найдены$(NC)"
# Запуск workflow синхронизации wiki на github.dfv24.com
# Запуск workflow синхронизации wiki на gitea.example.com
ifeq ($(OS),Windows_NT)
wiki-sync:
@echo "$(BLUE)╔════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(BLUE)║ Запуск wiki-sync workflow на github.dfv24.com ║$(NC)"
@echo "$(BLUE)║ Запуск wiki-sync workflow на gitea.example.com ║$(NC)"
@echo "$(BLUE)╚════════════════════════════════════════════════════════════════╝$(NC)"
@echo ""
$(if $(AUTH_TOKEN),,$(error Токен не задан. Укажите DFGIT_TOKEN или GIT_TOKEN/GITEA_TOKEN/GITEA_ACCESS_TOKEN))
@@ -462,7 +462,7 @@ wiki-sync:
else
wiki-sync:
@echo "$(BLUE)╔════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(BLUE)║ Запуск wiki-sync workflow на github.dfv24.com ║$(NC)"
@echo "$(BLUE)║ Запуск wiki-sync workflow на gitea.example.com ║$(NC)"
@echo "$(BLUE)╚════════════════════════════════════════════════════════════════╝$(NC)"
@echo ""
$(if $(AUTH_TOKEN),,$(error Токен не задан. Укажите DFGIT_TOKEN или GIT_TOKEN/GITEA_TOKEN/GITEA_ACCESS_TOKEN))
@@ -478,7 +478,7 @@ endif
ifeq ($(OS),Windows_NT)
ci-release:
@echo "$(BLUE)╔════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(BLUE)║ Запуск release workflow на github.dfv24.com ║$(NC)"
@echo "$(BLUE)║ Запуск release workflow на gitea.example.com ║$(NC)"
@echo "$(BLUE)╚════════════════════════════════════════════════════════════════╝$(NC)"
@echo ""
ifndef TAG
@@ -491,7 +491,7 @@ endif
else
ci-release:
@echo "$(BLUE)╔════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(BLUE)║ Запуск release workflow на github.dfv24.com ║$(NC)"
@echo "$(BLUE)║ Запуск release workflow на gitea.example.com ║$(NC)"
@echo "$(BLUE)╚════════════════════════════════════════════════════════════════╝$(NC)"
@echo ""
ifndef TAG
@@ -512,7 +512,7 @@ endif
ifeq ($(OS),Windows_NT)
deploy-service:
@echo "$(BLUE)╔════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(BLUE)║ Запуск deploy-service workflow на github.dfv24.com ║$(NC)"
@echo "$(BLUE)║ Запуск deploy-service workflow на gitea.example.com ║$(NC)"
@echo "$(BLUE)╚════════════════════════════════════════════════════════════════╝$(NC)"
@echo ""
$(if $(AUTH_TOKEN),,$(error Токен не задан. Укажите DFGIT_TOKEN или GIT_TOKEN/GITEA_TOKEN/GITEA_ACCESS_TOKEN))
@@ -520,7 +520,7 @@ deploy-service:
else
deploy-service:
@echo "$(BLUE)╔════════════════════════════════════════════════════════════════╗$(NC)"
@echo "$(BLUE)║ Запуск deploy-service workflow на github.dfv24.com ║$(NC)"
@echo "$(BLUE)║ Запуск deploy-service workflow на gitea.example.com ║$(NC)"
@echo "$(BLUE)╚════════════════════════════════════════════════════════════════╝$(NC)"
@echo ""
$(if $(AUTH_TOKEN),,$(error Токен не задан. Укажите DFGIT_TOKEN или GIT_TOKEN/GITEA_TOKEN/GITEA_ACCESS_TOKEN))
+11 -11
View File
@@ -1,4 +1,4 @@
# Руководство по использованию скриптов для управления SSL сертификатами Let's Encrypt с DNS-валидацией через API reg.ru
# Руководство по использованию скриптов для управления SSL сертификатами Let's Encrypt с DNS-валидацией через API reg.ru
## 🆕 Новое в версии 2.0
@@ -1697,8 +1697,8 @@ sudo openssl x509 -enddate -noout -in /etc/letsencrypt/live/example.com/cert.pem
2. Перейдите в **SSL Certificates** → **Add SSL Certificate**
3. Выберите **Custom**
4. Вставьте содержимое файлов:
- Certificate Key: `/etc/letsencrypt/live/dfv24.com/privkey.pem`
- Certificate: `/etc/letsencrypt/live/dfv24.com/fullchain.pem`
- Certificate Key: `/etc/letsencrypt/live/example.com/privkey.pem`
- Certificate: `/etc/letsencrypt/live/example.com/fullchain.pem`
5. Сохраните сертификат
### Вариант 2: Прямая настройка Nginx
@@ -1708,10 +1708,10 @@ sudo openssl x509 -enddate -noout -in /etc/letsencrypt/live/example.com/cert.pem
```nginx
server {
listen 443 ssl http2;
server_name dfv24.com *.dfv24.com;
server_name example.com *.example.com;
ssl_certificate /etc/letsencrypt/live/dfv24.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dfv24.com/privkey.pem;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
# Дополнительные SSL настройки
ssl_protocols TLSv1.2 TLSv1.3;
@@ -2108,7 +2108,7 @@ chmod +x /path/to/repo.git/hooks/post-receive
## 🚀 Deploy через GitHub Actions (с генерацией config.json)
Workflow `.github/workflows/deploy-service.yml` выполняет удалённый деплой на сервер `192.168.10.14` по SSH (ключ) и автоматически генерирует рабочий `config.json` из секретов.
Workflow `.github/workflows/deploy-service.yml` выполняет удалённый деплой на сервер `192.0.2.1` по SSH (ключ) и автоматически генерирует рабочий `config.json` из секретов.
### Как это работает
@@ -2124,7 +2124,7 @@ Workflow `.github/workflows/deploy-service.yml` выполняет удалён
- `GIT_TOKEN` (или `GITEA_TOKEN`)
#### SSH / деплой
- `DEPLOY_HOST` = `192.168.10.14`
- `DEPLOY_HOST` = `192.0.2.1`
- `DEPLOY_PORT` (обычно `22`)
- `DEPLOY_USER`
- `DEPLOY_SSH_PRIVATE_KEY` (приватный ключ для SSH)
@@ -2139,10 +2139,10 @@ Workflow `.github/workflows/deploy-service.yml` выполняет удалён
Примеры `CFG_DOMAINS`:
- `[
"dfv24.com",
"pages.github.dfv24.com"
"example.com",
"pages.gitea.example.com"
]`
- `dfv24.com,pages.github.dfv24.com`
- `example.com,pages.gitea.example.com`
### Опциональные secrets
+6 -6
View File
@@ -1,13 +1,13 @@
{
{
"regru_username": "your_username",
"regru_password": "your_password",
"domain": "dfv24.com",
"domain": "example.com",
"domains": [
"*.dfv24.com,dfv24.com",
"github.dfv24.com"
"*.example.com,example.com",
"gitea.example.com"
],
"wildcard": true,
"email": "admin@dfv24.com",
"email": "admin@example.com",
"cert_dir": "/etc/letsencrypt/live",
"log_file": "/var/log/letsencrypt_regru.log",
"dns_propagation_wait": 60,
@@ -15,7 +15,7 @@
"dns_check_interval": 10,
"renewal_days": 30,
"npm_enabled": true,
"npm_host": "http://192.168.10.14:81",
"npm_host": "http://192.0.2.1:81",
"npm_email": "admin@example.com",
"npm_password": "changeme"
}
@@ -1,4 +1,4 @@
# Инструкция по созданию Let's Encrypt сертификата с DNS Challenge для провайдера reg.ru в Nginx Proxy Manager
# Инструкция по созданию Let's Encrypt сертификата с DNS Challenge для провайдера reg.ru в Nginx Proxy Manager
---
@@ -6,7 +6,7 @@
- Доступ к Nginx Proxy Manager (NPM)
- Доступ к аккаунту reg.ru с правами управления DNS-записями
- API-ключ для управления DNS в reg.ru (если есть автоматическая интеграция)
- Нужно получить сертификат для `*.dfv24.com` (wildcard сертификат)
- Нужно получить сертификат для `*.example.com` (wildcard сертификат)
---
@@ -28,8 +28,8 @@
- Client ID
- API Token
5. В поле **Domain Names** укажите:
`*.dfv24.com` (для wildcard сертификата)
и основной домен `dfv24.com`
`*.example.com` (для wildcard сертификата)
и основной домен `example.com`
6. Включите остальные опции (Terms of Service, Email)
7. Нажмите **Save** для запроса сертификата
8. NPM автоматически добавит DNS TXT-записи для подтверждения владения доменом через API reg.ru
@@ -1,4 +1,4 @@
# Руководство по использованию letsencrypt_regru.sh
# Руководство по использованию letsencrypt_regru.sh
**Автор:** Фофанов Дмитрий
**Дата:** 28.10.2025
@@ -342,7 +342,7 @@ letsencrypt-regru --obtain -v
**Не загружается в NPM**
```bash
# Проверьте доступность NPM
curl http://192.168.10.14:81
curl http://192.0.2.1:81
# Проверьте учетные данные в config.json
# Попробуйте вручную
@@ -406,7 +406,7 @@ sudo systemctl restart letsencrypt-regru.timer
- GitHub Issues: https://github.com/YOUR_USERNAME/configure_nginx_manager/issues
- Документация: `/opt/letsencrypt-regru/docs/`
- Email: admin@dfv24.com
- Email: admin@example.com
---
@@ -1,4 +1,4 @@
# Автоматизация SSL сертификатов Let's Encrypt для reg.ru
# Автоматизация SSL сертификатов Let's Encrypt для reg.ru
Набор скриптов для автоматического создания и обновления SSL сертификатов Let's Encrypt с использованием DNS-валидации через API reg.ru.
@@ -55,9 +55,9 @@ sudo python3 letsencrypt_regru_api.py -c /etc/letsencrypt/regru_config.json --ob
{
"regru_username": "ваш_логин",
"regru_password": "ваш_пароль",
"domain": "dfv24.com",
"domain": "example.com",
"wildcard": true,
"email": "admin@dfv24.com"
"email": "admin@example.com"
}
```
@@ -107,7 +107,7 @@ sudo crontab -e
После получения сертификата:
1. Войдите в NPM: http://192.168.10.14:81/
1. Войдите в NPM: http://192.0.2.1:81/
2. SSL Certificates → Add SSL Certificate → Custom
3. Вставьте содержимое:
- Certificate Key: `/etc/letsencrypt/live/domain.com/privkey.pem`
-206
View File
@@ -1,206 +0,0 @@
# 🔧 reg.ru API Troubleshooting Guide
## ❌ Issue: "Access to API from this IP denied"
This error occurs when reg.ru API is blocked for your IP address due to security settings.
### 🔍 Diagnostics
First, determine your current IP address:
```bash
# Method 1: Using script's built-in function
sudo letsencrypt-regru --test-api
# Method 2: Using curl
curl -s https://ipinfo.io/ip
# Method 3: Using website
# Open https://whatismyipaddress.com/
```
### ✅ Solution
#### Method 1: Add IP to whitelist (recommended)
1. **Login to reg.ru control panel**
- Open https://www.reg.ru/
- Login to your account
2. **Navigate to API settings**
- Menu → "Settings" (Настройки)
- Section "Security" (Безопасность)
- Subsection "API"
3. **Configure IP access**
- Find "IP Restrictions" section
- Click "Add IP address"
- Enter your current IP address
- Save settings
4. **Test settings**
```bash
sudo letsencrypt-regru --test-api
```
#### Method 2: Disable IP restrictions (less secure)
⚠️ **WARNING**: This reduces your account security!
1. In reg.ru API settings find "IP Restrictions"
2. Disable "Allow access only from specified IPs" option
3. Save settings
### 🔒 Security Recommendations
1. **Use static IP**
- If you have dynamic IP, consider purchasing static IP
- Or regularly update allowed IP list
2. **Limit API access**
- Add only necessary IP addresses
- Regularly review and clean up the list
3. **Use strong passwords**
- Complex password for reg.ru account
- Two-factor authentication if available
## ❌ Issue: "Invalid username or password"
### ✅ Solution
1. **Check credentials**
```bash
sudo nano /etc/letsencrypt-regru/config.json
```
Make sure you have correct:
- `regru_username` - reg.ru login
- `regru_password` - reg.ru password
2. **Check file permissions**
```bash
sudo chmod 600 /etc/letsencrypt-regru/config.json
sudo chown root:root /etc/letsencrypt-regru/config.json
```
3. **Test connection**
```bash
sudo letsencrypt-regru --test-api
```
## ❌ Issue: "IP exceeded allowed connection rate"
### Cause
Reg.ru API limits request frequency from single IP (typically 10-20 requests per minute).
### ✅ Solution
1. **Wait 5-10 minutes**
```bash
# Wait before next attempt
sleep 600 # 10 minutes
sudo letsencrypt-regru --obtain
```
2. **Configure automation properly**
```bash
# Check certificates once per day
sudo systemctl enable letsencrypt-regru.timer
sudo systemctl start letsencrypt-regru.timer
# Check schedule
sudo systemctl cat letsencrypt-regru.timer
```
3. **Request frequency recommendations**
- ✅ Automatic check: **once per day**
- ✅ Manual check: **no more than once per hour**
- ❌ Avoid frequent `--test-api` tests
- ❌ Don't create frequent cron jobs
4. **Use --check instead of --obtain**
```bash
# Check without creating certificate
sudo letsencrypt-regru --check
```
## ❌ Issue: Connection timeout
### ✅ Solution
1. **Check internet connection**
```bash
ping -c 4 api.reg.ru
curl -I https://api.reg.ru/api/regru2
```
2. **Check firewall**
```bash
# Temporarily disable firewall for testing
sudo ufw status
sudo iptables -L
```
3. **Check proxy settings**
- Ensure `HTTP_PROXY`, `HTTPS_PROXY` environment variables don't interfere
## 🧪 API Testing
Always test API before use:
```bash
# Full API test
sudo letsencrypt-regru --test-api
# Test with verbose output
sudo letsencrypt-regru --test-api -v
# Check configuration
sudo letsencrypt-regru --check
```
## 📞 Getting Help
### reg.ru Technical Support
- **Email**: support@reg.ru
- **Phone**: 8 (495) 580-11-11
- **Online chat**: on reg.ru website
### Documentation
- **reg.ru API**: https://www.reg.ru/support/api
- **Usage examples**: https://www.reg.ru/support/api/examples
- **API FAQ**: https://www.reg.ru/support/api/faq
### Diagnostic Logs
Always include logs when contacting support:
```bash
# Enable verbose logs
sudo letsencrypt-regru --test-api -v
# View recent logs
sudo tail -n 50 /var/log/letsencrypt-regru/letsencrypt_regru.log
# Certbot logs
sudo tail -n 50 /var/log/letsencrypt/letsencrypt.log
```
## 🔄 Alternative DNS Providers
If reg.ru API issues are critical, consider alternatives:
1. **Cloudflare** - excellent API, free DNS
2. **Route53** (AWS) - powerful but paid
3. **DigitalOcean DNS** - simple and reliable
4. **Google Cloud DNS** - GCP integration
These require script modification or other certbot plugins.
---
**Last Updated**: October 29, 2025
**Document Version**: 1.0
@@ -1,56 +0,0 @@
# Guide to Creating Let's Encrypt Certificate with DNS Challenge for reg.ru Provider in Nginx Proxy Manager
---
## Prerequisites
- Access to Nginx Proxy Manager (NPM)
- Access to reg.ru account with DNS management permissions
- API key for DNS management in reg.ru (if automatic integration is available)
- Need to obtain certificate for `*.dfv24.com` (wildcard certificate)
---
## Step 1. Getting API Key for reg.ru
1. Log in to reg.ru control panel
2. Navigate to API management section (if supported)
3. Create or find API key with DNS records editing permissions
4. Save API key and secret (Client ID and API Token)
---
## Step 2. Configuring Nginx Proxy Manager to Use DNS Challenge reg.ru
1. In NPM admin panel, go to **SSL Certificates → Add SSL Certificate**
2. Select **Let's Encrypt** -> **DNS Challenge**
3. In **Provider** field, select `reg_ru` or `custom` (if provider not available, script will be needed)
4. Fill in API fields with required parameters:
- Client ID
- API Token
5. In **Domain Names** field, specify:
`*.dfv24.com` (for wildcard certificate)
and main domain `dfv24.com`
6. Enable other options (Terms of Service, Email)
7. Click **Save** to request certificate
8. NPM will automatically add DNS TXT records for domain ownership verification through reg.ru API
---
## Step 3. Verification and Automatic Renewal
- After successful certificate creation, NPM will automatically renew it through DNS Challenge.
- For successful renewal, it's important that API key remains valid and NPM has access to DNS management.
---
## If NPM Doesn't Have Ready Integration with reg.ru
- Use external script to update DNS TXT records in reg.ru, configured in NPM through **Custom DNS Provider**.
- Configure curl requests to reg.ru API for adding/removing TXT records.
---
# Summary
For Let's Encrypt wildcard certificates with reg.ru, DNS Challenge must be used with provider's API for automatic DNS record management.
In Nginx Proxy Manager, configure DNS Challenge considering reg.ru specifics for seamless certificate obtaining and renewal.
-455
View File
@@ -1,455 +0,0 @@
# 🔨 Executable Build Guide
This guide describes the process of compiling the `letsencrypt_regru_api.py` Python script into executable files for Linux and Windows using PyInstaller.
## 📋 Table of Contents
- [Advantages of Executable Files](#advantages-of-executable-files)
- [Quick Start](#quick-start)
- [Detailed Instructions](#detailed-instructions)
- [Cross-Compilation](#cross-compilation)
- [Troubleshooting](#troubleshooting)
---
## ✅ Advantages of Executable Files
### Pros:
-**Single file** - easy to distribute and deploy
-**Standalone** - no Python installation required on target system
-**All dependencies included** - requests, cryptography, and certbot modules are bundled
-**Simple execution** - just download and run
### Cons:
-**Large size** - ~40-60 MB (including Python runtime and libraries)
-**Certbot dependency** - system certbot is still required
-**Slow first launch** - unpacking takes a few seconds
-**Rebuild required** - code changes require recompilation
---
## 🚀 Quick Start
### Build for current OS:
```bash
make build
```
### Build for all platforms:
```bash
make build-all
```
### Full release (build + packages):
```bash
make release
```
---
## 📖 Detailed Instructions
### 1. Install Dependencies
#### Option A: Automatic Installation
```bash
make install-pyinstaller
```
#### Option B: Manual Installation
```bash
pip install pyinstaller
pip install -r requirements.txt
```
### 2. Build for Linux
**On Linux system:**
```bash
make build-linux
```
**Result:**
- File: `dist/letsencrypt-regru`
- Size: ~45-55 MB
- Format: ELF 64-bit executable
**Testing:**
```bash
./dist/letsencrypt-regru --help
sudo ./dist/letsencrypt-regru --check -c /etc/letsencrypt-regru/config.json
```
### 3. Build for Windows
**On Windows system (PowerShell/CMD):**
```bash
make build-windows
```
**Result:**
- File: `dist/letsencrypt-regru.exe`
- Size: ~40-50 MB
- Format: PE32+ executable (Windows)
**Testing:**
```powershell
.\dist\letsencrypt-regru.exe --help
```
### 4. Create Distribution Packages
#### Linux package (tar.gz):
```bash
make package-linux
```
**Package contents:**
- `letsencrypt-regru` - executable file
- `README.md` - documentation
- `systemd/` - systemd unit files
- `config.json.example` - configuration example
**Result:** `dist/letsencrypt-regru-linux-x86_64.tar.gz`
#### Windows package (zip):
```bash
make package-windows
```
**Result:** `dist/letsencrypt-regru-windows-x86_64.zip`
### 5. Full Release Cycle
Create release with all artifacts:
```bash
make release
```
**What happens:**
1. Clean old artifacts (`clean-build`)
2. Install/update PyInstaller
3. Build for Linux (`build-linux`)
4. Build for Windows (`build-windows`)
5. Create Linux package (`package-linux`)
6. Create Windows package (`package-windows`)
7. Generate SHA256 checksums
**Result in `dist/`:**
```
letsencrypt-regru # Linux executable
letsencrypt-regru.exe # Windows executable
letsencrypt-regru-linux-x86_64.tar.gz
letsencrypt-regru-windows-x86_64.zip
```
---
## 🔄 Cross-Compilation
### ⚠️ Important Notes
**Not recommended:**
- Building Linux version on Windows
- Building Windows version on Linux
- Building macOS version on other OSes
**Reasons:**
- System library incompatibility
- Different executable formats
- Path and separator issues
### Recommendations
#### For Linux builds:
1. Use Ubuntu 20.04+ or Debian 10+
2. Install build-essential
3. Use Python virtual environment
```bash
sudo apt-get update
sudo apt-get install -y python3 python3-pip build-essential
make build-linux
```
#### For Windows builds:
1. Use Windows 10/11
2. Install Python 3.8+
3. Use PowerShell or CMD
```powershell
python -m pip install --upgrade pip
make build-windows
```
#### For both platforms:
Use CI/CD (GitHub Actions, GitLab CI):
```yaml
# .github/workflows/build.yml
name: Build Releases
on:
push:
tags:
- 'v*'
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Linux
run: make build-linux
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Build Windows
run: make build-windows
```
---
## 🛠️ All Makefile Commands
### Main Commands:
| Command | Description |
|---------|-------------|
| `make build` | Build for current OS |
| `make build-linux` | Build for Linux |
| `make build-windows` | Build for Windows |
| `make build-all` | Build for all platforms |
| `make package-linux` | Create tar.gz package |
| `make package-windows` | Create zip package |
| `make release` | Full release cycle |
### Supporting Commands:
| Command | Description |
|---------|-------------|
| `make install-pyinstaller` | Install PyInstaller |
| `make test-build` | Test built file |
| `make clean-build` | Clean build artifacts |
| `make build-info` | Show environment info |
---
## 🐛 Troubleshooting
### Issue: PyInstaller not found
**Error:**
```
make: pyinstaller: Command not found
```
**Solution:**
```bash
make install-pyinstaller
# or
pip install pyinstaller
```
---
### Issue: Module imports not working
**Error:**
```
ModuleNotFoundError: No module named 'requests'
```
**Solution:**
```bash
pip install -r requirements.txt
# or add to PyInstaller command:
--hidden-import requests
--hidden-import certbot
--hidden-import cryptography
```
---
### Issue: Large file size
**Size ~100+ MB instead of 40-60 MB**
**Causes:**
- Extra modules included
- Not using `--onefile`
- Debug symbols included
**Solution:**
```bash
# Use optimization flags:
pyinstaller --onefile \
--strip \
--exclude-module tkinter \
--exclude-module matplotlib \
letsencrypt_regru_api.py
```
---
### Issue: Certbot not working in executable
**Error:**
```
certbot: command not found
```
**Solution:**
Certbot is called via `subprocess` and must be installed on the system:
**Linux:**
```bash
sudo apt-get install certbot
```
**Windows:**
- Not directly supported
- Use WSL or Docker
---
### Issue: File permission errors
**Error:**
```
Permission denied: /etc/letsencrypt/
```
**Solution:**
```bash
# Linux/macOS
sudo ./dist/letsencrypt-regru --check
# Or set proper permissions:
sudo chmod +x ./dist/letsencrypt-regru
sudo chown root:root ./dist/letsencrypt-regru
```
---
### Issue: Slow startup
**First launch takes 5-10 seconds**
**Reason:**
PyInstaller unpacks files to temporary directory on each run.
**Solution:**
- This is normal behavior for `--onefile`
- Use `--onedir` for faster startup (but many files)
- Temporary directory is cached automatically
---
### Issue: Antivirus blocking file
**Windows Defender marks .exe as virus**
**Reasons:**
- Self-extracting archive looks like malware
- No digital signature
- Unknown executable file
**Solution:**
1. **Add to exclusions:**
- Windows Defender → Settings → Exclusions
2. **Sign file with digital signature:**
```bash
# Requires Code Signing certificate
signtool sign /f cert.pfx /p password dist/letsencrypt-regru.exe
```
3. **Check on VirusTotal:**
- Upload file to virustotal.com
- Add results to README
---
## 📊 Comparison: Python vs Executable
| Feature | Python Script | Executable File |
|---------|---------------|-----------------|
| Size | ~50 KB | ~40-60 MB |
| Dependencies | Requires Python + pip | Standalone |
| Startup Speed | Fast (~1 sec) | Slow (~5-10 sec) |
| Updates | Just replace .py | Requires rebuild |
| Compatibility | Any OS with Python | Only target OS |
| Installation | Requires venv setup | Download and run |
| Certbot | Via subprocess | Via subprocess |
---
## 🎯 Recommendations
### Use Python script if:
- ✅ Python already installed on system
- ✅ Frequent code updates needed
- ✅ Using virtual environment
- ✅ Working on servers (production)
### Use executable file if:
- ✅ Python not installed
- ✅ Simple deployment needed
- ✅ Distributing to end users
- ✅ Testing on clean systems
---
## 📦 Using Built File Examples
### Linux:
```bash
# Download and extract
wget https://github.com/user/repo/releases/download/v1.0/letsencrypt-regru-linux-x86_64.tar.gz
tar -xzf letsencrypt-regru-linux-x86_64.tar.gz
# Install
sudo mv letsencrypt-regru /usr/local/bin/
sudo chmod +x /usr/local/bin/letsencrypt-regru
# Use
sudo letsencrypt-regru --help
sudo letsencrypt-regru --check -c /etc/letsencrypt-regru/config.json
```
### Windows:
```powershell
# Download and extract
Invoke-WebRequest -Uri "https://github.com/user/repo/releases/download/v1.0/letsencrypt-regru-windows-x86_64.zip" -OutFile "letsencrypt-regru.zip"
Expand-Archive -Path letsencrypt-regru.zip -DestinationPath "C:\Program Files\LetsEncrypt-RegRu"
# Use
cd "C:\Program Files\LetsEncrypt-RegRu"
.\letsencrypt-regru.exe --help
```
---
## 📝 Additional Resources
- [PyInstaller Documentation](https://pyinstaller.org/en/stable/)
- [PyInstaller FAQ](https://pyinstaller.org/en/stable/FAQ.html)
- [Building Cross-Platform Applications](https://pyinstaller.org/en/stable/operating-mode.html)
---
## 📄 License
This project uses the license as specified in the main README.md.
---
**Author:** Dmitry Fofanov
**Last Updated:** October 28, 2025
-187
View File
@@ -1,187 +0,0 @@
# 📋 Changelog
## [2.1.0] - 2025-10-27
### 🆕 Added
#### Test SSL Certificate Generation
-**New `TestCertificateGenerator` class** - self-signed certificate generation
-**`--test-cert` command** in Python script for test certificate creation
-**`test_certificate.sh` script** - standalone creation via OpenSSL
-**`make test-cert` command** in Makefile for quick testing
#### Documentation
- 📘 **TESTING_GUIDE.md** (370+ lines) - complete testing guide
- Bypass Let's Encrypt limits (5 certificates per week)
- Certificate creation method comparison
- CI/CD and Docker examples
- Transition from test to production
- FAQ and solutions
- 📘 **TESTING_GUIDE_EN.md** - English version of testing guide
- 📘 **PROJECT_STRUCTURE.md** - project structure
- All files description
- Features list
- Technologies
- 📘 **PROJECT_STRUCTURE_EN.md** - English version
- 📘 **CHEATSHEET.md** - quick reference
- Main commands
- Use case scenarios
- Common errors and solutions
- Development workflow
- 📘 **CHEATSHEET_EN.md** - English version
- 📘 **DESCRIPTION.md** - project description in Russian and English
- 📘 **CHANGELOG_EN.md** - English changelog
- 📘 **GITEA_SYNC.md** - Gitea → GitHub synchronization
- 4 sync methods
- Step-by-step setup
- Troubleshooting
- 📘 **GITEA_SYNC_EN.md** - English version
- 📘 **README_EN.md** - Complete English main guide
#### Functionality
- ✨ Support for **unlimited** test certificates
-**Instant creation** (1-2 seconds) without DNS validation
-**Automatic upload** of test certificates to NPM
-**Full compatibility** of structure with Let's Encrypt
-**Wildcard support** for test certificates
#### Repository Synchronization
-**Automatic Gitea → GitHub sync** via Git Hooks
-**GitHub Actions workflow** for hourly sync check
-**Webhook integration** between Gitea and GitHub
-**Multiple sync methods** (Hooks, Actions, Mirror, Double Remote)
### 🔧 Improved
#### Python Script
- Added `cryptography` library import with installation check
- New command-line parameters:
- `--test-cert` - create test certificate
- `--auto` - explicit automatic mode
- Improved test certificate handling in NPM
- Detailed logging of generation process
#### Makefile
- Added `make test-cert` command with beautiful output
- Information messages about test certificate benefits
- Security warnings
#### README.md
- "Test Self-Signed Certificate Creation" section
- Updated table of contents with test certificates link
- Test certificate usage examples
- NPM integration for test certificates
- Links to additional documentation
- Gitea → GitHub sync section
### 🎯 Benefits
#### For Developers
-**No limits** - unlimited certificates
-**Fast** - creation in 1-2 seconds
-**Offline** - works without internet
-**Identical structure** - same files as Let's Encrypt
#### For Testing
-**CI/CD friendly** - quick creation in pipeline
-**Docker ready** - easily embeds in containers
-**Staging environments** - perfect for test servers
-**Local development** - HTTPS on localhost
#### For DevOps
-**Repository sync** - automatic Gitea → GitHub
-**Multiple methods** - choose what fits
-**Instant sync** - Git Hooks < 1 second
-**Reliable backup** - GitHub Actions hourly check
### 📊 Statistics
- **Lines of code**: 1,411 (Python script)
- **Makefile lines**: 415
- **Documentation lines**: 3,500+
- **Makefile commands**: 13
- **Operating modes**: 4 (obtain, renew, auto, test-cert)
- **Sync methods**: 4 (Hooks, Actions, Mirror, Remote)
- **Languages**: 2 (Russian, English)
---
## [2.0.0] - 2025-10-27
### 🆕 Added
- ✨ Nginx Proxy Manager (NPM) integration
-`NginxProxyManagerAPI` class for certificate management via API
- ✨ Automatic certificate upload to NPM
- ✨ Automatic certificate update in NPM
- ✨ Automatic expiration check
- ✨ Configurable renewal threshold (`renewal_days`)
- ✨ Makefile for installation/removal automation
- ✨ Systemd service + timer
- ✨ Cron automation
### 🔧 Improved
- Documentation consolidation into single README.md
- Detailed logging with operation statuses
- Configuration validation
- Improved error handling
### 📘 Documentation
- Complete NPM integration guide
- Quick start in 3 commands
- Automation examples
---
## [1.0.0] - 2025-10-26
### 🆕 First Release
- Python script for Let's Encrypt via reg.ru API
- Bash script with certbot-dns-regru
- PowerShell version for Windows
- DNS-01 validation
- Wildcard certificates
- Basic documentation
---
## Roadmap
### [2.2.0] - Planned
- [ ] Web interface for management
- [ ] Multiple domain support
- [ ] Notifications (email, telegram)
- [ ] Grafana dashboard for monitoring
- [ ] Certificate backups
### [3.0.0] - Future
- [ ] Other DNS provider support
- [ ] Cloudflare API
- [ ] Route53 (AWS)
- [ ] Google Cloud DNS
---
## Change Types
- `🆕 Added` - new functionality
- `🔧 Improved` - improvements to existing functionality
- `🐛 Fixed` - bug fixes
- `🗑️ Removed` - removed functionality
- `🔒 Security` - security changes
- `📘 Documentation` - documentation changes
---
**Versioning**: Semantic Versioning (MAJOR.MINOR.PATCH)
- **MAJOR**: Incompatible API changes
- **MINOR**: New functionality with backward compatibility
- **PATCH**: Bug fixes
-287
View File
@@ -1,287 +0,0 @@
# ⚡ SSL Certificate Cheatsheet
## 🚀 Quick Start
### Installation in 3 Commands
```bash
sudo make install
sudo nano /etc/letsencrypt/regru_config.json # Fill in data
sudo make test-cert # Test
```
---
## 🧪 Testing (NO Let's Encrypt Limits)
```bash
# Create test certificate (unlimited)
sudo make test-cert
# Check status
sudo make status
# View logs
sudo make logs
```
**When to use:**
- ⚠️ Let's Encrypt: max 5 certificates/week
- ✅ Test: UNLIMITED
- ⚡ Creation: 1-2 seconds vs 2-5 minutes
---
## 🔒 Production (Let's Encrypt)
```bash
# Get real certificate
sudo make obtain
# Automatic mode (check + renewal)
sudo make run
# Force renewal
sudo make renew
```
---
## 📋 Main Commands
### letsencrypt-regru Commands
| Command | Description | Limits | Use Case |
|---------|-------------|--------|----------|
| `--check` | Check certificate expiration | - | Monitoring |
| `--obtain` | Obtain new certificate | ⚠️ 5/week | Initial creation |
| `--renew` | Renew existing certificate | ⚠️ 5/week | Renewal |
| `--auto` | Auto-check and renewal | ⚠️ 5/week | Cron/systemd |
| `--test-cert` | Test certificate | ✅ None | Development |
| `--test-api` | Check API reg.ru access | - | Diagnostics |
| `--test-dns` | Test DNS record creation | - | Pre-SSL check |
| `--help` | Show help | - | Help |
| `-v` | Verbose output | - | Debugging |
### Makefile Commands
| Command | Description | Equivalent |
|---------|-------------|------------|
| `make test-cert` | Test certificate | `letsencrypt-regru --test-cert` |
| `make obtain` | New Let's Encrypt | `letsencrypt-regru --obtain` |
| `make renew` | Renew existing | `letsencrypt-regru --renew` |
| `make run` | Auto mode | `letsencrypt-regru --auto` |
| `make status` | System status | - |
| `make logs` | Show logs | `journalctl -u letsencrypt-regru` |
| `make check-config` | Check configuration | - |
### letsencrypt_regru.sh Commands
| Command | Description |
|---------|-------------|
| `sudo bash letsencrypt_regru.sh install` | Install application |
| `sudo bash letsencrypt_regru.sh update` | Update application |
| `sudo bash letsencrypt_regru.sh uninstall` | Uninstall application |
---
## 📝 Configuration
### Minimal (testing)
```json
{
"domain": "test.example.com",
"wildcard": true,
"cert_dir": "/etc/letsencrypt/live"
}
```
### Full (production + NPM)
```json
{
"regru_username": "myuser",
"regru_password": "mypassword",
"domain": "example.com",
"wildcard": true,
"email": "admin@example.com",
"renewal_days": 30,
"npm_enabled": true,
"npm_host": "https://npm.example.com",
"npm_email": "admin@example.com",
"npm_password": "npm_password"
}
```
---
## 🔄 Workflow
### Development → Production
```bash
# 1. Development (test certificates)
sudo make test-cert # Create test
# Test application...
# 2. Production (Let's Encrypt)
sudo rm -rf /etc/letsencrypt/live/example.com/ # Remove test
sudo make obtain # Create production
```
---
## 📁 Important Paths
```bash
# Configuration
/etc/letsencrypt/regru_config.json
# Certificates
/etc/letsencrypt/live/example.com/
├── privkey.pem # Private key
├── cert.pem # Certificate
├── fullchain.pem # Full chain (for nginx)
└── chain.pem # CA chain
# Scripts
/opt/letsencrypt-regru/letsencrypt_regru_api.py
# Logs
/var/log/letsencrypt_regru.log
```
---
## 🔍 Verification
```bash
# Check configuration
sudo make check-config
# Check certificate
openssl x509 -in /etc/letsencrypt/live/example.com/cert.pem -text -noout
# Check expiration date
openssl x509 -in /etc/letsencrypt/live/example.com/cert.pem -noout -dates
# Check systemd
sudo systemctl status letsencrypt-regru.timer
sudo systemctl list-timers letsencrypt-regru.timer
# Check cron
sudo crontab -l | grep letsencrypt
```
---
## 🐛 Debugging
```bash
# Detailed logs
sudo make logs
# Test run with details
sudo python3 /opt/letsencrypt-regru/letsencrypt_regru_api.py \
-c /etc/letsencrypt/regru_config.json --check -v
# Certbot logs
sudo tail -f /var/log/letsencrypt/letsencrypt.log
# Systemd logs
sudo journalctl -u letsencrypt-regru.service -f
```
---
## ⚠️ Common Errors
### Let's Encrypt: Rate limit exceeded
```bash
# SOLUTION: Use test certificates
sudo make test-cert
```
### NPM: Certificate not found
```bash
# SOLUTION: Check NPM settings
sudo make check-config
# Check connection
curl -k https://npm.example.com
```
### Permission denied
```bash
# SOLUTION: Run with sudo
sudo make test-cert
```
---
## 🎯 Use Case Scenarios
### Local Development
```bash
sudo make test-cert
# Open https://localhost (ignore warning)
```
### CI/CD Testing
```bash
# In pipeline
sudo make test-cert
# Run tests...
sudo make status
```
### Staging Environment
```bash
sudo make test-cert # Or
sudo make obtain # If domain available
```
### Production Environment
```bash
sudo make install
sudo make obtain
# Automatic renewal via cron/systemd
```
---
## 📚 Documentation
- **README.md** - Complete guide (1420+ lines)
- **TESTING_GUIDE.md** - Testing guide (370+ lines)
- **PROJECT_STRUCTURE.md** - Project structure
- **CHEATSHEET.md** - This cheatsheet
---
## 🆘 Quick Help
```bash
# Show all commands
make help
# Check installation
sudo make status
# Complete reinstall
sudo make uninstall
sudo make install
```
---
## 💡 Tips
1. **Always start with test certificates** - avoid limits
2. **Check configuration** - `make check-config`
3. **Monitor logs** - `make logs`
4. **Automate** - systemd/cron already configured
5. **Keep backups** of configuration
---
**Version**: 2.1
**Updated**: 27.10.2025
-143
View File
@@ -1,143 +0,0 @@
# 🔒 SSL Certificate Manager for Let's Encrypt + reg.ru
**Automated Let's Encrypt SSL certificate management with DNS validation via reg.ru API and Nginx Proxy Manager integration**
## 📖 Description
Comprehensive solution for automating the creation, renewal, and management of Let's Encrypt SSL certificates for domains registered with reg.ru. Supports DNS-01 validation, wildcard certificates, automatic upload to Nginx Proxy Manager, and test certificate generation for development.
### ✨ Key Features
- 🔐 **Automatic SSL certificate issuance** via Let's Encrypt
- 🌐 **DNS-01 validation** via reg.ru API (wildcard domain support)
- 🔄 **Automatic renewal** with configurable threshold
- 📦 **Nginx Proxy Manager integration** - automatic upload and update
- 🧪 **Test certificates** - bypass Let's Encrypt rate limits (5 per week)
- ⚙️ **Full automation** via systemd/cron
- 🔀 **Repository synchronization** - automatic Gitea → GitHub sync
### 🚀 Quick Start
```bash
# Install via Makefile
sudo make install
# Configure
sudo nano /etc/letsencrypt/regru_config.json
# Create test certificate (no rate limits)
sudo make test-cert
# Get production certificate
sudo make obtain
```
### 📋 Requirements
- **OS**: Linux (Ubuntu/Debian/CentOS)
- **Python**: 3.6+
- **Dependencies**: certbot, requests, cryptography
- **API**: reg.ru (DNS management access)
- **Optional**: Nginx Proxy Manager
### 🎯 Use Cases
- ✅ SSL certificate automation for web servers
- ✅ Centralized management via Nginx Proxy Manager
- ✅ Development and testing with self-signed certificates
- ✅ CI/CD integration
- ✅ Multi-domain configurations with wildcards
### 📚 Documentation
#### English Documentation
- [BUILD_GUIDE_EN.md](../en/BUILD_GUIDE_EN.md) - Complete build guide
- [QUICKSTART_BUILD_EN.md](../en/QUICKSTART_BUILD_EN.md) - Quick build start
- [RELEASE_GUIDE_EN.md](../en/RELEASE_GUIDE_EN.md) - Release creation guide
- [MAKEFILE_COMMANDS_EN.md](../en/MAKEFILE_COMMANDS_EN.md) - Makefile commands reference
- [TESTING_GUIDE_EN.md](../en/TESTING_GUIDE_EN.md) - Testing guide
- [CHEATSHEET_EN.md](../en/CHEATSHEET_EN.md) - Quick reference
- [GITEA_SYNC_EN.md](../en/GITEA_SYNC_EN.md) - Gitea → GitHub sync
- [PROJECT_STRUCTURE_EN.md](../en/PROJECT_STRUCTURE_EN.md) - Project structure
#### Russian Documentation / Русская документация
- [BUILD_GUIDE.md](../ru/BUILD_GUIDE.md) - Полное руководство по сборке
- [QUICKSTART_BUILD.md](../ru/QUICKSTART_BUILD.md) - Быстрый старт сборки
- [RELEASE_GUIDE.md](../ru/RELEASE_GUIDE.md) - Руководство по созданию релизов
- [MAKEFILE_COMMANDS.md](../ru/MAKEFILE_COMMANDS.md) - Справочник команд Makefile
- [TESTING_GUIDE.md](../ru/TESTING_GUIDE.md) - Руководство по тестированию
- [CHEATSHEET.md](../ru/CHEATSHEET.md) - Быстрая шпаргалка
- [GITEA_SYNC.md](../ru/GITEA_SYNC.md) - Синхронизация Gitea → GitHub
- [PROJECT_STRUCTURE.md](../ru/PROJECT_STRUCTURE.md) - Структура проекта
---
## 🔨 Building Executables
The project supports building standalone executables for Linux and Windows:
```bash
# Build for current OS
make build
# Build for all platforms
make build-all
# Create full release
make release
```
**Result:**
- Linux: `letsencrypt-regru` (~45-55 MB)
- Windows: `letsencrypt-regru.exe` (~40-50 MB)
See [BUILD_GUIDE_EN.md](../en/BUILD_GUIDE_EN.md) for details.
---
## 🎯 Automated Releases
### GitHub Actions
Create a tag to trigger automatic build and release:
```bash
git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0
```
### Gitea Actions
Same workflow available for self-hosted Gitea:
```bash
git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0
```
See [RELEASE_GUIDE_EN.md](../en/RELEASE_GUIDE_EN.md) for details.
---
## 👤 Author
**Dmitry Fofanov** @ 2025
## 📄 License
Open Source - Free to use
## 🤝 Contributing
Pull requests are welcome!
## 🔗 Links
- **reg.ru API Documentation**: https://www.reg.ru/support/api
- **Let's Encrypt**: https://letsencrypt.org/
- **Nginx Proxy Manager**: https://nginxproxymanager.com/
- **PyInstaller**: https://pyinstaller.org/
---
**Last Updated:** October 28, 2025
-174
View File
@@ -1,174 +0,0 @@
# 📚 Documentation Index
## 🇬🇧 English Documentation
### Main Guides
- **[DESCRIPTION_EN.md](DESCRIPTION_EN.md)** - Project Description & Overview
- **[BUILD_GUIDE_EN.md](BUILD_GUIDE_EN.md)** - Complete Build Guide
- **[QUICKSTART_BUILD_EN.md](QUICKSTART_BUILD_EN.md)** - Quick Build Start (5 minutes)
- **[RELEASE_GUIDE_EN.md](RELEASE_GUIDE_EN.md)** - Automated Release Guide
- **[INSTALL_GUIDE_EN.md](INSTALL_GUIDE_EN.md)** - Installation Guide
- **[TESTING_GUIDE_EN.md](TESTING_GUIDE_EN.md)** - Testing Guide
### Reference Materials
- **[MAKEFILE_COMMANDS_EN.md](MAKEFILE_COMMANDS_EN.md)** - Makefile Commands Reference
- **[CHEATSHEET_EN.md](CHEATSHEET_EN.md)** - Quick Reference
- **[CHANGELOG_EN.md](CHANGELOG_EN.md)** - Change History
### Developer Guides
- **[PROJECT_STRUCTURE_EN.md](PROJECT_STRUCTURE_EN.md)** - Project Structure
- **[GITEA_SYNC_EN.md](GITEA_SYNC_EN.md)** - Gitea → GitHub Synchronization
### SSL & Certificates
- **[SSL_SCRIPTS_README_EN.md](SSL_SCRIPTS_README_EN.md)** - SSL Scripts Documentation
- **[SSL_Certificate_Creation_and_Renewal_EN.md](SSL_Certificate_Creation_and_Renewal_EN.md)** - SSL Certificate Guide
- **[Add_Lets_Encrypt_Certificate_for_regru_Provider_EN.md](Add_Lets_Encrypt_Certificate_for_regru_Provider_EN.md)** - Let's Encrypt + reg.ru
### Nginx Integration
- **[Nginx_Manager_SSL_Configuration_EN.md](Nginx_Manager_SSL_Configuration_EN.md)** - Nginx Manager SSL Setup
---
## 🇷🇺 Russian Documentation / Русская документация
### Основные руководства / Main Guides
- **[DESCRIPTION.md](../ru/DESCRIPTION.md)** - Описание проекта
- **[BUILD_GUIDE.md](../ru/BUILD_GUIDE.md)** - Полное руководство по сборке
- **[QUICKSTART_BUILD.md](../ru/QUICKSTART_BUILD.md)** - Быстрый старт сборки (5 минут)
- **[RELEASE_GUIDE.md](../ru/RELEASE_GUIDE.md)** - Руководство по автоматическим релизам
- **[INSTALL_GUIDE.md](../ru/INSTALL_GUIDE.md)** - Руководство по установке
- **[TESTING_GUIDE.md](../ru/TESTING_GUIDE.md)** - Руководство по тестированию
### Справочная информация / Reference Materials
- **[MAKEFILE_COMMANDS.md](../ru/MAKEFILE_COMMANDS.md)** - Справочник команд Makefile
- **[CHEATSHEET.md](../ru/CHEATSHEET.md)** - Быстрая шпаргалка
- **[CHANGELOG.md](../ru/CHANGELOG.md)** - История изменений
### Руководства для разработчиков / Developer Guides
- **[PROJECT_STRUCTURE.md](../ru/PROJECT_STRUCTURE.md)** - Структура проекта
- **[GITEA_SYNC.md](../ru/GITEA_SYNC.md)** - Синхронизация Gitea → GitHub
---
## 🚀 Quick Start / Быстрый старт
### For End Users / Для конечных пользователей
**English:**
1. Start here: [DESCRIPTION_EN.md](DESCRIPTION_EN.md)
2. Install: [INSTALL_GUIDE_EN.md](INSTALL_GUIDE_EN.md)
3. Test: [TESTING_GUIDE_EN.md](TESTING_GUIDE_EN.md)
4. Quick reference: [CHEATSHEET_EN.md](CHEATSHEET_EN.md)
**Russian / Русский:**
1. Начните здесь: [DESCRIPTION.md](../ru/DESCRIPTION.md)
2. Установка: [INSTALL_GUIDE.md](../ru/INSTALL_GUIDE.md)
3. Тестирование: [TESTING_GUIDE.md](../ru/TESTING_GUIDE.md)
4. Шпаргалка: [CHEATSHEET.md](../ru/CHEATSHEET.md)
### For Developers / Для разработчиков
**English:**
1. Build guide: [BUILD_GUIDE_EN.md](BUILD_GUIDE_EN.md)
2. Quick build: [QUICKSTART_BUILD_EN.md](QUICKSTART_BUILD_EN.md)
3. Create release: [RELEASE_GUIDE_EN.md](RELEASE_GUIDE_EN.md)
4. Commands: [MAKEFILE_COMMANDS_EN.md](MAKEFILE_COMMANDS_EN.md)
**Russian / Русский:**
1. Руководство по сборке: [BUILD_GUIDE.md](../ru/BUILD_GUIDE.md)
2. Быстрая сборка: [QUICKSTART_BUILD.md](../ru/QUICKSTART_BUILD.md)
3. Создание релиза: [RELEASE_GUIDE.md](../ru/RELEASE_GUIDE.md)
4. Команды: [MAKEFILE_COMMANDS.md](../ru/MAKEFILE_COMMANDS.md)
---
## 📖 Documentation by Topic / Документация по темам
### Installation / Установка
| Topic | English | Russian |
|-------|---------|---------|
| Installation Guide | [INSTALL_GUIDE_EN.md](INSTALL_GUIDE_EN.md) | [INSTALL_GUIDE.md](../ru/INSTALL_GUIDE.md) |
| Quick Start | [DESCRIPTION_EN.md](DESCRIPTION_EN.md) | [DESCRIPTION.md](../ru/DESCRIPTION.md) |
### Building / Сборка
| Topic | English | Russian |
|-------|---------|---------|
| Complete Build Guide | [BUILD_GUIDE_EN.md](BUILD_GUIDE_EN.md) | [BUILD_GUIDE.md](../ru/BUILD_GUIDE.md) |
| Quick Build (5 min) | [QUICKSTART_BUILD_EN.md](QUICKSTART_BUILD_EN.md) | [QUICKSTART_BUILD.md](../ru/QUICKSTART_BUILD.md) |
| Makefile Commands | [MAKEFILE_COMMANDS_EN.md](MAKEFILE_COMMANDS_EN.md) | [MAKEFILE_COMMANDS.md](../ru/MAKEFILE_COMMANDS.md) |
### Releases / Релизы
| Topic | English | Russian |
|-------|---------|---------|
| Automated Releases | [RELEASE_GUIDE_EN.md](RELEASE_GUIDE_EN.md) | [RELEASE_GUIDE.md](../ru/RELEASE_GUIDE.md) |
| Changelog | [CHANGELOG_EN.md](CHANGELOG_EN.md) | [CHANGELOG.md](../ru/CHANGELOG.md) |
### Testing / Тестирование
| Topic | English | Russian |
|-------|---------|---------|
| Testing Guide | [TESTING_GUIDE_EN.md](TESTING_GUIDE_EN.md) | [TESTING_GUIDE.md](../ru/TESTING_GUIDE.md) |
### Reference / Справка
| Topic | English | Russian |
|-------|---------|---------|
| Quick Reference | [CHEATSHEET_EN.md](CHEATSHEET_EN.md) | [CHEATSHEET.md](../ru/CHEATSHEET.md) |
| Project Structure | [PROJECT_STRUCTURE_EN.md](PROJECT_STRUCTURE_EN.md) | [PROJECT_STRUCTURE.md](../ru/PROJECT_STRUCTURE.md) |
---
## 📊 Documentation Status / Статус документации
| Document | English | Russian | Status |
|----------|---------|---------|--------|
| Description | ✅ | ✅ | Complete |
| Build Guide | ✅ | ✅ | Complete |
| Quick Build | ✅ | ✅ | Complete |
| Release Guide | ✅ | ✅ | Complete |
| Install Guide | ✅ | ✅ | Complete |
| Makefile Commands | ✅ | ✅ | Complete |
| Testing Guide | ✅ | ✅ | Complete |
| Cheatsheet | ✅ | ✅ | Complete |
| Project Structure | ✅ | ✅ | Complete |
| Gitea Sync | ✅ | ✅ | Complete |
| Changelog | ✅ | ✅ | Complete |
**Legend:**
- ✅ Complete / Готово
- 🔄 In Progress / В разработке
- ❌ Not Started / Не начато
---
## 🎯 Choose Your Language / Выберите язык
### 🇬🇧 Prefer English?
👉 Start with [DESCRIPTION_EN.md](DESCRIPTION_EN.md)
### 🇷🇺 Предпочитаете русский?
👉 Начните с [DESCRIPTION.md](../ru/DESCRIPTION.md)
---
## 💡 Contributing / Вклад
Help improve documentation / Помогите улучшить документацию:
- Report issues / Сообщайте об ошибках
- Suggest improvements / Предлагайте улучшения
- Fix typos / Исправляйте опечатки
- Translate / Переводите
---
## 🔗 External Resources / Внешние ресурсы
- **reg.ru API**: https://www.reg.ru/support/api
- **Let's Encrypt**: https://letsencrypt.org/
- **Nginx Proxy Manager**: https://nginxproxymanager.com/
- **PyInstaller**: https://pyinstaller.org/
- **GitHub Actions**: https://docs.github.com/actions
- **Gitea Actions**: https://docs.gitea.com/usage/actions/overview
---
**Last Updated / Обновлено**: October 28, 2025
**Maintained by / Поддерживает**: Dmitry Fofanov
-438
View File
@@ -1,438 +0,0 @@
# 🔄 Gitea → GitHub Synchronization
Automatic repository synchronization from Gitea to GitHub after each push.
---
## 📋 Available Methods
| Method | Complexity | Speed | Reliability | Recommendation |
|--------|------------|-------|-------------|----------------|
| **1. Git Hooks** | ⭐⭐ | ⚡ Instant | ✅ High | Recommended |
| **2. GitHub Actions** | ⭐⭐⭐ | ⏱️ 1-5 min | ✅ High | Complex scenarios |
| **3. Gitea Mirror** | ⭐ | ⏱️ Scheduled | ⭐⭐ Medium | Simplest |
| **4. Double Remote** | ⭐ | ⚡ Instant | ⭐⭐ Medium | Local work |
---
## 🚀 Method 1: Git Hooks (Recommended)
### Installation
**1. On Gitea server, find repository path:**
```bash
# Usually:
/var/lib/gitea/data/gitea-repositories/username/configure_nginx_manager.git
# Or
/home/git/gitea-repositories/username/configure_nginx_manager.git
```
**2. Create post-receive hook:**
```bash
cd /path/to/gitea/repos/username/configure_nginx_manager.git/hooks/
nano post-receive
```
**3. Insert content** from `gitea-hooks/post-receive` file (in this repository)
**4. Configure parameters:**
```bash
# In post-receive file, change:
GITHUB_REPO="git@github.com:YOUR_USERNAME/configure_nginx_manager.git"
# Or for HTTPS with token:
GITHUB_REPO="https://YOUR_TOKEN@github.com/YOUR_USERNAME/configure_nginx_manager.git"
```
**5. Make script executable:**
```bash
chmod +x post-receive
```
**6. Create log directory:**
```bash
mkdir -p /var/log/gitea
chown git:git /var/log/gitea
```
### SSH Key Setup (for git@github.com)
**On Gitea server:**
**Step 1: Identify Gitea user**
```bash
# Check which user runs Gitea
ps aux | grep gitea | grep -v grep
# Usually one of:
# - git (standard installation)
# - gitea (Docker/LXC installation)
```
**Step 2: Switch to that user**
```bash
# Try git:
sudo su - git
# If that doesn't work, try gitea:
sudo su - gitea
# Verify current user
whoami # Should be: git or gitea
```
**Step 3: Create SSH key**
```bash
# Create SSH key (if not exists)
ssh-keygen -t ed25519 -C "gitea-to-github-sync" -f ~/.ssh/id_ed25519 -N ""
# Copy public key
cat ~/.ssh/id_ed25519.pub
```
**On GitHub:**
1. Settings → SSH and GPG keys
2. New SSH key
3. Paste public key
4. Save
**⚠️ IMPORTANT: Add GitHub to known_hosts:**
```bash
# From the same user (git or gitea)
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
# Verify key was added
cat ~/.ssh/known_hosts | grep github.com
```
**Verify connection:**
```bash
ssh -T git@github.com
# Should output: Hi username! You've successfully authenticated...
```
### Token Setup (for HTTPS)
**On GitHub:**
1. Settings → Developer settings → Personal access tokens → Tokens (classic)
2. Generate new token
3. Select scope: `repo` (full repository access)
4. Copy token
**In hook file:**
```bash
GITHUB_REPO="https://ghp_YOUR_TOKEN_HERE@github.com/username/configure_nginx_manager.git"
```
### Testing
```bash
# Make test commit in Gitea
cd /tmp
git clone http://gitea.example.com/username/configure_nginx_manager.git
cd configure_nginx_manager
echo "test" >> README.md
git add README.md
git commit -m "Test sync to GitHub"
git push
# Check log
tail -f /var/log/gitea/github-sync.log
# Check GitHub - changes should appear
```
---
## 🔄 Method 2: GitHub Actions
### Installation
**1. Create workflow in GitHub repository:**
File already created: `.github/workflows/sync-from-gitea.yml`
**2. Configure secrets in GitHub:**
GitHub Repository → Settings → Secrets and variables → Actions → New repository secret
Add:
- **Name**: `GITEA_URL`
- **Value**: `https://gitea.example.com/username/configure_nginx_manager.git`
- **Name**: `GITEA_TOKEN`
- **Value**: Gitea access token
### Getting Gitea Token
**In Gitea:**
1. Settings → Applications → Generate New Token
2. Token Name: "GitHub Sync"
3. Select permissions: `read:repository`
4. Generate Token
5. Copy token
### Running Sync
**Automatically (scheduled):**
- Checks for changes every hour
**Manually:**
1. GitHub → Actions
2. Select workflow "Sync from Gitea"
3. Run workflow
**Via Gitea webhook:**
In Gitea repository:
1. Settings → Webhooks → Add Webhook → Gitea
2. Target URL: `https://api.github.com/repos/USERNAME/configure_nginx_manager/dispatches`
3. HTTP Method: `POST`
4. POST Content Type: `application/json`
5. Trigger On: `Push events`
6. Body:
```json
{
"event_type": "gitea-push"
}
```
---
## 🪞 Method 3: Gitea Mirror (Built-in)
### Setup
**In Gitea repository:**
1. Settings → Repository
2. Scroll to "Mirror Settings"
3. Click "Add Push Mirror"
4. Fill in:
- **Git Remote Repository URL**: `https://github.com/username/configure_nginx_manager.git`
- **Username**: your GitHub username
- **Password**: GitHub Personal Access Token
- **Sync Interval**: `8h` (every 8 hours) or `0` (manual only)
5. Save
### Manual Sync
Settings → Repository → Mirror Settings → Sync Now
### Advantages
- ✅ Built-in feature
- ✅ No scripts required
- ✅ Web interface management
### Disadvantages
- ⚠️ Works on schedule (not instant)
- ⚠️ Not available in all Gitea versions
---
## 🔀 Method 4: Double Remote
### For Local Work
**Setup:**
```bash
# In your local repository
cd configure_nginx_manager
# Add GitHub as second remote
git remote add github git@github.com:username/configure_nginx_manager.git
# Or configure push to both repositories simultaneously
git remote set-url --add --push origin git@github.com:username/configure_nginx_manager.git
# Verify
git remote -v
```
**Usage:**
```bash
# Normal push (Gitea only)
git push origin main
# Push to GitHub
git push github main
# Push to both repositories
git push origin main
git push github main
# Or create alias
git config alias.pushall '!git push origin main && git push github main'
git pushall
```
---
## 🔍 Sync Verification
### Check via Git
```bash
# Compare commits
git ls-remote git@gitea.example.com:username/configure_nginx_manager.git
git ls-remote git@github.com:username/configure_nginx_manager.git
# Should have identical SHA
```
### Check Logs (Method 1 - Hooks)
```bash
# On Gitea server
tail -f /var/log/gitea/github-sync.log
```
### Check GitHub Actions (Method 2)
1. GitHub Repository → Actions
2. View recent runs
3. Check execution logs
---
## ⚙️ Recommended Configuration
For maximum reliability, use **combination of methods**:
1. **Git Hook** (primary) - instant sync
2. **GitHub Actions** (backup) - hourly check in case of hook failure
### Installing Both Methods
```bash
# 1. Install Git Hook on Gitea server
# (see Method 1)
# 2. Configure GitHub Actions
# (see Method 2)
# 3. GitHub Actions will catch missed changes
```
---
## 🐛 Troubleshooting
### Problem: Hook not firing
**Check:**
```bash
# On Gitea server
ls -la /path/to/repo.git/hooks/post-receive
# Should be -rwxr-xr-x
# Check permissions
chmod +x /path/to/repo.git/hooks/post-receive
chown git:git /path/to/repo.git/hooks/post-receive
# Check Gitea error log
tail -f /var/log/gitea/gitea.log
```
### Problem: Permission denied (SSH)
**Solution:**
```bash
# Ensure SSH key is added to GitHub
ssh -T git@github.com
# Check .ssh permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
```
### Problem: Authentication failed (HTTPS)
**Solution:**
- Check GitHub token (should have `repo` scope)
- Token not expired
- Correct URL format: `https://TOKEN@github.com/user/repo.git`
### Problem: GitHub Actions not triggering
**Solution:**
1. Check secrets in Settings → Secrets
2. Verify webhook format from Gitea
3. Run manually for test
---
## 📊 Method Comparison
### Sync Speed
- **Git Hooks**: ⚡ < 1 second
- **GitHub Actions (webhook)**: ⏱️ 10-30 seconds
- **GitHub Actions (schedule)**: ⏱️ up to 1 hour
- **Gitea Mirror**: ⏱️ scheduled
### Reliability
- **Git Hooks**: ⭐⭐⭐⭐⭐ (when properly configured)
- **GitHub Actions**: ⭐⭐⭐⭐⭐ (very reliable)
- **Gitea Mirror**: ⭐⭐⭐ (depends on Gitea version)
- **Double Remote**: ⭐⭐ (requires manual action)
---
## 🎯 Final Recommendation
For `configure_nginx_manager` project:
**1. Primary method: Git Hook**
- Fast
- Reliable
- Automatic
**2. Backup method: GitHub Actions**
- Hourly check
- Catches missed changes
- Can run manually
**3. Monitoring:**
```bash
# Weekly verification
git ls-remote origin | head -1
git ls-remote github | head -1
# SHA should match
```
---
## 📝 Quick Setup
```bash
# On Gitea server
sudo su - git
cd /path/to/gitea-repositories/username/configure_nginx_manager.git/hooks/
# Download hook
wget https://raw.githubusercontent.com/username/configure_nginx_manager/main/gitea-hooks/post-receive
# Configure
nano post-receive
# Change GITHUB_REPO
# Permissions
chmod +x post-receive
# Test
echo "test" | ./post-receive
```
Done! 🎉
---
## 📚 Additional Resources
- [Git Hooks Documentation](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)
- [GitHub Actions Documentation](https://docs.github.com/en/actions)
- [Gitea Documentation](https://docs.gitea.io/)
---
**Version**: 1.0
**Author**: Фофанов Дмитрий
**Date**: October 27, 2025
-415
View File
@@ -1,415 +0,0 @@
# Installation Guide for letsencrypt_regru.sh
**Author:** Dmitry Fofanov
**Date:** October 28, 2025
## Description
`letsencrypt_regru.sh` is an automated installer for Let's Encrypt Manager with reg.ru and Nginx Proxy Manager integration.
The script automates:
- Installation of all system dependencies
- Python virtual environment creation
- Python library installation (requests, cryptography, certbot)
- Interactive configuration setup
- Creating and configuring systemd services
- Automatic certificate renewal setup
## Requirements
- Linux (Debian/Ubuntu, CentOS/RHEL/Fedora)
- Root access (sudo)
- Minimum 512MB RAM
- Minimum 1GB free disk space
- Internet connection
## Quick Installation
**Method 1: Automatic Installation (Recommended)**
The fastest way - run installation directly from GitHub:
```bash
sudo bash -c "$(curl -fsSL https://github.com/DFofanov/configure_nginx_manager/raw/refs/heads/master/letsencrypt_regru.sh)"
```
This command will:
- Automatically download the installation script
- Run it with root privileges
- Guide you through interactive setup
**Method 2: Clone Repository**
If you want to review the code before installation:
```bash
# 1. Download repository
git clone https://github.com/DFofanov/configure_nginx_manager.git
cd configure_nginx_manager
# 2. Make executable
chmod +x letsencrypt_regru.sh
# 3. Run installation
sudo ./letsencrypt_regru.sh
```
## Interactive Setup
During installation, the script will ask for:
1. **Domain** - your main domain (e.g., `example.com`)
2. **Email** - for Let's Encrypt notifications
3. **reg.ru credentials:**
- Username
- Password
4. **Wildcard certificate** - create `*.example.com` (recommended: Yes)
5. **NPM integration** (optional):
- NPM address (e.g., `http://10.10.10.14:81`)
- NPM login email
- NPM password
## Structure After Installation
```
/opt/letsencrypt-regru/ # Application
├── letsencrypt_regru_api.py # Main script
├── venv/ # Python virtual environment
└── docs/ # Documentation
/etc/letsencrypt-regru/ # Configuration
└── config.json # Settings (credentials, domain, NPM)
/var/log/letsencrypt-regru/ # Logs
└── letsencrypt_regru.log
/etc/letsencrypt/live/ # Let's Encrypt certificates
└── example.com/
├── privkey.pem
├── cert.pem
├── chain.pem
└── fullchain.pem
/etc/systemd/system/ # Systemd services
├── letsencrypt-regru.service # Renewal service
└── letsencrypt-regru.timer # Timer (every 12 hours)
/usr/local/bin/
└── letsencrypt-regru # Global command
```
## Using letsencrypt-regru Command
After installation, a convenient global command with multiple functions is available:
### 🔧 Main Commands
```bash
# Check current certificate expiration
letsencrypt-regru --check
# Obtain new Let's Encrypt certificate
letsencrypt-regru --obtain
# Renew existing certificate
letsencrypt-regru --renew
# Automatically check and renew if needed
letsencrypt-regru --auto
# Create test self-signed certificate
letsencrypt-regru --test-cert
```
### 🧪 Diagnostic and Testing Commands
```bash
# Check API access to reg.ru
# - Shows current IP address
# - Tests API connection
# - Displays account balance
letsencrypt-regru --test-api
# Test DNS TXT record creation
# - Full SSL certification process simulation
# - Creates temporary _acme-challenge TXT record
# - Waits for DNS propagation (60 seconds)
# - Verifies via public DNS servers
# - Automatically removes test record
letsencrypt-regru --test-dns
# Show help for all commands
letsencrypt-regru --help
# Enable verbose output
letsencrypt-regru --obtain -v
letsencrypt-regru --check -v
```
### ⚙️ Service Commands (internal use)
```bash
# Certbot authentication hook (used by certbot automatically)
letsencrypt-regru --auth-hook
# Certbot cleanup hook (used by certbot automatically)
letsencrypt-regru --cleanup-hook
```
### 📋 Command Reference
| Command | Description | Use Case |
|---------|-------------|----------|
| `--check` | Check certificate expiration | Regular monitoring |
| `--obtain` | Obtain new certificate from Let's Encrypt | Initial creation |
| `--renew` | Renew existing certificate | Renewal |
| `--auto` | Automatic check and renewal | For cron/systemd |
| `--test-cert` | Create test self-signed certificate | Development/testing |
| `--test-api` | Check API access to reg.ru | Connection diagnostics |
| `--test-dns` | Test DNS record creation | Pre-SSL verification |
| `--auth-hook` | Certbot hook (DNS creation) | Internal |
| `--cleanup-hook` | Certbot hook (DNS deletion) | Internal |
| `--help` | Show help | Help |
| `-v` | Verbose output | Debugging |
## Automatic Renewal
The installer configures a systemd timer for automatic checks:
```bash
# Check timer status
systemctl status letsencrypt-regru.timer
# When is next run
systemctl list-timers letsencrypt-regru.timer
# View run history
journalctl -u letsencrypt-regru
# Follow logs in real-time
journalctl -u letsencrypt-regru -f
```
### Timer Settings
Default settings:
- First run: 15 minutes after system boot
- Frequency: every 12 hours
- Random delay: up to 1 hour (to avoid creating load)
Can be modified in `/etc/systemd/system/letsencrypt-regru.timer`.
## Editing Configuration
```bash
# Open configuration in editor
sudo nano /etc/letsencrypt-regru/config.json
# After changes, restart timer
sudo systemctl restart letsencrypt-regru.timer
```
### Example config.json
```json
{
"regru_username": "your_username",
"regru_password": "your_password",
"domain": "example.com",
"wildcard": true,
"email": "admin@example.com",
"cert_dir": "/etc/letsencrypt/live",
"log_file": "/var/log/letsencrypt-regru/letsencrypt_regru.log",
"dns_propagation_wait": 60,
"dns_check_attempts": 10,
"dns_check_interval": 10,
"renewal_days": 30,
"npm_enabled": true,
"npm_host": "http://10.10.10.14:81",
"npm_email": "admin@npm.local",
"npm_password": "secure_password"
}
```
## Updating Application
```bash
# Download latest version
cd configure_nginx_manager
git pull
# Run update
sudo ./letsencrypt_regru.sh update
```
Update will:
- Stop timer
- Update script
- Update Python dependencies
- Restart timer
## Uninstallation
```bash
# Complete application removal
sudo ./letsencrypt_regru.sh uninstall
```
Script will remove:
- Application from `/opt/letsencrypt-regru/`
- Systemd services
- Global command
Certificates in `/etc/letsencrypt/live/` are preserved!
Optionally you can remove:
- Configuration `/etc/letsencrypt-regru/`
- Logs `/var/log/letsencrypt-regru/`
## Viewing Logs
```bash
# Systemd logs (recommended)
journalctl -u letsencrypt-regru -f
# Log file
tail -f /var/log/letsencrypt-regru/letsencrypt_regru.log
# Last 100 lines
tail -n 100 /var/log/letsencrypt-regru/letsencrypt_regru.log
```
## Troubleshooting
### Installation Check
```bash
# Check command availability
which letsencrypt-regru
# Check Python environment
ls -la /opt/letsencrypt-regru/venv/
# Check systemd services
systemctl list-unit-files | grep letsencrypt-regru
```
### Installation Errors
**Error: "Permission denied"**
```bash
# Run with sudo
sudo ./letsencrypt_regru.sh
```
**Error: "Package not found"**
```bash
# Update package lists
sudo apt-get update # Debian/Ubuntu
sudo yum update # CentOS/RHEL
```
**Error: "Python module not found"**
```bash
# Reinstall virtual environment
sudo rm -rf /opt/letsencrypt-regru/venv
sudo ./letsencrypt_regru.sh
```
### Certificate Issues
**Certificate not created**
```bash
# Check logs
tail -n 50 /var/log/letsencrypt-regru/letsencrypt_regru.log
# Check configuration
cat /etc/letsencrypt-regru/config.json
# Try manually
letsencrypt-regru --obtain -v
```
**DNS not updating**
```bash
# Increase wait time in config.json
"dns_propagation_wait": 120,
"dns_check_attempts": 20
```
### NPM Issues
**Not uploading to NPM**
```bash
# Check NPM availability
curl http://192.168.10.14:81
# Check credentials in config.json
# Try manually
letsencrypt-regru --test-cert -v
```
## Supported OS
✅ Debian 10, 11, 12
✅ Ubuntu 20.04, 22.04, 24.04
✅ CentOS 7, 8
✅ RHEL 7, 8, 9
✅ Fedora 35+
## Additional Features
### Test Certificate
For testing without Let's Encrypt rate limits:
```bash
letsencrypt-regru --test-cert
```
Creates self-signed certificate valid for 90 days.
### Manual Renewal Run
```bash
# Start service manually
sudo systemctl start letsencrypt-regru.service
# Check status
systemctl status letsencrypt-regru.service
```
### Change Check Frequency
Edit `/etc/systemd/system/letsencrypt-regru.timer`:
```ini
[Timer]
# Every 6 hours instead of 12
OnUnitActiveSec=6h
```
Then:
```bash
sudo systemctl daemon-reload
sudo systemctl restart letsencrypt-regru.timer
```
## Security
- Configuration with passwords has `600` permissions (root only)
- Certificate private keys have `600` permissions
- All operations run as root
- Logs accessible only to root
## Support
- GitHub Issues: https://github.com/DFofanov/configure_nginx_manager/issues
- Documentation: `/opt/letsencrypt-regru/docs/`
- Email: admin@dfv24.com
---
**Developed by:** Dmitry Fofanov
**Date:** October 28, 2025
**Version:** 2.0
-159
View File
@@ -1,159 +0,0 @@
# Makefile Commands - Quick Reference
## 📋 Command Categories
### 🛠️ Installation and Deployment
```bash
make install # Full application installation
make uninstall # Remove application
make status # Check installation status
make check-config # Verify configuration
```
### 🔨 Building Executables
```bash
make build # Build for current OS
make build-linux # Build for Linux
make build-windows # Build for Windows
make build-all # Build for all platforms
```
### 📦 Creating Packages
```bash
make package-linux # Create tar.gz for Linux
make package-windows # Create zip for Windows
make release # Full release cycle
```
### 🧪 Testing
```bash
make test-run # Test script run
make test-cert # Create test certificate
make test-build # Test built file
```
### 🚀 Running Operations
```bash
make run # Automatic check and renewal
make obtain # Obtain new certificate
make renew # Renew existing certificate
```
### 📊 Monitoring
```bash
make logs # Show logs
make status # Service status
```
### 🧹 Cleanup
```bash
make clean # Clean Python temporary files
make clean-build # Clean build artifacts
```
### Information
```bash
make help # Show help
make build-info # Build environment information
```
---
## 🎯 Common Scenarios
### Initial Installation
```bash
sudo make install
sudo make check-config
sudo make test-run
```
### Building Release for GitHub
```bash
make clean-build
make release
# Files will be in dist/
```
### Creating Test Environment
```bash
sudo make install
sudo make test-cert
sudo make status
```
### Manual Certificate Renewal
```bash
sudo make run
sudo make logs
```
### Removing Application
```bash
sudo make uninstall
```
---
## 📝 Environment Variables
Main variables defined in Makefile:
```makefile
INSTALL_DIR = /opt/letsencrypt-regru
CONFIG_FILE = /etc/letsencrypt/regru_config.json
LOG_FILE = /var/log/letsencrypt_regru.log
SERVICE_NAME = letsencrypt-regru
PYTHON = python3
```
---
## 🔐 Required Permissions
**Require sudo:**
- `make install`
- `make uninstall`
- `make run`
- `make obtain`
- `make renew`
- `make test-run`
- `make test-cert`
**Don't require sudo:**
- `make build*`
- `make package*`
- `make clean*`
- `make help`
- `make build-info`
---
## 💡 Useful Combinations
```bash
# Full reinstallation
sudo make uninstall && sudo make install
# Build and test
make build && make test-build
# Clean and release
make clean-build && make release
# Post-installation check
sudo make status && sudo make test-run && sudo make logs
```
---
**Author:** Dmitry Fofanov
**Last Updated:** October 28, 2025
@@ -1,79 +0,0 @@
# Detailed Guide to Configuring Nginx Proxy Manager with One Global SSL Certificate for All dfv24.com Domains
## Prerequisites
- [Nginx Proxy Manager](http://192.168.10.14:81/) is installed and running
- Main domain: dfv24.com
- Domain hosting and DNS records are on reg.ru
- Need to use one SSL certificate (e.g., wildcard) for all dfv24.com subdomains
---
## Step 1. Purchasing and Obtaining SSL Wildcard Certificate for dfv24.com
1. On reg.ru or any other Certificate Authority (CA), order wildcard certificate for domain `*.dfv24.com`.
2. Obtain certificate files:
- Main certificate (CRT)
- Intermediate certificates (CA Bundle)
- Private key (KEY)
---
## Step 2. Importing Your SSL Certificate to Nginx Proxy Manager
1. Log in to Nginx Proxy Manager at http://192.168.10.14:81/
2. Go to **SSL Certificates** section → **Add SSL Certificate** button
3. Select **Custom** (custom certificate)
4. Paste into fields:
- **Certificate** — main CRT + CA Bundle (if CA Bundle is separate, concatenate into one file or paste sequentially)
- **Key** — private key content
- Name certificate, e.g., `dfv24_wildcard`
5. Save
---
## Step 3. Configuring Proxy Hosts Using Global Certificate
1. Go to **Proxy Hosts****Add Proxy Host**
2. Fill in fields:
- **Domain Names**: For example, `sub1.dfv24.com` (for first subdomain)
- **Scheme**: http or https, depending on backend
- **Forward Hostname / IP**: IP or DNS address of your internal service
- **Forward Port**: service port (e.g., 80 or 443)
3. Enable **SSL** → Check **Use a shared SSL certificate** (if such option is available) or select previously imported certificate from list
4. Activate: **Block Common Exploits**, **Websockets Support**, set Redirect HTTP to HTTPS if required
5. Save proxy host
6. Repeat for all subdomains, specifying needed domains and selecting same wildcard SSL certificate
---
## Step 4. Configuring DNS Records on reg.ru
1. Log in to domain management panel on reg.ru
2. Create or edit DNS A records:
- `dfv24.com` → IP of your Nginx Proxy Manager (e.g., 192.168.10.14)
- `*.dfv24.com` → same IP or specific subdomains if there are special ones
3. Save changes
4. Wait for DNS update (from few minutes to 24 hours)
---
## Step 5. Testing and Verification
1. In browser, open any subdomain `https://sub1.dfv24.com`
2. Certificate should be valid, issued for wildcard `*.dfv24.com`
3. Check proxy functionality and correct certificate assignment
4. If necessary, check Nginx Proxy Manager logs and fix errors
---
## Additional Information
- If Nginx Proxy Manager doesn't have GUI option to select shared certificate, you can manually configure configs through `/data/nginx/proxy_host` directory and specify SSL certificate for all hosts.
- When updating certificate — re-import it to Nginx Proxy Manager.
- You can use Let's Encrypt for automatic wildcard certificate obtaining using DNS validation (if supported by your DNS provider).
---
# Summary
Use one wildcard certificate for all subdomains, import it as custom certificate in Nginx Proxy Manager, when creating proxy hosts select it in SSL settings. Manage DNS records on reg.ru, directing domain to Nginx Proxy Manager IP.
This allows legitimate use of single certificate for all services with different subdomains under your dfv24.com domain.
-287
View File
@@ -1,287 +0,0 @@
# 📁 configure_nginx_manager Project Structure
## Main Scripts
### Python (Recommended)
- **letsencrypt_regru_api.py** (1,411 lines)
- Full-featured Python script
- Direct reg.ru API integration
- Nginx Proxy Manager integration
- Automatic certificate check and renewal
- Test self-signed certificate generation
- Wildcard domain support
### Bash
- **letsencrypt_regru_dns.sh**
- Bash script with certbot-dns-regru plugin
- Easy to use
- Minimal dependencies
### PowerShell
- **letsencrypt_regru.ps1**
- Windows version
- Similar to Bash script
### Testing
- **test_certificate.sh**
- Quick test certificate creation via OpenSSL
- Standalone operation without Python
- Wildcard domain support
## Automation
### Makefile
- **Makefile** (415 lines)
- `make install` - Complete installation and setup
- `make uninstall` - Clean removal
- `make status` - Check status
- `make test-cert` - Create test certificate
- `make obtain` - Get Let's Encrypt certificate
- `make renew` - Renew certificate
- `make logs` - View logs
- `make check-config` - Validate configuration
## Configuration
### config.json.example
Example configuration with all parameters:
- reg.ru API credentials
- Domain and email settings
- Renewal parameters (renewal_days)
- Nginx Proxy Manager settings
- Directory and log paths
## Documentation
### README.md (1,420+ lines)
Main documentation:
- Introduction and features
- Quick start
- Makefile installation
- Test certificate creation
- Requirements and dependencies
- Configuration and usage
- NPM integration
- Automatic check and renewal
- Automation via cron/systemd
- Troubleshooting
### README_EN.md (English version)
Complete English translation of main guide
### TESTING_GUIDE.md (370+ lines)
Testing guide:
- Why test certificates are needed
- Bypass Let's Encrypt limits (5 per week)
- Quick start with test certificates
- Method comparison
- Development usage
- Test automation
- Transition from test to production
- FAQ
- CI/CD and Docker examples
### TESTING_GUIDE_EN.md (English version)
Complete English translation of testing guide
### GITEA_SYNC.md
Gitea → GitHub synchronization:
- 4 sync methods (Git Hooks, GitHub Actions, Gitea Mirror, Double Remote)
- Step-by-step installation
- SSH and token setup
- Webhook integration
- Troubleshooting
- Method comparison
### GITEA_SYNC_EN.md (English version)
Complete English translation of sync guide
### CHEATSHEET.md
Quick reference:
- Main commands
- Development workflow
- Use case scenarios
- Common errors and solutions
- Checking and debugging
### CHEATSHEET_EN.md (English version)
Complete English translation of cheatsheet
### PROJECT_STRUCTURE.md (this file)
- All project files description
- Component overview
### PROJECT_STRUCTURE_EN.md (English version)
Complete English translation of structure
### DESCRIPTION.md
Project description:
- Russian description
- English description
- Quick start
- Features overview
### CHANGELOG.md
Change history:
- Versions and updates
- New features
- Bug fixes
- Roadmap
### CHANGELOG_EN.md (English version)
Complete English translation of changelog
## Git Integration
### .github/workflows/sync-from-gitea.yml
GitHub Actions for synchronization:
- Automatic check every hour
- Webhook trigger from Gitea
- Manual run
- Merge changes from Gitea
- Push to GitHub
### gitea-hooks/
Git hooks for Gitea server:
**post-receive**
- Automatic push to GitHub after commit
- Instant sync (< 1 second)
- Operation logging
- Tag synchronization
- SSH and HTTPS support
**README.md**
- Hook installation instructions
- Authentication setup
- Troubleshooting
**README_EN.md** (English version)
Complete English translation
## Additional Files
### Markdown Documents
- **Add Let's Encrypt Certificate для провайдера reg.ru.md**
- Initial instructions (Russian)
- **Создание и продление SSL сертификата.md**
- Additional process information (Russian)
## Features
### ✅ Core Features
- [x] Let's Encrypt certificates via reg.ru DNS API
- [x] Wildcard certificates (*.domain.com)
- [x] Automatic certificate renewal
- [x] DNS-01 validation
- [x] Nginx Proxy Manager integration
- [x] Automatic upload/update to NPM
### ✅ Advanced Features
- [x] Automatic expiration check
- [x] Configurable renewal threshold (renewal_days)
- [x] Systemd service + timer
- [x] Cron automation
- [x] Detailed logging
- [x] Configuration validation
### 🆕 Testing
- [x] Self-signed test certificate generation
- [x] Bypass Let's Encrypt limits (5/week)
- [x] Instant creation without DNS
- [x] Test certificate NPM integration
- [x] Full structure compatibility with Let's Encrypt
### 🔄 Repository Sync
- [x] Automatic Gitea → GitHub sync
- [x] Git Hooks (instant sync)
- [x] GitHub Actions (hourly check)
- [x] Webhook integration
- [x] SSH and HTTPS authentication
## Installation
### Quick Install
```bash
sudo make install
sudo nano /etc/letsencrypt/regru_config.json
sudo make test-cert # For testing
sudo make obtain # For production
```
### Post-Install Structure
```
/opt/letsencrypt-regru/
├── letsencrypt_regru_api.py
/etc/letsencrypt/
├── regru_config.json
└── live/
└── example.com/
├── privkey.pem
├── cert.pem
├── fullchain.pem
└── chain.pem
/etc/systemd/system/
├── letsencrypt-regru.service
└── letsencrypt-regru.timer
/var/log/letsencrypt/
└── letsencrypt_regru.log
```
## Usage
### Testing (no limits)
```bash
sudo make test-cert # Create test certificate
sudo make status # Check status
```
### Production
```bash
sudo make obtain # Get Let's Encrypt certificate
sudo make renew # Renew certificate
sudo make run # Automatic mode
```
### Monitoring
```bash
sudo make logs # View logs
sudo make status # Service status
sudo make check-config # Check configuration
```
## Technologies
- **Python 3.6+** - Main language
- **Certbot** - Let's Encrypt client
- **requests** - HTTP API requests
- **cryptography** - Test certificate generation
- **systemd** - Launch automation
- **cron** - Alternative automation
- **Make** - Installation management
- **OpenSSL** - Alternative certificate generation
## License
Open Source - Free to use
## Author
Фофанов Дмитрий @ 2025
## Support
See documentation:
- [README.md](README.md) / [README_EN.md](README_EN.md) - Main guide
- [TESTING_GUIDE.md](TESTING_GUIDE.md) / [TESTING_GUIDE_EN.md](TESTING_GUIDE_EN.md) - Testing guide
- [GITEA_SYNC.md](GITEA_SYNC.md) / [GITEA_SYNC_EN.md](GITEA_SYNC_EN.md) - Repository sync
---
**Version**: 2.1
**Date**: October 27, 2025
**Status**: ✅ Production Ready
-111
View File
@@ -1,111 +0,0 @@
# 🎯 Quick Start - Building Executables
This is a quick guide for those who want to build an executable file fast.
## For Linux
### 1. Install dependencies
```bash
sudo apt-get update
sudo apt-get install -y python3 python3-pip git make
```
### 2. Clone repository
```bash
git clone https://github.com/DFofanov/configure_nginx_manager.git
cd configure_nginx_manager
```
### 3. Build
```bash
make build-linux
```
### 4. Result
```bash
ls -lh dist/letsencrypt-regru
# Executable file is ready!
```
### 5. Install (optional)
```bash
sudo cp dist/letsencrypt-regru /usr/local/bin/
sudo chmod +x /usr/local/bin/letsencrypt-regru
```
### 6. Use
```bash
letsencrypt-regru --help
```
---
## For Windows
### 1. Install Python
Download from [python.org](https://www.python.org/downloads/) and install
### 2. Clone repository
```powershell
git clone https://github.com/DFofanov/configure_nginx_manager.git
cd configure_nginx_manager
```
### 3. Build
```powershell
make build-windows
```
### 4. Result
```powershell
dir dist\letsencrypt-regru.exe
# Executable file is ready!
```
### 5. Use
```powershell
.\dist\letsencrypt-regru.exe --help
```
---
## Creating Release for Both Platforms
```bash
# This will create packages for Linux and Windows
make release
```
**Result in `dist/`:**
- `letsencrypt-regru-linux-x86_64.tar.gz`
- `letsencrypt-regru-windows-x86_64.zip`
---
## Useful Commands
```bash
# Show help for all commands
make help
# Build environment information
make build-info
# Test built file
make test-build
# Clean artifacts
make clean-build
```
---
## ❓ Problems?
See [BUILD_GUIDE_EN.md](BUILD_GUIDE_EN.md) for detailed instructions and troubleshooting.
---
**File size:** ~40-60 MB (including Python runtime)
**Build time:** ~2-5 minutes
**Requirements:** Python 3.8+, PyInstaller
-178
View File
@@ -1,178 +0,0 @@
# 🎯 Quick Guide: Automatic Releases
## For GitHub
### 1. Creating a Release
```bash
# Create tag
git tag -a v1.0.0 -m "Release version 1.0.0"
# Push tag
git push origin v1.0.0
```
### 2. What Happens Automatically
GitHub Actions will run `.github/workflows/build-release.yml`:
1. ✅ Build Linux version (Ubuntu runner)
2. ✅ Build Windows version (Windows runner)
3. ✅ Create packages
4. ✅ Generate SHA256 checksums
5. ✅ Create GitHub Release
6. ✅ Upload artifacts
### 3. Result
Release will appear at: `https://github.com/USER/REPO/releases/tag/v1.0.0`
**Files:**
- `letsencrypt-regru-linux-x86_64.tar.gz`
- `letsencrypt-regru-linux-x86_64.tar.gz.sha256`
- `letsencrypt-regru-windows-x86_64.zip`
- `letsencrypt-regru-windows-x86_64.zip.sha256`
---
## For Gitea
### 1. Setup (one time)
#### Enable Actions in Gitea:
Edit `app.ini`:
```ini
[actions]
ENABLED = true
DEFAULT_ACTIONS_URL = https://gitea.com
```
#### Install Gitea Runner:
```bash
# Download
wget https://dl.gitea.com/act_runner/latest/act_runner-linux-amd64 -O act_runner
chmod +x act_runner
# Register
./act_runner register --no-interactive \
--instance https://your-gitea.com \
--token YOUR_RUNNER_TOKEN
# Run
./act_runner daemon
```
### 2. Creating a Release
```bash
# Create tag
git tag -a v1.0.0 -m "Release version 1.0.0"
# Push tag
git push origin v1.0.0
```
### 3. What Happens
Gitea Actions will run `.gitea/workflows/release.yml`:
1. ✅ Build Linux version
2. ✅ Build Windows version
3. ✅ Create packages
4. ✅ Generate SHA256 + MD5 checksums
5. ✅ Create Gitea Release
6. ✅ Detailed release notes
### 4. Result
Release will appear at: `https://your-gitea.com/USER/REPO/releases/tag/v1.0.0`
---
## 🔧 Pre-Release Checklist
```bash
# 1. Local build
make clean-build
make release
# 2. Testing
make test-build
# 3. Check files
ls -lh dist/
# 4. If all OK - create tag
git tag -a v1.0.0 -m "Release 1.0.0"
git push origin v1.0.0
```
---
## 📊 Monitoring
### GitHub:
`https://github.com/USER/REPO/actions`
### Gitea:
`https://your-gitea.com/USER/REPO/actions`
---
## 🐛 If Something Goes Wrong
### Delete tag and release:
```bash
# Delete local tag
git tag -d v1.0.0
# Delete remote tag
git push --delete origin v1.0.0
# Delete release manually via web interface
```
### Recreate release:
```bash
# Fix the issue
git commit -am "Fix build"
# Recreate tag
git tag -a v1.0.0 -m "Release 1.0.0" --force
git push origin v1.0.0 --force
```
---
## 📝 Semantic Versioning
```bash
# Major (breaking changes)
git tag v2.0.0
# Minor (new features)
git tag v1.1.0
# Patch (bug fixes)
git tag v1.0.1
# Pre-release
git tag v1.0.0-beta.1
git tag v1.0.0-rc.1
```
---
**See also:**
- [.gitea/README.md](../../.gitea/README.md) - Full Gitea Actions documentation
- [BUILD_GUIDE_EN.md](BUILD_GUIDE_EN.md) - Build guide
---
**Author:** Dmitry Fofanov
**Last Updated:** October 28, 2025
@@ -1,86 +0,0 @@
# Guide to Creating Wildcard Certificate *.dfv24.com in Nginx Proxy Manager and Configuring Automatic SSL Renewal
---
## Step 1. Preparation
- Ensure Nginx Proxy Manager (NPM) is installed and accessible at http://192.168.10.14:81/
- You have access to DNS records for dfv24.com domain in reg.ru control panel or another registrar
---
## Step 2. Creating Wildcard SSL Certificate in Nginx Proxy Manager
1. Log in to Nginx Proxy Manager admin panel at http://192.168.10.14:81/
2. Navigate to **SSL Certificates** → click **Add SSL Certificate** button
3. Select **Let's Encrypt**
4. Fill in the fields:
- **Domain Names:**
Enter `*.dfv24.com` — for wildcard certificate
Also recommended to add main domain `dfv24.com` (comma-separated or in new field)
- **Email Address:**
Specify your Email for Let's Encrypt notifications (required)
- **HTTP Challenge:**
Leave HTTP verification if NPM is accessible from internet on ports 80 and 443, or configure DNS Challenge if supported by your DNS
5. Check "Agree to the Let's Encrypt Terms of Service"
6. Click **Save**
- NPM will begin certificate obtaining process with domain verification.
- Upon successful certificate request, you'll see new certificate in the list.
---
## Step 3. Configuring Automatic Renewal
- Nginx Proxy Manager automatically handles Let's Encrypt certificate renewal.
- For this, server must be accessible from internet on ports 80 and 443, and DNS records must correctly point to your server.
- NPM periodically (usually 30 days before expiration) requests certificate renewal.
- When using DNS Challenge, NPM must have DNS provider integration configured (if supported).
---
## Step 4. Using Wildcard Certificate in Proxy Hosts
1. Go to **Proxy Hosts** → Create or edit proxy entry
2. In **Domain Names** field, specify needed subdomain from dfv24.com, for example:
`api.dfv24.com` or `www.dfv24.com`
3. In **SSL** section, select your wildcard certificate `*.dfv24.com` that you obtained in Step 2
4. Enable options:
- Use SSL
- Force SSL
- HSTS (if needed)
5. Save changes.
---
## Step 5. Verification
1. Verify that all subdomains use the same certificate
2. Visit https://api.dfv24.com or other subdomains from browser
3. Ensure certificate is valid, not expired, and issued for *.dfv24.com
4. Check certificate renewal status in SSL Certificates section
---
## Additional Information
- If Let's Encrypt cannot perform HTTP Challenge due to closed port, configure DNS Challenge (may require DNS provider API key)
- For security and notifications, keep Email up to date
- Check Nginx Proxy Manager logs to identify renewal errors
---
# Summary
Nginx Proxy Manager allows easy obtaining and automatic renewal of wildcard SSL certificates for *.dfv24.com domain using Let's Encrypt.
Main requirements — properly configured DNS records and internet access on HTTP/HTTPS ports.
Then use one global certificate for all your subdomains through Proxy Hosts settings.
-250
View File
@@ -1,250 +0,0 @@
# SSL Certificate Automation Scripts
**Author:** Фофанов Дмитрий
## 📖 Overview
This project contains scripts for automating the creation and renewal of Let's Encrypt SSL certificates using DNS-01 Challenge via the reg.ru API.
## 🎯 Quick Start
### Linux (Bash)
```bash
# 1. Install dependencies
sudo apt-get install certbot jq
# 2. Configure credentials
nano ~/.regru_credentials
# Add:
# export REGRU_USERNAME="your_login"
# export REGRU_PASSWORD="your_password"
# 3. Set permissions
chmod 600 ~/.regru_credentials
# 4. Run the script
./letsencrypt_regru.sh \
-d "*.dfv24.com" \
-e "dfofanov@dfv24.com"
```
### Linux (Python)
```bash
# 1. Install dependencies
pip install requests dnspython certbot
# 2. Configure
cp config.example.yml config.yml
nano config.yml
# 3. Run
python letsencrypt_regru.py
# 4. Setup auto-renewal (cron)
crontab -e
# Add:
# 0 3 * * 1 /usr/bin/python3 /path/to/letsencrypt_regru.py
```
### Windows (PowerShell)
```powershell
# 1. Run as Administrator
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# 2. Configure credentials
$env:REGRU_USERNAME = "your_login"
$env:REGRU_PASSWORD = "your_password"
# 3. Run
.\letsencrypt_regru.ps1 `
-Domain "*.dfv24.com" `
-Email "dfofanov@dfv24.com"
# 4. Setup auto-renewal (Task Scheduler)
# Import-Module .\ScheduledTask.psm1
# Create-CertRenewalTask
```
## ⚙️ Configuration
### Bash Script (`letsencrypt_regru.sh`)
```bash
#!/bin/bash
# Required parameters
DOMAIN="*.dfv24.com" # Your domain
EMAIL="dfofanov@dfv24.com" # Contact email
REGRU_USERNAME="your_login" # reg.ru login
REGRU_PASSWORD="your_password" # reg.ru password
# Optional parameters
DNS_PROPAGATION_WAIT=60 # Wait time for DNS propagation (seconds)
LOG_FILE="/var/log/letsencrypt_regru.log"
WEBSERVER="nginx" # nginx or apache2
```
### Python Script (`letsencrypt_regru.py`)
Create `config.yml`:
```yaml
# reg.ru credentials
regru:
username: "your_login"
password: "your_password"
# Certificate settings
certificate:
domain: "*.dfv24.com"
email: "dfofanov@dfv24.com"
dns_propagation_wait: 60
# Logging
logging:
file: "/var/log/letsencrypt_regru.log"
level: "INFO"
# Web server
webserver:
type: "nginx" # nginx, apache2, or null
reload_command: "systemctl reload nginx"
```
### PowerShell Script (`letsencrypt_regru.ps1`)
```powershell
# Configuration
$Config = @{
Domain = "*.dfv24.com"
Email = "dfofanov@dfv24.com"
RegRuUsername = $env:REGRU_USERNAME
RegRuPassword = $env:REGRU_PASSWORD
DnsPropagationWait = 60
LogFile = ".\letsencrypt_regru.log"
}
```
## 📋 Requirements
### Bash Script
- **certbot** - Let's Encrypt client
- **jq** - JSON processor
- **curl** - HTTP requests
- **dig** (optional) - DNS queries
### Python Script
- **Python 3.6+**
- **requests** - HTTP library
- **dnspython** - DNS operations
- **certbot** - Let's Encrypt client
- **PyYAML** - YAML configuration
### PowerShell Script
- **PowerShell 5.1+** or **PowerShell Core 7+**
- **certbot** (via Chocolatey or manual installation)
## 🔄 Automatic Renewal
### Linux (cron)
```bash
# Edit crontab
crontab -e
# Add (runs every Monday at 3 AM):
0 3 * * 1 /path/to/letsencrypt_regru.sh >> /var/log/cert_renewal.log 2>&1
# Or for Python:
0 3 * * 1 /usr/bin/python3 /path/to/letsencrypt_regru.py
```
### Windows (Task Scheduler)
```powershell
# Create scheduled task
$Action = New-ScheduledTaskAction -Execute "PowerShell.exe" `
-Argument "-File C:\path\to\letsencrypt_regru.ps1"
$Trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -At 3am
Register-ScheduledTask -TaskName "SSL Certificate Renewal" `
-Action $Action -Trigger $Trigger -RunLevel Highest
```
## ✨ Features
✅ Automatic DNS validation via reg.ru API
✅ Certificate expiration check
✅ Automatic renewal before expiration
✅ Web server reload after renewal
✅ Detailed logging of all operations
## 🔧 Using with Nginx Proxy Manager
After obtaining the certificate:
1. Log in to NPM: http://192.168.10.14:81/
2. SSL Certificates → Add SSL Certificate → Custom
3. Paste the content:
- Certificate Key: `/etc/letsencrypt/live/domain.com/privkey.pem`
- Certificate: `/etc/letsencrypt/live/domain.com/fullchain.pem`
## 📝 Logs
- Bash: `/var/log/letsencrypt_regru.log`
- Python: `/var/log/letsencrypt_regru.log`
- PowerShell: `.\letsencrypt_regru.log`
- Certbot: `/var/log/letsencrypt/letsencrypt.log`
## 🆘 Troubleshooting
### API Authentication Error
- Check your reg.ru credentials
- Ensure the domain is under your control
### DNS Record Not Propagating
- Increase `dns_propagation_wait` to 120 seconds
- Check DNS: `nslookup -type=TXT _acme-challenge.domain.com`
### Certbot Not Found
```bash
# Ubuntu/Debian
sudo apt-get install certbot
# Or via snap
sudo snap install --classic certbot
```
## 📚 Documentation
Detailed documentation in [USAGE.md](USAGE.md)
## 🔐 Security
- Keep credentials secure
- Use `chmod 600` for configuration files
- Regularly update passwords
## ⚠️ Important
- Let's Encrypt certificates are valid for 90 days
- Automatic renewal setup is recommended
- Wildcard certificates require DNS validation
## 📞 Support
- [reg.ru API Documentation](https://www.reg.ru/support/api)
- [Let's Encrypt Documentation](https://letsencrypt.org/docs/)
- [Certbot Documentation](https://certbot.eff.org/docs/)
## 📄 License
Scripts are provided "as is" for free use.
---
**Happy Automation! 🔒**
-379
View File
@@ -1,379 +0,0 @@
# 🧪 SSL Certificate Testing Guide
## Why do you need test certificates?
Let's Encrypt has **strict limits**:
- ⚠️ Maximum **5 certificates per week** per domain
- ⚠️ Maximum **50 certificates per week** per account
- ⚠️ **1 week ban** if limits exceeded
**Solution**: Use self-signed test certificates for development!
---
## Quick Start
### Option 1: Via Makefile (Recommended)
```bash
# After script installation (make install)
sudo make test-cert
```
**Result**: Certificate created in `/etc/letsencrypt/live/your-domain/`
### Option 2: Via Python Script
```bash
sudo python3 letsencrypt_regru_api.py \
--config /etc/letsencrypt/regru_config.json \
--test-cert -v
```
### Option 3: Via Bash Script (Standalone)
```bash
# Simple domain
sudo ./test_certificate.sh example.com no
# With wildcard
sudo ./test_certificate.sh example.com yes
```
---
## Method Comparison
| Method | Speed | Requirements | NPM Integration | Limits |
|--------|-------|--------------|-----------------|--------|
| **Let's Encrypt** | 2-5 min | Internet, DNS | ✅ Yes | ⚠️ 5/week |
| **Test (Python)** | 1-2 sec | Python only | ✅ Yes | ✅ None |
| **Test (Bash)** | 1-2 sec | OpenSSL only | ❌ Manual | ✅ None |
---
## Detailed Instructions
### 1. Configuration Setup
```bash
# Create configuration
sudo nano /etc/letsencrypt/regru_config.json
```
```json
{
"domain": "test.example.com",
"wildcard": true,
"cert_dir": "/etc/letsencrypt/live",
"npm_enabled": true,
"npm_host": "https://npm.example.com",
"npm_email": "admin@example.com",
"npm_password": "your_password"
}
```
### 2. Create Test Certificate
```bash
sudo make test-cert
```
### 3. Verify Created Files
```bash
ls -la /etc/letsencrypt/live/test.example.com/
# Should contain:
# - privkey.pem (private key)
# - cert.pem (certificate)
# - fullchain.pem (full chain)
# - chain.pem (CA chain)
```
### 4. View Certificate Information
```bash
openssl x509 -in /etc/letsencrypt/live/test.example.com/cert.pem -text -noout
```
---
## Using in Nginx
### Direct Usage
```nginx
server {
listen 443 ssl;
server_name test.example.com;
ssl_certificate /etc/letsencrypt/live/test.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/test.example.com/privkey.pem;
# ... rest of configuration
}
```
### Via Nginx Proxy Manager
If `npm_enabled: true` in configuration, certificate will automatically upload to NPM.
**Check in NPM:**
1. Open NPM web interface
2. Go to **SSL Certificates**
3. Find your domain in the list
4. ⚠️ Will be marked as "Custom" (not Let's Encrypt)
---
## Test Automation
### CI/CD Script
```bash
#!/bin/bash
# test_ssl_integration.sh
set -e
echo "🧪 Testing SSL integration..."
# 1. Create test certificate
sudo python3 letsencrypt_regru_api.py \
--config test_config.json \
--test-cert
# 2. Verify files
if [ ! -f "/etc/letsencrypt/live/test.example.com/fullchain.pem" ]; then
echo "❌ Certificate not created"
exit 1
fi
# 3. Check validity
openssl x509 -in /etc/letsencrypt/live/test.example.com/cert.pem -noout -checkend 0
if [ $? -eq 0 ]; then
echo "✅ Certificate is valid"
else
echo "❌ Certificate is invalid"
exit 1
fi
echo "✅ All tests passed"
```
### Makefile for Testing
```makefile
.PHONY: test-ssl test-npm test-all
test-ssl:
@echo "Creating test certificate..."
sudo make test-cert
@echo "Verifying files..."
test -f /etc/letsencrypt/live/$(DOMAIN)/fullchain.pem
@echo "✅ SSL test passed"
test-npm:
@echo "Checking NPM integration..."
# Your NPM API checks
@echo "✅ NPM test passed"
test-all: test-ssl test-npm
@echo "✅ All tests passed"
```
---
## Transition to Production
### Step 1: Testing
```bash
# 1. Create test certificate
sudo make test-cert
# 2. Verify with NPM
# Open https://your-domain and check
# 3. Ensure everything works
```
### Step 2: Switch to Let's Encrypt
```bash
# 1. Remove test certificate
sudo rm -rf /etc/letsencrypt/live/your-domain/
# 2. Get real certificate
sudo make obtain
# 3. Verify update in NPM
sudo make status
```
---
## FAQ
### Q: Why does browser show warning?
**A:** Self-signed certificates are not trusted by browsers. This is normal for testing.
To avoid browser warning (local testing only):
1. Chrome: `chrome://flags/#allow-insecure-localhost`
2. Firefox: Click "Advanced" → "Accept the Risk"
### Q: Can I use in production?
**A:****NO!** Test certificates are for development and testing only.
### Q: How often can I create test certificates?
**A:** ✅ Unlimited! No limits whatsoever.
### Q: Do they upload to NPM automatically?
**A:** ✅ Yes, if `npm_enabled: true` in configuration.
### Q: Do they work with wildcard domains?
**A:** ✅ Yes! Just set `"wildcard": true` in configuration.
### Q: How to check expiration date?
```bash
openssl x509 -in /etc/letsencrypt/live/your-domain/cert.pem -noout -dates
```
### Q: How to change validity period?
Edit `validity_days` in `generate_self_signed_certificate()` function:
```python
validity_days: int = 365 # Change to desired number of days
```
---
## Troubleshooting
### Error: Permission denied
```bash
# Run with sudo
sudo make test-cert
```
### Error: Module 'cryptography' not found
```bash
# Install dependencies
sudo pip3 install cryptography
```
### NPM doesn't show certificate
1. Check NPM settings in configuration
2. Check logs: `sudo make logs`
3. Try uploading manually via NPM web interface
### Certificate not created
```bash
# Check permissions
ls -la /etc/letsencrypt/live/
# Create directory manually
sudo mkdir -p /etc/letsencrypt/live/
# Check configuration
sudo make check-config
```
---
## Usage Examples
### Docker Development
```dockerfile
FROM nginx:alpine
# Copy test certificate
COPY test-certs/ /etc/nginx/ssl/
# Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 443
```
### Local Testing
```bash
# Create certificate for localhost
sudo python3 letsencrypt_regru_api.py --test-cert
# Add to /etc/hosts
echo "127.0.0.1 test.example.com" | sudo tee -a /etc/hosts
# Start nginx
sudo nginx -t && sudo nginx -s reload
# Open in browser
open https://test.example.com
```
### Automated Testing Before Deployment
```bash
#!/bin/bash
# pre-deploy.sh
# Test SSL check
sudo make test-cert
if [ $? -eq 0 ]; then
echo "✅ Test certificate created successfully"
echo "✅ Ready for production certificate"
sudo make obtain
else
echo "❌ Error creating test certificate"
exit 1
fi
```
---
## Additional Resources
- 📘 [Let's Encrypt Rate Limits](https://letsencrypt.org/docs/rate-limits/)
- 📘 [OpenSSL Documentation](https://www.openssl.org/docs/)
- 📘 [Nginx Proxy Manager Docs](https://nginxproxymanager.com/guide/)
---
## Quick Reference
```bash
# Installation
sudo make install
# Configuration
sudo nano /etc/letsencrypt/regru_config.json
# Create test certificate
sudo make test-cert
# Verify
sudo make check-config
sudo make status
# Switch to production
sudo rm -rf /etc/letsencrypt/live/domain/
sudo make obtain
# Automatic renewal
sudo make run
```
**Done!** 🎉 Now you can test SSL certificates without limits!
@@ -1,15 +1,15 @@
# Подробная инструкция по настройке Nginx Proxy Manager с одним глобальным SSL сертификатом для всех доменов dfv24.com
# Подробная инструкция по настройке Nginx Proxy Manager с одним глобальным SSL сертификатом для всех доменов example.com
## Предпосылки
- Установлен и запущен [Nginx Proxy Manager](http://192.168.10.14:81/)
- Основной домен: dfv24.com
- Установлен и запущен [Nginx Proxy Manager](http://192.0.2.1:81/)
- Основной домен: example.com
- Хостинг и DNS записи домена находятся на reg.ru
- Нужно использовать один SSL сертификат (например, wildcard) для всех поддоменов dfv24.com
- Нужно использовать один SSL сертификат (например, wildcard) для всех поддоменов example.com
---
## Шаг 1. Покупка и получение SSL Wildcard сертификата для dfv24.com
1. На reg.ru или любом другом удостоверяющем центре (CA) закажите wildcard сертификат на домен вида `*.dfv24.com`.
## Шаг 1. Покупка и получение SSL Wildcard сертификата для example.com
1. На reg.ru или любом другом удостоверяющем центре (CA) закажите wildcard сертификат на домен вида `*.example.com`.
2. Получите файлы сертификата:
- Главный сертификат (CRT)
- Промежуточные сертификаты (CA Bundle)
@@ -18,7 +18,7 @@
---
## Шаг 2. Импорт вашего SSL сертификата в Nginx Proxy Manager
1. Авторизуйтесь в Nginx Proxy Manager на http://192.168.10.14:81/
1. Авторизуйтесь в Nginx Proxy Manager на http://192.0.2.1:81/
2. Перейдите в раздел **SSL Certificates** → кнопку **Add SSL Certificate**
3. Выберите **Custom** (пользовательский сертификат)
4. В поля вставьте:
@@ -33,7 +33,7 @@
1. Перейдите в **Proxy Hosts****Add Proxy Host**
2. Заполните поля:
- **Domain Names**: Например, `sub1.dfv24.com` (для первого поддомена)
- **Domain Names**: Например, `sub1.example.com` (для первого поддомена)
- **Scheme**: http или https, в зависимости от бекенда
- **Forward Hostname / IP**: IP или DNS адрес вашего внутреннего сервиса
- **Forward Port**: порт сервиса (например, 80 или 443)
@@ -49,8 +49,8 @@
1. Войдите в панель управления доменом на reg.ru
2. Создайте или отредактируйте DNS записи типа A:
- `dfv24.com` → IP вашего Nginx Proxy Manager (например, 192.168.10.14)
- `*.dfv24.com` → тот же IP или конкретные поддомены, если есть специальные
- `example.com` → IP вашего Nginx Proxy Manager (например, 192.0.2.1)
- `*.example.com` → тот же IP или конкретные поддомены, если есть специальные
3. Сохраните изменения
4. Дождитесь обновления DNS (от нескольких минут до 24 часов)
@@ -58,8 +58,8 @@
## Шаг 5. Тест и проверка работы
1. В браузере откройте любой из поддоменов `https://sub1.dfv24.com`
2. Сертификат должен быть валидным, выданным на wildcard `*.dfv24.com`
1. В браузере откройте любой из поддоменов `https://sub1.example.com`
2. Сертификат должен быть валидным, выданным на wildcard `*.example.com`
3. Проверьте работу прокси и корректность подстановки сертификата
4. При необходимости проверьте логи Nginx Proxy Manager и исправьте ошибки
@@ -76,4 +76,4 @@
# Итог
Используйте один wildcard сертификат для всех поддоменов, импортируйте его как пользовательский сертификат в Nginx Proxy Manager, при создании прокси-хостов выбирайте его в настройках SSL. Управляйте DNS записями на reg.ru, направляя domен на IP Nginx Proxy Manager.
Это позволит юридически использовать единый сертификат для всех сервисов с различными поддоменами под вашим доменом dfv24.com.
Это позволит юридически использовать единый сертификат для всех сервисов с различными поддоменами под вашим доменом example.com.
@@ -1,17 +1,17 @@
# Инструкция по созданию wildcard сертификата *.dfv24.com в Nginx Proxy Manager и настройке автоматического продления SSL
# Инструкция по созданию wildcard сертификата *.example.com в Nginx Proxy Manager и настройке автоматического продления SSL
---
## Шаг 1. Подготовка
- Убедитесь, что Nginx Proxy Manager (NPM) установлен и доступен по адресу http://192.168.10.14:81/
- У вас есть доступ к DNS-записям домена dfv24.com в панели управления reg.ru или у другого регистратора
- Убедитесь, что Nginx Proxy Manager (NPM) установлен и доступен по адресу http://192.0.2.1:81/
- У вас есть доступ к DNS-записям домена example.com в панели управления reg.ru или у другого регистратора
---
## Шаг 2. Создание Wildcard SSL сертификата в Nginx Proxy Manager
1. Войдите в админку Nginx Proxy Manager по адресу http://192.168.10.14:81/
1. Войдите в админку Nginx Proxy Manager по адресу http://192.0.2.1:81/
2. Перейдите в раздел **SSL Certificates** → нажмите кнопку **Add SSL Certificate**
@@ -19,8 +19,8 @@
4. Заполните поля:
- **Domain Names:**
Введите `*.dfv24.com` — для wildcard сертификата
Также рекомендуется добавить основной домен `dfv24.com` (через запятую или в новом поле)
Введите `*.example.com` — для wildcard сертификата
Также рекомендуется добавить основной домен `example.com` (через запятую или в новом поле)
- **Email Address:**
Укажите ваш Email для уведомлений от Let's Encrypt (обязательно)
- **HTTP Challenge:**
@@ -48,10 +48,10 @@
1. Перейдите в **Proxy Hosts** → Создайте или отредактируйте запись прокси
2. В поле **Domain Names** укажите нужный поддомен из dfv24.com, например:
`api.dfv24.com` или `www.dfv24.com`
2. В поле **Domain Names** укажите нужный поддомен из example.com, например:
`api.example.com` или `www.example.com`
3. В разделе **SSL** выберите ваш wildcard сертификат `*.dfv24.com`, который вы получили на шаге 2
3. В разделе **SSL** выберите ваш wildcard сертификат `*.example.com`, который вы получили на шаге 2
4. Включите опции:
- Use SSL
@@ -65,8 +65,8 @@
## Шаг 5. Проверка
1. Проверьте, что для всех поддоменов используется единый сертификат
2. Посетите https://api.dfv24.com или другие поддомены из браузера
3. Убедитесь, что сертификат валиден, не просрочен и выдан на *.dfv24.com
2. Посетите https://api.example.com или другие поддомены из браузера
3. Убедитесь, что сертификат валиден, не просрочен и выдан на *.example.com
4. Проверяйте в разделе SSL Certificates статус продления сертификата
---
@@ -81,6 +81,6 @@
# Итог
Nginx Proxy Manager позволяет легко получать и автоматически обновлять wildcard SSL сертификаты для домена *.dfv24.com с помощью Let's Encrypt.
Nginx Proxy Manager позволяет легко получать и автоматически обновлять wildcard SSL сертификаты для домена *.example.com с помощью Let's Encrypt.
Главное — правильно настроить DNS записи и обеспечить интернет доступ на HTTP/HTTPS порты.
Далее используйте один глобальный сертификат для всех ваших поддоменов через настройки Proxy Hosts.
+7 -7
View File
@@ -1,4 +1,4 @@
# ============================================================================
# ============================================================================
# Скрипт для создания и обновления SSL сертификата Let's Encrypt
# с использованием DNS-валидации через API reg.ru (PowerShell версия)
#
@@ -16,7 +16,7 @@
для доменов на reg.ru используя DNS-01 challenge через API
.PARAMETER Domain
Основной домен (например, dfv24.com)
Основной домен (например, example.com)
.PARAMETER Email
Email для уведомлений Let's Encrypt
@@ -34,15 +34,15 @@
Путь к файлу конфигурации JSON
.EXAMPLE
.\letsencrypt_regru.ps1 -Domain "dfv24.com" -Email "admin@dfv24.com" -Wildcard
.\letsencrypt_regru.ps1 -Domain "example.com" -Email "admin@example.com" -Wildcard
#>
param(
[Parameter(Mandatory=$false)]
[string]$Domain = "dfv24.com",
[string]$Domain = "example.com",
[Parameter(Mandatory=$false)]
[string]$Email = "admin@dfv24.com",
[string]$Email = "admin@example.com",
[Parameter(Mandatory=$false)]
[string]$RegRuUsername = "",
@@ -138,9 +138,9 @@ function Create-SampleConfig {
$sampleConfig = @{
regru_username = "your_username"
regru_password = "your_password"
domain = "dfv24.com"
domain = "example.com"
wildcard = $true
email = "admin@dfv24.com"
email = "admin@example.com"
dns_propagation_wait = 60
dns_check_attempts = 10
dns_check_interval = 10
+11 -11
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@@ -63,7 +63,7 @@ DEFAULT_CONFIG = {
# Параметры домена
"domain": "example.com",
"domains": [], # Группы SAN-доменов: ["*.dfv24.com,dfv24.com", "github.dfv24.com"]
"domains": [], # Группы SAN-доменов: ["*.example.com,example.com", "gitea.example.com"]
# Запятая внутри строки = один сертификат с несколькими SAN
"wildcard": True, # Создавать wildcard сертификат (*.domain.com) если domains пуст
@@ -1264,7 +1264,7 @@ class LetsEncryptManager:
Обработчик DNS challenge - добавление TXT записи
Args:
validation_domain: Домен для валидации (например, dfv24.com или *.dfv24.com)
validation_domain: Домен для валидации (например, example.com или *.example.com)
validation_token: Токен валидации
Returns:
@@ -1339,7 +1339,7 @@ class LetsEncryptManager:
Обработчик очистки DNS challenge - удаление TXT записи
Args:
validation_domain: Домен валидации (например, dfv24.com или *.dfv24.com)
validation_domain: Домен валидации (например, example.com или *.example.com)
validation_token: Токен валидации
Returns:
@@ -1846,7 +1846,7 @@ def get_configured_domains(config: Dict) -> List[str]:
Поддерживаемые варианты:
- domain: "example.com"
- domains: ["example.com", "example.org"]
- domains: ["*.dfv24.com,dfv24.com", "github.dfv24.com"]
- domains: ["*.example.com,example.com", "gitea.example.com"]
- оба варианта одновременно
"""
domains: List[str] = []
@@ -1892,8 +1892,8 @@ def parse_cert_groups(config: Dict) -> List[List[str]]:
сертификаты.
Примеры:
domains: ["*.dfv24.com,dfv24.com", "github.dfv24.com"]
→ [["*.dfv24.com", "dfv24.com"], ["github.dfv24.com"]]
domains: ["*.example.com,example.com", "gitea.example.com"]
→ [["*.example.com", "example.com"], ["gitea.example.com"]]
domains: ["example.com"]
→ [["example.com"]] (+ wildcard если включён)
@@ -1973,11 +1973,11 @@ def extract_registrable_domain(target_domain: str, configured_domains: List[str]
"""
Определяет зарегистрированный домен и префикс поддомена для DNS API (reg.ru).
Для pages.github.dfv24.com (если dfv24.com в конфигурации):
→ ("dfv24.com", "pages.github")
Для pages.gitea.example.com (если example.com в конфигурации):
→ ("example.com", "pages.github")
Для dfv24.com:
→ ("dfv24.com", "")
Для example.com:
→ ("example.com", "")
Args:
target_domain: Целевой домен (может быть субдоменом, может содержать "*.")
+4 -4
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
###############################################################################
# Скрипт для создания и обновления SSL сертификата Let's Encrypt
@@ -19,9 +19,9 @@ REGRU_USERNAME="your_username" # Имя пользователя reg.r
REGRU_PASSWORD="your_password" # Пароль от аккаунта reg.ru
# Параметры домена и сертификата
DOMAIN="dfv24.com" # Основной домен
WILDCARD_DOMAIN="*.dfv24.com" # Wildcard домен
EMAIL="admin@dfv24.com" # Email для уведомлений Let's Encrypt
DOMAIN="example.com" # Основной домен
WILDCARD_DOMAIN="*.example.com" # Wildcard домен
EMAIL="admin@example.com" # Email для уведомлений Let's Encrypt
# Директории для хранения сертификатов
CERT_DIR="/etc/letsencrypt/live/$DOMAIN"
-98
View File
@@ -1,98 +0,0 @@
# Secrets for Deployment and Configuration
This document provides a detailed description of the secrets required for deploying and configuring the `configure_nginx_manager` project. Each secret is listed with its purpose, example value, and any default behavior if applicable.
## Deployment Secrets
### DEPLOY_PORT
- **Description**: The SSH port used to connect to the deployment server.
- **Example**: `22`
### DEPLOY_USER
- **Description**: The SSH user for deployment.
- **Example**: `deploy`
### DEPLOY_SSH_PRIVATE_KEY
- **Description**: The private SSH key used for authentication.
- **Example**: Full PEM/OpenSSH block.
### DEPLOY_PATH
- **Description**: The path on the server where the project will be deployed.
- **Example**: `/opt/configure_nginx_manager`
### DEPLOY_SERVICE
- **Description**: The name of the systemd unit to manage the service.
- **Example**: `letsencrypt-regru.service`
### DEPLOY_SSH_KNOWN_HOSTS
- **Description**: The `known_hosts` entry for the deployment server.
- **Example**: `192.168.10.14 ssh-ed25519 AAAAC3...`
## Configuration Secrets
### CFG_REGRU_USERNAME
- **Description**: The username for the reg.ru API.
- **Example**: `my_reg_ru_login`
### CFG_REGRU_PASSWORD
- **Description**: The password for the reg.ru API.
- **Example**: `StrongPass123!`
### CFG_EMAIL
- **Description**: The email address used for Lets Encrypt notifications.
- **Example**: `admin@dfv24.com`
### CFG_DOMAINS
- **Description**: Certificate groups (SAN). Each array element = one certificate. Comma-separated domains within one element form a single multi-SAN certificate.
- **Format**: JSON array — `["*.dfv24.com,dfv24.com", "github.dfv24.com"]`
- **Result**: 2 certificates:
1. `*.dfv24.com` + `dfv24.com` (one cert, two SANs)
2. `github.dfv24.com` (separate cert)
### CFG_DOMAIN
- **Description**: The primary domain. If empty, the first domain from the first group in `CFG_DOMAINS` is used.
- **Example**: `dfv24.com`
### CFG_WILDCARD
- **Description**: Whether to use wildcard certificates.
- **Example**: `true`
### CFG_CERT_DIR
- **Description**: The directory where certificates are stored.
- **Default**: `/etc/letsencrypt/live`
### CFG_LOG_FILE
- **Description**: The log file for the Lets Encrypt process.
- **Default**: `/var/log/letsencrypt_regru.log`
### CFG_DNS_PROPAGATION_WAIT
- **Description**: The wait time for DNS propagation (in seconds).
- **Default**: `60`
### CFG_DNS_CHECK_ATTEMPTS
- **Description**: The number of attempts to check DNS propagation.
- **Default**: `10`
### CFG_DNS_CHECK_INTERVAL
- **Description**: The interval between DNS propagation checks (in seconds).
- **Default**: `10`
### CFG_RENEWAL_DAYS
- **Description**: The number of days before certificate renewal.
- **Default**: `30`
### CFG_NPM_ENABLED
- **Description**: Whether Nginx Proxy Manager (NPM) integration is enabled.
- **Default**: `true`
### CFG_NPM_HOST
- **Description**: The host URL for Nginx Proxy Manager.
- **Example**: `http://192.168.10.14:81`
### CFG_NPM_EMAIL
- **Description**: The email address for Nginx Proxy Manager.
- **Example**: `admin@example.com`
### CFG_NPM_PASSWORD
- **Description**: The password for Nginx Proxy Manager.
- **Example**: `changeme`
+2 -2
View File
@@ -1,4 +1,4 @@
# Сборка и релизы
# Сборка и релизы
Проект поддерживает сборку исполняемых файлов через PyInstaller.
@@ -52,4 +52,4 @@
`make ci-release TAG=v1.0.0`
Для запуска через Makefile нужен токен (любой из): `DFGIT_TOKEN` / `GIT_TOKEN` / `GITEA_TOKEN` / `GITEA_ACCESS_TOKEN`.
Makefile отправляет запрос на `DFGIT_URL` (по умолчанию `https://github.dfv24.com`) в репозиторий `DFGIT_REPO`.
Makefile отправляет запрос на `DFGIT_URL` (по умолчанию `https://gitea.example.com`) в репозиторий `DFGIT_REPO`.
+4 -4
View File
@@ -1,4 +1,4 @@
# Команды и сценарии
# Команды и сценарии
## CLI: letsencrypt-regru
@@ -47,7 +47,7 @@
### CI / Wiki (workflow dispatch)
Эти команды **не выполняют деплой/синк локально** — они делают API-запрос в Actions
на `github.dfv24.com` и запускают соответствующий workflow.
на `gitea.example.com` и запускают соответствующий workflow.
- `make wiki-sync` — запустить синхронизацию `wiki/` в Wiki репозитория
- `make ci-release TAG=vX.Y.Z` (или `make ci-release VERSION=X.Y.Z`) — запустить релизный workflow
@@ -82,8 +82,8 @@ DFGIT_TOKEN="<token>" make deploy-service REF=master
Примечания:
- Базовый URL задаётся переменной `DFGIT_URL` (по умолчанию `https://github.dfv24.com`).
- Репозиторий задаётся `DFGIT_REPO` (по умолчанию `fofanov.dmitry/configure_nginx_manager`).
- Базовый URL задаётся переменной `DFGIT_URL` (по умолчанию `https://gitea.example.com`).
- Репозиторий задаётся `DFGIT_REPO` (по умолчанию `your_username/configure_nginx_manager`).
- Для Linux/macOS требуется установленный `curl`.
## Типовой workflow (рекомендуется)
+6 -6
View File
@@ -1,4 +1,4 @@
# Конфигурация
# Конфигурация
Проект использует JSON-конфиг (пример: `config.json.example`).
@@ -16,13 +16,13 @@
{
"regru_username": "your_username",
"regru_password": "your_password",
"domain": "dfv24.com",
"domain": "example.com",
"domains": [
"dfv24.com",
"pages.github.dfv24.com"
"example.com",
"pages.gitea.example.com"
],
"wildcard": true,
"email": "admin@dfv24.com",
"email": "admin@example.com",
"cert_dir": "/etc/letsencrypt/live",
"log_file": "/var/log/letsencrypt_regru.log",
"dns_propagation_wait": 60,
@@ -30,7 +30,7 @@
"dns_check_interval": 10,
"renewal_days": 30,
"npm_enabled": true,
"npm_host": "http://192.168.10.14:81",
"npm_host": "http://192.0.2.1:81",
"npm_email": "admin@example.com",
"npm_password": "changeme"
}
+6 -6
View File
@@ -1,4 +1,4 @@
# Deploy через Actions и Secrets
# Deploy через Actions и Secrets
Эта страница описывает деплой через workflow `.github/workflows/deploy-service.yml`.
@@ -20,7 +20,7 @@
## Что делает workflow
- деплоит проект на сервер `192.168.10.14` по SSH (ключ)
- деплоит проект на сервер `192.0.2.1` по SSH (ключ)
- перед деплоем генерирует `config.json` из secrets
- копирует архив на сервер, распаковывает в `DEPLOY_PATH`
- перезапускает systemd-сервис `DEPLOY_SERVICE`
@@ -33,7 +33,7 @@
### SSH и деплой
- `DEPLOY_HOST` — должен быть `192.168.10.14`
- `DEPLOY_HOST` — должен быть `192.0.2.1`
- `DEPLOY_PORT` — обычно `22`
- `DEPLOY_USER`
- `DEPLOY_SSH_PRIVATE_KEY`
@@ -52,13 +52,13 @@
1) JSON-массив:
```json
["dfv24.com", "pages.github.dfv24.com"]
["example.com", "pages.gitea.example.com"]
```
2) строка через запятую:
```text
dfv24.com,pages.github.dfv24.com
example.com,pages.gitea.example.com
```
Если `CFG_DOMAIN` не указан, в поле `domain` берётся первый домен из `CFG_DOMAINS`.
@@ -106,7 +106,7 @@ dfv24.com,pages.github.dfv24.com
### Запуск через Makefile
Makefile умеет запускать workflow через API на `github.dfv24.com`:
Makefile умеет запускать workflow через API на `gitea.example.com`:
- `make deploy-service` — деплой `master`
- `make deploy-service REF=<branch_or_tag>` — деплой указанной ветки/тега
+2 -2
View File
@@ -1,4 +1,4 @@
# Интеграция с Nginx Proxy Manager (NPM)
# Интеграция с Nginx Proxy Manager (NPM)
Проект умеет автоматически загружать (или обновлять) сертификаты в NPM через его API.
@@ -7,7 +7,7 @@
В конфиге:
- `npm_enabled: true`
- `npm_host`: например `http://192.168.10.14:81`
- `npm_host`: например `http://192.0.2.1:81`
- `npm_email`, `npm_password`
После этого: