On 2017/01/24 00:27, Austin Bentley wrote:
> I'm using kfcgi with httpd on OpenBSD 6.0. It seems I can't get
> anything to spawn a worker that utilizes a shared library. I'm using a
> daemonized CGI program following the tutorial here:
> https://kristaps.bsd.lv/kcgi/tutorial2.html
> 
> I have two files: main.cpp and test.cpp. main.cpp is completely
> unchanged from the tutorial listed above (hence, absolutely no shared
> library code is executed [found out from debugging.]) test.cpp
> references shared libraries: kcgi (w/ zlib), scrypt, and sqlite3.
> 
> Everything compiles fine -- that's not the problem. When I spawn the
> kcgi program, the following happens:
> 
> # kfcgi -n 1 -v -d -U www -u www -- /cgi-bin/cgimg
> kfcgi[66849]: worker unexpectedly exited

Try this command. If it fails, it's not going to work with kfcgi either (but
it might give you more information on-screen as to why).

# chroot /var/www /cgi-bin/cgimg

kfcgi is a FastCGI wrapper which spawns a pool of backend FastCGI processes
under a certain uid and inside a chroot jail. As these processes are run inside
that chroot (kfcgi manual says it defaults to /var/www), everything they need
at runtime must be available.

Either static-link (and ensure that any files needed at runtime are available
inside the jail), or disable kfcgi's jail.

On 2017/01/24 17:44, Ross L Richardson wrote:
> Presumably, you're running standard httpd(8), and thus the FCGI code
> runs in a chroot(2)-restricted environment.  Thus, you'll need to build
> it statically-linked (unless you really want to try to set up shared
> libraries inside the chroot).

Right about chroot, but httpd(8)'s chroot isn't relevant here, only the
chroot for the FastCGI process is important. You can have httpd run inside
a jail and pass requests to a FastCGI script that is running outside of the
jail (or even in a different jail).

Reply via email to