Koozali.org: home of the SME Server

webmail and different domains

Offline calisun

  • *
  • 620
  • +0/-1
webmail and different domains
« on: March 12, 2008, 07:57:57 AM »
I have several domains on my server, my question is, is there  way to setup the server so webmail would be accessible only from certain domains.
ie. right now if I go to domainA/webmail and domainB/webmail I get horde log on  screen in both cases.
What I want is domainA/webmail I get Horde log on screen, but domainB/webmail I get nothing or error message.
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: webmail and different domains
« Reply #1 on: March 12, 2008, 01:29:30 PM »
What I want is domainA/webmail I get Horde log on screen, but domainB/webmail I get nothing or error message.

That can be done with custom templates, but IMO would be pointless.

Offline calisun

  • *
  • 620
  • +0/-1
Re: webmail and different domains
« Reply #2 on: March 12, 2008, 07:59:43 PM »
Thanks Charlie,
Do you or someone be able to show me how to setup custom template to do this. I have no idea how to set one up.
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: webmail and different domains
« Reply #3 on: March 12, 2008, 09:06:08 PM »
Do you or someone be able to show me how to setup custom template to do this.

I simply wouldn't bother. webmail is accessible - why do you care how many different URLs can be used to access it?

Offline calisun

  • *
  • 620
  • +0/-1
Re: webmail and different domains
« Reply #4 on: March 13, 2008, 05:42:05 AM »
I have couple domains that have a lot of daily traffic (several thousand hits a day) people being people, they will poke around, so I don't want to give them any reason to poke around. I know that I have very secure passwords and they can't get in, but why give them temptation.
Besides, bandwidth is not cheap and all the poking around uses up bites that cost me money.
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline calisun

  • *
  • 620
  • +0/-1
Re: webmail and different domains
« Reply #5 on: March 14, 2008, 08:10:58 AM »
Does anybody know how to setup custom template to do this?
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: webmail and different domains
« Reply #6 on: March 14, 2008, 09:51:58 AM »
Does anybody know how to setup custom template to do this?
  • Create the template tree:

    mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/

  • Copy the template fragment we want to overwrite:

    cp /etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/30WebmailAliases \ /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/

  • Change the following section in the copy (/etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/30WebmailAliases) using your favorite editor (I use nano mostly):

        foreach $place ('webmail','horde')
        {
            if (($port eq "80") && ($haveSSL eq 'yes') && ($webmailAccessType eq 'SSL'))
            {
                $OUT .= "    RewriteRule ^/$place(/.*|\$)    https://%{HTTP_HOST}/$place\$1 [L,R]\n";
            } else {
                $OUT .= "    Alias       /$place   $dirs{$place}\n";
            }
        }


    to

        if ($virtualHost eq 'domain1.cc') {

            foreach $place ('webmail','horde')
            {
                if (($port eq "80") && ($haveSSL eq 'yes') && ($webmailAccessType eq 'SSL'))
                {
                    $OUT .= "    RewriteRule ^/$place(/.*|\$)    https://%{HTTP_HOST}/$place\$1 [L,R]\n";
                } else {
                    $OUT .= "    Alias       /$place   $dirs{$place}\n";
                }

            }

        }


    If you want multiple domains you can modify the first line of above fragment to read something like this:

    if ( ($virtualHost eq 'domain1.cc') || ($virtualHost eq 'domain2.cc') ){

  • After that regenerate the configuration file:

    expand-template /etc/httpd/conf/httpd.conf

  • And restart your webserver:

    sv t httpd-e-smith


Above should result in a 404 error when trying to access webmail for a domain where is is not enabled.

Disclaimer: This is written down from the top of my head and is untested.

If you run in to troubles remove the modified template fragment (created in step 2) and re-run steps 4 and 5. This should reset your configuration to the working order it was in before making the modifications.
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline calisun

  • *
  • 620
  • +0/-1
Re: webmail and different domains
« Reply #7 on: March 14, 2008, 05:43:18 PM »
Thank you very much Cactus.
I will report back with results after I attempt this over the weekend.
SME user and community member since 2005.
Want to install Wordpress in iBay of SME Server?
See my step-by-step How-To wiki here:
http://wiki.contribs.org/Wordpress_Multisite