Question

I have a SVN repo served by Apache over DAV.

I've created a post-commit hook that I want to open a telnet session to a server.

When I execute the commands from the command prompt, it works fine.

But when I execute it with the hook, it fails, saying that it doesn't have permissions to execute.

My script is simple:

 #!/bin/sh
 REPOS="$1"
 REV="$2"

 echo -e symeon\\nfrobnitz\\n.say \#foo easitag $REV $(svnlook author $REPOS -r $REV)    $(svnlook changed $REPOS -r $REV): $(svnlook log $REPOS -r $REV) | telnet server 8080

The hook is running on a RedHat Enterprise Linux machine. I'm assuming it's executing as the apache user.

Anyone know why?

Était-ce utile?

La solution 2

I found this on a rather obscure forum:

The apache user is disallowed to make http connections by default. To enable this, do the following from root:

setsebool -P httpd_can_network_connect 1

that was found on http://forums.phpfreaks.com/topic/64806-solved-could-not-connect-to-server-permission-denied/

Autres conseils

Two points:

  1. The user account under which Apache is running (assuming that you're serving the repository with Apache) must have permission to do everything your script is attempting to do.
  2. Hook scripts execute in an empty environment - no environment variables are set, not even $PATH. So those binaries you're attempting to execute (svnlook & telnet) aren't found. You need to specify the full path to those, or set a $PATH in your script.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top