/// <summary> /// RequestSIDsInformations method implementation /// </summary> public SIDsParametersRecord RequestSIDsInformations() { SIDsParametersRecord retvalue = null; try { retvalue = SIDs.Initialize(); } catch (Exception e) { _log.WriteEntry(string.Format("Error on WebAdminService Service RequestSIDsInformations method : {0}.", e.Message), EventLogEntryType.Error, 2010); throw e; } return(retvalue); }
/// <summary> /// GetLocalSIDsInformations method implmentation /// </summary> private SIDsParametersRecord GetLocalSIDsInformations(Dictionary <string, bool> servers) { SIDsParametersRecord retvalue = null; try { retvalue = SIDs.Initialize(); if (retvalue != null) { string fqdn = Dns.GetHostEntry("localhost").HostName; foreach (var srv in servers) { if (srv.Key.ToLower().Equals(fqdn.ToLower())) { continue; } WebAdminClient manager = new WebAdminClient(); manager.Initialize(srv.Key); try { IWebAdminServices client = manager.Open(); try { client.PushSIDsInformations(retvalue); } finally { manager.Close(client); } } catch (Exception e) { _log.WriteEntry(string.Format("Error on WebAdminService Service GetLocalSIDsInformations method : {0} / {1}.", srv, e.Message), EventLogEntryType.Error, 2010); } finally { manager.UnInitialize(); } } } } catch (Exception e) { _log.WriteEntry(string.Format("Error on WebAdminService Service GetLocalSIDsInformations method : {0}.", e.Message), EventLogEntryType.Error, 2010); throw e; } return(retvalue); }
/// <summary> /// CreateRSACertificateForSQLEncryption method implementation /// </summary> internal string CreateRSACertificateForSQLEncryption(Dictionary <string, bool> servers, string subject, int years) { SIDs.Initialize(); string thumbprint = null; try { string strcert = string.Empty; X509Certificate2 cert = null; try { cert = Certs.CreateRSACertificateForSQLEncryption(subject, years, out strcert); if (cert == null) { return(null); } else { thumbprint = cert.Thumbprint; } } finally { cert.Reset(); } SIDs.internalUpdateCertificatesACLs(KeyMgtOptions.MFACerts); string fqdn = Dns.GetHostEntry("localhost").HostName; List <string> servernames = (from server in servers where (server.Key.ToLower() != fqdn.ToLower()) select server.Key.ToLower()).ToList <string>(); foreach (string srv in servernames) { WebAdminClient manager = new WebAdminClient(); manager.Initialize(srv); try { IWebAdminServices client = manager.Open(); try { client.PushCertificate(strcert); } finally { manager.Close(client); } } catch (Exception e) { _log.WriteEntry(string.Format("Error on WebAdminService Service CreateRSACertificateForSQLEncryption method : {0} / {1}.", srv, e.Message), EventLogEntryType.Error, 2010); } finally { manager.UnInitialize(); } } } catch (Exception e) { _log.WriteEntry(string.Format("Error on WebAdminService Service CreateRSACertificateForSQLEncryption method : {0}.", e.Message), EventLogEntryType.Error, 2010); throw e; } return(thumbprint); }