Roundcube Community Forum

 

remove the server list dropdown during log in/ authentication time

Started by albunix, August 27, 2009, 12:37:26 PM

Previous topic - Next topic

albunix

Greetings Folks,

i would like to ask your assistance in the following.  We would like to deploy RoundCube for a small hosting company.  The root requirement would be the following.

A client should only specify their email address & password at the login prompt.
No underlying mail server should be specified, and the authentication should work as such.

If their domain name for example  roundcubeuser.com has a valid CNAME such as  mail.roundcubeuser.com which maps back to one of the 7 mail server IP's which we run, than the user should be allowed to AUTHENTICATE properly.  Otherwise the user should be denied login.  

The requirement is such as we don't want users logging in while not being hosted by us, but also we would want to avoid the dreaded drop down list of allowed mail servers.  While a technically driven person would know and remember their mail server name, a generic user generally does not.

We've been able to edit such login pages on both Horde & Atmail and currently would like to extend this on RoundCube.

We are planning to retire Atmail and replace it with RoundCube by the end of the year.


Please advise with hints on what file needs editing etc.

Thanks for your help.

Jason_Bassford

#1
You should be able to just configure a default host in config/main.inc.php:

Quote// the mail host chosen to perform the log-in
// leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
$rcmail_config['default_host'] = 'mail.roundcubeuser.com';
Of course, if each user might have a different mail server - I don't see how it would be possible to set this up in a way other than prompting them.  Unless, perhaps, you somehow direct individual users (in some manner) to different RoundCube installations that each use their own hardcoded mail host entries.

rosali

Look here: dnsbl.php - myroundcube - Project Hosting on Google Code

The function "dnsbl_blacklisted" detects if a user is blacklisted. You could use this as framework for your purpose. To detect the cname use on window "nslookup -type=cname ..." or on *nix "checkdnsrr".

If the cname matches your criterias set "default_host" accordingly, if not set the "default_host" to localhost and "auto_create_user" to false to prevent logins.

Insert your code for this purpose in main.inc.php. Starting with v0.3RC1 you could also write a plugin.

Enough hints?
Regards,
Rosali

albunix

Greetings Rosali,

I am not a coder and it seems way over my head, but yes
it seems as a good start.  That's for your hint.

I think it's easier to just create a helper function to
provide clients with the mail server name they reside
rather than rolling up the sleeves for such work.

Thanks

albunix

Greetings Rosali,

I think I've stated the question in a way to complicate things.

What I really am interested into knowing is a method so that a user
simply enters

[email protected]
password

and RoundCube handles the rest such as

1)mail server to be mail.domainname.com
2)handles the smtp server which is also mail.domainname.com

Currently we've got #2 working fine.  All we need is an "official" method rather than a dirty hack of how to edit  'main.inc.php' to allow for such.

I am sure you can advise on this with your eyes closed.

Thanks

rosali

in main.inc.php:


$tempDomain = array_reverse(explode(".",$_SERVER['HTTP_HOST']));
$tempDomain = $tempDomain[1].".".$tempDomain[0];
// now $tempDomain holds the domain and can be used for configuration
//... see the following examples
$rcmail_config['username_domain'] = $tempDomain; // to allow login without domain part
$rcmail_config['default_host'] = "mail.".$tempDomain; // to define the imap host
$rcmail_config['smtp_server'] = "smtp.".$tempDomain; // to define the smtp server
$rcmail_config['smtp_helo_host'] = "smtp.".$tempDomain; // to define helo greeting
Regards,
Rosali