private Dns CreateDNS(Dns dns) { //генерируем сертификат BusinessLayer.SSL.GenerateSSL(GeneralFunction.SslPathOnMainServer(), dns.Name); //копируем файлы сертификата на прокси сервера var ProxyList = DbContext.ProxyServer.Where(p => p.Enable).ToList(); foreach (var proxy in ProxyList) { ssh = new SshFunction(proxy.Ip, proxy.CertPath, proxy.UserName, proxy.PassPhrase); ssh.SftpConnectToServer(); ssh.SCPFile(OpenFile(dns.PublicKeyPathOnMainServer()), dns.PublicKeyPathOnProxy()); ssh.SCPFile(OpenFile(dns.PrivateKeyPathOnMainServer()), dns.PrivateKeyPathOnProxy()); ssh.Disconnect(); } dns.SslPathOnProxy = GeneralFunction.SslPathOnProxyServer(); dns.SslPathOnMainServer = GeneralFunction.SslPathOnMainServer(); var HttpPortList = DbContext.WebHookPort.Where(p => p.Enable).ToList(); dns = DbInsertDns(dns); foreach (var port in HttpPortList) { WebHookUrl hookUrl = new WebHookUrl { DnsId = dns.Id, IsFree = true, PortId = port.Id, Controller = "bot" }; DbContext.WebHookUrl.Add(hookUrl); DbContext.SaveChanges(); } return(dns); }