Author Topic: remove the server list dropdown during log in/ authentication time  (Read 4701 times)

Offline albunix

  • Jr. Member
  • **
  • Posts: 11
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.

Offline Jason_Bassford

  • Jr. Member
  • **
  • Posts: 13
remove the server list dropdown during log in/ authentication time
« Reply #1 on: August 27, 2009, 02:16:36 PM »
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.
« Last Edit: August 27, 2009, 02:20:33 PM by Jason_Bassford »

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
remove the server list dropdown during log in/ authentication time
« Reply #2 on: August 28, 2009, 04:09:41 AM »
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
__________________
MyRoundcube Project (commercial)

Offline albunix

  • Jr. Member
  • **
  • Posts: 11
remove the server list dropdown during log in/ authentication time
« Reply #3 on: August 29, 2009, 03:23:06 PM »
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

Offline albunix

  • Jr. Member
  • **
  • Posts: 11
remove the server list dropdown during log in/ authentication time
« Reply #4 on: September 30, 2009, 12:20:02 PM »
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

user@domainname.com
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

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
remove the server list dropdown during log in/ authentication time
« Reply #5 on: October 02, 2009, 04:30:54 AM »
in main.inc.php:

Code: [Select]

$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
__________________
MyRoundcube Project (commercial)