Help - Search - Members - Calendar
Full Version: HOW-TO: OpenWebmail (Ensim)
The Planet Forums > Control Panels > Ensim > Ensim HOWTOs
Pages: 1, 2
Netino
*** OpenWebmail Installation to Ensim 3.x 4.x (RedHat - any) *** Last updated: 22/Aug/2005

This is an installation of OpenWebmail to Ensim (RedHat), but these steps can be easily adapted to other boxes with very little modifications.

- Install Openwebmail

You will need the following perl modules:

CGI
MIME::Base64
libnet
Text::Iconv

Login as root.

To install it, you can use the command:

# perl -MCPAN -e 'install CGI'
# perl -MCPAN -e 'install MIME::Base64'
# perl -MCPAN -e 'install Bundle::libnet'
# perl -MCPAN -e 'install Text::Iconv'

Or (if you havenīt cpan installed):

Download the following packages (or their newer versions) and copy them to /tmp directory:
CGI.pm-2.74.tar.gz
MIME-Base64-2.12.tar.gz
libnet-1.0901.tar.gz
Text-Iconv-1.2.tar.gz

For CGI.pm do the following:

cd /tmp
tar -zxvf CGI.pm-2.74.tar.gz
cd CGI.pm-2.74
perl Makefile.PL
make
make install

For MIME-Base64 do the following:

cd /tmp
tar -zxvf MIME-Base64-2.12.tar.gz
cd MIME-Base64-2.12
perl Makefile.PL
make
make install

For libnet do the following:

cd /tmp
tar -zxvf libnet-1.0901.tar.gz
cd libnet-1.0901
perl Makefile.PL
make
make install

For Text-Iconv-1.2 do the following:

cd /tmp
tar -zxvf Text-Iconv-1.2.tar.gz
cd Text-Iconv-1.2
perl Makefile.PL
make
make test
make install

(Any problems?: see the README)

Now download and install your openwebmail software.

# cd /var/www
# wget http://openwebmail.org/openwebmail/downloa...ail-current.tgz
# tar -zxvBpf openwebmail-current.tgz

Alternatively, you can install rpm package:
# rpm -ivh http://openwebmail.com/openwebmail/downloa...2.51-1.i386.rpm
1)Check this address, or , for new versions;
2)If rpm is claiming about some dependencies in perl modules, try to install rpm versions of these perl modules, instead of install manually from cpan;
3)If upgrading, use "-Uvh" parameters to rpm, instead "-ivh".

Install auth_unix_ensim.pl file in /var/www/cgi-bin/openwebmail/ directory.
This is the heart of the Ensimīs OpenWebmail installation.
(Deprecated download for 1.x versions. although if really needed, pm me)
Download auth_unix_ensim.txt

###################
For Version 2.0+ only
###################
Was reported the howto works for version 2.0 or superior, with the installation of a different authentication file: auth_unix_ensim.v2.pl
###################

###################
For Version 2.30+ only
###################
Was reported the howto works for version 2.30 or superior, with the installation of a different authentication file: auth_unix_ensim.v2-30.pl
###################

Remember: Rename/save it to auth_unix_ensim.pl in /var/www/cgi-bin/openwebmail/ directory.

# mv data/openwebmail html
# rmdir data

# cd cgi-bin/openwebmail/etc

edit openwebmail.conf:
set mailspooldir to /var/spool/mail
ow_cgidir to /var/www/cgi-bin/openwebmail
ow_htmldir to /var/www/html/openwebmail
spellcheck to /usr/bin/aspell
auth_module to auth_unix_ensim.pl

include the following:
auth_withdomain yes
timeoffset +0800
(change the timeoffset to your taste)

OpenWebmail is feature rich, so you can change any other feature you like.

- Setup openwebmail.log rotation. (optional)

/var/log/openwebmail.log {
postrotate
/usr/bin/killall -HUP syslogd
endscript
}

to /etc/logrotate.d/syslog to enable logrotate on openwebmail.log


- Install domain files in /var/www/cgi-bin/openwebmail/etc/sites.conf
*** ATTENTION ***
In this installation, at this point your customer could until already to use Openwebmail
with no specific customization to a domain.
But the problem is the disk space will count to user 'root', group 'apache',
this is not good. The program will use the directory
/var/www/cgi-bin/openwebmail/etc/users to their folders. So, you must not
let your customer use Openwebmail without this domain file.
Comunicate them only AFTER installed this file. So, the userīs files will
be in /home/virtual/DOMAIN/home/USER directory, and the user quotas are always respected.
You need install one file DOMAIN per domain you need installed.
(The file name is *only* the domain, doesnīt append any suffix)

# cd /var/www/cgi-bin/openwebmail/etc/sites.conf

# pico DEFAULT

Copy and paste the following text:

***** Cut here (donīt include this line) *******************************
#
# Open WebMail configuration file
#
# This file contains just the overrides from openwebmail.conf.default
# please make all changes to this file.
#
# This file sets options for all domains and all users.
# To set options on per domain basis, please put them in sites.conf/domainname
# To set options on per user basis, please put them in users.conf/username
#
domainnames NEWDOMAIN
auth_module auth_unix_ensim.pl
mailspooldir /home/virtual/NEWDOMAIN/var/spool/mail
dbm_ext .db
dbmopen_ext none
dbmopen_haslock no
timeoffset +0800
ow_cgidir /var/www/cgi-bin/openwebmail
ow_cgiurl /cgi-bin/openwebmail
ow_htmldir /var/www/html/openwebmail
ow_htmlurl /openwebmail
logfile /var/log/openwebmail.log
spellcheck /usr/bin/aspell

# Virtual Space Configuration
use_homedirspools no
use_homedirfolders yes

enable_changepwd no
enable_autoreply no
enable_setforward yes
enable_setfromemail yes
getmail_from_pop3_authserver no
autopop3_at_refresh yes
auth_withdomain yes

default_language en_US
spellcheck_dictionaries english, american
default_dictionary english
default_dateformat mm/dd/yyyy
default_autoreplysubject This is an automatic response...[Re: $SUBJECT]


Hello,
I will not be reading my mail for a while.
Your mail regarding '$SUBJECT' will be read when I return.



--
Open WebMail Project (http://openwebmail.org)

***** Cut here (donīt include this line) *******************************


Define the file of your specific domain:
(obviously substitute with domain.com with the domain you want configured)

# sed -e 's/NEWDOMAIN/domain.com/g'domain.com

When you need configure more domains, you could repeat only the step above to other domains.

Use OpenWebmail
You already can access in your browser:
https://www.DOMAIN/cgi-bin/openwebmail/openwebmail.pl

Login with 'user@domain.com', and your password.

*** Optional ***
- You could create aliases in /etc/httpd/conf/siteXX for each domain.

First discover what is the site number of your domain:
(obviously substitute DOMAIN with your domain)

# sitelookup -d DOMAIN|awk -F, '{print $3;}'

This will identificate what is the string you must substitute in 'XX' part, in siteXX:
(Check before if you donīt already have a file /etc/httpd/conf/siteXX/webmail)
echo "Redirect /webmail https://www.DOMAIN/cgi-bin/openwebmail/openwebmail.pl">>/etc/httpd/conf/siteXX/webmail

Restart httpd:

# service httpd restart

Use OpenWebmail
You already can access in your browser:
http://www.domain.com/webmail

You will redirected to:
https://www.DOMAIN/cgi-bin/openwebmail/openwebmail.pl

Login with 'user@domain.com', and your password.

Note:
This really will redirect to default cgi-bin directory installation,
as in "https://IP_ADDRESS/cgi-bin/openwebmail/openwebmail.pl", if DOMAIN have
none certificate installed. If you need to use a different certificate, other than
localhost.localdomain cert to a domain, you need to create a ScriptAlias directive
to '/var/www/cgi-bin/openwebmail' directory in apache in your domain configuration.

# echo "ScriptAlias /var/www/cgi-bin/webmail/ /var/www/cgi-bin/openwebmail/">>/etc/httpd/conf/siteXX/webmail

In this case (only), then you need create the redirect:

# echo "Redirect /webmail https://www.DOMAIN/cgi-bin/webmail/openwebmail.pl">>/etc/httpd/conf/siteXX/webmail


Benefits of install OpenWebmail:
-Many people think itīs better than Squirrelmail;
-Possible to only one installation globally on the server (localdomain.localhost cert)
-Saves the 9MB of Squirrelmail, per domain.
-Apropriates the disk space used to userīs quota
-Secure access via https for all
-Donīt affect Imap server
-Many language translations
-Work with speedycgi for better performance

Regards,
Netino
inquisitive
Nice icon_smile.gif...did anyone tried the how to ?
maxihost
netino,

where is the auth_unix_ensim.pl to download ?
it is not attached like you said, I need that o install the openwebmail, please :-/

thanks.
Netino
Sorry, attachment not working.

I think could be a problem on this board program, because the file was attached, but is not showed.

So, download from the following link.

Netino
maxihost
netino,

I am almost there !

Iīve installed all the things properly and I got it running: https://www.mh47.net/cgi-bin/openwebmail/op...openwebmail.cgi

The only problem is that when I log in I get 3 error messages:

-------------------------------------------------------------------------------
Software error:
Can't locate Text/Iconv.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /var/www/cgi-bin/openwebmail .) at /var/www/cgi-bin/openwebmail/iconv.pl line 7.

For help, please send mail to the webmaster (root@ensim.mh47.net), giving this error message and the time and date of the error. Content-type: text/html

Software error:
[Thu Jan 23 14:11:42 2003] openwebmail-prefs.pl: Can't locate Text/Iconv.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /var/www/cgi-bin/openwebmail .) at /var/www/cgi-bin/openwebmail/iconv.pl line 7.
BEGIN failed--compilation aborted at /var/www/cgi-bin/openwebmail/iconv.pl line 7.

For help, please send mail to the webmaster (root@ensim.mh47.net), giving this error message and the time and date of the error. Content-type: text/html

Software error:
[Thu Jan 23 14:11:42 2003] openwebmail-prefs.pl: [Thu Jan 23 14:11:42 2003] openwebmail-prefs.pl: Can't locate Text/Iconv.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl /var/www/cgi-bin/openwebmail .) at /var/www/cgi-bin/openwebmail/iconv.pl line 7.
[Thu Jan 23 14:11:42 2003] openwebmail-prefs.pl: BEGIN failed--compilation aborted at /var/www/cgi-bin/openwebmail/iconv.pl line 7.
Compilation failed in require.

For help, please send mail to the webmaster (root@ensim.mh47.net), giving this error message and the time and date of the error.
-------------------------------------------------------------------------------

any ideas ? :/
webbcite
Install Text::Iconv perl module. Search for it on cpan.org and install.
maxihost
finally working fine now :-)

how do I set up to automatically install openwebmail when new site is configured on ensim GUI ?
Netino
Thanks webbcite, about Text-Iconv.

When I post, was version 1.71. The new version 1.81, strongly recommended due to a vulnerability in 1.71, needs Text-Iconv installed. I already correct the Howto.

Regards,
Netino
maxihost
just a little fix here

when you install openwebmail, the system tries to find the en_US directory and do give some errors when installed

so, do the following after installed openwebmail:

cd /var/www/cgi-bin/openwebmail/etc/templates/
cp -R en en_US

and

cd /var/www/cgi-bin/openwebmail/etc/lang
cp -R en en_US

this should fix the errors.
mr ouija
If I wanted to do an install of a different webmail client for just 1 site, could I use this? Currently, I have setup Squirrelmail 1.2.10 centrally. What I would like to do, is use Squirrelmail for all the regular user sites, and openwebmail for one particular site.

Thanks!
Marc
Matt_01
anybody got a demo ?
feijao
Hi,

I've installed it and i can access the login page, but after submiting my info I get the Internal Server Error...


I get this errors on error log:

Undefined subroutine &openwebmail::auth_unix_ensim::get_userinfo called at /var/www/cgi-bin/openwebmail/ow-shared.pl line 693.
[Tue Mar 25 19:27:37 2003] [error] [client 81.84.111.10] Premature end of script headers: /var/www/cgi-bin/openwebmail/openwebmail.pl


Very strange no?
gpan
check your error_log and suexec_log files.
feijao
My error log shows the error on my last message.
su_exec.log doesn't show anything...

My Openwebmail version is 1.9 and the HOWTO looks to be to 1.7.
I think could be it, but how can i be shore without uninstalling/re-installing it?

any idea?

thkns
New2Linux
Can anyone help with the new 2.00 version of OpenWebMail?

I used 1.90 version and modified it to use SpeedyCGI like it saids to do it and it works well with the Auth_ensim.pl file. but, 2.00 doesn't want to work. i keep getting a Internal Server Error when it tryies to use Auth_ensim.pl. if i tell it to use the original Auth_unix.pl it works fine. Can anyone help me.:confused:
madsere
QUOTE
Originally posted by Matt_01
anybody got a demo ?


http://openwebmail.com/about/
New2Linux
QUOTE
Originally posted by New2Linux
Can anyone help with the new 2.00 version of OpenWebMail?

I used 1.90 version and modified it to use SpeedyCGI like it saids to do it and it works well with the Auth_ensim.pl file. but, 2.00 doesn't want to work. i keep getting a Internal Server Error when it tryies to use Auth_ensim.pl. if i tell it to use the original Auth_unix.pl it works fine. Can anyone help me.:confused:


Has anyone else run into this problem?
Please help me i am a linux newbie icon_biggrin.gif
vexmedia
anyone come up with a solution for the 2.0 openwebmail on ensim?

icon_smile.gif

any help would be greatly appreciated.
New2Linux
Hey vexmedia
any idea what could be the problem?
vexmedia
i'm assuming its something to do with the auth_unix_ensim.pl file
deVisie
I'm having the same problems as feijao.
Same errors, no idea how to solve them. I did everything as descriped in this thread.
New2Linux
The problem is due to OpenWebmail being rewritten for Speedy CGI and the old Ensim_Auth.pl module was not. i wish i knew how to program perl but i am too stupid to learn icon_biggrin.gif

can anyone help us poor guys? icon_razz.gif
zerilnet
Hi,

I'm just installing Openwebmail 1.9 in my server. It work great. Even better than IMP.

The only problem is I have to set configuration file for each domain one by one.

Is it possible to just make one config file for all domain?

I've look at openwebmail.conf.default, but don't know how to substitute each domain path to make it global.

Thank you.
Duke
Netino
QUOTE
Originally posted by zerilnet
Hi,

I'm just installing Openwebmail 1.9 in my server. It work great. Even better than IMP.  

The only problem is I have to set configuration file for each domain one by one.

Is it possible to just make one config file for all domain?  

I've look at openwebmail.conf.default, but don't know how to substitute each domain path to make it global.

Thank you.
Duke


I do not try still, but you already tried the HTTP apache variables?
In this example, could be HTTP_HOST coult give the domain.

Netino
bluecrow76
Just wanted to let those interested know, I got OpenWebmail version 1.90 installed, configured and working wonderfully on my new server! Thanks for the great HOWTO!

I had tried OpenWebmail 2.01 first, and had problems with auth_unix_ensim.pl. It worked just fine with version 1.90.
New2Linux
Dear Programmers,

I have being keeping up with OpenWebmail.org progress and would love to be able to use it on my server. I beleive that the problem started when 2.0 came out using Speedy CGI code. the old "auth_unix_ensim.pl" file was written in regular perl code.

can anyone help fix this file so that we can start using OpenWebMail.org on our server. i am not to rich (I just started to offer hosting to my customers and olny have about 9 domains) but i can try to pay to get the file fix. please email me for more information. I can pay using PayPal.

PS: If anyone else can help with paying a programmer to fix this file, please let me know so we can setup a collection to pay with.

Thanks guys,
Daniel Chitiva
DnA Web Designs
danny@yourdnaonline.com
www.YourDnAOnline.com

John 3:16
MJT
An authentication module for Open Webmail 2.01 is attached (if attachments work). There are a number of changes to the format of authentication module for version 2 mostly related to the addition of error messages and return codes.

Thanks to New2Linux for giving it a try on Ensim Pro
MJT
Looks like attachments are a loser - here's the code

CODE
package openwebmail::auth_unix_ensim;

use strict;

#

# auth_unix_ensim.pl - authenticate user with unix password

#

# 2003/04/25 [email]tung@turtle.ee.ncku.edu.tw[/email]

# 2003/04/25 [email]tchung@openwebmail.org[/email]

# 2003/06/13 mterry - converted auth_unix.pl to auth_unix_ensim.pl

#

# $unix_passwdfile_plaintext : the plaintext file containing all usernames

#                              and related uid, gid, homedir, shell info.

#                              The deault is /etc/passwd on most unix systems.

#

# $unix_passwdfile_encrypted : the file containing all usernames and

#                              their corresponding encrypted passwords.

# ------------------------------   --------------------------------

# platform                         passwdfile encrypted

# ------------------------------   --------------------------------

# Shadow Passwd (linux/solaris)    /etc/shadow

# FreeBSD                          /etc/master.passwd

# Mac OS X                         /usr/bin/nidump passwd .|

# NIS/YP                           /usr/bin/ypcat passwd|

# NIS+                             /usr/bin/niscat passwd.org_dir|

# else...                          /etc/passwd

# ------------------------------   --------------------------------

#

# $unix_passwdmkdb : The command executed after any password modification

#                    to update the changes of passwdfile to passwd database.

# ------------------------------   --------------------------------

# platform                         passwd mkdb command

# ------------------------------   --------------------------------

# Free/Net/OpenBSD                 /usr/sbin/pwd_mkdb

# Linux/Solaris                    none

# else...                          none

# ------------------------------   --------------------------------

#

# $check_shell : whether to check if the user's shell is listed in /etc/shells.

#



my $unix_passwdfile_plaintext="";

my $unix_passwdfile_encrypted="";

my $unix_passwdmkdb="none";

my $check_shell=0;



################### No configuration required from here ###################



use Fcntl qw(:DEFAULT :flock);

require "filelock.pl";



#  0 : ok

# -2 : parameter format error

# -3 : authentication system/internal error

# -4 : user doesn't exist

sub get_userinfo {

  my ($r_config)=@_;

  my ($user, $virtdomain) = split( /@/, $_[1] );

  my ($uid, $gid, $realname, $homedir);



  return(-2, 'User is null') if (!$user);



  # configure the corrected password file paths

  $unix_passwdfile_plaintext = "/home/virtual/$virtdomain/etc/passwd";

  $unix_passwdfile_encrypted = "/home/virtual/$virtdomain/etc/shadow";



  if ($unix_passwdfile_plaintext eq "/etc/passwd") {

     ($uid, $gid, $realname, $homedir)= (getpwnam($user))[2,3,6,7];

  } else {

     if ($unix_passwdfile_plaintext=~/|/) { # maybe NIS, try getpwnam first

        ($uid, $gid, $realname, $homedir)= (getpwnam($user))[2,3,6,7];

     }

     if ($uid eq "") { # else, open file directly

        ($uid, $gid, $realname, $homedir)= (getpwnam_file($user, $unix_passwdfile_plaintext))[2,3,6,7];

     }

  }

  return(-4, "User $user doesn't exist") if ($uid eq "");



  # correct the home directory for ensim users

  $homedir = "/home/virtual/$virtdomain$homedir";



  # use first field only

  $realname=(split(/,/, $realname))[0];

  # guess real homedir under sun's automounter

  if ($uid) {

     $homedir="/export$homedir" if (-d "/export$homedir");

  }

  return(0, "", $realname, $uid, $gid, $homedir);

}





#  0 : ok

# -1 : function not supported

# -3 : authentication system/internal error

sub get_userlist {    # only used by openwebmail-tool.pl -a

  my $r_config=$_[0];



  my @userlist=();

  my $line;



  # a file should be locked only if it is local accessable

  if ( -f $unix_passwdfile_plaintext) {

     filelock("$unix_passwdfile_plaintext", LOCK_SH) or

        return (-3, "Couldn't get read lock on $unix_passwdfile_plaintext", @userlist);

  }

  open(PASSWD, $unix_passwdfile_plaintext);

  while (defined($line=<PASSWD>)) {

     next if ($line=~/^#/);

     chomp($line);

     push(@userlist, (split(/:/, $line))[0]);

  }

  close(PASSWD);

  filelock("$unix_passwdfile_plaintext", LOCK_UN) if ( -f $unix_passwdfile_plaintext);

  return(0, "", @userlist);

}





#  0 : ok

# -2 : parameter format error

# -3 : authentication system/internal error

# -4 : password incorrect

sub check_userpassword {

  my ($r_config, $fulluser, $password)=@_;

  my ($user,$virtdomain) = split( /@/,$fulluser );



  return (-2, "User or password is null") if (!$user||!$password);



  # a file should be locked only if it is local accessable

  if ( -f $unix_passwdfile_encrypted) {

     filelock("$unix_passwdfile_encrypted", LOCK_SH) or

        return (-3, "Couldn't get read lock on $unix_passwdfile_encrypted");

  }

  if ( ! open (PASSWD, "$unix_passwdfile_encrypted") ) {

     filelock("$unix_passwdfile_encrypted", LOCK_UN) if ( -f $unix_passwdfile_encrypted);

     return (-3, "Couldn't open $unix_passwdfile_encrypted");

  }

  my ($line, $u, $p);

  while (defined($line=<PASSWD>)) {

     chomp($line);

     ($u, $p) = (split(/:/, $line))[0,1];

     last if ($u eq $user); # We've found the user in /etc/passwd

  }

  close (PASSWD);

  filelock("$unix_passwdfile_encrypted", LOCK_UN) if ( -f $unix_passwdfile_encrypted);



  return(-4, "User $user doesn't exist") if ($u ne $user);

  return(-4, "Password incorrect") if (crypt($password,$p) ne $p);

  return (0, "") if (!$check_shell);



  my ($name, $shell);

  if ($unix_passwdfile_plaintext eq "/etc/passwd") {

     $shell = (getpwnam($user))[8];

  } else {

     if ($unix_passwdfile_plaintext=~/|/) { # maybe NIS, try getpwnam first

        ($name, $shell)= (getpwnam($user))[0,8];

     }

     if ($name eq "") { # else, open file directly

        ($name, $shell) = (getpwnam_file($user, $unix_passwdfile_plaintext))[0,8];

     }

  }

  if ($shell && open(ES, "/etc/shells")) {

     my $validshell = 0;   # assume an invalid shell until we get a match

     while(<ES>) {

        chop;

        if( $shell eq $_ ) {

           $validshell = 1; last;

        }

     }

     close(ES);

     return (-4, "user doesn't have valid shell") if (!$validshell);

  }

  return (0, "");

}





#  0 : ok

# -1 : function not supported

# -2 : parameter format error

# -3 : authentication system/internal error

# -4 : password incorrect

sub change_userpassword {

  return (-1,"Function not supported");

}





################### misc support routine ###################

# use flock since what we modify here are local system files

sub filelock () {

  return(openwebmail::filelock::flock_lock(@_));

}



# this routie is slower than system getpwnam() but can work with file

# other than /etc/passwd. ps: it always return '*' for passwd field.

sub getpwnam_file {

  my ($user, $passwdfile_plaintext)=@_;

  my ($name, $passwd, $uid, $gid, $gcos, $dir, $shell);



  return("", "", "", "", "", "", "", "", "") if ($user eq "");



  open(PASSWD, "$passwdfile_plaintext");

  while(<PASSWD>) {

     next if (/^#/);

     chomp;

     ($name, $passwd, $uid, $gid, $gcos, $dir, $shell)=split(/:/);

     last if ($name eq $user);

  }

  close(PASSWD);



  if ($name eq $user) {

     return($name, "*", $uid, $gid, 0, "", $gcos, $dir, $shell);

  } else {

     return("", "", "", "", "", "", "", "", "");

  }

}



1;
New2Linux
Thanks to the GREAT MJT icon_biggrin.gif




He D Man


icon_biggrin.gif
feijao
Great HOWTO!
Nice contribuition to OWB 2.10!

Here is my contribution:

If anyone needs to create configuration files to all domains, just execute this script:

----------

#! /bin/sh
# Script written by Paulo Cardoso

DOMAINS=`/usr/local/bin/sitelookup -a domain`
SITERETVAL=$?
cd /var/www/cgi-bin/openwebmail/etc/sites.conf
if [ $SITERETVAL -eq 0 ]; then
for DOMAIN in $DOMAINS
do
sed -e 's/NEWDOMAIN/'$DOMAIN'/g'$DOMAIN
#->Optional!
# To redirect a site from www.domain.com/email to openwebmail
# just uncoment the next lines and change 'email' for whatever
# you want and SERVER for server IP or domain:

SITE=`/usr/local/bin/sitelookup -d $DOMAIN site_handle`
echo "Redirect /openwebmail https://www.SERVER/cgi-bin/openwebmail/openwebmail.pl">>/etc/httpd/conf/$SITE/00openwebmail

done
fi


----------

If you want to automate new account configurations just do this:

cd /etc/appliance/customization/
pico -w virtDomain.sh
write this on the end of the file:

DOMAIN=$1
sed -e 's/NEWDOMAIN/'$1'/g'/var/www/cgi-bin/openwebmail/etc/sites.conf/$1
SITE=`/usr/local/bin/sitelookup -d $DOMAIN site_handle`
echo "Redirect /openwebmail https://www.SERVER/cgi-bin/openwebmail/openwebmail.pl">>/etc/httpd/conf/$SITE/00openwebmail
RackShark
feijao
can you creat a Script to add an alias like /email for all domains to redirect https://www.Domainame.com/email to https://www.DomaiName.com/cgi-bin/openwebma.../openwebmail.pl

thank you.
feijao
I've edited the script and i think that should work now. I haven't tested it yet.

After that you just have to restart httpd for the redirect to work.
If you prefer you can change the https: to http:

Nice avatar icon_wink.gif .
RackShark
hi feijao
thank you for your time,

the script didn't work, it gave:
error: domain $DOMAIN does not exist
error: domain $DOMAIN does not exist
error: domain $DOMAIN does not exist
etc....

QUOTE
echo "Redirect /mail https://www.SERVER/cgi-bin/openwebmail/openwebmail.pl">>/etc/httpd/conf/$SITE/00openwebmail


it would be perfect if it Redirect to https://www.DomainofClient.com/cgi-bin/openwebmail/openwebmail.pl rather than server ip.

i got the avatar from here
icon_biggrin.gif
feijao
Fixed. icon_smile.gif Sory but i hadn't tested it.


You may change SERVER for the server domain and the users will redirected to there.
RackShark
the script is perfect.
i changed SERVER to $DOMAIN too.
obrigado feijao
icon_wink.gif
RackShark
i found a problem with this openwebmail.

it doesn't work with other ips in the server, just the primary ip.
Netino
QUOTE
Originally posted by RackShark
i found a problem with this openwebmail.

it doesn't work with other ips in the server, just the primary ip.


The problem is not related to ipīs, but to digital certificates, as explained in howto.
If you have another certificate installed in another domain, it will not point to the shared root, but to the own domainīs root.

In this case, you will need to install OpenWebmail for that own domain.

I have several ipīs, all of them working normally with OpenWebmail.

Regards,

Netino
biolight
Weeeell, due to everybody's absolutely fabulous efforts, and a lucking post to the mailing list (whoever mentioned that they found the solution to the ensim problem in the user mailing lists, you are the freekin' man!), I've gotten everything installed.

A couple of nasty tricks. First, the file posted in this forum doesn't work with the latest build. It gives a boatload of errors about line 47 in the auth_unix_ensim.pl file (check it out):

CODE
Software error:

Can't continue after import errors at /var/www/cgi-bin/openwebmail/auth_unix_ensim.pl line 47

BEGIN failed--compilation aborted at /var/www/cgi-bin/openwebmail/auth_unix_ensim.pl line 47.



For help, please send mail to the webmaster (webmaster@servesite.net), giving this error message and the time and date of the error.



Content-type: text/html

Software error:

[Sun Jul 13 05:25:49 2003] openwebmail.pl: Can't continue after import errors at /var/www/cgi-bin/openwebmail/auth_unix_ensim.pl line 47

[Sun Jul 13 05:25:49 2003] openwebmail.pl: BEGIN failed--compilation aborted at /var/www/cgi-bin/openwebmail/auth_unix_ensim.pl line 47.

Compilation failed in require at /var/www/cgi-bin/openwebmail/ow-shared.pl line 699.



For help, please send mail to the webmaster (webmaster@servesite.net), giving this error message and the time and date of the error.


That's so annoying. So, the answer was found in another thread...

http://www.bluecrow.net/files/auth_unix_ensim.v2.pl

This file contains (for posterity, you know how sometimes these files dissapear):

(I've got to split the post... it's too long)
biolight
CODE
package openwebmail::auth_unix_ensim;

use strict;

#

# auth_unix_ensim.pl -  authenticate user with unix password and check

#                       if user is valid under the host

#

# Version 1.16 Jun 26, 2003 UNOFFICIAL RELEASE

# Update by [email]mitch@bluecrow.net[/email]

# Added support for versions of OpenWebMail greater than 1.90

# THIS VERSION WILL NOT WORK WITH OPENWEBMAIL VERSIONS LESS THAN 2!!!

# I have only tested it under OPENWEBMAIL version 2.10.

#

# In OWM version 2 (greater than 1.90), an additional parameter was passed

# to the functions in ALL of the authentication modules.  This parameter

# is designated as $r_config in the documentation.  It is a HASH

# containing the configuration of OWM.  The fix was to change the $user

# and other assignment statements from =@_[0] to =@_[1], or whatever the

# number just increment by 1.

#

# The other problem that I ran into was there were numberous calls to

# a function filelock in auth_unix_ensim.pl and the compiler complained

# that that function could not be found.  The calls to filelock were

# changed to calls to flock.

#

# I tested it out as far as logging in is concerened, but have not tested

# the change password function.  I have disabled it as I don't really want

# to use it.

#

# This is my first whack at Perl, so I'm sure the fix could be better.

#

# TODO: update the script so that it can be used with any version of

# OpenWebMail.  To do this, the script needs to detect if @_[0] is a

# HASH.  If it is not, it is a version <2.  If it is, the version is

# greater than 1.90.

#

# Version 1.15 Aug 6, 2002

#

# 2002/08/06 [email]Trevor.Paquette@TeraGo.ca[/email]

#            Fix comments

# 2001/12/20 [email]tung@turtle.ee.ncku.edu.tw[/email] (orig: auth_unix.pl)

#

# This auth module will check if the authenticated user has a

# directory in /home/virtual/DOMAIN/home/USER, and if exists the

# shell informed in domainsīs passwd.

#

# Use this module in conjunction with allowed_serverdomain to lock

# down which domains actually have access to webmail.

#

# $unix_passwdfile_plaintext : the plaintext file containing all usernames

#                              and related uid, gid, homedir, shell info.

#                              The deault is /etc/passwd on most unix systems.

# $unix_passwdfile_encrypted : the file containing all usernames and

#                              their corresponding encrypted passwords.

# $unix_passwdmkdb : The command executed after any password modification

#                    to update the changes of passwdfile to passwd database.



my $unix_passwdfile_plaintext="/etc/passwd";

my $unix_passwdfile_encrypted="/etc/shadow";

my $unix_passwdmkdb="none";



################### No configuration required from here ###################



use strict;

use Fcntl qw(:DEFAULT :flock);



sub get_userinfo {

  my $user=$_[1];

  my ($uid, $gid, $realname, $homedir);

  my $domain;



  ($user, $domain)=split(/@/, $user);



  $unix_passwdfile_plaintext = "/home/virtual/$domain$unix_passwdfile_plaintext" if ($domain ne "" && $unix_passwdfile_plaintext !~ /^/home/virtual/);



  if ($unix_passwdfile_plaintext eq "/etc/passwd") {

     ($uid, $gid, $realname, $homedir)= (getpwnam($user))[2,3,6,7];

  } else {

     ($uid, $gid, $realname, $homedir)= (getpwnam_file($user, $unix_passwdfile_plaintext))[2,3,6,7];

  }



  # use first field only

  $realname=(split(/,/, $realname))[0];

  # guess real homedir under sun's automounter

  if ($uid) {

     $homedir="/export$homedir" if (-d "/export$homedir");

  }

  $homedir = "/home/virtual/$domain$homedir" if ($domain ne "");

  return(0, "", $realname, $uid, $gid, $homedir);

}





sub get_userlist {      # only used by checkmail.pl -a

  my @userlist=();

  my $line;  



  # a file should be locked only if it is local accessable

  flock("$unix_passwdfile_encrypted", LOCK_SH) if ( -f $unix_passwdfile_encrypted);

  open(PASSWD, $unix_passwdfile_encrypted);

  while (defined($line=<PASSWD>)) {

     push(@userlist, (split(/:/, $line))[0]);

  }

  close(PASSWD);

  flock("$unix_passwdfile_encrypted", LOCK_UN) if ( -f $unix_passwdfile_encrypted);



  return(@userlist);

}





#  0 : ok

# -2 : parameter format error

# -3 : authentication system/internal error

# -4 : password incorrect

sub check_userpassword {

  my ($user)=@_[1];

  my ($password)=@_[2];

  my ($line, $u, $p);

  my $domain;



  ($user, $domain)=split(/@/, $user);



  return -2 unless ( $user ne "" && $password ne "");



  $unix_passwdfile_encrypted = "/home/virtual/$domain$unix_passwdfile_encrypted" if ($domain ne "" && $unix_passwdfile_encrypted !~ /^/home/virtual/);

  $unix_passwdfile_plaintext = "/home/virtual/$domain$unix_passwdfile_plaintext" if ($domain ne "" && $unix_passwdfile_plaintext !~ /^/home/virtual/);



  # a file should be locked only if it is local accessable

  flock("$unix_passwdfile_encrypted", LOCK_SH) if ( -f $unix_passwdfile_encrypted);

  if ( ! open (PASSWD, "$unix_passwdfile_encrypted") ) {

     flock("$unix_passwdfile_encrypted", LOCK_UN) if ( -f $unix_passwdfile_encrypted);

     return -3;

  }

  while (defined($line=<PASSWD>)) {

     ($u, $p) = (split(/:/, $line))[0,1];

     last if ($u eq $user); # We've found the user in /etc/passwd

  }

  close (PASSWD);

  flock("$unix_passwdfile_encrypted", LOCK_UN) if ( -f $unix_passwdfile_encrypted);



  return -4 if ($u ne $user || crypt($password,$p) ne $p);



  # validate user shell if /etc/shells exists

  if (open(ES, "/etc/shells")) {

     my $shell;

     if ($unix_passwdfile_plaintext eq "/etc/passwd") {

        $shell = (getpwnam($user))[8];

     } else {

        $shell = (getpwnam_file($user, $unix_passwdfile_plaintext))[8];

     }

     my $validshell = 0;   # assume an invalid shell until we get a match

     while(<ES>) {

        chop;

        if( $shell eq $_ ) {

           $validshell = 1; last;

        }

     }

     close(ES);

     return -4 if (!$validshell);

  }

       

  return 0;

}





#  0 : ok

# -1 : function not supported

# -2 : parameter format error

# -3 : authentication system/internal error

# -4 : password incorrect

sub change_userpassword {

  my ($user)=@_[1];

  my ($oldpassword)=@_[2];

  my ($newpassword)=@_[3];

  my ($u, $p, $misc, $encrypted);

  my $content="";

  my $line;

  my $domain;



  return -2 unless ( $user ne "" && $oldpassword ne "" && $newpassword ne "" );

  return -2 if (length($newpassword)<4);



  ($user, $domain)=split(/@/, $user);

  $unix_passwdfile_encrypted = "/home/virtual/$domain$unix_passwdfile_encrypted" if ($domain ne "" && $unix_passwdfile_encrypted !~ /^/home/virtual/);



  # a passwdfile could be modified only if it is local accessable

  return -1 if (! -f $unix_passwdfile_encrypted);



  flock("$unix_passwdfile_encrypted", LOCK_EX);

  open (PASSWD, $unix_passwdfile_encrypted) or return -3;

  while (defined($line=<PASSWD>)) {

     $content .= $line;

     if ($u ne $user) {

        ($u, $p, $misc) = split(/:/, $line, 3);

     }

  }

  close (PASSWD);



  if ($u ne $user || crypt($oldpassword,$p) ne $p) {

     flock("$unix_passwdfile_encrypted", LOCK_UN);

     return -4;

  }



  srand();

  my $table="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

  my $salt=substr($table, int(rand(length($table))), 1).

           substr($table, int(rand(length($table))), 1);



  if ($p =~ /^$1$/) {        # if orig encryption is MD5, keep using it

     $salt = '$1$'. $salt;

  }



  $encrypted= crypt($newpassword, $salt);



  my $oldline=join(":", $u, $p, $misc);

  my $newline=join(":", $u, $encrypted, $misc);



  if ($content !~ s/Q$oldlineE/$newline/) {

     flock("$unix_passwdfile_encrypted", LOCK_UN);

     return -3;

  }



  open(TMP, ">$unix_passwdfile_encrypted.tmp.$$") || goto authsys_error;

  print TMP $content || goto authsys_error;

  close(TMP) || goto authsys_error;



  if ($unix_passwdmkdb ne "" && $unix_passwdmkdb ne "none" ) {

     # update passwd and db with pwdmkdb program

     if ( system("$unix_passwdmkdb $unix_passwdfile_encrypted.tmp.$$")!=0 ) {

        goto authsys_error;

     }

  } else {

     # automic update passwd by rename

     my ($fmode, $fuid, $fgid) = (stat($unix_passwdfile_encrypted))[2,4,5];

     chown($fuid, $fgid, "$unix_passwdfile_encrypted.tmp.$$");

     chmod($fmode, "$unix_passwdfile_encrypted.tmp.$$");

     rename("$unix_passwdfile_encrypted.tmp.$$", $unix_passwdfile_encrypted) || goto authsys_error;

  }

  flock("$unix_passwdfile_encrypted", LOCK_UN);

  return(0);



authsys_error:

  unlink("$unix_passwdfile_encrypted.tmp.$$");

  flock("$unix_passwdfile_encrypted", LOCK_UN);

  return(-3);

}



# this routie is slower than system getpwnam() but can work with file

# other than /etc/passwd. ps: it always return '*' for passwd field.

sub getpwnam_file {

  my ($user, $passwdfile_plaintext)=@_;

  my ($name, $passwd, $uid, $gid, $gcos, $dir, $shell);



  return("", "", "", "", "", "", "", "", "") if ($user eq "" || ! -f $passwdfile_plaintext);



  open(PASSWD, "$passwdfile_plaintext");

  while(<PASSWD>) {

     next if (/^#/);

     chomp;

     ($name, $passwd, $uid, $gid, $gcos, $dir, $shell)=split(/:/);

     last if ($name eq $user);

  }

  close(PASSWD);



  if ($name eq $user) {

     return($name, "*", $uid, $gid, 0, "", $gcos, $dir, $shell);

  } else {

     return("", "", "", "", "", "", "", "", "");

  }

}



1;
biolight
Ah! Jumpin' Jehosaphat, it works!

But then, you've got a new error message:

Couldn't open /var/www/cgi-bin/openwebmail/etc/templates/en_US/loginfailed.template! (No such file or directory)

Dude.

Why did I like Linux again? Oh yea, that's right. It's tha fact that you can even *do* this without VC++ and a headache...

So, how do you solve that?

It's in this thread... thanks to maxihost (in my tired stupor I misread that at first... hehe):

CODE
just a little fix here



when you install openwebmail, the system tries to find the en_US directory and do give some errors when installed



so, do the following after installed openwebmail:



cd /var/www/cgi-bin/openwebmail/etc/templates/

cp -R en en_US



and



cd /var/www/cgi-bin/openwebmail/etc/lang

cp -R en en_US



this should fix the errors.


And, I can verify, that get's it working with the latest build.

However! When I logged in, all my images were broken and the rich text editor is not working... what'd I miss?

[root@ns www]# cd /var/www/
[root@ns www]# cd data/
[root@ns data]# ls
openwebmail

Ah!

[root@ns data]# mv openwebmail/ ../html/
[root@ns data]# ls
[root@ns data]# cd ..
[root@ns www]# rmdir data/

Blammo. I just missed the step in the howto. I hope all this helps some new person figure it out.

Thanks to all of you!

Jonathan
fleabags
QUOTE
Originally posted by Netino
*** OpenWebmail Installation to Ensim 3.x (RedHat 7.2) ***

You will redirected to:
https://www.DOMAIN/cgi-bin/openwebmail/openwebmail.pl

Login with 'user@domain.com', and your password.

Note:
This really will redirect to default cgi-bin directory installation,
as in "https://IP_ADDRESS/cgi-bin/openwebmail/openwebmail.pl", if DOMAIN have
none certificate installed. If you need to use a different certificate, other than  
localhost.localdomain cert to a domain, you need to create a ScriptAlias directive  
to '/var/www/cgi-bin/openwebmail' directory in apache in your domain configuration.

# echo "ScriptAlias /var/www/cgi-bin/webmail/ /var/www/cgi-bin/openwebmail/">>/etc/httpd/conf/siteXX/webmail

In this case (only), then you need create the redirect:

# echo "Redirect /webmail https://www.DOMAIN/cgi-bin/webmail/openwebmail.pl">>/etc/httpd/conf/siteXX/webmail



Regards,
Netino


How can I change the redirect back to sqirrelmail. I followed the directions above, however, I decided to just use squirrelmail. Thanks in advance.
j:D
dnerty
I get empty page after all. What could be the problem?
New2Linux
Hey I LOVE OpenWebMail

i can customize each domain to their own info like:
1. login logo for domain
2. quota and rights to access what i want ot give to each domain like attachment limits or webdisk access and/or space
3. TOO MANY more to list here...

if you need help installing and customizing it and/or automating it when you add or modify a domain. let me know by post your questions here and i can also give you the scripts to do all of it.

LOVE LINUX
Microsoft can just take a bite...
just kiding icon_biggrin.gif

anyway just post here: hehe icon_biggrin.gif
New2Linux
Sorry, i forgot to tell you how the redirect works

look for a file called openwebmail under:
/etc/httpd/conf/site#/

look at the file to see if it has the /webmail redirect inside
if yes then you just delete the file. "ONLY the file named OPENWEBMAIL"

you might find another file called:
0sqmail or sqmail

if you look at this file you will see that /webmail and /squirrelmail redirects are their. so do not delete this file

once you delete the openwebmail file. restart apache

service httpd restart

hope this helps! icon_biggrin.gif
fleabags
It worked perfectly. Thanks for the info.

j:p
Renato
Hello pals,

When trying to install one of the latest releases of OWM I get this error after user is authenticated.

Open WebMail ERROR
All modules are disabled, Access denied

This error doesn't happen with July and previous releases.
I think the error might be related with the authentication module, but I'm not quite sure.

Any help and all comments are welcome.
New2Linux
1. Do you use the site.conf directory?
if yes check the conf files inse of it and see if under each module it's disabled

if not the check the openwebmail.conf for those things or better yet back that file and replace it with the one that came with openwebmail.

2. are you using auth_unix_ensim.pl?
only needed if you are using ensim.

3. what version of openwebmail 2.01 or 2.10?
the auth_unix_ensim.pl for each is different.
Renato
Hi, yes I've checked the site.conf files and they are fine.

As I said, I'm also running an older version of 2.10 (from July or August) and then I decided to take advantage of the latest build. So I'm using the same conf files as my previous version and I just doesn't pass the after login process.

It's letting me to login since if I try an incorrect password then the error is related to it. If I login with the correct password is when I get the:


Open WebMail ERROR
All modules are disabled, Access denied


cheers,

renato
New2Linux
are you using a separete conf file for each domain?

if yes, then check that conf file for something like this:

enable_calendar yes
enable_webdisk yes

if it said no then viola thiers your error.
Renato
Yes you are right, I had them disabled.

But, as I said, those are the same config files I'm using with a previous 2.10 release.

If I enable for instance: webdisk, then I'm able to see this module, but not the email.
Why is it email is not showing? I have not disable it. I not even know what's the variable to disble local email access.
I have disbled sshterm, calendar, webdisk and pop3, since the service I'm providing is for email only.

what other settings should I be lookinf for?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.