From 2de3bbcea745053b513908b9b285e7d2ba998567 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 16 Dec 2020 00:04:39 +0900 Subject: [PATCH] Disallow installing Rhymix with the DB root account --- modules/install/install.controller.php | 6 ++++++ modules/install/lang/en.php | 1 + modules/install/lang/ko.php | 1 + 3 files changed, 8 insertions(+) diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index 558aea2fe..2ff9245e7 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -32,6 +32,12 @@ class installController extends install // Get DB config variables. $config = Context::gets('db_type', 'db_host', 'db_port', 'db_user', 'db_pass', 'db_database', 'db_prefix'); + // Disallow installation using the root account. + if (trim($config->db_user) === 'root') + { + return new BaseObject(-1, 'msg_dbroot_disallowed'); + } + // Create a temporary setting object. Rhymix\Framework\Config::set('db.master', array( 'type' => $config->db_type, diff --git a/modules/install/lang/en.php b/modules/install/lang/en.php index 52b8b31f2..840a175e2 100644 --- a/modules/install/lang/en.php +++ b/modules/install/lang/en.php @@ -87,6 +87,7 @@ $lang->msg_db_checking = 'Checking...'; $lang->msg_installing = 'Installing...'; $lang->msg_cannot_proc = 'Installation environment is not proper to proceed.'; $lang->msg_already_installed = 'Rhymix is already installed.'; +$lang->msg_dbroot_disallowed = 'Installing with the DB root account is not permitted. Please create a non-root account and use it.'; $lang->msg_dbconnect_failed = 'An error has occurred while connecting to DB. Please check DB information again.'; $lang->msg_table_is_exists = 'Table is already created in the DB. Config file is recreated.'; $lang->msg_install_completed = 'Installation has been completed. Thank you for choosing Rhymix.'; diff --git a/modules/install/lang/ko.php b/modules/install/lang/ko.php index c94a9ef99..5137fe771 100644 --- a/modules/install/lang/ko.php +++ b/modules/install/lang/ko.php @@ -86,6 +86,7 @@ $lang->success_installed = '설치가 되었습니다.'; $lang->msg_cannot_proc = '설치 환경이 갖춰지지 않아 요청을 실행할 수가 없습니다.'; $lang->msg_db_checking = '확인 중입니다...'; $lang->msg_installing = '설치 중입니다...'; +$lang->msg_dbroot_disallowed = 'DB root 계정으로 설치하는 것은 허용되지 않습니다. root가 아닌 일반 DB 계정을 생성하여 사용하시기 바랍니다.'; $lang->msg_already_installed = '이미 설치가 되어 있습니다.'; $lang->msg_dbconnect_failed = 'DB접속 오류가 발생하였습니다. DB정보를 다시 확인해주세요.'; $lang->msg_table_is_exists = '이미 DB에 테이블이 생성되어 있습니다. config 파일을 재생성하였습니다.';