CREATE TABLE domain (
  domain varchar(30) NOT NULL,
  anything varchar(30) NOT NULL,
  enable tinyint(4) NOT NULL default '1',
  PRIMARY KEY  (domain)
);

CREATE TABLE  passwd(
  user_name varchar(15) NOT NULL default '',
  realname varchar(30) NOT NULL default '',
  shell varchar(30) NOT NULL default '/bin/false',
  password varchar(30) NOT NULL default '',
  uid int(11) NOT NULL default '2000',
  gid int(11) NOT NULL default '100',
  homedir varchar(30) NOT NULL default '/home/nohome',
  sys tinyint(4) default '1',
  pop tinyint(4) default '1',
  imap tinyint(4) default '1',
  ftp tinyint(4) default '1',
  UNIQUE KEY uid (uid),
  PRIMARY KEY  (user_name)
);

CREATE TABLE virtual (
  alias varchar(30) NOT NULL,
  forw_addr varchar(30) NOT NULL,
  enable tinyint(4) NOT NULL default '1',
  style varchar(8) NOT NULL default 'alias'
);

CREATE TABLE sender_restrictions (
  sender varchar(30) NOT NULL,
  action varchar(10) NOT NULL default 'reject',
  enable tinyint(4) NOT NULL default '1'
);

CREATE TABLE recipient_restrictions (
  recipient varchar(30) NOT NULL,
  action varchar(10) NOT NULL default 'reject',
  enable tinyint(4) NOT NULL default '1'
);

GRANT SELECT ON passwd TO myshadow@localhost IDENTIFIED BY 'myshadow';
GRANT SELECT (user_name,realname,shell,uid,gid,homedir,sys,pop,imap,ftp) ON passwd TO mypasswd@localhost IDENTIFIED BY 'mypasswd';
GRANT SELECT ON domain TO mypostfix@localhost IDENTIFIED BY 'mypostfix';
GRANT SELECT ON virtual TO mypostfix@localhost IDENTIFIED BY 'mypostfix';
GRANT SELECT ON sender_restrictions TO mypostfix@localhost IDENTIFIED BY 'mypostfix';
GRANT SELECT ON recipient_restrictions TO mypostfix@localhost IDENTIFIED BY 'mypostfix';
GRANT ALL ON * TO etcadm@localhost IDENTIFIED BY 'etcadm';
FLUSH PRIVILEGES;
