Commit b5b08732 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Add postfix

parents
Loading
Loading
Loading
Loading

bounce.cf

0 → 100644
+15 −0
Original line number Diff line number Diff line
failure_template = <<EOF
Charset: utf-8
From: MAILER-DAEMON (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
Postmaster-Subject: Postmaster Copy: Undelivered Mail

This is an automated message from $myhostname.

The message attached could not be delivered for the reason given
below.

For further assistance please contact the server administrator at
postmaster@$mydomain, including a copy of this message.

EOF

dynamicmaps.cf

0 → 100644
+8 −0
Original line number Diff line number Diff line
# Postfix dynamic maps configuration file.
#
# The first match found is the one that is used.  Wildcards are not supported
# as of postfix 2.0.2
#
#type	location of .so file			open function	(mkmap func)
#====	================================	=============	============
mysql	postfix-mysql.so.1.0.1		dict_mysql_open	

main.cf

0 → 100644
+103 −0
Original line number Diff line number Diff line
# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Host details
mydomain = kodo.org.uk
myhostname = smtp.$mydomain
myorigin = $mydomain
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
inet_interfaces = all

smtpd_banner = $myhostname ESMTP $mail_name
biff = no

# Template files
bounce_template_file = /etc/postfix/bounce.cf

# Appending .domain is the MUA's job.
append_dot_mydomain = no

delay_warning_time = 4h
maximal_queue_lifetime = 6d

minimal_backoff_time = 1000s
maximal_backoff_time = 8000s
smtp_helo_timeout = 60s

# Error codes
unknown_local_recipient_reject_code = 450
invalid_hostname_reject_code = 6

# Restrictions
message_size_limit = 16777216
disable_vrfy_command = yes
smtpd_delay_reject = yes
smtpd_recipient_limit = 100
smtpd_soft_error_limit = 3
smtpd_hard_error_limit = 12
smtpd_client_restrictions =
	permit_mynetworks,
	permit_sasl_authenticated,
	reject_rbl_client zen.spamhaus.org
	warn_if_reject reject_unknown_client_hostname,
	warn_if_reject reject_unknown_reverse_client_hostname
	sleep 1, reject_unauth_pipelining,
	permit
smtpd_helo_required = yes
smtpd_helo_restrictions =
	permit_mynetworks,
	reject_invalid_hostname,
	warn_if_reject reject_non_fqdn_hostname,
	warn_if_reject reject_unknown_helo_hostname,
	permit
smtpd_sender_restrictions =
	reject_non_fqdn_sender,
	reject_unknown_sender_domain,
	permit
#smtpd_relay_restrictions =
#	permit_mynetworks,
#	permit_sasl_authenticated
#	reject
smtpd_recipient_restrictions =
	permit_mynetworks,
	permit_sasl_authenticated,
	reject_non_fqdn_recipient,
	reject_unknown_recipient_domain,
	defer_unauth_destination,
	check_policy_service unix:private/policy-spf
	permit
#	sleep 1, reject_unauth_pipelining,
smtpd_data_restrictions =
	reject_unauth_pipelining,
	permit

# Incoming TLS parameters
smtpd_tls_security_level = may
smtpd_tls_cert_file=/etc/tls/tls.crt
smtpd_tls_key_file=/etc/tls/tls.key
#smtpd_tls_CAfile=/etc/tls/tls.crt
smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3
smtpd_tls_mandatory_ciphers = high
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache

# Outgoing TLS parameters
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_CAfile = /etc/tls/tls.crt

# SASL parameters
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = inet:dovecot.default.svc.cluster.local:63123
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = no

# All delivery is virtual, through dovecot LMTP
virtual_transport = lmtp:inet:dovecot.default.svc.cluster.local:63124
virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf
#virtual_alias_domains = mysql:/etc/postfix/mysql_domain_alias.cf
virtual_alias_maps = mysql:/etc/postfix/mysql_alias.cf
local_recipient_maps =
recipient_delimiter = +

# SPF policy server
policy-spf_time_limit = 300s
compatibility_level = 2

master.cf

0 → 100644
+113 −0
Original line number Diff line number Diff line
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (no)    (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
submission inet n       -       n       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
#smtps     inet  n       -       y       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       y       -       -       qmqpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       y       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
	-o smtp_fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
retry     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
#local     unix  -       n       n       -       -       local
#virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
#maildrop  unix  -       n       n       -       -       pipe
#  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
#uucp      unix  -       n       n       -       -       pipe
#  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#
#ifmail    unix  -       n       n       -       -       pipe
#  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
#bsmtp     unix  -       n       n       -       -       pipe
#  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
#scalemail-backend unix	-	n	n	-	2	pipe
#  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
#mailman   unix  -       n       n       -       -       pipe
#  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
#  ${nexthop} ${user}


# SPF policy server
policy-spf  unix  -     n       n       -       -       spawn
  user=nobody argv=/usr/bin/policyd-spf

mysql_alias.cf

0 → 100644
+55 −0
Original line number Diff line number Diff line
#
# This MySQL query maps addresses (user@domain) and domains (@domain) to users.  
# The value(s) returned will be passed to mysql_mailbox.cf so need not be email 
# addresses, only some way for mysql_mailbox.cf to identify a user (& hence 
# their mailbox).
#
# If multiple values are returned the message will be delivered to each mailbox 
# associated with the values.
#
# The address or domain to match is passed as the argument %s
#

#hosts = mail-db

#user = mail-user
#password = siCQ0evnvopokwef09G508wh0v8hw98hv8NSWnwug93jg98vbbj0Hrb87gyUBf3095g67

dbname = app_accounts
#query =
#  SELECT
#    username
#  FROM accounts
#  LEFT JOIN mailboxes
#  ON
#    accounts.id = mailboxes.account_id
#  LEFT JOIN addresses
#  ON
#    address.id = mailboxes.address_id
#  WHERE
#    addresses.address = '%s'

query =
  (
   SELECT
     username
   FROM users as u
   LEFT JOIN email_addr as a
   ON
     a.pkid=u.pkid
   WHERE
     address = '%s'
  )
  UNION
  (
   SELECT
     username
   FROM lists as l
   LEFT JOIN (users as u, list_members as m)
   ON
     u.pkid = m.pkid
     AND
     m.listid = l.listid
   WHERE
     address = '%s'
  )