mariadb-secure-installation 무엇인가?

mariadb 를 초기 설치를 하게 되면 DB를 실행 후
추가적으로 mysql_secure_installation을 실행하게 되는데

그런데 이번에 DB 업그레이드 검토를 mysql_secure_installation가 스크립트 네이밍이 변경된 것을 알게 되었다.
하이픈(-)이 가운데로 올라간 정도(?) 인지 아니면 다른 게 더 있는지
mariadb-secure-installation 스크립트에 대해 자세히 알아본다.

1. mariadb-secure-installation 란?

mariadb-secure-installation은 (MariaDB 10.4.6 or MariaDB 10.5.2) 이후부터 제공되는
mysql_secure_installation에 대한 심볼릭링크로 MariaDB 설치의 보안을 향상시키기 위한 스크립트이다.

binary 파일 확인)
[admin@test-db bin]$ ls -al mariadb-secure-installation
lrwxrwxrwx 1 mysql mysql 25 Feb 19  2021 mariadb-secure-installation -> mysql_secure_installation

2. mariadb-secure-installation 사용하는 이유

mariadb-secure-installation은 Unix system에서 사용할 수 있는 shell script로
수행시 다음과 같은 방법으로 보안을 향상시킬 수 있다.

1) root 계정의 암호를 설정할 수 있다.

ex) Change the root password? [Y/n]

2) localhost 외부에서 접근할 수 있는 root 계정을 제거할 수 있다.

ex) Disallow root login remotely? [Y/n]

3) anonymous 사용자 계정을 제거할 수 있습니다.

ex) Remove anonymous users? [Y/n]

4) anonymous 사용자가 기본적으로 액세스할 수 있는 TEST 데이터베이스를 제거할 수 있습니다.

ex) Remove test database and access to it? [Y/n]

3. mariadb-secure-installation 사용방법

옵션은 보통 –basedir 과 함께 실행한다.

ex)
./mariadb-secure-installation --basedir=/data/mariadb --socket=/tmp/mysql.sock



NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.


Enter current password for root (enter for none): 
OK, successfully used password, moving on...


Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.


You already have a root password set, so you can safely answer 'n'.


Change the root password? [Y/n] n
 ... skipping.


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.


Remove anonymous users? [Y/n] y
 ... Success!


Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.


Disallow root login remotely? [Y/n] y
 ... Success!


By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.


Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!


Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.


Reload privilege tables now? [Y/n] y
 ... Success!


Cleaning up...


All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.


Thanks for using MariaDB!

4. 확인결과

mariadb-secure-installation은 mariadb_secure_installation을 심볼릭링크로 변경한 것을 제외하고
딱히 바뀐건 없는 것으로 보인다.

끝.

참조: https://mariadb.com/kb/en/mariadb-secure-installation/

Leave a Comment