|Newbie questions about Pliant
I have a request for a plugin in /pliant/protocol/http/server.pli
At the top of start_check, please add
|Message posted by maybe Gord Eagle on 2002/12/13 14:52:36
|I added this plugin so that I could write in /custom/MYDOMAIN/pliant/protocol/http/server.pli
console "Dropping privileges"
This is very useful to run a web server on port 80 without root privileges.
|Message posted by hubert.tonneau on 2002/12/13 15:28:04
|Adding a 'server_start' plugin at the end of 'server_start_checkup' function
is ok, but it might not be a safe way to loose Unix 'root rights.
When 'server_start_checkup' function is run, you may already have several
Pliant threads running, so some of these might keep 'root' rights (as far as I
understand Linux rights mechanism). Also Pliant is using a pool of threads instead
of creating a new thread each time (same as OS/2 Warp did years ago in order to
reduce thread creation time at the expense of using more ressources), so they
will live forever. Now any request to the HTTP server is not answered by the HTTP
server main thread, but by a new thread ... selected from the existing threads
pull, unless no more thread is available, so a still 'root' thread may well be
If you want to run Pliant without 'root' rights, which is wise, then it's much
better to change the process uid before running 'pliant' command.
Pliant logical servers is another solution to achieve this, but it's probably
the more convienient solution only if you are running FullPliant operating system.
|Message posted by maybe Gord Eagle on 2002/12/13 18:01:29
|User and group ids are process-wide, so setting them in one thread will affect all other threads in the process.
|Message posted by hubert.tonneau on 2002/12/13 18:03:37
|The problem with Linux is that a thread is a process, so what you say should be
right but might not.
|Message posted by hubert.tonneau on 2002/12/13 18:30:32
|Here is a proof of what I say (run the program as 'root'):
A thread is started and will imediately sleep for a second. The master thread
is changing it's user ID, so cannot read the file any more, but the other
thread sill can.
(var Stream s) open "file:/tmp/secret" out+safe
s writeline "abc"
file_rights "file:/tmp/secret" undefined undefined 0 4*8+4
(var Stream s) open "file:/tmp/secret" in+safe
console s:readline eol