LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 04-28-2010, 08:08 PM   #1
redhydralisk
LQ Newbie
 
Registered: Apr 2010
Posts: 2

Rep: Reputation: 0
When called from cgi script/apache user: "ldap_bind: Can't contact LDAP server (-1)"


Here are the specs of my machine:

Linux matrix 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386 GNU/Linux
Red Hat Enterprise Linux Server release 5.2 (Tikanga)
  • When I run an ldapsearch in root, it works fine. tcpdump filtered by dest IP shows packets captured.
  • When I run an ldapsearch in a perl script as root, it works fine. tcpdump filtered by dest IP shows packets captured.
  • However, when I run it via a perl script in my cgi-bin directory it fails. tcpdump shows no packets captured. When I added a "2>&1" to my ldap search in my cgi script, I got "ldap_bind: Can't contact LDAP server (-1)".
  • I ran a "whoami" in my cgi script and it showed up as apache.

Another twist to all this is that I ran the same test on my slackware box, and everything works (esp the cgi script). Here's what the specs are on that machine:

Linux slackvm 2.6.29.6-smp #2 SMP Mon Aug 17 00:52:54 CDT 2009 i686 Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz GenuineIntel GNU/Linux

I checked the permissions on the ldapsearch file and directory, and they're the same (755).

Could there be something blocking the apache user on my Red Hat box from sending packets out?

Thanks.

Last edited by redhydralisk; 04-29-2010 at 05:00 AM.
 
Old 04-29-2010, 12:08 AM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,894

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Hi,

Looks like a SELinux problem.

Regards
 
Old 04-29-2010, 01:26 PM   #3
redhydralisk
LQ Newbie
 
Registered: Apr 2010
Posts: 2

Original Poster
Rep: Reputation: 0
that was it. just ran a "setenforce 0" and it works great. This is a lab machine (not servicing anything on the web) so i think i'll be ok.

thank you so much. i would've never figured that out. it saved me a lot of time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ldap_bind Can't contact LDAP server mesh2005 Linux - Networking 17 06-19-2014 08:44 AM
ldap_bind:cannot contact to ldap (-1) defeater_man Linux - Networking 11 10-01-2009 04:19 PM
ldap_bind: Can't contact LDAP server (-1) ramramu Linux - Networking 1 01-06-2009 06:37 AM
Getting a "Can't contact LDAP server" when trying to add an ldif file custangro Linux - Server 4 09-04-2008 01:00 PM
"apache" user in cgi-bin scripts cool47 Linux - Server 3 08-10-2008 05:27 PM


All times are GMT -5. The time now is 04:47 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration