feat(smartproxy): Update dependencies and enhance ACME certificate provisioning with wildcard support
This commit is contained in:
		| @@ -3,6 +3,6 @@ | ||||
|  */ | ||||
| export const commitinfo = { | ||||
|   name: '@push.rocks/smartproxy', | ||||
|   version: '19.2.6', | ||||
|   version: '19.3.0', | ||||
|   description: 'A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.' | ||||
| } | ||||
|   | ||||
| @@ -244,8 +244,29 @@ export class SmartCertManager { | ||||
|       // Challenge route should already be active from initialization | ||||
|       // No need to add it for each certificate | ||||
|        | ||||
|       // Use smartacme to get certificate | ||||
|       const cert = await this.smartAcme.getCertificateForDomain(primaryDomain); | ||||
|       // Determine if we should request a wildcard certificate | ||||
|       // Only request wildcards if: | ||||
|       // 1. The primary domain is not already a wildcard | ||||
|       // 2. The domain has multiple parts (can have subdomains) | ||||
|       // 3. We have DNS-01 challenge support (required for wildcards) | ||||
|       const hasDnsChallenge = (this.smartAcme as any).challengeHandlers?.some((handler: any) =>  | ||||
|         handler.getSupportedTypes && handler.getSupportedTypes().includes('dns-01') | ||||
|       ); | ||||
|        | ||||
|       const shouldIncludeWildcard = !primaryDomain.startsWith('*.') &&  | ||||
|                                     primaryDomain.includes('.') &&  | ||||
|                                     primaryDomain.split('.').length >= 2 && | ||||
|                                     hasDnsChallenge; | ||||
|        | ||||
|       if (shouldIncludeWildcard) { | ||||
|         console.log(`Requesting wildcard certificate for ${primaryDomain} (DNS-01 available)`); | ||||
|       } | ||||
|        | ||||
|       // Use smartacme to get certificate with optional wildcard | ||||
|       const cert = await this.smartAcme.getCertificateForDomain( | ||||
|         primaryDomain, | ||||
|         shouldIncludeWildcard ? { includeWildcard: true } : undefined | ||||
|       ); | ||||
|      | ||||
|       // SmartAcme's Cert object has these properties: | ||||
|       // - publicKey: The certificate PEM string   | ||||
|   | ||||
		Reference in New Issue
	
	Block a user