Preparing the Emails Base

 

The current created modules for MTA Selor are: MySQLLDAP  and system users PASSWD

 


If you want use MySQL:

Get module here.

Unzip the file in /usr/local/selor/mod

cd /usr/local/selor/mod
tar xjf selor_mysql_x.x.tar.bz2

Create the database in your MySQL

mysql -uroot

Change 'mypassword' for a password of your preference

mysql> create database mail;
mysql> grant all privileges on mail.* to selor@localhost identified by 'mypassword';
mysql> flush privileges;
mysql> quit

Put the dump selor_mysql.sql to your new database:
mysql -uroot mail < selor_mysql.sql

Now compile the module to your operating system.

Linux
:

32 Bits: gcc -shared -nostartfiles selor_mysql.c -o selor_mysql.so -lmysqlclient -lcrypt -Wall
64 Bits: gcc -shared -nostartfiles selor_mysql.c -o selor_mysql.so -DA64 -lmysqlclient -lcrypt -Wall -fPIC

FreeBSD:
32 Bits: gcc -shared -nostartfiles selor_mysql.c -o selor_mysql.so -L/usr/local/lib/mysql -DFreeBSD -lmysqlclient -Wall
64 Bits: gcc -shared -nostartfiles selor_mysql.c -o selor_mysql.so -L/usr/local/lib/mysql -DFreeBSD -DA64 -lmysqlclient -Wall -fPIC

 

Obs: Sometimes you get the below error while you tries to compile this module:

/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status

This occurs because the compiler has not found the mysqlclient lib. You can use the -L option to indicate the location of this lib in your server. Usually this is in /usr/lib64/mysql or /usr/lib/mysql.
In this case, use the '-L
/usr/lib64/mysql' or '-L/usr/lib/mysql' in your compilation line.

 

Open the configuration file of module and set the user and password of your MySQL database (Options: 'User=' and 'Pass=')
pico selor_mysql.conf

Open the configuration file of Selor (/usr/local/selor/selor.conf), seek the 'Module' option and change it to its module:
pico /usr/local/selor/selor.conf

Module "/usr/local/selor/mod/selor_mysql.so /usr/local/selor/mod/selor_mysql.conf"

The module is configured

 

 


If you want use LDAP


It is complicated to explain a step by step about Selor with LDAP module because this base is extremely diversified. In each case, in each company it has a different struct

I will spend a example with a simple base, without alias, using only default schemes that coming with LDAP.

Download LDAP module here.

Unzip file in /usr/local/selor/mod

cd /usr/local/selor/mod
tar xjf selor_ldap_x.x.tar.bz2

Now, compile the module for your operating system:

Linux:
32 Bits: gcc -shared -nostartfiles selor_ldap.c -o selor_ldap.so -lldap -Wall
64 Bits: gcc -shared -nostartfiles selor_ldap.c -o selor_ldap.so -DA64 -lldap -Wall -fPIC

FreeBSD:
32 Bits: gcc -shared -nostartfiles selor_ldap.c -o selor_ldap.so -DFreeBSD -lldap -Wall
64 Bits: gcc -shared -nostartfiles selor_ldap.c -o selor_ldap.so -DFreeBSD -DA64 -lldap -Wall -fPIC

 

Example of a simple LDAP base (example.ldif)

# Main Entry. Company Name
dn: dc=company
objectclass: domain
dc: company

Domain domain.com
dn: dc=domain.com,dc=company
objectclass: dNSDomain
dc: domain.com

# Email
dn: cn=contact,dc=domain.com,dc=company
objectclass: inetOrgPerson
objectclass: top
objectclass: posixAccount
cn: contact
gidnumber: 105
homedirectory: /home/mail/domain.com/contact
mail: contact@domain.com
sn: contact
uid: Contact
uidnumber: 1000
userpassword: {MD5}59gP/u+iErfFxVcA5PcZPg==

 

# Email
dn: cn=teste,dc=domain.com,dc=company
objectclass: inetOrgPerson
objectclass: top
objectclass: posixAccount
cn: test
gidnumber: 105
homedirectory: /home/mail/domain.com/test
mail: test@domain.com
sn: test
uid: Test
uidnumber: 1001

# Domain test.com
dn: dc=test.com,dc=company
objectclass: dNSDomain
dc: test.com

# Email
dn: cn=test,dc=test.com,dc=company
objectclass: inetOrgPerson
objectclass: top
objectclass: posixAccount
cn: test
gidnumber: 105
homedirectory: /home/mail/test.com/test
mail: test@test.com
sn: test
uid: Test
uidnumber: 1002



Example of configuration file to access the LDAP base above:

#### Variables
# %d -> Domain
# %u -> Mail
#

# ---- Dados de conexao ----
Host=                   ldap://localhost
Login_dn=               cn=Manager,dc=company
Pass=                   mypassword

# ---- Atributos ----
Attr_domain=            dc
Attr_mail=              mail
Attr_pass=              userpassword
Attr_home=              homedirectory

# ---- Buscas ----
Sch_domain_base=        dc=company
Sch_domain_filter=      (&(dc=%d)(objectClass=dNSDomain))
Sch_user_base=          dc=%d,dc=company
Sch_user_filter=        (&(mail=%u))

 

The selor_ldap module has some other configurations for search alias domains, Maildir,etc.
Adjust the file /usr/local/selor/mod/selor_lap.conf according with your LDAP base.

Open the configuration file of Selor (/usr/local/selor/selor.conf), seek the 'Module' option  and change this to your module.
pico /usr/local/selor/selor.conf

Module "/usr/local/selor/mod/selor_ldap.so /usr/local/selor/mod/selor_ldap.conf"

The module is configured


 

If you want use Selor with system users (PASSWD):

This module, Selor_passwd, supports virtual domains too, but the best modules to use all resources of Selor is MySQL and LDAP.
If you want use your email server with virtual domains, is recommended to you use the MySQL module.


Download PASSWD module here.

Unzip the file in /usr/local/selor/mod

cd /usr/local/selor/mod
tar xjf selor_passwd_x.x.tar.bz2

Now, compile module for your operating system.

Linux:
32 Bits: gcc -shared -nostartfiles selor_passwd.c -o selor_passwd.so -lcrypt -Wall
64 Bits: gcc -shared -nostartfiles selor_passwd.c -o selor_passwd.so -lcrypt -DA64 -Wall -fPIC

On Linux is needed compile extra module:
Both versions(32 e 64 bits): gcc selor_shadowmod.c -o selor_shadowmod -lcrypt -Wall                                                                    

FreeBSD:
32 Bits: gcc -shared -nostartfiles selor_passwd.c -o selor_passwd.so -DFreeBSD -Wall
64 Bits: gcc -shared -nostartfiles selor_passwd.c -o selor_passwd.so -DFreeBSD -DA64 -Wall -fPIC

The configuration file is /usr/local/selor/mod/selor_passwd.conf

If you use Linux, give special permission to selor_shadowmod


chown root. selor_shadowmod
chmod 4500 selor_shadowmod

This permission is necessary to module can access 'shadow' file in Linux. In FreeBSD is not necessary

Open the configuration file of Selor (/usr/local/selor/selor.conf) and seek 'Module' option and change this to your Module:
pico /usr/local/selor/selor.conf

Module "/usr/local/selor/mod/selor_passwd.so /usr/local/selor/mod/selor_passwd.conf"

The module is configured

Powered by C - Assembly