Последние пару дней я пытался настроить почтовый сервер на своем ubuntu vServer. Я использую postfix с mySQL и Courier. Для веб-почты я использую roundcube.
Я могу получать электронные письма на свой адрес, но когда я пытаюсь отправить электронное письмо с помощью SMTP, я получаю следующее сообщение об ошибке: https://i.imgur.com/FxJByog.png
Неважно, на какой адрес я его отправляю, я всегда получаю одну и ту же ошибку. РЕДАКТИРОВАТЬ: Я забыл сказать, что могу отправлять почту самому себе, только исходящая почта не работает.
Теперь, после некоторого поиска в Google, я обнаружил этот сайт: https://www.gammadyne.com/relaying_denied.htm который в основном говорит о том, что эта ошибка возникает, когда пользователь не аутентифицируется правильно. Я новичок в postfix и smpt, поэтому не знаю, где искать исправление этой ошибки.
Это сообщение об ошибке из /var/log/mail.log, когда я пытаюсь отправить почту через roundcube (cybershit.de - мой домен, bnry.de - второй домен, который ссылается на тот же IP-адрес, хотя cybershit.de - используется для почтовых служб):
NOQUEUE: reject: RCPT from vps1908220.fastwebserver.de[62.141.44.212]: 554 5.7.1 <example@example.com>: Relay access denied; from=<staddle@cybershit.de> to=<example@example.com> proto=ESMTP helo=<bnry.de>
Когда я пытаюсь отправить письмо через Thunderbird, я получаю сообщение об ошибке SMTP, но ничего более конкретного.
Я очень ценю любую помощь, я могу опубликовать любые другие файлы журналов / конфигурации, если это необходимо. Спасибо!
Вот мои файлы конфигурации:
постфикс main.cf:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = cybershit.de ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain reject_unauth_destination, check_policy_service inet:127.0.0.1:10023, permit
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, reject_unauth_pipelining, permit
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain =
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = mail.cybershit.de
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination =
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
#mynetworks = localhost
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
# Virtual Mailbox Domain Settings
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit = 51200000
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual
# Additional for quota support
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes
Roundcubes config.inc.php:
<?php
/*
+-----------------------------------------------------------------------+
| Local configuration for the Roundcube Webmail installation. |
| |
| This is a sample configuration file only containing the minimum |
| setup required for a functional installation. Copy more options |
| from defaults.inc.php to this file to override the defaults. |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2013, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
+-----------------------------------------------------------------------+
*/
$config = array();
/* Do not set db_dsnw here, use dpkg-reconfigure roundcube-core to configure database ! */
include_once("/etc/roundcube/debian-db-roundcube.php");
// The IMAP host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
$config['default_host'] = array("mail.cybershit.de");
// SMTP server host (for sending mails).
// Enter hostname with prefix tls:// to use STARTTLS, or use
// prefix ssl:// to use the deprecated SSL over SMTP (aka SMTPS)
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
$config['smtp_server'] = 'cybershit.de';
// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
$config['smtp_port'] = 25;
// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
$config['smtp_user'] = '';
// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
$config['smtp_pass'] = '%p';
// provide an URL where a user can get support for this Roundcube installation
// PLEASE DO NOT LINK TO THE ROUNDCUBE.NET WEBSITE HERE!
$config['support_url'] = '';
// Name your service. This is displayed on the login screen and in the window title
$config['product_name'] = 'CYBERSHIIIIT Mail Service';
// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
// YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
$config['des_key'] = '[removed for security]';
// List of active plugins (in plugins/ directory)
// Debian: install roundcube-plugins first to have any
$config['plugins'] = array(
);
// skin name: folder from skins/
$config['skin'] = 'larry';
// Disable spellchecking
// Debian: spellshecking needs additional packages to be installed, or calling external APIs
// see defaults.inc.php for additional informations
$config['enable_spellcheck'] = false;
$config['smtp_auth_type'] = 'LOGIN';
Ошибка, которую вы получаете, связана с тем, что почтовый сервер не распознает вас, поэтому не позволит вам отправлять через него электронную почту, поскольку вы можете быть спамером.
Есть несколько способов исправить это в зависимости от вашего сценария. Безусловно, самый простой способ - зарегистрировать IP-адрес почтового сервера в postfix.
Если вы посмотрите журнал, postfix получает электронное письмо от 62.141.44.212, но этого адреса нет в параметре my_networks. Вы можете добавить этот IP в постфикс и перезапустить его.
В качестве альтернативы и более безопасно, если клиент веб-почты находится в том же ящике, что и postfix, вы можете изменить $ config ['smtp_server'] = 127.0.0.1, чтобы он взаимодействовал через localhost, который уже распознается SMTP-сервером.
Существуют и другие, более сложные решения, которые также позволяют выполнять аутентификацию на основе пользователей.