Мой хост работает под управлением Fedora 31. Я использую postfix с mysql для хранения своих виртуальных адресов электронной почты. Итак, у меня есть:
mysql -virtual-alias-maps.cf: пользователь = пользователь пароль = mypass хосты = 127.0.0.1 dbname = maildb запрос = ВЫБЕРИТЕ пункт назначения ОТ virtual_aliases WHERE source = '% s' mysql -virtual-email2email.cf: пользователь = пользователь пароль = mypass хосты = 127.0.0.1 dbname = maildb запрос = ВЫБЕРИТЕ электронную почту ОТ Виртуальных_пользователей ГДЕ электронная почта = '% s' mysql -virtual-mailbox-domains.cf: пользователь = пользователь пароль = mypass хосты = 127.0.0.1 dbname = maildb query = SELECT 1 FROM virtual_domains WHERE name = '% s' mysql -virtual-mailbox-maps.cf: пользователь = пользователь пароль = mypass хосты = 127.0.0.1 dbname = maildb query = SELECT 1 FROM virtual_users WHERE электронная почта = '% s' main.cf:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
command_directory = /usr/sbin
compatibility_level = 2
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
disable_vrfy_command = yes
html_directory = no
inet_interfaces = all
inet_protocols = all
invalid_hostname_reject_code = 550
mailbox_size_limit = 0
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
maximal_backoff_time = 3h
meta_directory = /etc/postfix
milter_default_action = accept
milter_protocol = 6
minimal_backoff_time = 180s
mydestination = localhost.$mydomain, localhost
mydomain = $myhostname
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
non_fqdn_reject_code = 550
non_smtpd_milters = $smtpd_milters
policyd-spf_time_limit = 3600
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix/README_FILES
recipient_delimiter = +
relayhost =
sample_directory = /usr/share/doc/postfix/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
shlib_directory = /usr/lib64/postfix
smtp_always_send_ehlo = yes
smtpd_delay_reject = yes
smtpd_error_sleep_time = 1s
smtpd_hard_error_limit = 20
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname
smtpd_milters = inet:127.0.0.1:8891,inet:127.0.0.1:8893
smtpd_recipient_limit = 40
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination, reject_unlisted_recipient, reject_unknown_recipient_domain, reject_non_fqdn_recipient, check_policy_service unix:private/policyd-spf
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous, noplaintext
smtpd_sasl_tls_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_sender, reject_unknown_sender_domain
smtpd_soft_error_limit = 10
smtpd_timeout = 30s
smtpd_tls_auth_only = yes
smtpd_tls_cert_file=/etc/letsencrypt/live/mydomain/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/mydomain/privkey.pem
smtpd_tls_security_level = may
smtpd_use_tls=yes
smtp_helo_timeout = 15s
smtp_rcpt_timeout = 15s
smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
smtp_tls_CApath = /etc/pki/tls/certs
smtp_tls_security_level = may
strict_rfc821_envelopes = yes
unknown_address_reject_code = 550
unknown_client_reject_code = 550
unknown_hostname_reject_code = 550
unverified_recipient_reject_code = 550
unverified_sender_reject_code = 550
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf, mysql:/etc/postfix/mysql-virtual-email2email.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
master.cf:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# 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
#smtp inet n - n - 1 postscreen
#smtpd pass - - n - - smtpd
#dnsblog unix - - n - 0 dnsblog
#tlsproxy unix - - n - 0 tlsproxy
submission inet n - n - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_tls_auth_only=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
smtps inet n - n - - smtpd
-o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes
-o smtpd_sasl_auth_enable=yes
-o smtpd_sasl_type=dovecot
-o smtpd_sasl_path=private/auth
-o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=
# -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
#628 inet n - n - - qmqpd
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 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
relay unix - - n - - smtp
-o syslog_name=postfix/$service_name
# -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
postlog unix-dgram n - n - 1 postlogd
#
# ====================================================================
# 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/local/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=/usr/lib/cyrus-imapd/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
#
# Old example of delivery via Cyrus.
#
#old-cyrus unix - n n - - pipe
# flags=R user=cyrus argv=/usr/lib/cyrus-imapd/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/local/sbin/bsmtp -f $sender $nexthop $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}
policyd-spf unix - n n - 0 spawn
user=nobody argv=/usr/libexec/postfix/policyd-spf
Он отлично работает, и я сдаю все тесты dmarc / dkim / spf на mxtoolbox.com. Я настроил его в Evolution, однако каждый раз, когда я отправляю или получаю электронную почту, SE Linux сообщает мне:
SELinux is preventing smtpd from read access on the file /etc/my.cnf.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that smtpd should be allowed read access on the my.cnf file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'smtpd' --raw | audit2allow -M my-smtpd
# semodule -X 300 -i my-smtpd.pp
Additional Information:
Source Context system_u:system_r:postfix_smtpd_t:s0
Target Context system_u:object_r:mysqld_etc_t:s0
Target Objects /etc/my.cnf [ file ]
Source smtpd
Source Path smtpd
Port <Unknown>
Host <Unknown>
Source RPM Packages
Target RPM Packages mariadb-connector-c-config-3.1.7-1.fc31.noarch
Policy RPM selinux-policy-3.14.4-49.fc31.noarch
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name FedoraNAS.local
Platform Linux FedoraNAS.local 5.5.6-201.fc31.x86_64 #1 SMP
Mon Feb 24 20:24:13 UTC 2020 x86_64 x86_64
Alert Count 177
First Seen 2020-02-27 21:42:22 CET
Last Seen 2020-03-03 11:15:56 CET
Local ID 0dc678b9-59a5-44c2-84fa-a1217c530f0a
Raw Audit Messages
type=AVC msg=audit(1583230556.275:3949): avc: denied { read } for pid=222986 comm="smtpd" name="my.cnf" dev="md0" ino=4376743107 scontext=system_u:system_r:postfix_smtpd_t:s0 tcontext=system_u:object_r:mysqld_etc_t:s0 tclass=file permissive=0
Также:
SELinux is preventing cleanup from read access on the file /etc/my.cnf.
***** Plugin catchall (100. confidence) suggests **************************
If you believe that cleanup should be allowed read access on the my.cnf file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# ausearch -c 'cleanup' --raw | audit2allow -M my-cleanup
# semodule -X 300 -i my-cleanup.pp
Additional Information:
Source Context system_u:system_r:postfix_cleanup_t:s0
Target Context system_u:object_r:mysqld_etc_t:s0
Target Objects /etc/my.cnf [ file ]
Source cleanup
Source Path cleanup
Port <Unknown>
Host <Unknown>
Source RPM Packages
Target RPM Packages mariadb-connector-c-config-3.1.7-1.fc31.noarch
Policy RPM selinux-policy-3.14.4-49.fc31.noarch
Selinux Enabled True
Policy Type targeted
Enforcing Mode Enforcing
Host Name FedoraNAS.local
Platform Linux FedoraNAS.local 5.5.6-201.fc31.x86_64 #1 SMP
Mon Feb 24 20:24:13 UTC 2020 x86_64 x86_64
Alert Count 80
First Seen 2020-02-28 03:30:13 CET
Last Seen 2020-03-03 11:15:56 CET
Local ID 6f32f341-0e44-40b2-8c66-af0607e27831
Raw Audit Messages
type=AVC msg=audit(1583230556.285:3951): avc: denied { read } for pid=222998 comm="cleanup" name="my.cnf" dev="md0" ino=4376743107 scontext=system_u:system_r:postfix_cleanup_t:s0 tcontext=system_u:object_r:mysqld_etc_t:s0 tclass=file permissive=0
Я долго чесал голову и ничего не нашел в net, почему postfix ' smtpd или cleanup двоичные файлы должны попытаться получить доступ к /etc/my.cnf. У меня есть эта установка, запущенная на другом сервере Fedora 31 с тем же main.cf/master.cf, и там я не получаю эти сообщения. Я попытался пометить мою файловую систему и даже сделал дополнительный «restorecon -vFR / etc /». Все еще нет игры в кости .. Есть идеи?