Re: OpenSMTPD on OpenBSD 5.6 backend MySQL

2015-02-10 Thread Giovanni Bechis
On 02/10/15 16:20, Ultramedia Libertad wrote:
> Greetings friends,
> 
> I read that OpenSMTPD already have the option of mysql backend,
> I would like to have an example of how to do it,
> As that previously used postfix with 3 virtual domains and 10 virtual users 
> in total.
> by the time my mail server is stopped and l people without post until I learn 
> how to work OpenSMTD with mysql backend.
> 
> thank you for advance.
> 
> OpenBSD 5.6
> 
> OpenSMTPD 5.4.3
> 
> Thank you for advance
> 
> -- 
> editor de sueños
To be able to connect with MySQL you should install opensmtpd-extras port.
It is available on current, I do not know if the current port will compile on 
5.6 due to netdb.h change.
Attached a couple of config files to start with, in mysql.conf you have to 
write your own sql queries.
 Cheers
  Giovanni

#
# Sample MySQL configuration file
#

hostlocalhost
usernameuser
passwordpass
databasedb

# Alias lookup query
#
# rows   >= 0
# fields == 1 (user varchar)
#
query_alias select destination from mail_valias where source=?


# Domain lookup query
#
# rows   == 1
# fields == 1 (domain varchar)
#
query_domainselect domain from mail_domain where domain=?;


# User lookup query
#
# rows   == 1
# fields == 3 (uid int, gid int, directory varchar)
#
query_userinfoselect uid,gid,maildir from mail_user where 
login=?


# Credentials lookup query
#
# rows   == 1
# fields == 2 (username varchar, password varchar)
#
query_credentialsselect login, password from mail_user where login=?;


# Netaddr lookup query
#
# rows   == 1
# fields == 1 (netaddr varchar)
#
#query_netaddrselect value from netaddr where value=$1;
#   $OpenBSD: smtpd.conf,v 1.7 2014/03/12 18:21:34 tedu Exp $

# This is the smtpd server system-wide configuration file.
# See smtpd.conf(5) for more information.

# To accept external mail, replace with: listen on all
#
listen on lo0

table vusers mysql:/tmp/mysql.conf
table vdomains mysql:/tmp/mysql.conf
table aliases mysql:/tmp/mysql.conf

accept for domain  userbase  virtual  deliver to 
maildir
accept from local for any relay


OpenSMTPD on OpenBSD 5.6 backend MySQL

2015-02-10 Thread Ultramedia Libertad
Greetings friends,

I read that OpenSMTPD already have the option of mysql backend,
I would like to have an example of how to do it,
As that previously used postfix with 3 virtual domains and 10 virtual users
in total.
by the time my mail server is stopped and l people without post until I
learn how to work OpenSMTD with mysql backend.

thank you for advance.

OpenBSD 5.6

OpenSMTPD 5.4.3

Thank you for advance

-- 
editor de sueños