Download HTTPS_CERTIFICATE_GUIDE.md from SmartySmile/freespace-freemind: direct link, hf CLI and curl.
- Browser
- Download file 6.67 kB
-
https://huggingface.co/datasets/SmartySmile/freespace-freemind/resolve/main/HTTPS_CERTIFICATE_GUIDE.md
- Command line
-
hf download hf://datasets/SmartySmile/freespace-freemind/HTTPS_CERTIFICATE_GUIDE.md
-
curl -L -o HTTPS_CERTIFICATE_GUIDE.md https://huggingface.co/datasets/SmartySmile/freespace-freemind/resolve/main/HTTPS_CERTIFICATE_GUIDE.md
HTTPS Certificate Management Configuration Guide
Overview
This application now includes enterprise-grade HTTPS certificate management with automatic renewal capabilities. The system can:
- ✅ Automatically create self-signed certificates for development
- ✅ Validate certificates on startup
- ✅ Automatically renew certificates before expiration
- ✅ Backup old certificates before renewal
- ✅ Expose certificate status via API endpoints
- ✅ Support custom certificate paths for production environments
- ✅ Provide detailed logging for certificate operations
Configuration
The HTTPS certificate settings are configured in appsettings.json:
{
"HttpSettings": {
"HttpPort": 5293,
"HttpsPort": 7145
},
"HttpsCertificate": {
"Enabled": true,
"CertificatePath": "Data/certificates",
"CertificateFileName": "port-watcher-cert",
"CertificateFormat": "pfx",
"SubjectName": "CN=localhost",
"ValidityDays": 365,
"AutoRenewThresholdDays": 30,
"CheckIntervalHours": 24,
"UseProductionCert": false,
"ProductionCertPath": "",
"EnableAutoRenewal": true
}
}
Configuration Options
| Option | Default | Description |
|---|---|---|
Enabled |
true | Enable/disable certificate management |
CertificatePath |
Data/certificates | Relative path where certificates are stored |
CertificateFileName |
port-watcher-cert | Name of the certificate file (without extension) |
CertificateFormat |
pfx | Certificate format (pfx/pem/cer) |
SubjectName |
CN=localhost | Certificate subject name |
ValidityDays |
365 | Validity period for new certificates |
AutoRenewThresholdDays |
30 | Days before expiration to trigger renewal |
CheckIntervalHours |
24 | Interval for automatic renewal checks |
UseProductionCert |
false | Use production certificate instead of self-signed |
ProductionCertPath |
"" | Path to production certificate file |
EnableAutoRenewal |
true | Enable automatic certificate renewal |
Development Environment
For development (appsettings.Development.json):
{
"HttpsCertificate": {
"UseProductionCert": false,
"EnableAutoRenewal": false,
"SubjectName": "CN=localhost"
}
}
Production Environment
For production, you have two options:
Option 1: Use Self-Signed Certificates with Auto-Renewal
{
"HttpsCertificate": {
"Enabled": true,
"EnableAutoRenewal": true,
"SubjectName": "CN=yourdomain.com",
"AutoRenewThresholdDays": 30,
"CheckIntervalHours": 24
}
}
Option 2: Use Production Certificate (e.g., Let's Encrypt)
{
"HttpsCertificate": {
"UseProductionCert": true,
"ProductionCertPath": "C:\\path\\to\\your\\certificate.pfx",
"EnableAutoRenewal": false
}
}
API Endpoints
The application exposes certificate diagnostics via REST API:
Get Certificate Status
GET /api/certificatediagnostics/status
Response:
{
"success": true,
"data": {
"subjectName": "CN=localhost",
"issuedDate": "2026-03-03",
"expirationDate": "2027-03-03",
"daysUntilExpiration": 365,
"isExpired": false,
"needsRenewal": false,
"thumbprint": "ABC123..."
}
}
Validate and Auto-Renew
POST /api/certificatediagnostics/validate
Manual Certificate Renewal
POST /api/certificatediagnostics/renew
Automatic Renewal Process
- Startup Check: Certificate is validated when the application starts
- Background Task: Certificate is checked every 24 hours (configurable)
- Renewal Trigger: If certificate expires within the threshold (30 days), renewal is triggered
- Backup: Old certificate is backed up with timestamp before renewal
- Logging: All operations are logged for audit trail
Certificate Files Location
Certificates are stored in: Data/certificates/port-watcher-cert.pfx
Backup certificates use the naming convention: port-watcher-cert.pfx.backup-20260303-120000
Monitoring Certificate Status
Monitor the application logs for certificate-related messages:
[INF] HTTPS certificate found at Data/certificates/port-watcher-cert.pfx
[INF] Certificate Info: Subject=CN=localhost, Issued=2026-03-03, Expires=2027-03-03, DaysRemaining=365, Thumbprint=ABC123...
[INF] Running automatic certificate validation check...
[WRN] HTTPS certificate expires in 25 days. Auto-renewal will be triggered.
[INF] HTTPS certificate renewed successfully.
Troubleshooting
HTTPS Port Not Determined Error
The warning "Failed to determine the https port for redirect" should now be fixed by:
- Explicit Kestrel configuration in Program.cs
- Proper port settings in appsettings.json
- Enhanced HSTS configuration
Certificate Not Found
- Check that
Data/certificates/directory exists or will be created on startup - Verify write permissions for the application process
- Check logs for detailed error messages
Cannot Load Certificate
- Ensure certificate file is valid PFX format
- Check file permissions
- Verify certificate hasn't been corrupted
Auto-Renewal Not Triggering
- Verify
EnableAutoRenewalis set totrue - Check
AutoRenewThresholdDaysvalue (default: 30 days) - Check application logs for renewal task status
- Manually trigger renewal via API:
POST /api/certificatediagnostics/renew
Security Considerations
- Certificate Storage: Keep certificate files in a secure location with restricted access
- Backup Strategy: Automatic backups are created during renewal - maintain offline backups for production
- Key Protection: Private keys are stored in PFX format - ensure the process has correct permissions
- Logging: Certificate operations are logged - review logs regularly for anomalies
- Production Certs: Use proper SSL certificates from trusted CAs in production environments
Integration with eSecSys/nCONNECT OS
For integration with enterprise certificate management systems:
- Set
UseProductionCerttotrue - Point
ProductionCertPathto the provisioned certificate location - Configure your certificate management system to update this path
- Set
EnableAutoRenewaltofalseto allow external management
The API endpoints can be called by your enterprise certificate management system to validate certificate status and trigger renewals when needed.
Last Updated: March 3, 2026