From ba7fd5837ea149b2e319cc577fad27ce1162a064 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 17 Feb 2025 22:30:31 -0500 Subject: Support non-SNI SSL certificates in Http extension Implements https://github.com/wixtoolset/issues/issues/7622 --- src/ext/Http/wixext/HttpCompiler.cs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/ext/Http/wixext/HttpCompiler.cs') diff --git a/src/ext/Http/wixext/HttpCompiler.cs b/src/ext/Http/wixext/HttpCompiler.cs index 51fdfebc..27ddeb0e 100644 --- a/src/ext/Http/wixext/HttpCompiler.cs +++ b/src/ext/Http/wixext/HttpCompiler.cs @@ -49,7 +49,11 @@ namespace WixToolset.Http switch (element.Name.LocalName) { case "SniSslCertificate": - this.ParseSniSslCertificateElement(intermediate, section, element, componentId); + this.ParseCertificateElement(intermediate, section, element, componentId, CertificateType.SniSsl); + break; + + case "SslCertificate": + this.ParseCertificateElement(intermediate, section, element, componentId, CertificateType.IpSsl); break; case "UrlReservation": @@ -71,7 +75,7 @@ namespace WixToolset.Http /// /// The element to parse. /// Identifier of the component that owns this SNI SSL Certificate. - private void ParseSniSslCertificateElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentId) + private void ParseCertificateElement(Intermediate intermediate, IntermediateSection section, XElement node, string componentId, CertificateType type) { var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node); Identifier id = null; @@ -138,13 +142,25 @@ namespace WixToolset.Http // Need the element ID for child element processing, so generate now if not authored. if (null == id) { - id = this.ParseHelper.CreateIdentifier("ssl", componentId, host, port); + var prefix = type == CertificateType.IpSsl ? "ips" : "sni"; + + id = this.ParseHelper.CreateIdentifier(prefix, componentId, host, port); } // Required attributes. if (null == host) { - this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Host")); + if (type == CertificateType.SniSsl) + { + this.Messaging.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Host")); + } + } + else + { + if (type == CertificateType.IpSsl) + { + this.Messaging.Write(ErrorMessages.IllegalAttributeExceptOnElement(sourceLineNumbers, node.Name.LocalName, "Host", "SniSslCertificate")); + } } if (null == port) @@ -162,7 +178,7 @@ namespace WixToolset.Http if (!this.Messaging.EncounteredError) { - section.AddSymbol(new WixHttpSniSslCertSymbol(sourceLineNumbers, id) + section.AddSymbol(new HttpCertificateSymbol(sourceLineNumbers, id) { Host = host, Port = port, @@ -170,11 +186,12 @@ namespace WixToolset.Http AppId = appId, Store = store, HandleExisting = handleExisting, + CertificateType = type, ComponentRef = componentId, }); - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedHttpSniSslCertsInstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); - this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix4SchedHttpSniSslCertsUninstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix6SchedHttpCertificatesInstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); + this.ParseHelper.CreateCustomActionReference(sourceLineNumbers, section, "Wix6SchedHttpCertificatesUninstall", this.Context.Platform, CustomActionPlatforms.X86 | CustomActionPlatforms.X64 | CustomActionPlatforms.ARM64); } } -- cgit v1.2.3-55-g6feb