Tags:
create new tag
view all tags

SID-01592: Cannot send an email with selinux enforcing.

Status: Answered Answered TWiki version: 5.1.2 Perl version: 5.10.1
Category: CategoryEmail Server OS: CentOS 6.3 kernel 2.6.32-279.14.1.el6.x86_64 Last update: 13 years ago

When trying to send an email I got the following message

ERROR: Can't send mail using Net::SMTP. Can't connect to 'mars.lereta.com' - 0, Permission denied, Net::SMTP: connect: Permission denied at /var/www/twiki/lib/TWiki/Net.pm line 515.

Too many failures sending mail %PARAM2% %PARAM3% %PARAM4%

(I expanded the error message in Net.pm with $?, $! and $@)

This made absolutely no sense to me. I could use Net::SMTP from a standalone program as apache and it worked fine. When I used a sniffer (thsark) to capture the traffic between scadev04 and mars during the attempted send from TWiki, I saw nothing on port 25.

I finally traced the problem to selinux. The settings httpd_can_sendmail and httpd_can_network_connect were both set to "off". I changed them to "on" and emails are now being sent as expected.

$ sudo setsebool -P httpd_can_sendmail on

$ sudo setsebool -P httpd_can_network_connect on

-- StephenCarville - 2012-11-28

Discussion and Answer

I guess I answered in the description smile

-- StephenCarville - 2012-11-28

Thank you Stephen! I updated the TWikiSiteTools doc and the {SMTP}{MAILHOST} configure setting accordingly.

-- PeterThoeny - 2012-11-29

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Cannot send an email with selinux enforcing.
SupportCategory CategoryEmail
TWiki version 5.1.2
Server OS CentOS 6.3 kernel 2.6.32-279.14.1.el6.x86_64
Web server Apache 2.2.15
Perl version 5.10.1
Browser & version Firefox 15.0.1
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2012-11-29 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.