PDA

View Full Version : Domain with numbers unable to create users


ppettigrew
3rd August 2006, 10:13
Hi,

Sorry to be coming back to the forum with an issue - we are such grateful users of this wonderful application.

We are unable to create a user in ISPConfig, for a domain that starts in a number. Ie:

domain name = 12thman.com.au
User prefix = [DOMAIN]_
desired user email = info@12thman.com.au
This should result in a username = 12thman.com.au_info

However, when trying to add the user we are getting the following ISPConfig error.....
Field: Username
The user name has to contain a minimum of 4 and a maximum of 32 letters or figures and has to begin with a letter.

Is there any way we can achieve the use of a domain that starts with a digit, without making a global change to the User prefix setting?

Many thanks for your ideas on how to resolve this issue.

Cheers,

Paul

falko
4th August 2006, 13:56
I don't know if this works today, but a few years ago Linux didn't allow user names that started with a digit... That's why we have this restriction in ISPConfig.
You can try to add a user that begins with a digit with the useradd command for testing purposes. Please make sure you give that user a user ID below 10000 (otherwise it will conflict with your ISPConfig users).

ppettigrew
5th August 2006, 14:14
Hi Falko,

Great to receive your reply, thank you.

Yes, our FC4 server can happily create the user with the adduser command.

Would it be possible for us to disable the numeric prefix check/constraint ISPConfig uses (as it is not necessary on this distro)? If so, which file do we need to change?

With many thanks,

Paul

falko
6th August 2006, 14:59
If so, which file do we need to change?

Have a look at /home/admispconfig/ispconfig/lib/plugins/isp_username.plugin.php.

ppettigrew
8th August 2006, 08:22
Thanks Falko - we are all fixed :-)

Please find below our MINI-HOWTO to help others that may search this forum looking for the solution.....
-----------------------------------------------------
HOWTO - Enabling numeric prefix on usernames in ISPConfig (as at Version 2.2.5)
-----------------------------------------------------
Target settings:
domain name = 13thbloke.com.au
User prefix = [DOMAIN]_
desired user email = info@13thbloke.com.au
This should result in a username = 13thbloke.com.au_info

Issue:
When trying to add the user will get the following ISPConfig error.....
Field: Username
The user name has to contain a minimum of 4 and a maximum of 32 letters
or figures and has to begin with a letter.

Workaround:
# cp /home/admispconfig/ispconfig/lib/plugins/isp_username.plugin.php /home/admispconfig/ispconfig/lib/plugins/isp_username.plugin.php-ORIGINAL
# vi /home/admispconfig/ispconfig/lib/plugins/isp_username.plugin.php

Find the following line:
if(!preg_match("/^[a-z][\w\.\-\_]{3,64}$/",$user_prefix . $username)) {
$go_api->db->query("DELETE from isp_isp_user where doc_id = '$doc_id'");

And change it to:
if(!preg_match("/^[a-zA-Z0-9][\w\.\-\_]{3,64}$/",$user_prefix . $username)) {
$go_api->db->query("DELETE from isp_isp_user where doc_id = '$doc_id'");

Done :-)

PS: You will probably need to make this change each time ISPConfig is upgraded, until
the functionality is included into the base package (assumes UNIX system of choice will
allow numeric prefix as Fedora does).

datayoung
29th August 2006, 06:23
Thanks ppettigrew,

Can I add @ in your updated code like this for let user
from 13thbloke.com.au_info to info@13thbloke.com.au

by

if(!preg_match("/^[a-z][\w\.\-\_\@]{3,64}$/",$user_prefix . $username)) {
$go_api->db->query("DELETE from isp_isp_user where doc_id = '$doc_id'");


Find the following line:
if(!preg_match("/^[a-z][\w\.\-\_]{3,64}$/",$user_prefix . $username)) {
$go_api->db->query("DELETE from isp_isp_user where doc_id = '$doc_id'");

And change it to:
if(!preg_match("/^[a-zA-Z0-9][\w\.\-\_]{3,64}$/",$user_prefix . $username)) {
$go_api->db->query("DELETE from isp_isp_user where doc_id = '$doc_id'");

I not test yet,anyone have comment for this
I don't know reason of ispconfig:rolleyes: to unaccept @ in username format

I test add user by hand into my Ubutu 6.061 Server ,it is no problem from username@xxxxx format

till
29th August 2006, 08:53
Can I add @ in your updated code like this for let user
from 13thbloke.com.au_info to info@13thbloke.com.au

No, because linux system user accounts may not contain a @ sign.