Copyright 2021 Simon Quantrill, All Rights Reserved

Setting up Postfix for the kids

Mon 17 June 2013

Setup postfix mysql and spamassassin for kids use

First of all you need debian install on a server on the internet

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip unarj bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop apt-get install postfix postgrey dovecot squrrielmail proemail apt-get install razor pyzor adduser clamav amavis adduser amavis clamav

postconf -e ‘content_filter = amavis:[127.0.0.1]:10024’ postconf -e ‘receive_override_options = no_address_mappings’

root@1256-1776-4220:/etc/amavis/conf.d# cat 15-content_filter_mode

use strict;

You can modify this file to re-enable SPAM checking through spamassassin

and to re-enable antivirus checking.

# Default antivirus checking mode

Please note, that anti-virus checking is DISABLED by

default.

If You wish to enable it, please uncomment the following lines:

@bypass_virus_checks_maps = ( %bypass_virus_checks, @bypass_virus_checks_acl, $bypass_virus_checks_re);

# Default SPAM checking mode

Please note, that anti-spam checking is DISABLED by

default.

If You wish to enable it, please uncomment the following lines:

@bypass_spam_checks_maps = ( %bypass_spam_checks, @bypass_spam_checks_acl, $bypass_spam_checks_re); 1;

ensure a defined return

root@1256-1776-4220:/etc/amavis/conf.d# cat 50-user use strict;

# Place your configuration directives here. They will override those in

earlier files.

# See /usr/share/doc/amavisd-new/ for documentation and examples of # the directives you can use in this file

@local_domains_acl = ( “.$mydomain” ); @inet_acl = qw(127.0.0.1 );

—————— Do not modify anything below this line ——————- 1;

ensure a defined return

Create postfix database in mysql

create database postfix; CREATE TABLE protected_users ( recipient VARCHAR( 50 ) NOT NULL , class VARCHAR( 10 ) NOT NULL, UNIQUE ( recipient ) );

CREATE TABLE whitelist ( sender VARCHAR( 50 ) NOT NULL , action VARCHAR( 2 ) NOT NULL , UNIQUE ( sender ) );

insert into protected_users (recipient, class) values (‘marjanne@quantrill.eu’,’whitelist’);

insert into whitelist (sender, action) values (‘terry.quantrill@btinternet.com’,’OK’);

GRANT SELECT on postfix.* TO postfix@localhost identified by ‘postfix’;

/etc/postfix/main.cf

strict_rfc821_envelopes = yes disable_vrfy_command = yes smtpd_delay_reject = yes smtpd_helo_required = yes smtpd_recipient_restrictions = reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_pipelining, permit_mynetworks, check_policy_service inet:127.0.0.1:60000, permit_tls_clientcerts, reject_rbl_client zen.spamhaus.org, warn_if_reject reject_invalid_hostname, warn_if_reject reject_non_fqdn_hostname, reject_unauth_destination, check_helo_access hash:/etc/postfix/helo_checks, mysql:/etc/postfix/protected_users.cf smtpd_restriction_classes = whitelist whitelist = check_sender_access mysql:/etc/postfix/whitelist.cf reject receive_override_options = no_address_mappings

root@1256-1776-4220:/etc/postfix# cat protected_users.cf

dbname = postfix hosts = 127.0.0.1 user = postfix password = postfix table = protected_users select_field = class where_field = recipient

root@1256-1776-4220:/etc/postfix# cat whitelist.cf

dbname = postfix hosts = 127.0.0.1 user = postfix password = postfix table = whitelist select_field = action where_field = sender Check using: postmap -v -q “simon.quantrill@gmail.com” mysql:/etc/postfix/whitelist.cf postmap -v -q “marjanne@quantrill.eu” mysql:/etc/postfix/protected_users.cf

on the top

Comments