From 6ce4723634da4adc055bdc22b96583953f76b3f6 Mon Sep 17 00:00:00 2001 From: Volkmar Seifert Date: Wed, 29 Apr 2009 15:51:24 +0000 Subject: [PATCH] Import spawn-fcgi-1.6.2 as wip/spawnfcgi. spawn-fcgi is used to spawn remote and local FastCGI processes. Until recently, it was part of the lighttpd project, but has been unhinged into its own projects some weeks ago. Because of this, I have made some efforts to include it into pkgsrc as its own package. Here the official statement from the project-website about spawn-fcgi: While it is obviously needed to spawn remote FastCGI backends (the web server can only spawn local ones), it is recommended to spawn local backends with spawn-fcgi, too. Reasons why you may want to use spawn-fcgi instead of something else: * Privilege separation without needing a suid-binary or running a server as root. * You can restart your web server and the FastCGI applications without restarting the others. * You can run them in different chroot()s. * Running your FastCGI applications doesn't depend on the web server you are running, which allows for easier testing of other web servers. --- spawnfcgi/DESCR | 16 ++++++++++ spawnfcgi/MESSAGE | 26 ++++++++++++++++ spawnfcgi/Makefile | 35 ++++++++++++++++++++++ spawnfcgi/PLIST | 8 +++++ spawnfcgi/distinfo | 5 ++++ spawnfcgi/files/spawnfcgi.sh | 58 ++++++++++++++++++++++++++++++++++++ 6 files changed, 148 insertions(+) create mode 100644 spawnfcgi/DESCR create mode 100644 spawnfcgi/MESSAGE create mode 100644 spawnfcgi/Makefile create mode 100644 spawnfcgi/PLIST create mode 100644 spawnfcgi/distinfo create mode 100644 spawnfcgi/files/spawnfcgi.sh diff --git a/spawnfcgi/DESCR b/spawnfcgi/DESCR new file mode 100644 index 0000000000..5506f75779 --- /dev/null +++ b/spawnfcgi/DESCR @@ -0,0 +1,16 @@ +spawn-fcgi is used to spawn remote and local FastCGI processes. + +While it is obviously needed to spawn remote FastCGI backends (the web +server can only spawn local ones), it is recommended to spawn local +backends with spawn-fcgi, too. + +Reasons why you may want to use spawn-fcgi instead of something else: + +* Privilege separation without needing a suid-binary or running a + server as root. +* You can restart your web server and the FastCGI applications without + restarting the others. +* You can run them in different chroot()s. +* Running your FastCGI applications doesn't depend on the web server + you are running, which allows for easier testing of other web + servers. diff --git a/spawnfcgi/MESSAGE b/spawnfcgi/MESSAGE new file mode 100644 index 0000000000..3d167f8358 --- /dev/null +++ b/spawnfcgi/MESSAGE @@ -0,0 +1,26 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $ + +Use the following flags to adjust spawn-fcgi to your demands: +(These flags come into /etc/rc.conf. Flags that are commented out + are added here with their default-values. You can leave them untouched + or adjust them to your own demands) + +### Enables spawn-fcgi +spawnfcgi=YES +### The path to the pidfile... +#spawnfcgi_pidfile=@VARBASE@/run/spawnfcgi.pid +### The path to the actual FastCGI-Application +#spawnfcgi_app=@PREFIX@/libexec/cgi-bin/php +### The number of children, fast-cgi should launch for processing requests +#spawnfcgi_children=10 +### The IP, spawn-fcgi should bind to... +#spawnfcgi_ip=127.0.0.1 +### The port, spawn-fcgi should listen on... +#spawnfcgi_port=9999 +### The user, spawn-fcgi should change to after startup +#spawnfcgi_user=www +### The group, spawn-fcgi should change to after startup +#spawnfcgi_group=www + +=========================================================================== diff --git a/spawnfcgi/Makefile b/spawnfcgi/Makefile new file mode 100644 index 0000000000..301e8ee4f0 --- /dev/null +++ b/spawnfcgi/Makefile @@ -0,0 +1,35 @@ +# $NetBSD: Makefile,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $ +# + +DISTNAME= spawn-fcgi-1.6.2 +CATEGORIES= net www +MASTER_SITES= http://www.lighttpd.net/download/ +EXTRACT_SUFX= .tar.bz2 + +MAINTAINER= vs@nifelheim.info +HOMEPAGE= http://redmine.lighttpd.net/projects/spawn-fcgi +COMMENT= Spawns FCGI-Processes and runs with priviledge separation + +PKG_DESTDIR_SUPPORT= user-destdir + +CONFLICTS= lighttpd<1.4.23 + +GNU_CONFIGURE= yes + +CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} +CONFIGURE_ARGS+= --libdir=${PREFIX}/lib/${PKGBASE} + +DOCDIR= ${PREFIX}/share/doc/${PKGBASE} +EGDIR= ${PREFIX}/share/examples/${PKGBASE} +PKG_SYSCONFSUBDIR= ${PKGBASE} + +RCD_SCRIPTS= spawnfcgi + +INSTALLATION_DIRS= ${DOCDIR} ${EGDIR} + +post-install: + cd ${WRKSRC}; for f in AUTHORS COPYING ChangeLog NEWS README; do \ + ${INSTALL_DATA} ${WRKSRC}/$$f ${DESTDIR}${DOCDIR}; \ + done + +.include "../../mk/bsd.pkg.mk" diff --git a/spawnfcgi/PLIST b/spawnfcgi/PLIST new file mode 100644 index 0000000000..ab8a0a8590 --- /dev/null +++ b/spawnfcgi/PLIST @@ -0,0 +1,8 @@ +@comment $NetBSD: PLIST,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $ +bin/spawn-fcgi +man/man1/spawn-fcgi.1 +share/examples/rc.d/spawnfcgi +share/doc/spawn-fcgi/AUTHORS +share/doc/spawn-fcgi/COPYING +share/doc/spawn-fcgi/NEWS +share/doc/spawn-fcgi/README diff --git a/spawnfcgi/distinfo b/spawnfcgi/distinfo new file mode 100644 index 0000000000..c01782fdf8 --- /dev/null +++ b/spawnfcgi/distinfo @@ -0,0 +1,5 @@ +$NetBSD: distinfo,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $ + +SHA1 (spawn-fcgi-1.6.2.tar.bz2) = 475e9d9bff7ab31c29d082cc214cea66e04da690 +RMD160 (spawn-fcgi-1.6.2.tar.bz2) = 7a0986a9254646e7c635c086ef055b0f9a00a458 +Size (spawn-fcgi-1.6.2.tar.bz2) = 73169 bytes diff --git a/spawnfcgi/files/spawnfcgi.sh b/spawnfcgi/files/spawnfcgi.sh new file mode 100644 index 0000000000..f6df1be533 --- /dev/null +++ b/spawnfcgi/files/spawnfcgi.sh @@ -0,0 +1,58 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: spawnfcgi.sh,v 1.1.1.1 2009/04/29 15:51:24 mjoellnir Exp $ +# +# FastCGI process spawner +# + +# PROVIDE: spawn-fcgi +# REQUIRE: DAEMON +# BEFORE: LOGIN + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +name="spawnfcgi" +rcvar=${name} +command="@PREFIX@/bin/spawn-fcgi" +start_precmd="spawnfcgi_start_precmd" +stop_postcmd="spawnfcgi_stop_postcmd" +load_rc_config $name + +pidfile="${spawnfcgi_pidfile:=@VARBASE@/run/spawnfcgi.pid}" +fcgiapp="${spawnfcgi_app:=@PREFIX@/libexec/cgi-bin/php}" +fcgiip="${spawnfcgi_ip:=127.0.0.1}" +fcgiport="${spawnfcgi_port:=9999}" +fcgiuser="${spawnfcgi_user:=www}" +fcgigroup="${spawnfcgi_group:=www}" + +spawnfcgi_children="${spawnfcgi_children:=10}" + +if /bin/test "`echo ${fcgiapp} | grep php`" = "${fcgiapp}" ; then + fcgichildren="-C ${spawnfcgi_children}" + procname=${fcgiapp} +else + fcgichildren="-F ${spawnfcgi_children}" +fi + +if /bin/test -n "${spawnfcgi_chroot}"; then + fcgichroot="-c ${spawnfcgi_chroot}" +else + fcgichroot="" +fi + + +spawnfcgi_start_precmd() { + touch ${pidfile} + chown ${fcgiuser}:${fcgigroup} ${pidfile} +} + +spawnfcgi_stop_postcmd() { + rm ${pidfile} +} + + +spawnfcgi_flags="-f ${fcgiapp} ${fcgichildren} -a ${fcgiip} -p ${fcgiport} -P ${pidfile} -u ${fcgiuser} -g ${fcgigroup} ${fcgichroot}" + +run_rc_command "$1"