public DaemonCenterServerRpcHttpHost(Server daemonCenterServer)
        {
            try
            {
                // Start Log Server
                string certVaultDir = Lfs.ConfigPathStringToPhysicalDirectoryPath(@"Local/DaemonCenterRpc_CertVault/");

                this.CertVault = new CertVault(certVaultDir,
                                               new CertVaultSettings(EnsureSpecial.Yes)
                {
                    ReloadIntervalMsecs = 3600 * 1000,
                    UseAcme             = false,
                    NonAcmeEnableAutoGenerateSubjectNameCert = false,
                });

                PalSslServerAuthenticationOptions sslOptions = new PalSslServerAuthenticationOptions(this.CertVault.X509CertificateSelector("dummy", true), true, null);

                this.DaemonCenterServer = daemonCenterServer;

                JsonRpcServerConfig rpcCfg = new JsonRpcServerConfig();

                HttpServerOptions httpConfig = new HttpServerOptions
                {
                    HttpPortsList  = new List <int>(),
                    HttpsPortsList = Consts.Ports.DaemonCenterHttps._SingleList(),
                    UseStaticFiles = false,
                    AutomaticRedirectToHttpsIfPossible = false,
                    HiveName           = "DaemonCenterRpcHttpServer",
                    DenyRobots         = true,
                    UseGlobalCertVault = false,
                    ServerCertSelector = (param, sni) => (X509Certificate2)(this.CertVault.X509CertificateSelector(sni, true).NativeCertificate),
                };

                this.HttpServer = JsonRpcHttpServerBuilder.StartServer(httpConfig, rpcCfg, this.DaemonCenterServer);
            }
            catch
            {
                this._DisposeSafe();
                throw;
            }
        }
    public DataVaultServerOptions(FileSystem?destFileSystem, string destRootDirName, FileFlags fileFlags, Action <DataVaultServerReceivedData, DataVaultServerOptions>?setDestinationProc,
                                  TcpIpSystem?tcpIp, PalSslServerAuthenticationOptions sslAuthOptions, int[] ports, string accessKey, DataVaultServerFlags serverFlags = DataVaultServerFlags.Default, string?rateLimiterConfigName = null)
        : base(tcpIp, sslAuthOptions, ports, accessKey, rateLimiterConfigName)
    {
        if (setDestinationProc == null)
        {
            setDestinationProc = DataVaultServer.DefaultSetDestinationsProc;
        }

        this.DestRootDirName = destRootDirName;

        this.ServerFlags = serverFlags;

        this.FileFlags = fileFlags;

        this.DestFileSystem = destFileSystem ?? Lfs;

        this.DestRootDirName = this.DestFileSystem.PathParser.RemoveLastSeparatorChar(this.DestFileSystem.PathParser.NormalizeDirectorySeparatorAndCheckIfAbsolutePath(this.DestRootDirName));

        this.SetDestinationsProc = setDestinationProc;
    }
 public void StartSslServer(PalSslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken = default)
 => StartSslServerAsync(sslServerAuthenticationOptions, cancellationToken)._GetResult();
 public async Task StartSslServerAsync(PalSslServerAuthenticationOptions sslServerAuthenticationOptions, CancellationToken cancellationToken = default)
 {
     await Stack.SslStartServerAsync(sslServerAuthenticationOptions, cancellationToken);
 }
 public SslServerOptions(TcpIpSystem?tcpIp, PalSslServerAuthenticationOptions sslAuthOptions, string?rateLimiterConfigName = null, params IPEndPoint[] endPoints) : base(tcpIp, rateLimiterConfigName, endPoints)
 {
     this.SslServerAuthenticationOptions = sslAuthOptions;
 }
 public LogServerOptionsBase(TcpIpSystem?tcpIp, PalSslServerAuthenticationOptions sslAuthOptions, int[] ports, string?rateLimiterConfigName = null)
     : base(tcpIp, sslAuthOptions, rateLimiterConfigName, IPUtil.GenerateListeningEndPointsList(false, ports))
 {
 }
 public LogServerOptionsBase(TcpIpSystem tcpIp, PalSslServerAuthenticationOptions sslAuthOptions, string?rateLimiterConfigName = null, params IPEndPoint[] endPoints)
     : base(tcpIp, sslAuthOptions, rateLimiterConfigName, endPoints.Any() ? endPoints : IPUtil.GenerateListeningEndPointsList(false, Consts.Ports.LogServerDefaultServicePort))
 {
 }
示例#8
0
        public LogServerApp()
        {
            try
            {
                this.Settings.AccessData(true, k =>
                {
                    string logDestDir   = k.GetStr("DestDir", CoresConfig.LogServerApp.DefaultDestDirString);
                    string certVaultDir = k.GetStr("LogServerCertVaultDirString", CoresConfig.LogServerApp.DefaultLogServerCertVaultDirString);

                    string servicePortsStr = k.GetStr("LogServerPorts", CoresConfig.LogServerApp.DefaultLogServerPortsString);

                    string httpPortsStr  = k.GetStr("WebServerHttpPorts", CoresConfig.LogServerApp.DefaultHttpServerPortsString);
                    string httpsPortsStr = k.GetStr("WebServerHttpsPorts", CoresConfig.LogServerApp.DefaultHttpsServerPortsString);

                    string mustIncludeHostnameStr = k.GetStr("MustIncludeHostname", "*");

                    logDestDir   = Lfs.ConfigPathStringToPhysicalDirectoryPath(logDestDir);
                    certVaultDir = Lfs.ConfigPathStringToPhysicalDirectoryPath(certVaultDir);


                    // Start Log Server
                    this.CertVault = new CertVault(certVaultDir,
                                                   new CertVaultSettings(EnsureSpecial.Yes)
                    {
                        ReloadIntervalMsecs = 3600 * 1000,
                        UseAcme             = false,
                        NonAcmeEnableAutoGenerateSubjectNameCert = false,
                    });

                    Lfs.CreateDirectory(logDestDir, FileFlags.OnCreateSetCompressionFlag);

                    PalSslServerAuthenticationOptions sslOptions = new PalSslServerAuthenticationOptions(this.CertVault.X509CertificateSelector("dummy", true), true, null);

                    this.LogServer = new LogServer(new LogServerOptions(null, logDestDir,
                                                                        FileFlags.AutoCreateDirectory | FileFlags.OnCreateSetCompressionFlag | FileFlags.LargeFs_AppendWithoutCrossBorder | FileFlags.LargeFs_AppendNewLineForCrossBorder,
                                                                        setDestinationProc: null,
                                                                        sslAuthOptions: sslOptions,
                                                                        tcpIp: LocalNet,
                                                                        ports: Str.ParsePortsList(servicePortsStr),
                                                                        rateLimiterConfigName: "LogServer"
                                                                        ));

                    // Start HTTP Server-based Web log browser
                    HttpServerOptions httpServerOptions = new HttpServerOptions
                    {
                        UseStaticFiles = false,
                        UseSimpleBasicAuthentication = true,
                        HttpPortsList                      = Str.ParsePortsList(httpPortsStr).ToList(),
                        HttpsPortsList                     = Str.ParsePortsList(httpsPortsStr).ToList(),
                        DebugKestrelToConsole              = true,
                        UseKestrelWithIPACoreStack         = true,
                        AutomaticRedirectToHttpsIfPossible = true,
                        LocalHostOnly                      = false,
                    };

                    if (mustIncludeHostnameStr._IsFilled() && mustIncludeHostnameStr._IsSamei("*") == false)
                    {
                        string[] tokens = mustIncludeHostnameStr.Split(new char[] { ' ', ' ', ';', '/', ',' }, StringSplitOptions.RemoveEmptyEntries);
                        tokens._DoForEach(x => httpServerOptions.MustIncludeHostnameStrList.Add(x));
                    }

                    LogBrowserOptions browserOptions = new LogBrowserOptions(logDestDir);

                    this.LogBrowserHttpServer = LogBrowserHttpServerBuilder.StartServer(httpServerOptions, new LogBrowserHttpServerOptions(browserOptions, ""));
                });
            }
            catch
            {
                this._DisposeSafe();
                throw;
            }
        }
 public DataVaultServerOptionsBase(TcpIpSystem?tcpIp, PalSslServerAuthenticationOptions sslAuthOptions, int[] ports, string accessKey, string?rateLimiterConfigName = null)
     : base(tcpIp, sslAuthOptions, rateLimiterConfigName, IPUtil.GenerateListeningEndPointsList(false, ports))
 {
     this.AccessKey = accessKey;
 }