update
This commit is contained in:
@@ -89,6 +89,52 @@ export class OneboxSslManager {
|
||||
return this.smartacme !== null && this.acmeEmail !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire certificate and return certificate data (for CertRequirementManager)
|
||||
* Returns certificate paths and expiry information
|
||||
*/
|
||||
async acquireCertificate(
|
||||
domain: string,
|
||||
includeWildcard = false
|
||||
): Promise<{
|
||||
certPath: string;
|
||||
keyPath: string;
|
||||
fullChainPath: string;
|
||||
expiryDate: number;
|
||||
issuer: string;
|
||||
}> {
|
||||
try {
|
||||
if (!this.isConfigured()) {
|
||||
throw new Error('SSL manager not configured');
|
||||
}
|
||||
|
||||
logger.info(`Acquiring SSL certificate for ${domain} via SmartACME DNS-01...`);
|
||||
|
||||
// Use SmartACME to obtain certificate via DNS-01 challenge
|
||||
const cert = await this.smartacme!.getCertificateForDomain(domain, {
|
||||
includeWildcard,
|
||||
});
|
||||
|
||||
logger.success(`SSL certificate obtained for ${domain}`);
|
||||
logger.info(`Certificate valid until: ${new Date(cert.validUntil).toISOString()}`);
|
||||
|
||||
// Reload certificates in reverse proxy
|
||||
await this.oneboxRef.reverseProxy.reloadCertificates();
|
||||
|
||||
// Return certificate data
|
||||
return {
|
||||
certPath: cert.certFilePath,
|
||||
keyPath: cert.keyFilePath,
|
||||
fullChainPath: cert.chainFilePath || cert.certFilePath,
|
||||
expiryDate: cert.validUntil,
|
||||
issuer: cert.issuer || 'Let\'s Encrypt',
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error(`Failed to acquire certificate for ${domain}: ${error.message}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain SSL certificate for a domain using SmartACME
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user