Re: Routing solution on mail servers with all domain pointing at the same externel IP

"Gustavo Luiz Duarte" <[email protected]>
Newsgroups gmane.mail.perdition.user
Message-ID <[email protected]>
Hi Stephen,

You could use the transport table if the string "smtp:" wasn't there.
Do you really want to use mysql for the lookup? If you have only 3
domain you could use a text file.

USING TEXT FILE:
$ cat << END > /etc/perdition_lookup.txt
satimis.dnsalias.com:192.168.0.209
satimis.changeip.net:192.168.0.208
satimis.com:192.168.0.210
END

$ makegdbm /etc/perdition_lookup.gdbm.db < /etc/perdition_lookup.txt

$ perdition -m /etc/perdition_lookup.gdbm.db --query_key "\d"


USING MYSQL:
You have some alternatives:
1. Continue with your tblPerdition and populate it, so that user
column has the domain, hostname column has the localIP and port column
you leave empty (supposing your real pop/imap servers listen to
standard ports).

Then you would do (supposing you have mysql perdition library in /usr/lib):

perdition -M /usr/lib/libperditiondb_mysql.so.0 --query_key "\d" -m
"<dbhost>:<dbport>:dbPerdition:tblPerdition:perdition:perdition"

(substituting <dbhost> and <dbport> by you db hostname and port)


2. Modify your transport table so that the string smtp and localIP are
in diferent columns. Then you create a view concatenating them for the
postfix query. A bit more complicated but easier to maintain when you
have lots of domains and servers.

[]'s
Gustavo Duarte

On Wed, Dec 3, 2008 at 02:28, Stephen Liu <[email protected]> wrote:
> Hi Gustavo,
>
>
>> The URL I sent you has information about using mysql as lookup
>> library:
>> http://www.vergenet.net/linux/perdition/perditiondb.5.shtml
>
>
> I suppose you're referring to following section;
>
>
> MYSQL
> This map library can be used by specifying the full path to the library
> using the -M|--map_library command line option or configuration file
> option.
>
> E.g.
> perdition -M /usr/lib/libperditiondb_mysql.so.0
> ......
>
>
> I'll start from there.
>
>
> I suppose the name of this database is "dbPerdition" to be created on
> MySQL
>
>
> mysql> create database dbPerdition;
>
>
> mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
>    -> ON dbPerdition.* TO 'perdition' IDENTIFIED by 'perdition';
>
> the 1st "perdition" on above second line is "database user".  The 2nd
> "perdition" is "database password".
>
>
> mysql> CREATE TABLE `tblPerdition` (
>    -> `user` varchar(128), null '' default '',
>    -> `servername` varchar(255) null '' default '',
>    -> `port` varchar(8) YES NULL,
>    -> PRIMARY KEY (`user`),
>    -> ) ;
>
>
> Afterwards I'll edit data on 'tblPerdition" table.
>
>
>> The table you've shown doesn't have information about the
>> hostnames/localIPs. Where is it? In the transport table?
>
>
> Yes.
>
> mysql> SELECT * from transport;
> +------+----------------------+--------------------+-----------+---------+
> | pkid | domain               | hostname           | transport |
> enabled |
> +------+----------------------+--------------------+-----------+---------+
> |    1 | satimis.dnsalias.com | smtp:192.168.0.209 | :[]       |
> 1 |
> |    2 | satimis.changeip.net | smtp:192.168.0.208 | :[]       |
> 1 |
> |    3 | satimis.com          | smtp:192.168.0.210 | :[]       |
> 1 |
> +------+----------------------+--------------------+-----------+---------+
> 3 rows in set (0.00 sec)
>
>
> # cat /etc/postfix/mysql_transport_maps.cf
> user=mail
> password=mypassword
> dbname=maildb
> table=transport
> select_field=hostname
> where_field=domain
> hosts=127.0.0.1
> additional_conditions = and enabled = 1
> * end *
>
>
>> I've never used mysql to do it, so I don't know  the details and how
>> flexible it is. Maybe you'll need to create a view in your database
>> for the perdition lookup with the domain as key and the localIP as
>> value.
>>
>> Unfortunately I don't have any example. But the two URLs I sent you
>> have all information you need. In particular, look at --query_key
>> option and mysql database access library.
>
>
> Whether you meant "--query_key FORMAT[,FORMAT...]:" on;
>
> http://www.vergenet.net/linux/perdition/perdition.8.shtml
>
>
> Thanks
>
>
> B.R.
> Stephen L
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> ______________________________________________
> Perdition-users mailing list
> [email protected]
> http://lists.vergenet.net/listinfo/perdition-users
>
______________________________________________
Perdition-users mailing list
[email protected]
http://lists.vergenet.net/listinfo/perdition-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.