Skip to content

Commit 18b0d29

Browse files
authored
prohibit MariaDB-sensitive usernames (hestiacp#2757)
* prohibit MariaDB-sensitive usernames For example: we don't want anyone creating a user named "aria" which then try to make a mysql database named "log", because that would conflict with the mariadb internal database name aria_log * make CI run again (letsencrypt was down)
1 parent 39cc911 commit 18b0d29

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

bin/v-add-user

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ source_conf "$HESTIA/conf/hestia.conf"
3030

3131

3232
is_user_free() {
33+
# these names may cause issues with MariaDB/MySQL database names and should be reserved:
34+
check_sysuser=$(php -r '$reserved_names=array("aria", "aria_log", "mysql", "mysql_upgrade", "ib", "ib_buffer",
35+
"ddl", "ddl_recovery", "performance"); if(in_array(strtolower($argv[1]), $reserved_names, true)){echo implode(", ", $reserved_names);}' "$user" );
36+
if [ -n "$check_sysuser" ]; then
37+
check_result "$E_INVALID" "The user name '$user' is reserved and cannot be used. List of reserved names: $check_sysuser"
38+
return
39+
fi
3340
check_sysuser=$(cut -f 1 -d : /etc/passwd | grep "^$user$" )
3441
if [ -n "$check_sysuser" ] || [ -e "$USER_DATA" ]; then
3542
check_result "$E_EXISTS" "user $user exists"

0 commit comments

Comments
 (0)