mod_fastcgi is a module for the Apache webserver that implements

the FastCGI protocol.

ok alek@
This commit is contained in:
mbalmer 2005-02-14 06:23:23 +00:00
parent 7fe9eee4bf
commit 8fe74e69e8
9 changed files with 146 additions and 0 deletions

40
www/mod_fastcgi/Makefile Normal file
View File

@ -0,0 +1,40 @@
# $OpenBSD: Makefile,v 1.1.1.1 2005/02/14 06:23:23 mbalmer Exp $
# This port currently only works with archs supporting dynamic loading
# and has Apache that supports DSO's.
SHARED_ONLY= Yes
COMMENT= "Apache FastCGI module"
DISTNAME= mod_fastcgi-2.4.2
CATEGORIES= www
HOMEPAGE= http://www.fastcgi.com/
MASTER_SITES= ${HOMEPAGE}dist/
MAINTAINER= Marc Balmer <mbalmer@openbsd.org>
# Proprietary license
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
NO_REGRESS= Yes
do-build:
(cd ${WRKBUILD}; apxs -o mod_fastcgi.so -c *.c)
post-build:
sed 's,!!PREFIX!!,${PREFIX},' \
< ${FILESDIR}/mod_fastcgi-enable \
> ${WRKBUILD}/mod_fastcgi-enable
do-install:
${INSTALL_DATA} ${WRKBUILD}/mod_fastcgi.so ${PREFIX}/lib
${INSTALL_SCRIPT} ${WRKBUILD}/mod_fastcgi-enable ${PREFIX}/sbin
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/mod_fastcgi
${INSTALL_DATA} ${WRKBUILD}/docs/* ${PREFIX}/share/doc/mod_fastcgi
.include <bsd.port.mk>

4
www/mod_fastcgi/distinfo Normal file
View File

@ -0,0 +1,4 @@
MD5 (mod_fastcgi-2.4.2.tar.gz) = e994414304b535cb99e10b7d1cad1d1e
RMD160 (mod_fastcgi-2.4.2.tar.gz) = 83c01567bb9a6d39345573137408615260972e1e
SHA1 (mod_fastcgi-2.4.2.tar.gz) = a56be62a3f08262ae187989f5dacb3464a030e2e
SIZE (mod_fastcgi-2.4.2.tar.gz) = 98295

View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# $OpenBSD: mod_fastcgi-enable,v 1.1.1.1 2005/02/14 06:23:23 mbalmer Exp $
MODULE=!!PREFIX!!/lib/mod_fastcgi.so
if [ `id -u` -ne 0 ]; then
echo "You must be root to run this script."
exit
fi
if [ ! -f ${MODULE} ]; then
echo "Cannot find mod_fastcgi module (${MODULE})"
exit 1
else
echo "Enabling FastCGI module..."
/usr/sbin/apxs -i -a -n fastcgi ${MODULE}
fi

View File

@ -0,0 +1,41 @@
--- fcgi_pm.c.orig Thu Oct 30 02:08:34 2003
+++ fcgi_pm.c Mon Feb 14 06:57:49 2005
@@ -26,7 +26,7 @@ time_t fcgi_dynamic_epoch = 0;
* invoked by process mgr */
time_t fcgi_dynamic_last_analyzed = 0; /* last time calculation was
* made for the dynamic procs */
-
+int fcgi_is_chrooted = 0; /* If we run in a chrooted httpd */
static time_t now = 0;
#ifdef WIN32
@@ -1092,6 +1092,8 @@ static void dynamic_read_msgs(int read_r
/* Create socket file's path */
s->socket_path = fcgi_util_socket_hash_filename(tp, execName, user, group);
s->socket_path = fcgi_util_socket_make_path_absolute(sp, s->socket_path, 1);
+ if (fcgi_is_chrooted)
+ ap_server_strip_chroot((char *) s->socket_path, 1);
/* Create sockaddr, prealloc it so it won't get created in tp */
s->socket_addr = ap_pcalloc(sp, sizeof(struct sockaddr_un));
@@ -1649,7 +1651,19 @@ void fcgi_pm_main(void *dummy)
fcgi_config_set_env_var(fcgi_config_pool, dynamicEnvp, &i, "SystemRoot");
#else
-
+
+ if (ap_server_chroot_desired()) {
+ if (chroot(ap_server_root) < 0) {
+ ap_log_error(FCGI_LOG_NOTICE_NOERRNO, fcgi_apache_main_server,
+ "FastCGI: process manager unable to chroot into %s!", ap_server_root);
+ exit(1);
+ }
+ ap_log_error(FCGI_LOG_NOTICE_NOERRNO,
+ fcgi_apache_main_server, "FastCGI: process manager chrooted in %s", ap_server_root);
+ chdir("/");
+ fcgi_is_chrooted = 1;
+ }
+
reduce_privileges();
change_process_name("fcgi-pm");

View File

@ -0,0 +1,12 @@
--- mod_fastcgi.c.orig Thu Oct 30 02:08:34 2003
+++ mod_fastcgi.c Mon Feb 14 06:54:32 2005
@@ -1074,7 +1074,8 @@ static int open_connection_to_fs(fcgi_re
{
socket_path = fcgi_util_socket_hash_filename(rp, fr->fs_path, fr->user, fr->group);
socket_path = fcgi_util_socket_make_path_absolute(rp, socket_path, 1);
-
+ ap_server_strip_chroot((char *) socket_path, 0);
+
#ifndef WIN32
err = fcgi_util_socket_make_domain_addr(rp, (struct sockaddr_un **)&socket_addr,
&socket_addr_len, socket_path);

View File

@ -0,0 +1,9 @@
mod_fastcgi is a module for the Apache web server, that enables
FastCGI - a standards based protocol for communicating with
applications that generate dynamic content for web pages.
FastCGI provides a superset of CGI functionality, but a subset of the
functionality of programming for a particular web server API.
Nonetheless, the feature set is rich enough for programming virtually
any type of web application, but the result is generally more
scalable.

View File

@ -0,0 +1,8 @@
To finish the install of mod_fastcgi, you need
to enable the module using the following command
${PREFIX}/sbin/mod_fastcgi-enable
If you already have Apache running on your machine,
you should not use "apachectl restart" - instead,
you should fully stop and then restart the server.

View File

@ -0,0 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2005/02/14 06:23:23 mbalmer Exp $
lib/mod_fastcgi.so
sbin/mod_fastcgi-enable
share/doc/mod_fastcgi/
share/doc/mod_fastcgi/LICENSE.TERMS
share/doc/mod_fastcgi/mod_fastcgi.html

View File

@ -0,0 +1,8 @@
To completely deinstall the mod_fastcgi package you
need to perform these steps as root:
edit /var/www/conf/httpd.conf
remove the line: LoadModule fastcgi_module
Do not do this if you plan on re-installing the mod_fastcgi
package at some future time.