You are not logged in.

#1 2015-09-14 18:24:58

sverre
Member
From: Trondheim
Registered: 2009-04-07
Posts: 10

[SOLVED] lighttpd, cgi, systemd rights issue

So, this is just baffeling me, maybe someone has an idea of what might be wrong.

I have installed lighttpd, have configured it to run cgi and have it execute a bash shell script, no problblem so far, this works fine.

Now I have a shell script that executes a program that communicates with a daemon, I think it does this over socets.

So the problem is that if I use systemd to start lighttpd then the program executed in the shellscript can not communicate with the daemon (not correct rights I asume).

But if I start lighttpd with the same command as in the systemd service script, just with sudo on the cmdline instead, then everything works fine.
The shelscritp runs, the program communicates with the other daemon, and I am happy.


here is the output of ps axu when I started lighttpd with systemd, this does not work.

root       564  0.0  0.1   1756   832 ?        Ss   20:01   0:00 /usr/bin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
http       565  0.0  0.5   5552  2652 ?        S    20:01   0:00 /usr/bin/lighttpd -D -f /etc/lighttpd/lighttpd.conf

And here is when I start it with sudo... This works.

root       591  3.0  0.8   8648  3648 pts/0    S+   20:11   0:00 sudo lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
root       592  0.0  0.1   1756   848 pts/0    S+   20:11   0:00 lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
http       593  0.6  0.5   5420  2400 pts/0    S+   20:11   0:00 /usr/bin/lighttpd -D -f /etc/lighttpd/lighttpd.conf

I don't see the problem, both lighttpd-angel is started as root, and both lighttpd executions are as user http.

So anybody has any bright ideas? or just the solution, that would be nice smile

tl;dr
It seems programs execcuted as cgi from lighttpd started from systemd does not have rights to access socets and thus does not work, how to fix??

Last edited by sverre (2015-09-15 16:52:03)

Offline

#2 2015-09-15 16:50:53

sverre
Member
From: Trondheim
Registered: 2009-04-07
Posts: 10

Re: [SOLVED] lighttpd, cgi, systemd rights issue

So the issue here was that the process I had was depending on files in the /tmp folder and the service file for lighttpd has the PrivateTmp=true set.
Remove this and everything works as expected.

Offline

#3 2015-09-15 16:59:46

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: [SOLVED] lighttpd, cgi, systemd rights issue

Nice catch, good to know.


1000

Offline

Board footer

Powered by FluxBB