Skip to content
This repository was archived by the owner on Dec 30, 2025. It is now read-only.

Commit 31f0d8f

Browse files
committed
feat(Makefile, compose.yaml): add ssl-fix-existing target and improve certificate handling
Add a new Makefile target `ssl-fix-existing` to facilitate the fixing of existing SSL certificates by copying them from certbot to UnrealIRCd. This addition provides a streamlined process for maintaining SSL certificates without manual intervention. Enhance the `compose.yaml` to set appropriate permissions and ownership for the SSL certificate files. This ensures that the certificates are secure and accessible only to the necessary services, reducing the risk of unauthorized access. These changes improve the maintainability and security of SSL certificate management within the application.
1 parent 2238be8 commit 31f0d8f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,11 @@ help-ssl:
383383
@echo " ssl-check - Check status"
384384
@echo " ssl-monitor - Start monitoring"
385385
@echo " ssl-issue - Issue new SSL certificate"
386+
@echo " ssl-fix-existing - Fix existing certificates"
386387
@echo ""
387388
@echo "Usage examples:"
388389
@echo " make setup-ssl # Initial certificate setup"
390+
@echo " make ssl-fix-existing # Fix existing certificates"
389391
@echo " make ssl-check # Check certificate status"
390392
@echo " make certbot-up # Start certificate manager"
391393
@echo " make ssl-renew # Renew certificates"
@@ -589,6 +591,26 @@ certbot-status-check: ## Check certificate status
589591
ssl-issue: ## Issue new SSL certificate (manual)
590592
@echo -e "$(PURPLE)=== Issuing New SSL Certificate ===$(NC)"
591593
$(DOCKER_COMPOSE) exec certbot /usr/local/bin/certbot-scripts/entrypoint.sh issue
594+
@echo -e "$(BLUE)[INFO]$(NC) Waiting for certificates to be synced..."
595+
@sleep 10
596+
@echo -e "$(BLUE)[INFO]$(NC) Copying CA bundle for HTTPS client..."
597+
@cp unrealircd/default/tls/curl-ca-bundle.crt unrealircd/conf/tls/ 2>/dev/null || true
598+
@echo -e "$(BLUE)[INFO]$(NC) Restarting UnrealIRCd to load new certificates..."
599+
@$(DOCKER_COMPOSE) restart unrealircd >/dev/null 2>&1 || true
600+
@echo -e "$(GREEN)[SUCCESS]$(NC) SSL certificate issuance completed!"
601+
602+
ssl-fix-existing: ## Fix existing certificates (copy from certbot to UnrealIRCd)
603+
@echo -e "$(PURPLE)=== Fixing Existing SSL Certificates ===$(NC)"
604+
@echo -e "$(BLUE)[INFO]$(NC) This will copy existing certificates from certbot to UnrealIRCd"
605+
@echo -e "$(BLUE)[INFO]$(NC) Starting cert-sync container to copy certificates..."
606+
@$(DOCKER_COMPOSE) up -d cert-sync
607+
@echo -e "$(BLUE)[INFO]$(NC) Waiting for certificate sync..."
608+
@sleep 15
609+
@echo -e "$(BLUE)[INFO]$(NC) Copying CA bundle for HTTPS client..."
610+
@cp unrealircd/default/tls/curl-ca-bundle.crt unrealircd/conf/tls/ 2>/dev/null || true
611+
@echo -e "$(BLUE)[INFO]$(NC) Restarting UnrealIRCd to load certificates..."
612+
@$(DOCKER_COMPOSE) restart unrealircd >/dev/null 2>&1 || true
613+
@echo -e "$(GREEN)[SUCCESS]$(NC) Existing SSL certificates have been fixed!"
592614

593615
# ============================================================================
594616
# ENVIRONMENT SETUP

compose.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ services:
160160
if [ -d \"\$$domain_dir\" ]; then
161161
cp \"\$$domain_dir/fullchain.pem\" /app/unrealircd-tls/server.cert.pem 2>/dev/null || true
162162
cp \"\$$domain_dir/privkey.pem\" /app/unrealircd-tls/server.key.pem 2>/dev/null || true
163+
chmod 644 /app/unrealircd-tls/server.cert.pem 2>/dev/null || true
164+
chmod 600 /app/unrealircd-tls/server.key.pem 2>/dev/null || true
165+
chown 1001:1001 /app/unrealircd-tls/server.cert.pem 2>/dev/null || true
166+
chown 1001:1001 /app/unrealircd-tls/server.key.pem 2>/dev/null || true
163167
fi
164168
done
165169
fi

0 commit comments

Comments
 (0)