CONTENT
  • CHANGES
Szukaj
counter

#top Konfiguracja


O ile nie zdefiniowano inaczej wszystkie poniższe opcje dotyczą pliku konfiguracyjnego main.cf dostępnego standardowo w lokalizacji /etc/postfix/main.cf.

#top Timeout


Dokumentacja Postfix: smtpd_timeout (default: normal: 300s, overload: 10s)
Dokumentacja Postfix: smtpd_starttls_timeout (default: 300s)
Dokumentacja Postfix: smtpd_tls_session_cache_timeout (default: 3600s)
Dokumentacja Postfix: smtpd_proxy_timeout (default: 100s)
Dokumentacja Postfix: smtpd_policy_service_timeout (default: 100s)
Dokumentacja Postfix: smtp_connect_timeout (default: 30s)
Dokumentacja Postfix: smtp_starttls_timeout (default: 300s)
Dokumentacja Postfix: smtp_tls_session_cache_timeout (default: 3600s)
Dokumentacja Postfix: smtp_helo_timeout (default: 300s)
Dokumentacja Postfix: smtp_mail_timeout (default: 300s)
Dokumentacja Postfix: smtp_rcpt_timeout (default: 300s)
Dokumentacja Postfix: smtp_rset_timeout (default: 20s)
Dokumentacja Postfix: smtp_data_init_timeout (default: 120s)
Dokumentacja Postfix: smtp_data_xfer_timeout (default: 180s)
Dokumentacja Postfix: smtp_data_done_timeout (default: 600s)
Dokumentacja Postfix: smtp_quit_timeout (default: 300s)
Dokumentacja Postfix: smtp_xforward_timeout (default: 300s)
Dokumentacja Postfix: lmtp_connect_timeout (default: 0s)
Dokumentacja Postfix: lmtp_starttls_timeout (default: 300s)
Dokumentacja Postfix: lmtp_tls_session_cache_timeout (default: 3600s)
Dokumentacja Postfix: lmtp_lhlo_timeout (default: 300s)
Dokumentacja Postfix: lmtp_mail_timeout (default: 300s)
Dokumentacja Postfix: lmtp_rcpt_timeout (default: 300s)
Dokumentacja Postfix: lmtp_rset_timeout (default: 20s)
Dokumentacja Postfix: lmtp_data_init_timeout (default: 120s)
Dokumentacja Postfix: lmtp_data_xfer_timeout (default: 180s)
Dokumentacja Postfix: lmtp_data_done_timeout (default: 600s)
Dokumentacja Postfix: lmtp_quit_timeout (default: 300s)
Dokumentacja Postfix: lmtp_xforward_timeout (default: 300s)
Dokumentacja Postfix: daemon_timeout (default: 18000s)
Dokumentacja Postfix: qmqpd_timeout (default: 300s)
Dokumentacja Postfix: connection_cache_protocol_timeout (default: 5s)
Dokumentacja Postfix: trigger_timeout (default: 10s)
Dokumentacja Postfix: ipc_timeout (default: 3600s)
Dokumentacja Postfix: milter_command_timeout (default: 30s)
Dokumentacja Postfix: milter_connect_timeout (default: 30s)
Dokumentacja Postfix: milter_content_timeout (default: 300s)

EXAMPLES
# smtpd
smtpd_timeout = ${stress?10}${stress:300}s
smtpd_starttls_timeout = 300s
smtpd_tls_session_cache_timeout = 3600s
smtpd_proxy_timeout = 100s
smtpd_policy_service_timeout = 100s
# smtp
smtp_connect_timeout = 30s
smtp_starttls_timeout = 300s
smtp_tls_session_cache_timeout = 3600s
smtp_helo_timeout = 300s
smtp_mail_timeout = 300s
smtp_rcpt_timeout = 300s
smtp_rset_timeout = 20s
smtp_data_init_timeout = 120s
smtp_data_xfer_timeout = 180s
smtp_data_done_timeout = 600s
smtp_quit_timeout = 300s
smtp_xforward_timeout = 300s
# lmtp
lmtp_connect_timeout = 0s
lmtp_starttls_timeout = 300s
lmtp_tls_session_cache_timeout = 3600s
lmtp_lhlo_timeout = 300s
lmtp_mail_timeout = 300s
lmtp_rcpt_timeout = 300s
lmtp_rset_timeout = 20s
lmtp_data_init_timeout = 120s
lmtp_data_xfer_timeout = 180s
lmtp_data_done_timeout = 600s
lmtp_quit_timeout = 300s
lmtp_xforward_timeout = 300s
# daemon
daemon_timeout = 18000s
qmqpd_timeout = 300s
connection_cache_protocol_timeout = 5s
trigger_timeout = 10s
ipc_timeout = 3600s
# milter
milter_command_timeout = 30s
milter_connect_timeout = 30s
milter_content_timeout = 300s



#top inet_interfaces


Dokumentacja Postfix: inet_interfaces (default: all)
Określa adresy sieciowe na których powinien nasłuchiwać serwer Postfix. Domyślna wartość to all co oznacza, że Postfix nasłuchuje na wszystkich dostępnych w systemie adresach, czyli: (ipv4) 0.0.0.0:PORT i (ipv6) :::PORT.

EXAMPLES
inet_interfaces = all



#top inet_protocols


Dokumentacja Postfix: inet_protocols (default: all)
Określa protokoły Internetowe na które powinien obsługiwać serwer Postfix. Domyślna wartość to all co oznacza, że Postfix obsługuje wszystkie dostępne protokoły, czyli: ipv4 i ipv6.

EXAMPLES
inet_protocols = all



#top mynetworks


Dokumentacja Postfix: mynetworks (default: all)
Określa zaufane adresy podsieci. Po umieszczeniu w każdej restrykcji smtpd_*_restrictions na początku (jako pierwsza restrykcja) permit_mynetworks wiadomości od hostów z adresów określonych mynetworks będą akceptowane z pominięciem restrykcji występujących po niniejszej restrykcji.

EXAMPLES
mynetworks = 127.0.0.0/8, 10.5.5.0/28



#top permit_mynetworks


Dokumentacja Postfix: permit_mynetworks
Niniejsza restrykcja oznacza zaakceptowanie wiadomości pochodzących z hostów znajdujących się w mynetworks bez sprawdzania restrykcji występujących za niniejszą restrykcją.



#top Enable smtps and submission services


Usługi (porty) na które obsługuje serwer Postfix zdefiniowane są w pliku master.cf znajdującym się standardowo w lokalizacji /etc/postfix/master.cf.

EXAMPLES
Zmiany jakie wprowadzić w pliku /etc/postfix/master.cf:
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
# smtpd_sender_restrictions=permit_sasl_authenticated,reject - wysyłanie emaili poprzez 587 wymaga logowania
submission inet n       -       n       -       -       smtpd -o smtpd_sender_restrictions=permit_sasl_authenticated,reject
# smtpd_sender_restrictions=permit_sasl_authenticated,reject - wysyłanie emaili poprzez 465 wymaga logowania
smtps     inet n       -       n       -       -       smtpd -o smtpd_sender_restrictions=permit_sasl_authenticated,reject




Dokumentacja Postfix: smtpd_banner (default: $myhostname ESMTP $mail_name)
Dokumentacja Postfix: mail_name (default: Postfix)
Dokumentacja Postfix: mail_version (default: see "postconf -d" output (i.e.: 2.6.6))
Dokumentacja Postfix: smtp_helo_name (default: $myhostname)
Dokumentacja Postfix: myhostname (default: default: see "postconf -d" output (myhostname = host.example.com))
Dokumentacja Postfix: mydomain (default: default: see "postconf -d" output (mydomain = domain.tld))

EXAMPLES
# The internet domain name of this mail system. The default is to use $myhostname minus the first component,
# or "localdomain" (Postfix 2.3 and later). $mydomain is used as a default value for many other configuration parameters.
mydomain = localdomain

# INTERNET HOST AND DOMAIN NAMES
#
# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
#myhostname = host.domain.tld
#myhostname = virtual.domain.tld
myhostname = wbcd.pl

# The mail system name that is displayed in Received: headers, in the SMTP greeting banner, and in bounced mail.
mail_name = Postfix

# The version of the mail system. Stable releases are named major.minor.patchlevel.
# Experimental releases also include the release date. The version string can be used in,
# for example, the SMTP greeting banner.
mail_version = 2.6.6

# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# code in the SMTP server's greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
#
# You MUST specify $myhostname at the start of the text. That is an
# RFC requirement. Postfix itself does not care.
#
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
smtpd_banner = $myhostname ESMTP $mail_name

# The hostname to send in the SMTP HELO or EHLO command.
# The default value is the machine hostname. Specify a hostname or [ip.add.re.ss].
# This information can be specified in the main.cf file for all SMTP clients,
# or it can be specified in the master.cf file for a specific client, for example:
smtp_helo_name = $myhostname



#top strict_rfc821_envelopes


Dokumentacja Postfix: strict_rfc821_envelopes (default: no)
Określa wymagany sposób podawania adresów przekazywanych w komendach SMTP MAIL FROM: i RCPT TO:
strict_rfc821_envelopes = yes
Ustawienie opcji w powyższy sposób powoduje akceptowanie adresów przekazywanych w komendach SMTP MAIL FROM: i RCPT TO: podanych w następujący sposób (adresy podawane w inny sposób będą odrzucane z komunikatem: 501 5.5.4 Syntax: MAIL FROM:<address>):
MAIL FROM: <user@example.org>
RCPT TO: <user@example.org>

strict_rfc821_envelopes = no
Ustawienie opcji w powyższy sposób powoduje akceptowanie adresów przekazywanych w komendach SMTP MAIL FROM: i RCPT TO: podanych zarówno w powyżej przedstawiony sposób jak również poniżej:
MAIL FROM: user@example.org
RCPT TO: user@example.org



#top TLS README


Dokumentacja Postfix: TLS_README | FORWARD_SECRECY_README

EXAMPLES
# switch on TLS on smtpd server
smtpd_use_tls = yes
# smtpd server log level information
smtpd_tls_loglevel = 1
# enforce STARTTLS by remote SMTP clients, and never send mail in the clear
# set smtpd_enforce_tls=no to enable recv mail plain text
smtpd_enforce_tls = yes
# force STARTTLS before command AUTH ("yes" need SASL)
# set smtpd_tls_auth_only=no to enable AUTH without STARTTLS
smtpd_tls_auth_only = yes
# require client for send certificate
# comment out this when enable smtpd_tls_wrappermode=yes
#smtpd_tls_req_ccert = yes
# smtpd server key
smtpd_tls_key_file = /etc/pki/tls/certs/smtpd.pem
# smtpd server cert
smtpd_tls_cert_file = /etc/pki/tls/certs/smtpd.pem
# smtpd server CA
smtpd_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

# client use TLS when a remote SMTP server TLS support
smtp_use_tls = yes
# log the hostname of a remote SMTP server that offers STARTTLS, when TLS is not already enabled for that server
smtp_tls_note_starttls_offer = yes
# require that remote SMTP servers use TLS encryption, and never send mail in the clear
# set smtp_enforce_tls=no to enable send mail plain text
smtp_enforce_tls = no
# smtp client log level information
smtp_tls_loglevel = 1
# Postfix SMTP client SASL security options, disable anonymous and plain AUTH without TLS
# smtp_sasl_security_options (default: noplaintext, noanonymous)
smtp_sasl_security_options = noplaintext, noanonymous
# The SASL authentication security options that the Postfix SMTP client uses for TLS encrypted SMTP sessions, enable pain text AUTH after STARTTLS
smtp_sasl_tls_security_options = noanonymous
# smtp client key
smtp_tls_key_file = /etc/pki/tls/certs/smtpd.pem
# smtp client cert
smtp_tls_cert_file = /etc/pki/tls/certs/smtpd.pem
# smtp client CA
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

# The external entropy source for the in-memory tlsmgr(8) pseudo random number generator (PRNG) pool
tls_random_source = dev:/dev/urandom



#top SASL AUTH MECHANISM


Dokumentacja Postfix: SASL_README
What is SASL and do I need it?
By default, postfix uses the $mynetworks parameter to control access, i.e. who can send or relay mail through the mail server. There is no other authentication performed other than checking that the IP address of the user trying to send mail is part of a trusted network as specified in $mynetworks.

If you are only implementing a mail server where all your users are based on the same network then it is unlikely that you will need to use SASL or SSL/TLS. However, if there are mobile users that wish to use the mail server whilst away from base, we need a mechanism to authenticate them as trusted users so that they are able to send mail through the mail server.

SASL (Simple Authentication and Security Layer) provides a mechanism of authenticating users using their username and password. Probably the most well known implementation of SASL is provided by the Cyrus SASL library, but dovecot also has it's own SASL implementation built in, and as we are already running dovecot we may as well use it for SASL rather than having to install and configure another package.

EXAMPLES
# AUTH POSTFIX WITH DOVECOT
# -------------------------
# To configure SASL in postfix, we need to make the following additions to /etc/postfix/main.cf:
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_security_options = noanonymous

# Report the SASL authenticated user name in the smtpd(8) Received message header
# causes display in headers: Received: from ... (Authenticated sender: ...)
smtpd_sasl_authenticated_header = yes

#top WITH DOVECOT 1.2

/etc/dovecot.conf

EXAMPLES
# Next we need to configure auth default in the authentication processes section of /etc/dovecot.conf.
# Uncomment and/or add the following lines as necessary (be careful as this section is heavily commented,
# some entries already exist, others are commented out and need uncommenting such as socket listen):
auth default {
  mechanisms = plain login
  passdb pam {
    
  }
  userdb passwd {
    
  }
  user = root
  socket listen {
    client {
      path = /var/spool/postfix/private/dovecot-auth
      mode = 0660
      user = postfix
      group = postfix
    }
  }
}


#top WITH DOVECOT 2.0

/etc/dovecot/conf.d/10-master.conf

EXAMPLES
service auth {
  unix_listener /var/spool/postfix/private/dovecot-auth {
    mode = 0660
    user = postfix
    group = postfix
  }
}



#top mydestination


Dokumentacja Postfix: mydestination



#top mailbox_command


Dokumentacja Postfix: mailbox_command

EXAMPLES
# The mailbox_command parameter specifies the optional external
# command to use instead of mailbox delivery. The command is run as
# the recipient with proper HOME, SHELL and LOGNAME environment settings.
# Exception:  delivery for root is done as $default_user.
#
# Other environment variables of interest: USER (recipient username),
# EXTENSION (address extension), DOMAIN (domain part of address),
# and LOCAL (the address localpart).
#
# Unlike other Postfix configuration parameters, the mailbox_command
# parameter is not subjected to $parameter substitutions. This is to
# make it easier to specify shell syntax (see example below).
#
# Avoid shell meta characters because they will force Postfix to run
# an expensive shell process. Procmail alone is expensive enough.
#
# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#
mailbox_command = /usr/libexec/dovecot/deliver



#top ALIAS DATABASE


Dokumentacja Postfix: aliases(5)
Dokumentacja Postfix: alias_maps (default: see "postconf -d" output)
Dokumentacja Postfix: alias_database (default: see "postconf -d" output)

postconf -d | grep  alias_maps
alias_maps = hash:/etc/aliases, nis:mail.aliases

postconf -d | grep  alias_database
alias_database = hash:/etc/aliases

# ALIAS DATABASE
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases

Zawartość pliku /etc/aliases:
# aliasy zmapowane na mailbox konkretnego użytkownika
user1:			sp
user2:			sp
# Compile aliases into aliases.db:
newaliasses



#top virtual_transport


Dokumentacja Postfix: virtual_transport (default: virtual)
virtual_transport = dovecot

Zmiany jakie wprowadzić w pliku /etc/postfix/master.cf:
# case sensitive mailaddresses
# You should use flags=DR (without hu) if you have case sensitive directories
# for storing mails. Otherwise dovecot delivers all mails to the wrong directory.
dovecot   unix  -       n       n       -       -       pipe flags=DR user=vmail:vmail argv=/usr/libexec/dovecot/deliver -f ${sender} -d ${recipient}



#top virtual_alias_domains / virtual_alias_maps


Dokumentacja Postfix: virtual_alias_domains (default: $virtual_alias_maps)
Dokumentacja Postfix: virtual_alias_maps (default: $virtual_maps)
virtual_alias_domains = cen05dev.xen.wbcd.pl, cen05dev1.xen.wbcd.pl, cen05dev2.xen.wbcd.pl
virtual_alias_maps = hash:/etc/postfix/virtual

EXAMPLES
Content /etc/postfix/virtual:
-----------------------------
# virtualne adresy email zmapowane na aliasy
ola@cen05dev1.xen.wbcd.pl sp@cen05dev.xen.wbcd.pl
ala@cen05dev2.xen.wbcd.pl sp@cen05dev.xen.wbcd.pl
# virtual.5.html: can be also multiple emails
# user@domain address, address, ...
# user address, address, ...
# @domain address, address, ...
# Compile virtual into virtual.db:
postmap /etc/postfix/virtual



#top transport_maps


Dokumentacja Postfix: transport_maps (default: empty)
Dokumentacja Postfix: transport(5)

EXAMPLES
transport_maps = hash:/etc/postfix/transport


10.41.0.54
Content /etc/postfix/transport:
# In the above example, the [] suppress MX lookups.
cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:587
wbcd.pl                 smtp:[cen06dev.xen.wbcd.pl]:587
# additional you can also choose destination port
# In the case of delivery via SMTP, one may specify hostname:service instead
# of just a host:
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:25
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:465
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:587
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:12345

# Compile transport into transport.db:
postmap /etc/postfix/transport

/etc/postfix/main.cf:
relay_domains = cen05.xen.wbcd.pl, wbcd.pl


10.41.0.56
Content /etc/postfix/transport:
# In the above example, the [] suppress MX lookups.
cen05.xen.wbcd.pl       smtp:[cen05.xen.wbcd.pl]:587
wbcd.pl                 smtp:[cen05.xen.wbcd.pl]:587
# additional you can also choose destination port
# In the case of delivery via SMTP, one may specify hostname:service instead
# of just a host:
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:25
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:465
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:587
#cen05.xen.wbcd.pl       smtp:[cen06dev.xen.wbcd.pl]:12345

# Compile transport into transport.db:
postmap /etc/postfix/transport

/etc/postfix/main.cf:
relay_domains = cen05.xen.wbcd.pl, wbcd.pl


10.41.0.50
/etc/postfix/main.cf:
mydestination = cen05.xen.wbcd.pl
relay_domains = wbcd.pl



#top route some emails to a script (hash)


/etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport

Content /etc/postfix/transport:
bounces.example.com             bulkbounce:

# Compile transport into transport.db:
postmap /etc/postfix/transport

/etc/postfix/master.cf:
bulkbounce   unix  -       n       n       -       -       pipe user=nobody argv=/usr/local/bin/bounce_handler.py ${recipient}



#top route some emails to a script (regexp)


/etc/postfix/main.cf:
transport_maps = regexp:/etc/postfix/redirect.regexp

Content /etc/postfix/redirect.regexp:
/^user-.*@example\.com/   coolscript:

/etc/postfix/master.cf:
coolscript unix -    n    n    -    50    pipe flags=R user=vmail argv=/path/to/script -o SENDER=${sender} -m USER=${user} EXTENSION=${extension}



#top slow some emails


/etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport
slow_destination_recipient_limit = 20
slow_destination_concurrency_limit = 2

Content /etc/postfix/transport:
example.org      slow:

# Compile transport into transport.db:
postmap /etc/postfix/transport

/etc/postfix/master.cf:
slow      unix  -       -       N       -       1       smtp



#top source IPADDR dependent FROM destination address


Dokumentacja Postfix: smtp_bind_address (default: empty)
Dokumentacja Postfix: smtp_bind_address6 (default: empty)
/etc/postfix/main.cf:
transport_maps = pcre:/etc/postfix/transport.pcre

Content /etc/postfix/transport.pcre:
/^a.*@o2.pl/     smtp_o2_a
/^c.*@o2.pl/     smtp_o2_c
/^m.*@o2.pl/     smtp_o2_m

/etc/postfix/master.cf:
smtp_o2_a  unix -       -       n       -       -       smtp -o smtp_bind_address=10.0.0.11 -o syslog_name=postfix-smtp_o2_a
smtp_o2_c  unix -       -       n       -       -       smtp -o smtp_bind_address=10.0.0.12 -o syslog_name=postfix-smtp_o2_c
smtp_o2_m  unix -       -       n       -       -       smtp -o smtp_bind_address=10.0.0.13 -o syslog_name=postfix-smtp_o2_m

testing
# 10.0.0.11 ===> mx[0-9].go2.pl
echo "smtp_o2_a: 10.0.0.11 ===> mx[0-9].go2.pl" | mail -s "smtp_o2_a: 10.0.0.11 ===> mx[0-9].go2.pl" aaa@o2.pl
# 10.0.0.12 ===> mx[0-9].go2.pl
echo "smtp_o2_b: 10.0.0.12 ===> mx[0-9].go2.pl" | mail -s "smtp_o2_b: 10.0.0.12 ===> mx[0-9].go2.pl" bbb@o2.pl
# 10.0.0.13 ===> mx[0-9].go2.pl
echo "smtp_o2_c: 10.0.0.13 ===> mx[0-9].go2.pl" | mail -s "smtp_o2_c: 10.0.0.13 ===> mx[0-9].go2.pl" ccc@o2.pl



#top restrictions


#top smtpd_delay_reject


Dokumentacja Postfix: smtpd_delay_reject (default: yes)



#top smtpd_client_restrictions


Dokumentacja Postfix: smtpd_client_restrictions (default: empty)



#top smtpd_helo_restrictions


Dokumentacja Postfix: smtpd_helo_restrictions (default: empty)



#top smtpd_sender_restrictions + smtpd_sender_login_maps


Dokumentacja Postfix: smtpd_sender_restrictions (default: empty) + smtpd_sender_login_maps (default: empty)



#top smtpd_recipient_restrictions


Dokumentacja Postfix: smtpd_recipient_restrictions (default: see "postconf -d" output)
postconf -d | grep  smtpd_recipient_restrictions
smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination



#top smtpd_data_restrictions


Dokumentacja Postfix: smtpd_data_restrictions (default: empty)



#top smtpd_end_of_data_restrictions


Dokumentacja Postfix: smtpd_end_of_data_restrictions (default: empty)



#top smtpd_etrn_restrictions


smtpd_etrn_restrictions (default: empty)



#top TLS Engine


#top TLS Enable


Dokumentacja Postfix: smtpd_use_tls (default: no)
Dokumentacja Postfix: smtp_use_tls (default: no)

smtpd_use_tls = yes
smtp_use_tls = yes



#top TLS Cert/Key File


Dokumentacja Postfix: smtpd_tls_cert_file (default: empty)
Dokumentacja Postfix: smtpd_tls_key_file (default: empty)
Dokumentacja Postfix: smtpd_tls_CAfile (default: empty)
Dokumentacja Postfix: smtpd_tls_CApath (default: empty)
Dokumentacja Postfix: smtpd_tls_dcert_file (default: empty)
Dokumentacja Postfix: smtpd_tls_dkey_file (default: empty)
Dokumentacja Postfix: smtpd_tls_eccert_file (default: empty)
Dokumentacja Postfix: smtpd_tls_eckey_file (default: empty)

Dokumentacja Postfix: smtp_tls_cert_file (default: empty)
Dokumentacja Postfix: smtp_tls_key_file (default: empty)
Dokumentacja Postfix: smtp_tls_CAfile (default: empty)
Dokumentacja Postfix: smtp_tls_CApath (default: empty)
Dokumentacja Postfix: smtp_tls_dcert_file (default: empty)
Dokumentacja Postfix: smtp_tls_dkey_file (default: empty)
Dokumentacja Postfix: smtp_tls_eccert_file (default: empty)
Dokumentacja Postfix: smtp_tls_eckey_file (default: empty)

EXAMPLES
smtpd_tls_cert_file = /etc/pki/tls/certs/smtpd.pem
smtpd_tls_key_file = /etc/pki/tls/certs/smtpd.pem
smtpd_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt

smtp_tls_cert_file = /etc/pki/tls/certs/smtpd.pem
smtp_tls_key_file = /etc/pki/tls/certs/smtpd.pem
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt



#top TLS Protocols


Dokumentacja Postfix: smtpd_tls_protocols (default: !SSLv2, !SSLv3)
Dokumentacja Postfix: smtpd_tls_mandatory_protocols (default: !SSLv2, !SSLv3)

Dokumentacja Postfix: smtp_tls_protocols (default: !SSLv2, !SSLv3)
Dokumentacja Postfix: smtp_tls_mandatory_protocols (default: !SSLv2, !SSLv3)

EXAMPLES
# Wyłączenie protokołów w wersji SSLv2 and SSLv3
smtpd_tls_protocols = !SSLv2, !SSLv3
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3

# Wyłączenie protokołów w wersji SSLv2 and SSLv3
smtp_tls_protocols = !SSLv2, !SSLv3
smtp_tls_mandatory_protocols = !SSLv2, !SSLv3



#top TLS CipherSuite


Dokumentacja Postfix: smtpd_tls_ciphers (default: medium)
Dokumentacja Postfix: smtpd_tls_exclude_ciphers (default: empty)
Dokumentacja Postfix: smtpd_tls_mandatory_ciphers (default: medium)
Dokumentacja Postfix: smtpd_tls_mandatory_exclude_ciphers (default: empty)

Dokumentacja Postfix: smtp_tls_ciphers (default: medium)
Dokumentacja Postfix: smtp_tls_exclude_ciphers (default: empty)
Dokumentacja Postfix: smtp_tls_mandatory_ciphers (default: medium)
Dokumentacja Postfix: smtp_tls_mandatory_exclude_ciphers (default: empty)

Dokumentacja Postfix: tls_high_cipherlist (default: ALL:!EXPORT:!LOW:!MEDIUM:+RC4:@STRENGTH)
Dokumentacja Postfix: tls_medium_cipherlist (default: ALL:!EXPORT:!LOW:+RC4:@STRENGTH)
Dokumentacja Postfix: tls_low_cipherlist (default: ALL:!EXPORT:+RC4:@STRENGTH)
Dokumentacja Postfix: tls_export_cipherlist (default: ALL:+RC4:@STRENGTH)
Dokumentacja Postfix: tls_null_cipherlist (default: eNULL:!aNULL)
Dokumentacja Postfix: tls_preempt_cipherlist (default: no)

EXAMPLES
# Wyłączenie RC4 ze względów bezpieczeństwa (Obsługa RC4 nie jest zalecana ze względów bezpieczeństwa)
# excluded ciphers
smtpd_tls_exclude_ciphers = RC4
smtpd_tls_mandatory_exclude_ciphers = RC4

# Wyłączenie RC4 ze względów bezpieczeństwa (Obsługa RC4 nie jest zalecana ze względów bezpieczeństwa)
# excluded ciphers
smtp_tls_exclude_ciphers = RC4
smtp_tls_mandatory_exclude_ciphers = RC4



#top TLS Compression


Dokumentacja Postfix: postconf.5



#top TLS Options


Dokumentacja Postfix: smtpd_enforce_tls (default: no)
Dokumentacja Postfix: smtpd_tls_loglevel (default: 0)
Dokumentacja Postfix: smtpd_tls_security_level (default: empty)
Dokumentacja Postfix: smtpd_tls_ccert_verifydepth (default: 9)

Dokumentacja Postfix: smtp_enforce_tls (default: 0)
Dokumentacja Postfix: smtp_tls_loglevel (default: 0)
Dokumentacja Postfix: smtp_tls_security_level (default: empty)
Dokumentacja Postfix: smtp_tls_scert_verifydepth (default: 9)

Dokumentacja Postfix: smtpd_tls_auth_only (default: no)
Dokumentacja Postfix: smtp_tls_note_starttls_offer (default: no)
Dokumentacja Postfix: tls_random_source (default: see "postconf -d" output)

EXAMPLES
smtpd_enforce_tls = no
smtp_enforce_tls = no

smtpd_tls_loglevel = 1
smtp_tls_loglevel = 1

smtpd_tls_auth_only = yes
smtp_tls_note_starttls_offer=yes

# The external entropy source for the in-memory tlsmgr(8) pseudo random number generator (PRNG) pool
tls_random_source = dev:/dev/urandom



#top forwarding emails for external domains


forwarding emails (with sender=orig_recipient) for external domains to avoid rejecting email by SPF
Forwardowanie wiadomości email (Email forwarding / Przekierowanie poczty elektronicznej) realizowane jest w serverze Postfix poprzez aliasy (ALIAS DATABASE,virtual_alias_maps). W obrębie serwera Postfix oraz obsługiwanych przez serwer domen można przekazywanie poczty zrealizować z użyciem dostępnych w serwerze mechanizmów. W przypadku przekazywania poczty do kont zewnętrznych z powodu istnienia problemu SPAM(niechcianych lub niepożądanych wiadomości elektronicznych) oraz wdrożenia odpowiednich mechanizmów ograniczających to zjawisko wiadomości przekazywane dalej mogą zostać odrzucone przez serwery pocztowe poprzez mechanizm SPF (Sender Policy Framework) lub trafić do folderu SPAM zamiast do skrzynki odbiorczej. Mechanizm SPF poprzez odpowiedni wpis w domenie umożliwia serwerom pocztowym przyjmującym wiadomości zweryfikować czy dany serwer wysyłający korespondencję może wysyłać z danej domeny (jako nadawca tych wiadomości). W związku z powyższym jedną z możliwości jest zastąpienie adresu nadawcy, który wysłał wiadomość adresem odbiorcy wiadomości, który zdefiniował dla swojej skrzynki przekazywanie wiadomości. Poniżej przedstawiono w jaki sposób takie przekazywanie wiadomości skonfigurować w serwerze Postfix. Nie jest to oczywiści jedyny sposób realizacji tego celu. W zależności od konfiguracji serwera Postfix oraz w przypadku zapewnienia elastyczności konfiguracji przekazywania wiadomości email konfigurację przekazywania wiadomośći można przechowywać w bazie danych zamiast w pliku /usr/local/etc/forwarding.txt. Poniżej dla ułatwienia zrozumienia zastosowanego sposobu przekazywania wiadomości do kont zewnętrznych użyto wspomnianego pliku.

W pierwszej kolejności należy określić adresatów, którzy posiadają włączone przekazywanie wiadomości do kont zewnętrznych (przykładowa domena cen05dev.xen.wbcd.pl). Zrealizowane jest to poprzez aliasy do adresatów w "subdomenie" o intuicyjnej nazwie forwarding.cen05dev.xen.wbcd.pl ("subdomena" nie wymaga dodawania wpisów w DNS !!!):

UNIX accounts:
Content /etc/aliases:
sp:         sp,sp@forwarding.cen05dev.xen.wbcd.pl
# Compile aliases into aliases.db:
newaliasses

VIRTUAL(MySQL/PgSQL/SQLite/LDAP) accounts:
Content /etc/postfix/virtual:
sp@cen05dev.xen.wbcd.pl   sp@forwarding.cen05dev.xen.wbcd.pl,sp@cen05dev.xen.wbcd.pl
# Compile virtual into virtual.db:
postmap /etc/postfix/virtual


Następnie należy upewnić się, że w konfiguracji serwera Postfix ustawiona jest opcja transport_maps analogicznie jak poniżej:
/etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport
oraz w zależności od konfiguracji są odpowiednie wpisy związane z aliasami:
UNIX accounts:
# ALIAS DATABASE
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
VIRTUAL(MySQL/PgSQL/SQLite/LDAP) accounts:
# cen05: fatal: bad string length 0 < 1: virtual_mailbox_base =
#virtual_alias_domains =
virtual_alias_maps = hash:/etc/postfix/virtual, hash:/etc/postfix/etc-aliases

Następnie należy "subdomenę" przypisać do transportu, który będzie odpowiedzialny za obsługę wiadomości przekazywanych na konta zewnętrzne (dlatego własnie "subdomena" nie wymaga dodawania wpisów w DNS !!!).
Content /etc/postfix/transport:
forwarding.cen05dev.xen.wbcd.pl   forwarding:
Po wprowadzeniu zmian należy skompilować mapę hash:
# Compile transport into transport.db:
postmap /etc/postfix/transport

Następnie należy skonfigurować transport odpowiedzialny za przekazywanie wiadomości do kont zewnętrznych:
/etc/postfix/master.cf:
forwarding unix  -       n       n       -       -       pipe user=nobody argv=/usr/local/bin/forwarding.sh /usr/local/etc/forwarding.txt ${sender} -- ${recipient}


Następnie należy określić "aliasy", czyli adresatów wiadomości kont zewnętrznych dla kont wewnętrznych do których poczta jest wysyłana, którzy włączyli opcję przekazywania wiadomości do kont zewnętrznych:
/usr/local/etc/forwarding.txt:
root@cen05dev.xen.wbcd.pl root@cen06dev.xen.wbcd.pl
sp@cen05dev.xen.wbcd.pl   sp@cen06dev.xen.wbcd.pl
ola@cen05dev.xen.wbcd.pl  ola@cen06dev.xen.wbcd.pl


Poniżej znajduje się skrypt forwarding.sh, który realizuje przekazywanie wiadomości do kont zewnętrznych ustawiając jako nadawcę pierwotnego odbiorcę (adresata) wiadomości, który ma włączone przekazywanie wiadomości do kont zewnętrznych:
/usr/local/bin/forwarding.sh:
#!/bin/bash

# ----------------------------------------------------------
#                      instalation
# ----------------------------------------------------------
# 1. Copy forwardings.sh to /usr/local/sbin/forwardings.sh
#
# 2. Add the following to /etc/postfix/master.cf:
# forwarding unix  -       n       n       -       -       pipe user=nobody argv=/usr/local/bin/forwarding.sh /usr/local/etc/forwarding.txt ${sender} -- ${recipient}
#
# 3. Reload Postfix.
#    /etc/init.d/postfix reload
#    service postfix reload
#    systemctl reload postfix.service
#

# ARGS
argconf=$1
argfrom=$2
argtoto=$*
argtoto=`echo $argtoto | sed 's/^.* -- //g'`

# FROM: sp@cen05dev.xen.wbcd.pl --- TO: sp@cen05dev.xen.wbcd.pl
# echo "`date +'%Y/%m/%d %H:%M:%S'` [$$] argfrom=$argfrom" >> /tmp/forwarding.debug.log
# echo "`date +'%Y/%m/%d %H:%M:%S'` [$$] argtoto=$argtoto" >> /tmp/forwarding.debug.log
# --------------------------------------------------------------------------------------------
# 2013/07/23 19:35:44 argfrom=sp@cen05dev.xen.wbcd.pl
# 2013/07/23 19:35:44 argtoto=sp@cen06dev.xen.wbcd.pl

# Exit codes from <sysexits.h>
EX_TEMPFAIL=75
EX_UNAVAILABLE=69

# The -G option says the filter output is not a local mail submission:
# don't do silly things like appending the local domain name to addresses
# in message headers. This option does nothing before Postfix version 2.3.
# The -i option says don't stop reading input when a line contains "." only.
# NEVER NEVER NEVER use the "-t" command-line option here. It will mis-deliver mail,
# like sending messages from a mailing list back to the mailing list.
SENDMAIL="/usr/sbin/sendmail -G -i" # NEVER NEVER NEVER use "-t" here.

# Clean up when done or when aborting.
trap "rm -f /tmp/forwarding-$$-stdin" 0 1 2 3 15

# The idea is to first capture the message to file and then run the content through a third-party content filter program.
# If the message cannot be captured to file, mail delivery is deferred by terminating with exit status 75 (EX_TEMPFAIL).
# Postfix places the message in the deferred mail queue and tries again later.
cat > /tmp/forwarding-$$-stdin || { echo Cannot save mail to file; exit $EX_TEMPFAIL; }

for rowtoto in $argtoto;do
	if [ "$argfrom" == "MAILER-DAEMON" ];then
		echo "`date +'%Y/%m/%d %H:%M:%S'` [$$] argfrom=|$argfrom| continue" >> /tmp/forwarding.debug.log
		continue
	fi
	rowtoto=`echo $rowtoto | "s,@forwarding\.,,g"`
	# echo "`date +'%Y/%m/%d %H:%M:%S'` [$$] rowtoto=$rowtoto" >> /tmp/forwarding.debug.log
	rownext=`sed -n "s,^$rowtoto[ ]*\(.*\)$,\1,p" /usr/local/etc/forwarding.txt`
	if [ -n "$rownext" ];then
		# echo "`date +'%Y/%m/%d %H:%M:%S'` [$$] rownext=$rownext" >> /tmp/forwarding.debug.log
		echo "`date +'%Y/%m/%d %H:%M:%S'` [$$] cat /tmp/forwarding-$$-stdin | $SENDMAIL -r $rowtoto $rownext" >> /tmp/forwarding.debug.log
		cat /tmp/forwarding-$$-stdin | $SENDMAIL  -f $rowtoto $rownext
	fi
done

Na koniec po zapisaniu zawartości skryptu do pliku należy jeszcze plikowi ze skryptem nadać atrybut wykonywalności:
chmod a+x /usr/local/bin/forwarding.sh



#top autoreponder


autoreponder (forwardings to autoreponder transport)

Poniższa konfiguracja autorepondera zakłada konfigurację serwera Postfix z Virtual domain hosting.

W pierwszej kolejności należy upewnić się, że w konfiguracji serwera Postfix ustawiona jest opcja transport_maps oraz virtual_alias_maps (aliasy dla domen wirtualnych obsługiwanych przez serwer Postfix) analogicznie jak poniżej:
/etc/postfix/main.cf:
transport_maps = hash:/etc/postfix/transport
[...]
virtual_alias_maps = hash:/etc/postfix/virtual


Następnie należy utworzyć alias (przekierowanie) wiadomości do pierwotnego adresata wiadomości oraz do adresata, który będzie posiadał włączoną opcję autorespondera (przykładowa domena cen05dev.xen.wbcd.pl). Zrealizowane jest to poprzez aliasy do adresatów w "subdomenie" o intuicyjnej nazwie autoresponder.cen05dev.xen.wbcd.pl ("subdomena" nie wymaga dodawania wpisów w DNS !!!):
Content /etc/postfix/virtual (cen05dev: autoresponder):
sp@cen05dev.xen.wbcd.pl   sp@autoresponder.cen05dev.xen.wbcd.pl,sp@cen05dev.xen.wbcd.pl
Content /etc/postfix/virtual (cen06dev: autoresponder):
sp@cen06dev.xen.wbcd.pl   sp@autoresponder.cen06dev.xen.wbcd.pl,sp@cen06dev.xen.wbcd.pl

Po wprowadzeniu zmian należy skompilować mapę hash:
# Compile virtual into virtual.db:
postmap /etc/postfix/virtual

Następnie należy "subdomenę" przypisać do transportu, który będzie odpowiedzialny za obsługę automatycznego odpowiadania na wiadomości (dlatego własnie "subdomena" nie wymaga dodawania wpisów w DNS !!!).
Content /etc/postfix/transport (cen05dev: autoresponder):
autoresponder.cen05dev.xen.wbcd.pl       vacation:
Content /etc/postfix/transport (cen06dev: autoresponder):
autoresponder.cen06dev.xen.wbcd.pl       vacation:

Po wprowadzeniu zmian należy skompilować mapę hash:
# Compile transport into transport.db:
postmap /etc/postfix/transport

Następnie należy skonfigurować transport odpowiedzialny za automatyczne odpowiadanie na wiadomości:
/etc/postfix/master.cf (cen05dev: autoresponder):
# cen05: ${recipient}   This information is modified by the hqu flags for quoting and case folding.
# cen06: ${original_recipient}   This feature is available as of Postfix 2.5.   This information is modified by the hqu flags for quoting and case folding.
vacation   unix  -       n       n       -       -       pipe user=nobody argv=/usr/local/bin/responder.sh ${sender} -- ${recipient}
/etc/postfix/master.cf (cen06dev: autoresponder):
# cen05: ${recipient}   This information is modified by the hqu flags for quoting and case folding.
# cen06: ${original_recipient}   This feature is available as of Postfix 2.5.   This information is modified by the hqu flags for quoting and case folding.
vacation   unix  -       n       n       -       -       pipe user=nobody argv=/usr/local/bin/responder.sh ${sender} -- ${original_recipient}

Następnie należy określić użytkowników dla których autoresponder jest włączony (dla uproszczenia zastosowano plik /usr/local/etc/responder.txt, w którym obecność adresu docelowego powoduje automatyczne odpowiadanie na wiadomości):
/usr/local/etc/responder.txt (cen05dev: autoresponder):
sp@cen05dev.xen.wbcd.pl
/usr/local/etc/responder.txt (cen06dev: autoresponder):
sp@cen06dev.xen.wbcd.pl


Poniżej znajduje się skrypt forwarding.sh, który realizuje automatyczne odpowiadanie na wiadomości, który ma włączone automatyczne odpowiadanie na wiadomości:
/usr/local/bin/responder.sh:
#!/bin/bash

# ARGS
arg_sender=$1
arg_recipient=$*
arg_subject=""
arg_recipient=`echo $arg_recipient | sed 's/^.* -- //g'`

# STATIC TEXTS
fromtext="Autoresponder"
subjecttext="Autoresponder"
hdrs_toto="To: $arg_sender"
hdrs_subject="Subject: [Re:$subjecttext]"
message_body="autoresponder\nautoresponder\nautoresponder\n"

for row_recipient in $arg_recipient;do
	# for cen05 which not have feature ${original_recipient}
	# cen05: ${recipient}   This information is modified by the hqu flags for quoting and case folding.
	# cen06: ${original_recipient}   This feature is available as of Postfix 2.5.   This information is modified by the hqu flags for quoting and case folding.
	row_recipient=`echo $row_recipient | sed 's,@autoresponder\.,@,g'`
	responderok=`cat /usr/local/etc/responder.txt | grep "$row_recipient"`
	echo "row_recipient=$row_recipient responderok=$responderok" >> /tmp/responder
	if [ "$arg_sender" != "MAILER-DAEMON" ];then
		# if "$responderok" in not empty then send message to sender (responder)
		if [ -n "$responderok" ];then
			echo "/usr/sbin/sendmail -oi -f $row_recipient -F $fromtext $arg_sender" >> /tmp/responder
			echo -en "$hdrs_toto\n$hdrs_subject\n\n$message_body" | /usr/sbin/sendmail  -oi -f "$row_recipient" -F "$fromtext" "$arg_sender"
		else
			echo -n
			#echo -en "$hdrs_toto\n$hdrs_subject\n$query_message_result" | /usr/sbin/sendmail -oi -f "$arg_sender" "$row_recipient"
		fi
	fi
done

Na koniec po zapisaniu zawartości skryptu do pliku należy jeszcze plikowi ze skryptem nadać atrybut wykonywalności:
chmod a+x /usr/local/bin/responder.sh

Powyższa wersja jest bardzo uproszczona by pokazać ideę. W praktycznej autorespondera najwygodniej przechowywać dane w bazie, w której można zapisać nie tylko adresatów, którzy będą posiadali włączoną opcję automatycznego odpowiadania na wiadomości, ale również można określić daty przez które autoresponder będzie aktywny oraz również ustawić treść odpowiedzi dla każdego adresata inną.


















Zmodyfikowany ostatnio: 2018/01/01 16:08:02 (6 lat temu), textsize: 52,3 kB, htmlsize: 85,3 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników