예제 #1
0
        protected void ReadIniConfig()
        {
            MoneyServerConfigSource moneyConfig = new MoneyServerConfigSource();

            try {
                // [Startup]
                IConfig st_config = moneyConfig.m_config.Configs["Startup"];
                string  PIDFile   = st_config.GetString("PIDFile", "");
                if (PIDFile != "")
                {
                    Create_PIDFile(PIDFile);
                }

                // [MySql]
                IConfig db_config = moneyConfig.m_config.Configs["MySql"];
                string  sqlserver = db_config.GetString("hostname", "localhost");
                string  database  = db_config.GetString("database", "OpenSim");
                string  username  = db_config.GetString("username", "root");
                string  password  = db_config.GetString("password", "password");
                string  pooling   = db_config.GetString("pooling", "false");
                string  port      = db_config.GetString("port", "3306");
                MAX_DB_CONNECTION = db_config.GetInt("MaxConnection", 10);

                connectionString = "Server=" + sqlserver + ";Port=" + port + ";Database=" + database + ";User ID=" +
                                   username + ";Password="******";Pooling=" + pooling + ";";

                // [MoneyServer]
                m_config   = moneyConfig.m_config.Configs["MoneyServer"];
                DEAD_TIME  = m_config.GetInt("ExpiredTime", 120);
                m_hostName = m_config.GetString("HostName", "localhost");                       // be not used

                string checkcert = m_config.GetString("CheckClientCert", "false");
                if (checkcert.ToLower() == "true")
                {
                    m_checkClientCert = true;
                }
                m_certFilename = m_config.GetString("ServerCertFilename", "SineWaveCert.pfx");
                m_certPassword = m_config.GetString("ServerCertPassword", "123");
                if (m_certFilename != "" && m_certPassword != "" && m_checkClientCert != false)
                {
                    m_cert = new X509Certificate2(m_certFilename, m_certPassword);
                }
            }
            catch (Exception)
            {
                m_log.Error("[MONEY SERVER] ReadIniConfig: Fail to setup configure. Please check MoneyServer.ini. Exit");
                Environment.Exit(1);
            }
        }
		protected void ReadIniConfig()
		{
			MoneyServerConfigSource moneyConfig = new MoneyServerConfigSource();

			try {
				// [Startup]
				IConfig st_config = moneyConfig.m_config.Configs["Startup"];
				string PIDFile = st_config.GetString("PIDFile", "");
				if (PIDFile!="") Create_PIDFile(PIDFile);

				// [MySql]
				IConfig db_config = moneyConfig.m_config.Configs["MySql"];
				string sqlserver  = db_config.GetString("hostname", "localhost");
				string database   = db_config.GetString("database", "OpenSim");
				string username   = db_config.GetString("username", "root");
				string password   = db_config.GetString("password", "password");
				string pooling 	  = db_config.GetString("pooling",  "false");
				string port 	  = db_config.GetString("port", 	"3306");
				MAX_DB_CONNECTION = db_config.GetInt   ("MaxConnection", 10);

				connectionString  = "Server=" + sqlserver + ";Port=" + port + ";Database=" + database + ";User ID=" +
												username + ";Password="******";Pooling=" + pooling + ";";

				// [MoneyServer]
				m_config   = moneyConfig.m_config.Configs["MoneyServer"];
				DEAD_TIME  = m_config.GetInt   ("ExpiredTime", 120);
				m_hostName = m_config.GetString("HostName", "localhost");	// be not used

				string checkcert = m_config.GetString("CheckClientCert", "false");
				if (checkcert.ToLower()=="true") m_checkClientCert = true;
				m_certFilename = m_config.GetString("ServerCertFilename", "SineWaveCert.pfx");
				m_certPassword = m_config.GetString("ServerCertPassword", "123");
				//if (m_certFilename!="" && m_certPassword!="")
				//{
				//	m_cert = new X509Certificate2(m_certFilename, m_certPassword);
				//}
			}
			catch (Exception)
			{
				m_log.Error("[MONEY SERVER] ReadIniConfig: Fail to setup configure. Please check MoneyServer.ini. Exit");
				Environment.Exit(1);
			}
		}
		protected void ReadIniConfig()
		{
			MoneyServerConfigSource moneyConfig = new MoneyServerConfigSource();
			Config = moneyConfig.m_config;	// for base.StartupSpecific()

			try {
				// [Startup]
				IConfig st_config = moneyConfig.m_config.Configs["Startup"];
				string PIDFile = st_config.GetString("PIDFile", "");
                m_moneyServerPort = uint.Parse(st_config.GetString("Port", "8008"));
				if (PIDFile!="") Create_PIDFile(PIDFile);

				// [MySql]
				IConfig db_config = moneyConfig.m_config.Configs["MySql"];
				string sqlserver  = db_config.GetString("hostname", "localhost");
				string database   = db_config.GetString("database", "OpenSim");
				string username   = db_config.GetString("username", "root");
				string password   = db_config.GetString("password", "password");
				string pooling 	  = db_config.GetString("pooling",  "false");
				string port 	  = db_config.GetString("port", 	"3306");
				MAX_DB_CONNECTION = db_config.GetInt   ("MaxConnection", 10);

				connectionString  = "Server=" + sqlserver + ";Port=" + port + ";Database=" + database + ";User ID=" +
												username + ";Password="******";Pooling=" + pooling + ";";

				// [MoneyServer]
				m_config   = moneyConfig.m_config.Configs["MoneyServer"];
				DEAD_TIME  = m_config.GetInt   ("ExpiredTime", 120);
				m_hostName = m_config.GetString("HostName", "localhost");	// be not used

				// サーバ証明書
				m_certFilename = m_config.GetString("ServerCertFilename", "");
				m_certPassword = m_config.GetString("ServerCertPassword", "");
				if (m_certFilename!="") {
                    Console.WriteLine("[MONEY SERVER]: ReadIniConfig: Execute HTTPS comunication. Cert file is " + m_certFilename);
				}

				// クライアント認証
				string checkcert = m_config.GetString("CheckClientCert", "false");
				if (checkcert.ToLower()=="true") m_checkClientCert = true;

				m_cacertFilename = m_config.GetString("CACertFilename", "");
				m_clcrlFilename  = m_config.GetString("ClientCrlFilename", "");
				//
				if (m_checkClientCert && m_cacertFilename!="") {
					m_certVerify.SetPrivateCA(m_cacertFilename);
                    Console.WriteLine("[MONEY SERVER]: ReadIniConfig: Execute Authentication of Clients. CA  file is " + m_cacertFilename);
				}
				else {
					m_checkClientCert = false;
				}

				if (m_checkClientCert) {
					if (m_clcrlFilename!="") {
						m_certVerify.SetPrivateCRL(m_clcrlFilename);
                        Console.WriteLine("[MONEY SERVER]: ReadIniConfig: Execute Authentication of Clients. CRL file is " + m_clcrlFilename);
					}
				}
			}

			catch (Exception)
			{
                Console.WriteLine("[MONEY SERVER]: ReadIniConfig: Fail to setup configure. Please check MoneyServer.ini. Exit");
				Environment.Exit(1);
			}
		}
예제 #4
0
        protected void ReadIniConfig()
        {
            MoneyServerConfigSource moneyConfig = new MoneyServerConfigSource();

            Config = moneyConfig.m_config;              // for base.StartupSpecific()

            try {
                // [Startup]
                IConfig st_config = moneyConfig.m_config.Configs["Startup"];
                string  PIDFile   = st_config.GetString("PIDFile", "");
                if (PIDFile != "")
                {
                    Create_PIDFile(PIDFile);
                }

                // [MySql]
                IConfig db_config = moneyConfig.m_config.Configs["MySql"];
                string  sqlserver = db_config.GetString("hostname", "localhost");
                string  database  = db_config.GetString("database", "OpenSim");
                string  username  = db_config.GetString("username", "root");
                string  password  = db_config.GetString("password", "password");
                string  pooling   = db_config.GetString("pooling", "false");
                string  port      = db_config.GetString("port", "3306");
                MAX_DB_CONNECTION = db_config.GetInt("MaxConnection", MAX_DB_CONNECTION);

                connectionString = "Server=" + sqlserver + ";Port=" + port + ";Database=" + database + ";User ID=" +
                                   username + ";Password="******";Pooling=" + pooling + ";";

                // [MoneyServer]
                m_server_config = moneyConfig.m_config.Configs["MoneyServer"];
                DEAD_TIME       = m_server_config.GetInt("ExpiredTime", DEAD_TIME);

                //
                // [Certificate]
                m_cert_config = moneyConfig.m_config.Configs["Certificate"];
                if (m_cert_config == null)
                {
                    m_log.Info("[MONEY SERVER]: [Certificate] section is not found. Using [MoneyServer] section instead");
                    m_cert_config = m_server_config;
                }

                // HTTPS Server Cert (Server Mode)
                // サーバ証明書
                m_certFilename = m_cert_config.GetString("ServerCertFilename", m_certFilename);
                m_certPassword = m_cert_config.GetString("ServerCertPassword", m_certPassword);
                if (m_certFilename != "")
                {
                    m_log.Info("[MONEY SERVER]: ReadIniConfig: Execute HTTPS comunication. Cert file is " + m_certFilename);
                }

                // クライアント認証
                m_checkClientCert = m_cert_config.GetBoolean("CheckClientCert", m_checkClientCert);
                m_cacertFilename  = m_cert_config.GetString("CACertFilename", m_cacertFilename);
                m_clcrlFilename   = m_cert_config.GetString("ClientCrlFilename", m_clcrlFilename);
                //
                if (m_checkClientCert && m_cacertFilename != "")
                {
                    m_certVerify.SetPrivateCA(m_cacertFilename);
                    m_log.Info("[MONEY SERVER]: ReadIniConfig: Execute Authentication of Clients. CA  file is " + m_cacertFilename);
                }
                else
                {
                    m_checkClientCert = false;
                }

                if (m_checkClientCert)
                {
                    if (m_clcrlFilename != "")
                    {
                        m_certVerify.SetPrivateCRL(m_clcrlFilename);
                        m_log.Info("[MONEY SERVER]: ReadIniConfig: Execute Authentication of Clients. CRL file is " + m_clcrlFilename);
                    }
                }
            }

            catch (Exception) {
                m_log.Error("[MONEY SERVER]: ReadIniConfig: Fail to setup configure. Please check MoneyServer.ini. Exit");
                Environment.Exit(1);
            }
        }
		protected void ReadIniConfig()
		{
			MoneyServerConfigSource moneyConfig = new MoneyServerConfigSource();

			IConfig s_config = moneyConfig.m_config.Configs["Startup"];
			string PIDFile = s_config.GetString("PIDFile", "");
			if (PIDFile!="") Create_PIDFile(PIDFile);

			IConfig db_config = moneyConfig.m_config.Configs["MySql"];
			string hostname = db_config.GetString("hostname", "localhost");
			string database = db_config.GetString("database", "OpenSim");
			string username = db_config.GetString("username", "root");
			string password = db_config.GetString("password", "password");
			string pooling 	= db_config.GetString("pooling",  "false");
			string port 	= db_config.GetString("port", 	  "3306");
			MAX_DB_CONNECTION = db_config.GetInt("MaxConnection", 10);
			connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" +
										   username + ";Password="******";Pooling=" + pooling + ";";

			m_config = moneyConfig.m_config.Configs["MoneyServer"];
			DEAD_TIME = m_config.GetInt("ExpiredTime", 120);
		}