Quote:
Originally Posted by deemon
Heh - sorry, I didn't pay attention - I assumed you had FreeBSD installed.
I can't help you with linux packages though, I don't have much experience on that field.
|
Hi deemon,
Linux is the same not necessary installing BIND9. /etc/resolv.conf
Code:
nameservers ISP dns1
nameservers ISP dns2
will do the job.
What I'm trying to do installing BIND9 is ONLY for learning building my own DNS server.
Quote:
Code:
resolv.conf is still required - that's how you show your system which nameservers to use. Just having having bind installed and configured is not enought.
|
Noted with thanks
Quote:
I guess think you need only one table:
Code:
CREATE TABLE domains (
domain VARCHAR(255) NOT NULL AUTO_INCREMENT,
transport VARCHAR(255) NOT NULL,
PRIMARY KEY (domain)
);
Then you'll add mysql maps to relay_domains and transport_maps.
query for relay_domains map would be: SELECT 't' FROM domains WHERE domain='%s';
and for transport_maps: SELECT transport FROM domains WHERE domain='%s';
.. where transport is smtp:HOSTNAME.
For example:
domain: satimis.dnsalias.com, transport: smtp:MailServerB
domain: satimis.changeip.net, transport: smtp:MailServerC
|
On the running mail server /etc/postfix/main.cf the entries re virtual domains are as follows;
Code:
alias_maps = hash:/etc/postfix/aliases
alias_database = hash:/etc/postfix/aliases
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
virtual_gid_maps = mysql:/etc/postfix/mysql_gid.cf
virtual_mailbox_base = /var/spool/mail/virtual
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailbox.cf
virtual_uid_maps = mysql:/etc/postfix/mysql_uid.cf
then I have to add another line
Code:
transport_maps=mysql:/etc/postfix/mysql_transport_maps.cf
I have 3 tables on maildb, the database
mysql> show tables;
Code:
+------------------+
| Tables_in_maildb |
+------------------+
| aliases |
| domains |
| users |
+------------------+
I ran following commands creating domains;
Code:
mysql> CREATE TABLE `domains` (
-> `pkid` smallint(6) NOT NULL auto_increment,
-> `domain` varchar(120) NOT NULL default '',
-> `transport` varchar(120) NOT NULL default 'virtual:',
-> `enabled` tinyint(1) NOT NULL default '1',
-> PRIMARY KEY (`pkid`)
-> ) ;
mysql> SELECT * from domains;
Code:
+------+-----------------------+-----------+---------+
| pkid | domain | transport | enabled |
+------+-----------------------+-----------+---------+
| 1 | localhost | virtual: | 1 |
| 2 | localhost.localdomain | virtual: | 1 |
| 3 | satimis.com | virtual: | 1 |
| 4 | satimis.dnsalias.com | virtual: | 1 |
| 5 | satimis.changeip.net | virtual: | 1 |
+------+-----------------------+-----------+---------+
Do I need to make any change here?
According to your advice I'll add another table "transport"
I'll run following command to create it;
Code:
CREATE TABLE `transport` (
`pkid` smallint(6) NOT NULL auto_increment,
`domain` varchar(128) NOT NULL default '',
`hostname` varchar(128) NOT NULL default '',
`transport` varchar(128) NOT NULL default ':[]',
`enabled` smallint(6) NOT NULL default '1',
PRIMARY KEY (`pkid`),
UNIQUE KEY `domain` (`domain`)
);
Then run;
Code:
INSERT INTO transport (domain,hostname) VALUES
('satimis.dnsalias.com','MailServerB');
INSERT INTO transport (domain,hostname) VALUES
('satimis.changeip.net','MailServerC');
etc.
If I'm wrong please correct me. Thanks
Can I replay the hostname "MailServerB" with its local IP?
Create this file /etc/postfix/mysql_relay_domains
Code:
user=mail
password=apassword
dbname=maildb
table='t'
select_field=domains
where_field=domains
hosts=127.0.0.1
additional_conditions = and enabled = 1
and then create this file /etc/postfix/mysql_transport_maps.cf
Code:
user=mail
password=apassword
dbname=maildb
table=transport
select_field=hostname
where_field=domain
hosts=127.0.0.1
additional_conditions = and enabled = 1
Remark:
I have following 5 files created already. Do I need to make any change on them?
/etc/postfix/mysql_mailbox.cf
Code:
user=mail
password=apassword
dbname=maildb
table=users
select_field=maildir
where_field=id hosts=127.0.0.1
additional_conditions = and enabled = 1
/etc/postfix/mysql_uid.cf
Code:
user=mail
password=apassword
dbname=maildb
table=users
select_field=uid
where_field=id
hosts=127.0.0.1
/etc/postfix/mysql_gid.cf
Code:
user=mail
password=apassword
dbname=maildb
table=users
select_field=gid
where_field=id
hosts=127.0.0.1
/etc/postfix/mysql_alias.cf
Code:
user=mail
password=apassword
dbname=maildb
table=aliases
select_field=destination
where_field=mail
hosts=127.0.0.1
additional_conditions = and enabled = 1
/etc/postfix/mysql_domains.cf
Code:
user=mail
password=apassword
dbname=maildb
table=domains
select_field=domain
where_field=domain
hosts=127.0.0.1
additional_conditions = and enabled = 1
B.R.
satimis