public void Register() { if (!_configFileProvider.EnableSsl) { return; } if (IsRegistered()) { return; } if (string.IsNullOrWhiteSpace(_configFileProvider.SslCertHash)) { _logger.Warn("Unable to enable SSL, SSL Cert Hash is required"); return; } var arguments = string.Format("http add sslcert ipport=0.0.0.0:{0} certhash={1} appid={{{2}}}", _configFileProvider.SslPort, _configFileProvider.SslCertHash, APP_ID); //TODO: Validate that the cert was added properly, invisible spaces FTL _netshProvider.Run(arguments); }
private List <UrlAcl> GetRegisteredUrls() { if (OsInfo.IsNotWindows) { return(new List <UrlAcl>()); } var arguments = string.Format("http show urlacl"); var output = _netshProvider.Run(arguments); if (output == null || !output.Standard.Any()) { return(new List <UrlAcl>()); } return(output.Standard.Select(line => { var match = UrlAclRegex.Match(line.Content); if (match.Success) { return new UrlAcl { Scheme = match.Groups["scheme"].Value, Address = match.Groups["address"].Value, Port = Convert.ToInt32(match.Groups["port"].Value), UrlBase = match.Groups["urlbase"].Value.Trim() }; } return null; }).Where(r => r != null).ToList()); }
private bool IsRegistered(string urlAcl) { var arguments = String.Format("http show urlacl {0}", urlAcl); var output = _netshProvider.Run(arguments); if (output == null || !output.Standard.Any()) { return(false); } return(output.Standard.Any(line => line.Contains(urlAcl))); }
public void Register() { if (!_configFileProvider.EnableSsl) { return; } if (IsRegistered()) { return; } if (String.IsNullOrWhiteSpace(_configFileProvider.SslCertHash)) { _logger.Warn("Unable to enable SSL, SSL Cert Hash is required"); return; } var arguments = String.Format("netsh http add sslcert ipport=0.0.0.0:{0} certhash={1} appid={{{2}}", _configFileProvider.SslPort, _configFileProvider.SslCertHash, APP_ID); _netshProvider.Run(arguments); }