Author Topic: IMAP Error: Could not connect to localhost at port 143: Permission denied  (Read 8060 times)

Offline moogoogaipan

  • Newbie
  • *
  • Posts: 3
Error log:

IMAP Error: Could not connect to localhost at port 143: Permission denied in on line 0

I am not sure what's causing this. I fired up iptraf and see if there is any traffic sending to 143 port on the localhost (tried remote host too) but seeing nothing. Looks like it doesn't even want to look for my IMAP server.

I even chmod 777 for logs and temp directories

Apache is a default setting for FC5. I yumed pear, imap support for php. Login via Thunderbird to IMAP server is fine.

Any help is appreciated. Thanks.

-CD

Offline AlexRezid

  • Jr. Member
  • **
  • Posts: 12
Try a
Code: [Select]
telnet localhost 143
What do you have in RC Logs ?

Alex

Offline moogoogaipan

  • Newbie
  • *
  • Posts: 3
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK [CAPABILITY IMAP4REV1 LITERAL+ SASL-IR LOGIN-REFERRALS STARTTLS] mx IMAP4rev1 2006.368 at Mon, 2 Oct 2006 10:40:28 -0400 (EDT)


What I posted was the error logs from RC:

[29-Sep-2006 14:38:51 -0400] IMAP Error: Could not connect to localhost at port 143: Permission denied in on line 0
[29-Sep-2006 14:39:08 -0400] IMAP Error: Could not connect to localhost at port 143: Permission denied in on line 0
[29-Sep-2006 14:50:38 -0400] IMAP Error: Could not connect to localhost at port 143: Permission denied in on line 0

Offline urbanx

  • Newbie
  • *
  • Posts: 8
the telnetting to the imap server *looks* ok, but i'd start with a bit more testing there.

for the syntax of what to do after you've telnetted to localhost 143, take a look here:

http://www.macgeekery.com/tips/troubleshooting/troubleshooting_imap

1 LOGIN username password

should give you

1 OK Logged in.

does it?

thedave.

Offline moogoogaipan

  • Newbie
  • *
  • Posts: 3
I figured that SELINUX messed it up. Disabled it and it's OK now. Thanks for all the inputs.

Offline raffe

  • Newbie
  • *
  • Posts: 1
IMAP Error: Could not connect to localhost at port 143: Permission denied
« Reply #5 on: December 17, 2008, 10:22:44 AM »
Quote from: moogoogaipan;2963
Error log:

IMAP Error: Could not connect to localhost at port 143: Permission denied in on line 0
I got this after a 'yum update'. I tried "everything" ;) , but still the same.

After on my knees begging the server to work (it did not help), I remember that I use modsecurity, and after checking the logs I see modsecurity_crs_30_http_policy.conf has seen the login script.

Not strange yet... I excluded modsecurity_crs_30_http_policy.conf in mod_security.conf and restarted httpd -> It works again. And I'm happy :)

Then I wanted to know what in modsecurity_crs_30_http_policy.conf stopped the login so I made a new blank modsec_auidit.log file and included modsecurity_crs_30_http_policy.conf in mod_security.conf again and then restarted httpd -> Now I wanted a fresh log in modsec_auidit.log... But the login still works... Now it's strange, but it works... But I'm still happy :)

Maybe this helps somebody...

Extra info, if you like, from modsec_auidit.log after last login
Code: [Select]
--307f772a-A--
[17/Dec/2008:16:07:05 +0100] SUkVmX8AAAEAABF6NKIAAAAA 127.0.0.1 57370 127.0.0.1 80
--307f772a-B--
POST /rcm/ HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008111217 Fedora/3.0.4-1.fc9 Firefox/3.0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/rcm/?_task=mail&_action=logout
Cookie: mailviewsplitterv=165; mailviewsplitter=200; roundcube_sessid=22375626e347984c2ff8f7940aca372a
Content-Type: application/x-www-form-urlencoded
Content-Length: 77

--307f772a-C--
_action=login&_timezone=1&_user=user%40mydomain.com&_pass=secretpassword
--307f772a-F--
HTTP/1.1 302 Found
X-Powered-By: PHP/5.2.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: roundcube_sessid=deleted; expires=Tue, 18-Dec-2007 15:07:04 GMT
Set-Cookie: roundcube_sessid=632c05bb78dace0f265590d95cdee265; path=/
Location: ./?_task=mail
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 26
Connection: close
Content-Type: text/html; charset=UTF-8

--307f772a-H--
Message: Warning. Operator EQ matched 0 at GLOBAL. [file "/etc/httpd/modsecurity.d/modsecurity_crs_30_http_policy.conf"] [line "120"] [id "960903"] [msg "ModSecurity does not support content encodings"] [severity "WARNING"]
Apache-Handler: php5-script
Stopwatch: 1229526425007517 498585 (558* 3674 497397)
Producer: ModSecurity for Apache/2.5.6 (http://www.modsecurity.org/); core ruleset/1.6.1.
Server: Apache

--307f772a-K--
SecRule "REQUEST_METHOD" "@rx ^POST$" "phase:2,chain,t:none,deny,log,auditlog,status:400,msg:'POST request must have a Content-Length header',id:960012,tag:PROTOCOL_VIOLATION/EVASION,severity:4"
SecRule "REQUEST_METHOD" "!@rx ^(?:get|head|propfind|options)$" "phase:2,chain,t:none,t:lowercase,deny,log,auditlog,status:501,msg:'Request content type is not allowed by policy',id:960010,tag:POLICY/ENCODING_NOT_ALLOWED,severity:4"
SecRule "RESPONSE_HEADERS:Content-Encoding" "!@rx ^Identity$" "phase:4,t:none,pass,log,auditlog,msg:'ModSecurity does not support content encodings',id:960903,severity:4,chain,initcol:global=global"
SecRule "&GLOBAL:alerted_960903_compression" "@eq 0" "phase:2,log,auditlog,pass,setvar:global.alerted_960903_compression"

--307f772a-Z--


The error when it did'nt work
Code: [Select]
--ce549040-A--
[17/Dec/2008:15:00:03 +0100] SUkF4n8AAAEAAAsNFOMAAAAA 123.123.123.123 58583 172.0.0.1 80
--ce549040-B--
POST / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-shockwave-flash, */*
Referer: http://smtp.mydomain.com/
Accept-Language: sv
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1; .NET CLR 2.0.50727)
Host: smtp.mydomain.com
Content-Length: 75
Connection: Keep-Alive
Cache-Control: no-cache
Cookie: mailviewsplitterv=165; addressviewsplitter=250; language=sv; mailviewsplitter=236; roundcube_sessid=i0975jqlu4ndabfp0r7iv2afc5

--ce549040-C--
_action=login&_timezone=1&_user=user@mydomain.com&_pass=secretpassword
--ce549040-F--
HTTP/1.1 200 OK
X-Powered-By: PHP/5.2.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: sessauth=-del-; expires=Wed, 17-Dec-2008 13:59:03 GMT
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 1137
Connection: close
Content-Type: text/html; charset=UTF-8

--ce549040-H--
Message: Warning. Operator EQ matched 0 at GLOBAL. [file "/etc/httpd/modsecurity.d/modsecurity_crs_30_http_policy.conf"] [line "120"] [id "960903"] [msg "ModSecurity does not support content encodings"] [severity "WARNING"]
Apache-Handler: php5-script
Stopwatch: 1229522402416709 793984 (348* 3619 654363)
Producer: ModSecurity for Apache/2.5.6 (http://www.modsecurity.org/); core ruleset/1.6.1.
Server: Apache

--ce549040-K--
SecRule "REQUEST_METHOD" "@rx ^POST$" "phase:2,chain,t:none,deny,log,auditlog,status:400,msg:'POST request must have a Content-Length header',id:960012,tag:PROTOCOL_VIOLATION/EVASION,severity:4"
SecRule "REQUEST_METHOD" "!@rx ^(?:get|head|propfind|options)$" "phase:2,chain,t:none,t:lowercase,deny,log,auditlog,status:501,msg:'Request content type is not allowed by policy',id:960010,tag:POLICY/ENCODING_NOT_ALLOWED,severity:4"
SecRule "RESPONSE_HEADERS:Content-Encoding" "!@rx ^Identity$" "phase:4,t:none,pass,log,auditlog,msg:'ModSecurity does not support content encodings',id:960903,severity:4,chain,initcol:global=global"
SecRule "&GLOBAL:alerted_960903_compression" "@eq 0" "phase:2,log,auditlog,pass,setvar:global.alerted_960903_compression"

--ce549040-Z--
« Last Edit: December 17, 2008, 10:37:22 AM by raffe »