Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-18-2011, 11:36 PM
|
#1
|
Member
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724
Rep: 
|
sendmail - disable local delivery and queue is growing up?
Hi,
I want to setup sendmail to alert for Nagios, OSSEC, redmine, ...
I configure sendmail to work with Gmail smtp follow this guide.
I disable local delivery in sendmail by adding the following lines in sendmail.mc:
Code:
define(`MAIL_HUB', `xx.localdomain.')dnl
define(`LOCAL_RELAY', `xx.localdomain.')dnl
it works but this messages seems to be stuck in sendmail queue:
Code:
sendmail -bp
...
p0IAY17d021939 253 Tue Jan 18 17:34 <root@xx.localdomain>
(Deferred: Connection refused by xx.localdomain.)
<root@xx.localdomain>
Total requests: 2057
and is growing up very fast. Yesterday, it was up to 400000 msg. `sendmail -v -q` seems to not work and I must manually delete it from /var/spool/mqueue.
How can I solve this problem?
Below is my sendmail.mc:
Code:
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
FEATURE(`accept_unresolvable_domains')dnl
FEATURE(`authinfo',`hash /etc/mail/auth/client-info.db')dnl
define(`SMART_HOST',`smtp.gmail.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')
define(`ESMTP_MAILER_ARGS', `TCP $h 587')
define(`CERT_DIR', `/etc/mail/certs')
define(`confCACERT_PATH', `CERT_DIR')
define(`confCACERT', `CERT_DIR/ca-bundle.crt')
define(`confCRL', `CERT_DIR/ca-bundle.crt')
define(`confSERVER_CERT', `CERT_DIR/sendmail.pem')
define(`confSERVER_KEY', `CERT_DIR/sendmail.pem')
define(`confCLIENT_CERT', `CERT_DIR/sendmail.pem')
define(`confCLIENT_KEY', `CERT_DIR/sendmail.pem')
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')
MAILER(smtp)dnl
define(`MAIL_HUB', `xx.localdomain.')dnl
define(`LOCAL_RELAY', `xx.localdomain.')dnl
define(`confQUEUE_LA', `32')dnl
define(`confREFUSE_LA', `48')dnl
define(`confSHARED_MEMORY_KEY', `10000')
|
|
|
01-19-2011, 04:35 AM
|
#2
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
You specify an alias file: define(`ALIAS_FILE', `/etc/aliases')dnl. Do you have root.xx.localdomain mapped as an alias to a valid (gmail) or other address that can receive mail?
|
|
|
01-19-2011, 08:58 PM
|
#3
|
Member
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724
Original Poster
Rep: 
|
Hi Noway2,
My /etc/aliases remains default, something like this:
Code:
bin: root
daemon: root
adm: root
lp: root
sync: root
shutdown: root
halt: root
mail: root
news: root
Perhaps it is the cause of this.
I don't want to map the root to a valid email address. All I want is sending out mail to alert and completely disable the local delivery (don't go to the queue).
I deleted 2 lines below in sendmail.mc:
Code:
define(`ALIAS_FILE', `/etc/aliases')dnl
EXPOSED_USER(`root')dnl
but mails still send to root and stuck in queue:
Code:
...
p0JFp1Xf025053 253 Wed Jan 19 22:51 <root@SVR040-763.localdomain>
(Deferred: Connection refused by svr040-763.localdomain.)
<root@SVR040-763.localdomain>
p0JEv21a007790 253 Wed Jan 19 21:57 <root@SVR040-763.localdomain>
(Deferred: Connection refused by svr040-763.localdomain.)
<root@SVR040-763.localdomain>
p0JFO19w000305 253 Wed Jan 19 22:24 <root@SVR040-763.localdomain>
(Deferred: Connection refused by svr040-763.localdomain.)
<root@SVR040-763.localdomain>
Total requests: 1143
Thanks for your help.
|
|
|
01-20-2011, 04:37 AM
|
#4
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
I think we might be misunderstanding each other but trying to say the same things. When I mentioned mapping root to a valid email address, I meant to say map the email address 'root@localhost' to the address to the one where would like your alert emails to be sent, not the root user. By default, when applications send out their alerts they are going to send it to 'root@localhost' and unless your mail handler knows where to redirect the message, it will try to deliver it locally, which it can't and you don't want.
I also found this thread. I think the suggestion by Pawel (the second response) received a lot of comments saying it solved the problem for them.
|
|
|
01-20-2011, 09:05 PM
|
#5
|
Member
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724
Original Poster
Rep: 
|
Quote:
Originally Posted by Noway2
I think we might be misunderstanding each other but trying to say the same things.
|
No, I don't think so.
Quote:
Originally Posted by Noway2
When I mentioned mapping root to a valid email address, I meant to say map the email address 'root@localhost' to the address to the one where would like your alert emails to be sent, not the root user.
|
I know, but if I do that, I will get a lot of local messages like this:
Code:
**********************************************
** THIS IS A WARNING MESSAGE ONLY **
** YOU DO NOT NEED TO RESEND YOUR MESSAGE **
**********************************************
The original message was received at Fri, 21 Jan 2011 04:05:01 +0700
from SVR040-763.localdomain [127.0.0.1]
----- Transcript of session follows -----
<root@SVR040-763.localdomain>... Deferred: Connection refused by svr040-763.localdomain.
Warning: message still undelivered after 4 hours
Will keep trying until message is 5 days old
Reporting-MTA: dns; SVR040-763.localdomain
Arrival-Date: Fri, 21 Jan 2011 04:05:01 +0700
Final-Recipient: RFC822; root@SVR040-763.localdomain
Action: delayed
Status: 4.4.1
Remote-MTA: DNS; svr040-763.localdomain
Last-Attempt-Date: Fri, 21 Jan 2011 08:53:31 +0700
Will-Retry-Until: Wed, 26 Jan 2011 04:05:01 +0700
Part 1.2
Subject:
Cron <root@SVR040-763> /usr/bin/unison -batch
From:
root@SVR040-763.localdomain (Cron Daemon)
Date:
Fri, 21 Jan 2011 04:05:01 +0700
To:
root@SVR040-763.localdomain
Usage: unison [options]
or unison root1 root2 [options]
or unison profilename [options]
For a list of options, type "unison -help".
For a tutorial on basic usage, type "unison -doc tutorial".
For other documentation, type "unison -doc topics".
and as you know, that I don't want.
Quote:
Originally Posted by Noway2
I also found this thread. I think the suggestion by Pawel (the second response) received a lot of comments saying it solved the problem for them.
|
If you take notice of it, you can see that I read from it to disable the local delivery.
|
|
|
01-22-2011, 09:11 AM
|
#6
|
Senior Member
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125
|
I have been giving your posts some thought over the past few days. Specifically, I have been trying to understand and reconcile exactly what your problem is and what to do about it, assuming that anything can be. I was hoping that someone else would have some ideas to help you, but it doesn't appear to be the case. So, I will try to recap:
- You are running sendmail as your local MTA
- You have configured sendmail to relay to your gmail accounts
- You have disabled local delivery to Linux accounts
- You are seeing a large number of undelivered messages addressed to 'root@localhost' appearing in your mail queue
- You want to receive alerts (emails) from a limited set of applications that you chose, e.g. ossec, Nagios, Redmine.
- You do not want to forward ALL root@localdomain email to a gmail account, just the services you select?
The problem that I see is that various processes are configured, by default to send mail to root@localdomain. When the applications do this, your sendmail will pickup the messages and try to handle them. If it thinks that it is supposed to handle mail for localdomain it will try to accept the messages and then try to deliver them. It looks like what is happening is that sendmail is accepting these messages, but doesn't know what to do with them. Hence they get queued up in a deferred status. What it sounds like you need to do is stop sendmail from even accepting mail for this user.
My searching is coming up with little in this regard. However, I see this link. Please check it out. Specifically, look at section 28.3.2 on alias. You will notice that bit.bucket is mapped to /dev/null. Perhaps you could map root to /dev/null? This should cause all root@localdomain mail to go into the void. As long as you have configured the desired applications to send mail where you wish, this may achieve your goal.
|
|
1 members found this post helpful.
|
01-26-2011, 09:28 PM
|
#7
|
Member
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724
Original Poster
Rep: 
|
Problem solved. Noway2, thank you very much.
|
|
|
All times are GMT -5. The time now is 03:58 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|