seb-info | Oups j'ai oublié de récuperer les logs
Quel fichier de log est intéressant pour la configuration ?
J'ai des extraits de fichier de conf par contre. Je déballe
Ma table SQL amavis qui reprend l'exemple de la doc amavisd.sql
Code :
- --
- -- Structure de la table `maddr`
- --
- CREATE TABLE `maddr` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `email` varchar(255) NOT NULL,
- `domain` varchar(255) NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `email` (`email`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ;
- --
- -- Structure de la table `mailaddr`
- --
- CREATE TABLE `mailaddr` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `priority` int(11) NOT NULL default '7',
- `email` varchar(255) NOT NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `email` (`email`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
- -- --------------------------------------------------------
- --
- -- Structure de la table `msgrcpt`
- --
- CREATE TABLE `msgrcpt` (
- `mail_id` varchar(12) NOT NULL,
- `rid` int(10) unsigned NOT NULL,
- `ds` char(1) NOT NULL,
- `rs` char(1) NOT NULL,
- `bl` char(1) default '',
- `wl` char(1) default '',
- `bspam_level` float default NULL,
- `smtp_resp` varchar(255) default '',
- KEY `msgrcpt_idx_mail_id` (`mail_id`),
- KEY `msgrcpt_idx_rid` (`rid`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Structure de la table `msgs`
- --
- CREATE TABLE `msgs` (
- `mail_id` varchar(12) NOT NULL,
- `secret_id` varchar(12) default '',
- `am_id` varchar(20) NOT NULL,
- `time_num` int(10) unsigned NOT NULL,
- `time_iso` char(16) NOT NULL,
- `sid` int(10) unsigned NOT NULL,
- `policy` varchar(255) default '',
- `client_addr` varchar(255) default '',
- `size` int(10) unsigned NOT NULL,
- `content` char(1) default NULL,
- `quar_type` char(1) default NULL,
- `quar_loc` varchar(255) default '',
- `dsn_sent` char(1) default NULL,
- `spam_level` float default NULL,
- `message_id` varchar(255) default '',
- `from_addr` varchar(255) default '',
- `subject` varchar(255) default '',
- `host` varchar(255) NOT NULL,
- PRIMARY KEY (`mail_id`),
- KEY `msgs_idx_sid` (`sid`),
- KEY `msgs_idx_time_num` (`time_num`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Structure de la table `policy`
- --
- CREATE TABLE `policy` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `policy_name` varchar(32) default NULL,
- `virus_lover` char(1) default NULL,
- `spam_lover` char(1) default NULL,
- `banned_files_lover` char(1) default NULL,
- `bad_header_lover` char(1) default NULL,
- `bypass_virus_checks` char(1) default NULL,
- `bypass_spam_checks` char(1) default NULL,
- `bypass_banned_checks` char(1) default NULL,
- `bypass_header_checks` char(1) default NULL,
- `spam_modifies_subj` char(1) default NULL,
- `virus_quarantine_to` varchar(64) default NULL,
- `spam_quarantine_to` varchar(64) default NULL,
- `banned_quarantine_to` varchar(64) default NULL,
- `bad_header_quarantine_to` varchar(64) default NULL,
- `spam_tag_level` float default NULL,
- `spam_tag2_level` float default NULL,
- `spam_kill_level` float default NULL,
- `spam_dsn_cutoff_level` float default NULL,
- `addr_extension_virus` varchar(64) default NULL,
- `addr_extension_spam` varchar(64) default NULL,
- `addr_extension_banned` varchar(64) default NULL,
- `addr_extension_bad_header` varchar(64) default NULL,
- `warnvirusrecip` char(1) default NULL,
- `warnbannedrecip` char(1) default NULL,
- `warnbadhrecip` char(1) default NULL,
- `newvirus_admin` varchar(64) default NULL,
- `virus_admin` varchar(64) default NULL,
- `banned_admin` varchar(64) default NULL,
- `bad_header_admin` varchar(64) default NULL,
- `spam_admin` varchar(64) default NULL,
- `spam_subject_tag` varchar(64) default NULL,
- `spam_subject_tag2` varchar(64) default NULL,
- `message_size_limit` int(11) default NULL,
- `banned_rulenames` varchar(64) default NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
- --
- -- Contenu de la table `policy`
- --
- INSERT INTO `policy` (`id`, `policy_name`, `virus_lover`, `spam_lover`, `banned_files_lover`, `bad_header_lover`, `bypass_virus_checks`, `bypass_spam_checks`, `bypass_banned_checks`, `bypass_header_checks`, `spam_modifies_subj`, `virus_quarantine_to`, `spam_quarantine_to`, `banned_quarantine_to`, `bad_header_quarantine_to`, `spam_tag_level`, `spam_tag2_level`, `spam_kill_level`, `spam_dsn_cutoff_level`, `addr_extension_virus`, `addr_extension_spam`, `addr_extension_banned`, `addr_extension_bad_header`, `warnvirusrecip`, `warnbannedrecip`, `warnbadhrecip`, `newvirus_admin`, `virus_admin`, `banned_admin`, `bad_header_admin`, `spam_admin`, `spam_subject_tag`, `spam_subject_tag2`, `message_size_limit`, `banned_rulenames`) VALUES
- (1, 'Non-paying', 'N', 'N', 'N', 'N', 'Y', 'Y', 'Y', 'N', 'Y', NULL, NULL, NULL, NULL, 3, 7, 10, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
- (2, 'Uncensored', 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '***SPAM***', '***SPAM***', NULL, NULL),
- (3, 'Wants all spam', 'N', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'Y', NULL, 'spam@ad-dspam.local', 'spam@ad-dspam.local', 'spam@ad-dspam.local', 3, 7, 7, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '[SPAM]', '[SPAM]', NULL, NULL),
- (4, 'Wants viruses', 'Y', 'N', 'Y', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
- (5, 'Normal', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, 3, 6.9, 6.9, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
- (6, 'Trigger happy', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, 3, 5, 5, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),
- (7, 'Permissive', 'N', 'N', 'N', 'Y', 'N', 'N', 'N', 'N', 'Y', NULL, NULL, NULL, NULL, 3, 10, 20, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Structure de la table `quarantine`
- --
- CREATE TABLE `quarantine` (
- `mail_id` varchar(12) NOT NULL,
- `chunk_ind` int(10) unsigned NOT NULL,
- `mail_text` text NOT NULL,
- PRIMARY KEY (`mail_id`,`chunk_ind`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Structure de la table `users`
- --
- CREATE TABLE `users` (
- `id` int(10) unsigned NOT NULL auto_increment,
- `priority` int(11) NOT NULL default '7',
- `policy_id` int(10) unsigned NOT NULL default '1',
- `email` varchar(255) NOT NULL,
- `fullname` varchar(255) default NULL,
- `local` char(1) default NULL,
- PRIMARY KEY (`id`),
- UNIQUE KEY `email` (`email`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
- --
- -- Contenu de la table `users`
- --
- INSERT INTO `users` (`id`, `priority`, `policy_id`, `email`, `fullname`, `local`) VALUES
- (1, 7, 3, '@mondomaine.fr', NULL, NULL),
- (2, 7, 3, 'seb@mondomaine.fr', 'Sebastien', NULL),
- (3, 7, 1, 'spam@as-dspam.localdomain', 'Boite mail de SpamAssassin', 'Y');
- -- --------------------------------------------------------
- --
- -- Structure de la table `wblist`
- --
- CREATE TABLE `wblist` (
- `rid` int(10) unsigned NOT NULL,
- `sid` int(10) unsigned NOT NULL,
- `wb` varchar(10) NOT NULL,
- PRIMARY KEY (`rid`,`sid`)
- ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
- --
- -- Contenu de la table `wblist`
- --
- --
- -- Contraintes pour les tables exportées
- --
- --
- -- Contraintes pour la table `msgrcpt`
- --
- ALTER TABLE `msgrcpt`
- ADD CONSTRAINT `msgrcpt_ibfk_1` FOREIGN KEY (`rid`) REFERENCES `maddr` (`id`),
- ADD CONSTRAINT `msgrcpt_ibfk_2` FOREIGN KEY (`mail_id`) REFERENCES `msgs` (`mail_id`) ON DELETE CASCADE;
- --
- -- Contraintes pour la table `msgs`
- --
- ALTER TABLE `msgs`
- ADD CONSTRAINT `msgs_ibfk_1` FOREIGN KEY (`sid`) REFERENCES `maddr` (`id`);
- --
- -- Contraintes pour la table `quarantine`
- --
- ALTER TABLE `quarantine`
- ADD CONSTRAINT `quarantine_ibfk_1` FOREIGN KEY (`mail_id`) REFERENCES `msgs` (`mail_id`) ON DELETE CASCADE;
|
La config du Postfix :
Le fichier main.cf :
Code :
- myhostname = as-dspam.localdomain
- alias_maps = hash:/etc/aliases
- alias_database = hash:/etc/aliases
- myorigin = /etc/mailname
- mydestination = as-dspam.localdomain, localhost.localdomain, , localhost
- relayhost =
- mynetworks = 127.0.0.0/8 192.168.153.0/24
- mailbox_command = procmail -a "$EXTENSION"
- mailbox_size_limit = 0
- recipient_delimiter = +
- inet_interfaces = all
- content_filter = smtp-amavis:[127.0.0.1]:10024
- transport_maps = hash:/etc/postfix/relai
|
Le fichier master.cf
Code :
- # Configuration Postfix/Amavis :
- smtp-amavis unix - - y - 2 smtp
- -o smtp_data_done_timeout=1200
- -o smtp_send_xforward_command=yes
- -o disable_dns_lookups=yes
- -o max_use=20
- 127.0.0.1:10025 inet n - n - - smtpd
- -o content_filter=
- -o mynetworks=127.0.0.0/8
- -o strict_rfc821_envelopes=yes
- -o smtpd_error_sleep_time=0
- -o smtpd_soft_error_limit=1001
- -o smtpd_hard_error_limit=1000
- -o smtpd_client_connection_count_limit=0
- -o smtpd_client_connection_rate_limit=0
|
Mon fichier relai s'est fait postmappé et ressemble à :
mondomaine.fr smtp:[serveursmtp]
La configuration de mon fichier 50-user Amavis :
Code :
- # Here we set up access to MySQL data:
- @lookup_sql_dsn = ( ['DBI:mysql:amavis:localhost', '*********', '********'] );
- @storage_sql_dsn = @lookup_sql_dsn;
- # If using MailZu, store banned files and spam to MySQL if you want to give users the
- # ability to read those messages in the MailZu interface:
- $banned_files_quarantine_method = 'sql:';
- $spam_quarantine_method = 'sql:';
- $bad_header_quarantine_method = 'sql:';
- $sql_select_policy =
- 'SELECT *, users.id'.
- ' FROM users LEFT JOIN policy ON users.policy_id=policy.id'.
- ' WHERE users.email IN (%k) ORDER BY users.priority DESC';
- #$inet_socket_port = [10024,9998];
- #$interface_policy{'9998'} = 'AM.PDP';
- #$policy_bank{'AM.PDP'} = {
- # protocol => 'AM.PDP',
- # inet_acl => [qw( 127.0.0.1 [:1] 192.168.153.30 )],
- # };
- $unix_socketname = "$MYHOME/amavisd.sock"; # listen on Unix socket
- # alternatively (less common):
- $inet_socket_port = [10024, 9998]; # listen on listed inet tcp ports
- # apply policy bank AM.PDP-SOCK on a Unix socket:
- # (note that this precludes the use of old amavis-milter
- # helper program (with sendmail) on the same socket)
- $interface_policy{'SOCK'} = 'AM.PDP-SOCK';
- # apply policy bank AM.PDP-INET to some inet tcp socket, e.g. tcp port 9998:
- $interface_policy{'9998'} = 'AM.PDP-INET';
- $policy_bank{'AM.PDP-SOCK'} = {
- protocol => 'AM.PDP', # select Amavis policy delegation protocol
- auth_required_release => 0, # don't require secret_id for amavisd-release
- };
- $policy_bank{'AM.PDP-INET'} = {
- protocol => 'AM.PDP', # select Amavis policy delegation protocol
- inet_acl => [qw( 127.0.0.1 [:1] 192.168.153.30 )], # restrict access to these IP addresses
- auth_required_release => 0, # don't require secret_id for amavisd-release
- };
|
Pour la configuration de mailzu j'ai créer la base de donnée mailzu avec les comptes utilisateurs.
Elle est configurer pour accéder à la base d'amavis quelle lis et remplis.
Pour le renvoie des pourriels j'ai configurer de sorte que le message soit renvoyé vers un autre serveur smtp sur le port 25.
Dites moi si un élément manque. Message édité par seb-info le 05-03-2009 à 15:55:04
|