Skip to content

Commit 11bd744

Browse files
committed
Disallow special characters in panel usernames
1 parent 80652bc commit 11bd744

5 files changed

Lines changed: 12 additions & 14 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cd zimbra-migration-panel
5555
sudo bash setup.sh
5656
```
5757

58-
`sudo` sizden Ubuntu kullanıcı parolanızı isteyebilir. Kurulum daha sonra panel için bir kullanıcı adı ve parola sorar. Kullanıcı adını boş bırakırsanız `admin` kullanılır. Panel parolası Ubuntu parolasından farklıdır, en az 12 karakter olmalıdır ve tarayıcıda oturum açmak için kullanılır. Parola yazılırken ekranda karakter görünmemesi normaldir. Boş, kısa veya eşleşmeyen değer girilirse kurulum kapanmadan yeniden sorar.
58+
`sudo` sizden Ubuntu kullanıcı parolanızı isteyebilir. Kurulum daha sonra panel için bir kullanıcı adı ve parola sorar. Kullanıcı adını boş bırakırsanız `admin` kullanılır; kullanıcı adı yalnızca ASCII harf ve rakam içerebilir, özel karakter kullanılamaz. Panel parolası Ubuntu parolasından farklıdır, en az 12 karakter olmalıdır ve tarayıcıda oturum açmak için kullanılır. Parola yazılırken ekranda karakter görünmemesi normaldir. Boş, kısa veya eşleşmeyen değer girilirse kurulum kapanmadan yeniden sorar.
5959

6060
`setup.sh` ilk kurulumun tamamını yürütür:
6161

@@ -197,7 +197,7 @@ cd zimbra-migration-panel
197197
sudo bash setup.sh
198198
```
199199

200-
`sudo` may ask for your Ubuntu account password. The installer then asks for a panel username and password. Leaving the username empty selects `admin`. The panel password is separate from the Ubuntu password, must be at least 12 characters long, and is used to sign in through the browser. It is normal for no characters to appear while typing a password. Empty, short, or mismatched values are requested again without terminating setup.
200+
`sudo` may ask for your Ubuntu account password. The installer then asks for a panel username and password. Leaving the username empty selects `admin`; usernames may contain only ASCII letters and numbers, with no special characters. The panel password is separate from the Ubuntu password, must be at least 12 characters long, and is used to sign in through the browser. It is normal for no characters to appear while typing a password. Empty, short, or mismatched values are requested again without terminating setup.
201201

202202
`setup.sh` performs the complete first-time installation:
203203

scripts/locales/setup.en.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ MSG_ZIMBRA_DB_UNUSED="Zimbra's embedded database is not used for security and up
1919
MSG_DATABASE_PRESERVED="Preserving the existing database and application database user."
2020
MSG_STEP_CREDENTIALS="[6/8] Creating panel credentials..."
2121
MSG_USERNAME_PROMPT="Panel username [admin]: "
22-
MSG_USERNAME_INVALID="The username may contain only letters, numbers, dots, underscores, and hyphens."
22+
MSG_USERNAME_INVALID="The username may contain only ASCII letters and numbers; special characters are not allowed."
2323
MSG_CREDENTIALS_PRESERVED="Preserving the existing panel credentials and application secrets."
2424
MSG_STEP_PERMISSIONS="[7/8] Configuring file permissions and the systemd service..."
2525
MSG_STEP_SERVICE="[8/8] Starting the service..."

scripts/locales/setup.tr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ MSG_ZIMBRA_DB_UNUSED="Zimbra'nın gömülü veritabanı güvenlik ve güncelleme
1919
MSG_DATABASE_PRESERVED="Mevcut veritabanı ve uygulama veritabanı kullanıcısı korunuyor."
2020
MSG_STEP_CREDENTIALS="[6/8] Panel kimlik bilgileri oluşturuluyor..."
2121
MSG_USERNAME_PROMPT="Panel kullanıcı adı [admin]: "
22-
MSG_USERNAME_INVALID="Kullanıcı adı yalnızca harf, rakam, nokta, alt çizgi ve tire içerebilir."
22+
MSG_USERNAME_INVALID="Kullanıcı adı yalnızca ASCII harf ve rakam içerebilir; özel karakter kullanılamaz."
2323
MSG_CREDENTIALS_PRESERVED="Mevcut panel kimlik bilgileri ve uygulama sırları korunuyor."
2424
MSG_STEP_PERMISSIONS="[7/8] Dosya izinleri ve systemd servisi ayarlanıyor..."
2525
MSG_STEP_SERVICE="[8/8] Servis başlatılıyor..."

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fi
2222
source "$SOURCE_DIR/scripts/locales/setup.${LANGUAGE_CODE}.sh"
2323

2424
valid_username() {
25-
printf '%s\n' "$1" | LC_ALL=C grep -Eq '^[A-Za-z0-9._-]+$'
25+
printf '%s\n' "$1" | LC_ALL=C grep -Eq '^[A-Za-z0-9]+$'
2626
}
2727

2828
if [[ ${1:-} == "--print-language" ]]; then

tests/test_setup_locale.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ grep -q 'CREATE USER IF NOT EXISTS' "$ROOT/setup.sh"
2121
grep -q 'HAS_EXISTING_CONFIG' "$ROOT/setup.sh"
2222
echo "Setup repeatability guards are present."
2323

24-
for VALID_USERNAME in admin Raporzen2026- user.name user_name; do
24+
for VALID_USERNAME in admin Raporzen2026 User123; do
2525
bash "$ROOT/setup.sh" --validate-username "$VALID_USERNAME"
2626
done
27-
if bash "$ROOT/setup.sh" --validate-username 'invalid user'; then
28-
echo "Invalid username was accepted." >&2
29-
exit 1
30-
fi
31-
if bash "$ROOT/setup.sh" --validate-username 'kullanıcı'; then
32-
echo "Non-ASCII username was accepted." >&2
33-
exit 1
34-
fi
27+
for INVALID_USERNAME in 'invalid user' 'Raporzen2026-' 'user.name' 'user_name' 'kullanıcı'; do
28+
if bash "$ROOT/setup.sh" --validate-username "$INVALID_USERNAME"; then
29+
echo "Invalid username was accepted: $INVALID_USERNAME" >&2
30+
exit 1
31+
fi
32+
done
3533
echo "Setup username validation tests passed."

0 commit comments

Comments
 (0)