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, For some reason I was thinking about the hints I gave you and realized I made a mistake. I forgot to mention that your client needs to use the domain while authenticating. So the test would be: $ echo "tag login username@domain password" | nc perdition_host 143 Without the domain (as I had written) perdition cannot resolve which server to connect. On Wed, Dec 3, 2008 at 15:49, Gustavo Luiz Duarte <[email protected]> wrote: > On Wed, Dec 3, 2008 at 15:27, Stephen Liu <[email protected]> wrote: >> >> --- Gustavo Luiz Duarte <[email protected]> wrote: >> >>> On Wed, Dec 3, 2008 at 12:05, Stephen Liu <[email protected]> wrote: >>> > Hi Gustavo, >>> > >>> > >>> > I'll make 2 tests; >>> > >>> > >>> > 1) >>> > test1 - USING TEXT FILE >>> > >>> > >>> > 2) >>> > test2 - USING MYSQL >>> > >>> > >>> > I have cloned an image of the routing mail server for test2. Now >>> > proceed test1 first. >>> > >>> > >>> > --- Gustavo Luiz Duarte <[email protected]> wrote: >>> > >>> >> 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" >>> > >>> > >>> > Package installed - perdition-mysql >>> > >>> > >>> > # apt-cache policy perdition-mysql >>> > perdition-mysql: >>> > Installed: 1.17-7etch1 >>> > Candidate: 1.17-7etch1 >>> > Version table: >>> > *** 1.17-7etch1 0 >>> > 500 http://ftp.au.debian.org etch/main Packages >>> > 500 http://security.debian.org stable/updates/main Packages >>> > 100 /var/lib/dpkg/status >>> > >>> > >>> > # 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 >>> > >>> > >>> > # which makegdbm >>> > /usr/bin/makegdbm >>> > >>> > >>> > # which perdition >>> > /usr/sbin/perdition >>> > >>> > >>> > # makegdbm /etc/perdition_lookup.gdbm.db < >>> /etc/perdition_lookup.txt >>> > >>> > # perdition -m /etc/perdition_lookup.gdbm.db --query_key "\d" >>> > both without complaint >>> > >>> > >>> > Now I haven't figured out how to test perdition. There are 2 >>> databases >>> > running on this routing mail server, MySQL maildb and >>> > perdition_lookup.gdbm.db. Do I need to stop MySQL maildb to test >>> > perdition? How can the remote mail clients connect their mail >>> servers? >>> > What server settings shall I use? Please shed me some light. TIA >>> >>> No need for stopping you MySQL. >>> >>> If everything is wright (I haven't tested, I can have skipped >>> something), you can point your mail clients to the hostname where >>> perdition is installed and use it normally. >> >> >> Sorry I can't resolve how can the mail client (Evolution) find its >> server over Internet with following settings; > > The mail client doesn't know wich server to use. It always use the > routing server. The routing server redirects it to the correct imap > server. Make sure your are using the right protocol imap4 or imap4s. > >> >> Server Type: IMAP >> >> Server : xen11.satimis.com (hostname of the routing mail server where >> perdition is running >> >> User: satimis >> >> >> satimis is user of satimis.com, satimis.changeip.net and >> satimis.dnsalias.com as well as user of the routing mail server, >> xen11.satimis.com >> >> >> I tried it without success. >> >> >>> Note that perdition's default protocol is pop3. To use imap suply the >>> option -P IMAP4 >> >> >> xen11:~# /etc/init.d/perdition start >> /usr/sbin/perdition.pop3 already running. >> Starting /usr/sbin/perdition.pop3s... >> Starting /usr/sbin/perdition.imap4... >> Starting /usr/sbin/perdition.imaps... > > How are you configuring perdition? Have you modified your > /etc/init.d/perdition script to contain the correct parameters? > >> >> >> xen11:~# hostname >> xen11.satimis.com >> >> >> pop3 is already running. I have to manually run /etc/init.d/perdition >> to start pop3s, imap4 and imaps >> >> >>> You can use nc to test it: >>> $ echo "tag login username password" | nc perdition_host 143 >>> In username and password you use valid username and password for your >>> real imap server. >> >> >> I suppose running above command on the routing mail server where >> perdition is installed. >> >> >> # echo "tag login satimis mypassword" | nc xen11.satimis.com 143 >> * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE >> THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 >> AUTH=CRAM-SHA1 IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. >> Copyright 1998-2005 Double Precision, Inc. See COPYING fordistribution >> information. >> tag NO Login failed. >> >> >>> For pop3: >>> $ echo -e "user username\npass password | nc perdition_host 110 >> >> xen11:~# echo -e "user satimis\npass x11satimis | nc xen11.satimis.com >> 110 >>> >> waiting for input > > You can look at perdition logs to find information about what is going on. > >> >> >>> No special configuration is need for your pop/imap servers. Just >>> assure that they are listening on standard ports. >> >> >> I have only ONE external IP. All ports are forwarded to the routing >> mail server except port 53. >> >> >> B.R. >> Stephen L >> >> >> >>> []'s >>> Gustavo Duarte >>> >>> > >>> > >>> > B.R. >>> > Stephen >>> > >>> > >>> > >>> > >>> > >>> > >>> > >>> >> >>> >> 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 >>> >> > >>> >> >>> > >>> > >>> > 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 >>> > >>> >> >> >> 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