2019年1月14日月曜日

postfixコンフィグ整理:メモ

main.cfに、以下のスパムメール対策を追記した場合,
以下のコマンド1を投入して、データベースの再構築をする必要がある
それを行わないと作成したメールアカウントから送受信をサーバー側で拒否される。


◻️/etc/postfix/access.dbファイルが開けないと警告が出てしまうので
以下のデータベースの作成を行う。


#local_recipient_maps =
#luser_relay = unknown_user@localhost
#disable_vrfy_command = yes



<コマンド1>

1)postfixの設定ファイルmain.cfに追記したsmtpd_client_restrictionsパラメタのcheck_client_access hash:/etc/postfix/accessのデータベースファイルがない為に警告がでているのでデータベースファイルを作成
2)smtpd_sender_restrictionsパラメタのcheck_sender_access hash:/etc/postfix/reject_senderもデータベースファイル(データベースファイルを作成する元のテキストファイルも)がないので作成


postmap /etc/postfix/access
touch /etc/postfix/reject_sender
postmap /etc/postfix/reject_sender



*****************/etc/postfix/main.cf*************************************

#_/_/_/_/_/_/  add settings  /_/_/_/_/_/#


###### MailBox ################
mailbox_size_limit = 204800000


###### SPAM Mail settings #####
smtpd_client_restrictions =
    check_client_access hash:/etc/postfix/access
    reject_rbl_client zen.spamhaus.org
    reject_non_fqdn_sender
    reject_unknown_sender_domain
smtpd_sender_restrictions =
        reject_rhsbl_sender zen.spamhaus.org
        reject_unknown_sender_domain

#local_recipient_maps =
#luser_relay = unknown_user@localhost
#disable_vrfy_command = yes



########## SMTP-Auth ##########

# Dovecot SASL
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
broken_sasl_auth_clients = yes


# SASL Authentication
smtpd_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd <--メールのリレー設定をしないなら追記不要(メモ1)
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_sasl_auth_enable = yes
smtp_sasl_tls_security_options = noanonymous


########## TLS/SSL ##########
smtpd_use_tls = yes
smtp_tls_security_level = may
smtpd_tls_cert_file = /etc/pki/tls/device.crt
smtpd_tls_key_file = /etc/pki/tls/device.key
smtpd_tls_CAfile = /etc/pki/tls/rootCA.pem
tls_random_source = dev:/dev/urandom

smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_database = btree:/var/lib/postfix/smtpd_scache
smtpd_tls_session_cache_timeout = 3600s
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
    permit_mynetworks
    permit_sasl_authenticated
    reject_unauth_destination

***************************************************

0 件のコメント:

コメントを投稿

memo2

  ## ProxyPassにALBのパスルーティング先を記載 ## RUN echo 'LoadModule proxy_module modules/mod_proxy.so' >> /etc/apache2/apache2.conf ...