C
C
Coal Coalition2018-08-31 09:48:37
Email
Coal Coalition, 2018-08-31 09:48:37

How to receive letters from /var/spool/xxx to your mail?

Ситуация: поднял веб-сервер на ubuntu для 3-х внутренних сайтов в сети компании. Когда захожу по ssh на него, то периодически пишет, что, мол, вам письмо. Они лежат в /var/spool/xxx, где xxx - root и другие пользователи. Как автоматически пересылать эти письма к себе на рабочую почту? Видимо, к тому же надо еще что-то сделать с hostname машины, т.к. якобы все идет от домена в виде имени машины, а ведь тогда принимающий сервер может отбросить эти письма из-за DMARC, SPF и т.д? Как быть? Что делать? Пример присланных сообщений:

[email protected]:/home/company-site.ru# cat /var/mail/root
From [email protected]  Wed Aug 29 00:12:43 2018
Return-Path: <[email protected]>
Received: from my-ubuntu-host (localhost.localdomain [127.0.0.1])
        by my-ubuntu-host (8.15.2/8.15.2/Debian-10) with ESMTPS id ww43h33erge4y5
        (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
        for <[email protected]>; Wed, 29 Aug 2018 00:12:43 +0500
Received: (from [email protected])
        by my-ubuntu-host (8.15.2/8.15.2/Submit) id w7SJCggO032352
        for root; Wed, 29 Aug 2018 00:12:42 +0500
Date: Wed, 29 Aug 2018 00:12:42 +0500
Message-Id: <[email protected]>
From: Anacron <[email protected]>
To: [email protected]
Subject: Anacron job 'cron.weekly' on my-ubuntu-host
Content-Type: text/plain; charset=UTF-8
X-IMAPbase: 1535694118 2
Status: O
X-UID: 1

/etc/cron.weekly/update-notifier-common:
Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings

-----------------------------------------------------------------
From MAILER-DAEMON  Mon Aug 27 16:57:58 2018
Return-Path: <MAILER-DAEMON>
Received: from localhost (localhost)
        by localhost.localdomain (8.15.2/8.15.2/Debian-10) id d234rgwehw455yrt;
        Mon, 27 Aug 2018 16:57:58 +0500
Date: Mon, 27 Aug 2018 16:57:58 +0500
From: Mail Delivery Subsystem <MAILER-DAEMON>
Message-Id: <[email protected]>
To: <[email protected]>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="d234rgwehw455yrt.1535371078/localhost.localdomain"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--d234rgwehw455yrt.1535371078/localhost.localdomain

The original message was received at Mon, 27 Aug 2018 16:57:58 +0500
from localhost.localdomain [127.0.0.1]

   ----- The following addresses had permanent fatal errors -----
<[email protected]>
    (reason: 553 5.3.5 system config error)

   ----- Transcript of session follows -----
553 5.3.5 company-site.ru. config error: mail loops back to me (MX problem?)
554 5.3.5 Local configuration error
550 5.1.1 postmaster... User unknown

--d234rgwehw455yrt.1535371078/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Received-From-MTA: DNS; localhost.localdomain
Arrival-Date: Mon, 27 Aug 2018 16:57:58 +0500

Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.3.5
Diagnostic-Code: SMTP; 553 5.3.5 system config error
Last-Attempt-Date: Mon, 27 Aug 2018 16:57:58 +0500

--d234rgwehw455yrt.1535371078/localhost.localdomain
Content-Type: text/rfc822-headers

Return-Path: <[email protected]>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
        by localhost.localdomain (8.15.2/8.15.2/Debian-10) with ESMTPS id w7RBvw6r013350
        (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT)
        for <[email protected]>; Mon, 27 Aug 2018 16:57:58 +0500
Received: (from [email protected])
        by localhost.localdomain (8.15.2/8.15.2/Submit) id w7RBvwts013349
        for [email protected]; Mon, 27 Aug 2018 16:57:58 +0500
Date: Mon, 27 Aug 2018 16:57:58 +0500
From: company-site.ru <[email protected]>
Message-Id: <[email protected]>

--d234rgwehw455yrt.1535371078/localhost.localdomain--

Answer the question

In order to leave comments, you need to log in

3 answer(s)
Коал Коалыч, 2018-09-03
@tmman

Обчитаться рекомендаций, что не надо использовать sendmail.
Загуглить решение на exim4.
Закрыть вопрос как решенный.

Денис, 2018-08-31
@notwrite

There are 2 options here
1. configure mta on the machine to send letters to external addresses.
2. Install dovecot or equivalent and pick up mail from the machine directly.

A
alexander, 2018-08-31
@beza2000

In the /etc/aliases file, write your mail address like:
user: [email protected]
and call the command:
sudo newaliases
BUT, what is in /var/spool/xxx will not be delivered.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question