suPHP is a combination of an Apache module (mod_suphp) and an executable which provides a wrapper for PHP. With both together, it is possible to execute PHP scripts with the permissions of their owner without having to place a PHP binary in each user's cgi-bin directory. suPHP doesn't need Apache's suExec, and provides a logging function.
Update suPHP port. Changelog : - Update 0.2 -> 0.2.2 - Clean PORTSDOCS related problems - Add warning Have a nice day ;) clem diff -Nru suphp-0.2/Makefile suphp/Makefile --- suphp-0.2/Makefile Tue Nov 12 10:59:29 2002 +++ suphp/Makefile Tue Nov 12 12:46:48 2002 @@ -6,7 +6,7 @@ # PORTNAME= suphp -PORTVERSION= 0.2 +PORTVERSION= 0.2.2 CATEGORIES= www MASTER_SITES= http://www.suphp.org/download/ @@ -15,14 +15,14 @@ BUILD_DEPENDS= ${LOCALBASE}/sbin/apxs:${PORTSDIR}/www/apache13 RUN_DEPENDS= ${LOCALBASE}/bin/php:${PORTSDIR}/lang/php4 -WRKSRC= ${WRKDIR}/${PORTNAME} USE_REINPLACE= yes +HAS_CONFIGURE= no MAKE_ARGS+= APXS="${APXS}" APXS?= ${LOCALBASE}/sbin/apxs WWW_USER?= www LOG_PATH?= /var/log - +PHP_PATH?= ${LOCALBASE}/bin/php pre-configure: @${ECHO} @${ECHO} "*-------------------------------------------------------------*" @@ -32,7 +32,8 @@ @${ECHO} " - WWW_USER = Apache's User" @${ECHO} " - Define CHECK_PATH, to enable or disable suExec-like" @${ECHO} " path checking (based on DocumentRoot directive)." - @${ECHO} " - LOG_PATH=/path/to/your/logs . Default /var/log/." + @${ECHO} " - LOG_PATH=/path/to/your/logs. Default /var/log/." + @${ECHO} " - PHP_PATH=/path/to/bin/php. Default ${LOCALBASE}/bin/php." @${ECHO} "*-------------------------------------------------------------*" @${ECHO} @@ -46,7 +47,8 @@ @${ECHO} "Setting logs path" @${REINPLACE_CMD} -e 's,OPT_LOGFILE "/opt/apache/var/logs/suphp_log",OPT_LOGFILE "${LOG_PATH}/suphp_log",' \ ${WRKSRC}/config.h - @${REINPLACE_CMD} -e 's,OPT_PATH_TO_PHP "/usr/bin/php",OPT_PATH_TO_PHP "${LOCALBASE}/bin/php",' \ + @${ECHO} "Setting php path" + @${REINPLACE_CMD} -e 's,OPT_PATH_TO_PHP "/usr/bin/php",OPT_PATH_TO_PHP "${PHP_PATH}",' \ ${WRKSRC}/config.h pre-install: @@ -54,7 +56,7 @@ post-install: .if !defined(NOPORTDOCS) - @${MKDIR} ${DOCSDIR} ${DOCSDIR}/apache + @${MKDIR} ${DOCSDIR} ${DOCSDIR}/apache ${DOCSDIR}/de-doc ${DOCSDIR}/de-doc/apache ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/LICENSE ${DOCSDIR} @@ -62,8 +64,13 @@ ${INSTALL_DATA} ${WRKSRC}/apache/README ${DOCSDIR}/apache ${INSTALL_DATA} ${WRKSRC}/apache/INSTALL ${DOCSDIR}/apache ${INSTALL_DATA} ${WRKSRC}/apache/LICENSE ${DOCSDIR}/apache + ${INSTALL_DATA} -d ${WRKSRC}/de-doc/ ${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/de-doc/README.de ${DOCSDIR}/de-doc/ + ${INSTALL_DATA} ${WRKSRC}/de-doc/INSTALL.de ${DOCSDIR}/de-doc/ + ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/README.de ${DOCSDIR}/de-doc/apache + ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/INSTALL.de ${DOCSDIR}/de-doc/apache + ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/CONFIG.de ${DOCSDIR}/de-doc/apache .endif - @${CHMOD} u+s ${PREFIX}/sbin/suphp @${RM} mod_suphp.o @${CAT} ${PKGMESSAGE} diff -Nru suphp-0.2/distinfo suphp/distinfo --- suphp-0.2/distinfo Tue Nov 12 10:59:29 2002 +++ suphp/distinfo Tue Nov 12 11:00:21 2002 @@ -1 +1 @@ -MD5 (suphp-0.2.tar.gz) = 7bc75f50a7d6b97554d5c91089d7e089 +MD5 (suphp-0.2.2.tar.gz) = c035fa4ffc73b3cb037791ab85fe94fa diff -Nru suphp-0.2/files/patch-aa suphp/files/patch-aa --- suphp-0.2/files/patch-aa Tue Nov 12 10:59:29 2002 +++ suphp/files/patch-aa Tue Nov 12 12:11:16 2002 @@ -1,14 +1,17 @@ ---- Makefile.orig Sun Jun 2 16:07:34 2002 -+++ Makefile Sat Sep 14 16:23:40 2002 -@@ -2,7 +2,7 @@ +--- Makefile.orig Wed Oct 23 22:16:50 2002 ++++ Makefile Tue Nov 12 12:10:58 2002 +@@ -2,9 +2,9 @@ ## Makefile for suPHP ## ############################################## -SUPHP_INSTALL = /usr/sbin/suphp +SUPHP_INSTALL = $(PREFIX)/sbin/suphp - CC = gcc +-CC = gcc ++#CC = gcc CFLAGS = -c -Wall + LD = gcc + LDFLAGS = -o @@ -31,11 +31,7 @@ touch suphp.h @@ -18,7 +21,7 @@ - else \ - echo -e "You need to be root to install suPHP."; \ - fi -+ cp suphp ${SUPHP_INSTALL} ++ $(INSTALL) -o root -g wheel -m 4755 suphp ${SUPHP_INSTALL} clean: rm *.o diff -Nru suphp-0.2/pkg-comment suphp/pkg-comment --- suphp-0.2/pkg-comment Tue Nov 12 10:59:29 2002 +++ suphp/pkg-comment Tue Nov 12 12:40:12 2002 @@ -1 +1 @@ -suPHP is a combination which provides a wrapper for PHP. +suPHP is a combination which provides a wrapper for PHP diff -Nru suphp-0.2/pkg-message suphp/pkg-message --- suphp-0.2/pkg-message Tue Nov 12 10:59:29 2002 +++ suphp/pkg-message Tue Nov 12 12:51:33 2002 @@ -4,4 +4,8 @@ For help on using this module, please see the suPHP homepage: http://www.suphp.org + +Important hints: +Using suPHP can break some PHP-scripts, because of Apache's CGI +interface. ----------------------------------------------------------------- diff -Nru suphp-0.2/pkg-plist suphp/pkg-plist --- suphp-0.2/pkg-plist Tue Nov 12 10:59:29 2002 +++ suphp/pkg-plist Tue Nov 12 12:47:43 2002 @@ -1,8 +1,20 @@ sbin/suphp libexec/apache/mod_suphp.so @exec %D/sbin/apxs -e -a -n suphp %D/%f -@unexec echo "===> If you do not plan on reinstalling suphp, you must manually remove"; echo "===> references to it in httpd.conf." -%%PORTDOCS%%share/doc/suphp/README +@unexec echo "===> If you do not plan on reinstalling suphp, you must manually remove"; echo "===> references to it in httpd.conf." %%PORTDOCS%%share/doc/suphp/apache/CONFIG +%%PORTDOCS%%share/doc/suphp/apache/README +%%PORTDOCS%%share/doc/suphp/apache/INSTALL +%%PORTDOCS%%share/doc/suphp/apache/LICENSE +%%PORTDOCS%%share/doc/suphp/de-doc/apache/README.de +%%PORTDOCS%%share/doc/suphp/de-doc/apache/INSTALL.de +%%PORTDOCS%%share/doc/suphp/de-doc/apache/CONFIG.de +%%PORTDOCS%%share/doc/suphp/de-doc/README.de +%%PORTDOCS%%share/doc/suphp/de-doc/INSTALL.de +%%PORTDOCS%%share/doc/suphp/README +%%PORTDOCS%%share/doc/suphp/INSTALL +%%PORTDOCS%%share/doc/suphp/LICENSE +%%PORTDOCS%%@dirrm share/doc/suphp/de-doc/apache +%%PORTDOCS%%@dirrm share/doc/suphp/de-doc %%PORTDOCS%%@dirrm share/doc/suphp/apache %%PORTDOCS%%@dirrm share/doc/suphp/
Oups... Fatal bug.... clem here's the patch : diff -Nur suphp-bad/Makefile suphp/Makefile --- suphp-bad/Makefile Tue Nov 12 14:05:49 2002 +++ suphp/Makefile Tue Nov 12 12:46:48 2002 @@ -47,11 +47,9 @@ @${ECHO} "Setting logs path" @${REINPLACE_CMD} -e 's,OPT_LOGFILE "/opt/apache/var/logs/suphp_log",OPT_LOGFILE "${LOG_PATH}/suphp_log",' \ ${WRKSRC}/config.h - @${ECHO} "Setting php path" + @${ECHO} "Setting php path" @${REINPLACE_CMD} -e 's,OPT_PATH_TO_PHP "/usr/bin/php",OPT_PATH_TO_PHP "${PHP_PATH}",' \ ${WRKSRC}/config.h - @${ECHO} "Setting suphp path in mod_suphp" - @${REINPLACE_CMD} -e "s,/usr/sbin/suphp,${PREFIX}/sbin/suphp," ${WRKSRC}/apache/mod_suphp.c pre-install: ${APXS} -i -a -c -n suphp ${WRKSRC}/apache/mod_suphp.c
--------- Major changes so here's a new shar. ChangeLog : - Fix bugs - add patch to allow www user to use suphp # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # suphp # suphp/files # suphp/files/patch-Makefile # suphp/files/patch-config.h # suphp/files/patch-suphp.c # suphp/distinfo # suphp/pkg-comment # suphp/Makefile # suphp/pkg-message # suphp/pkg-plist # suphp/pkg-descr # echo c - suphp mkdir -p suphp > /dev/null 2>&1 echo c - suphp/files mkdir -p suphp/files > /dev/null 2>&1 echo x - suphp/files/patch-Makefile sed 's/^X//' >suphp/files/patch-Makefile << 'END-of-suphp/files/patch-Makefile' X--- Makefile.orig Wed Oct 23 22:16:50 2002 X+++ Makefile Tue Nov 12 12:10:58 2002 X@@ -2,9 +2,9 @@ X ## Makefile for suPHP ## X ############################################## X X-SUPHP_INSTALL = /usr/sbin/suphp X+SUPHP_INSTALL = $(PREFIX)/sbin/suphp X X-CC = gcc X+#CC = gcc X CFLAGS = -c -Wall X LD = gcc X LDFLAGS = -o X@@ -31,11 +31,7 @@ X touch suphp.h X X install: suphp X- if [ $$UID = 0 ]; then \ X- cp suphp ${SUPHP_INSTALL}; \ X- else \ X- echo -e "You need to be root to install suPHP."; \ X- fi X+ $(INSTALL) -o root -g wheel -m 4755 suphp ${SUPHP_INSTALL} X X clean: X rm *.o X@@ -43,3 +39,5 @@ X X rmbackups: X rm *~ X+ X+all: suphp END-of-suphp/files/patch-Makefile echo x - suphp/files/patch-config.h sed 's/^X//' >suphp/files/patch-config.h << 'END-of-suphp/files/patch-config.h' X--- config.h.orig Wed Oct 23 22:16:50 2002 X+++ config.h Wed Nov 13 16:30:35 2002 X@@ -24,5 +24,6 @@ X #define OPT_MIN_UID 100 X #define OPT_MIN_GID 100 X #define OPT_APACHE_USER "wwwrun" X+#define OPT_APACHE_GROUP "wwwrun" X #define OPT_PATH_TO_PHP "/usr/bin/php" X #define OPT_LOGFILE "/opt/apache/var/logs/suphp_log" END-of-suphp/files/patch-config.h echo x - suphp/files/patch-suphp.c sed 's/^X//' >suphp/files/patch-suphp.c << 'END-of-suphp/files/patch-suphp.c' X--- suphp.c.orig Wed Oct 23 22:16:50 2002 X+++ suphp.c Wed Nov 13 16:26:01 2002 X@@ -68,6 +68,7 @@ X { X // Check, if program has been started by Apache X struct passwd *apacheuser; X+ struct group *apachegroup; X struct passwd *calluser; X struct passwd *targetuser; X struct group *targetgroup; X@@ -76,6 +77,7 @@ X path_translated = getenv("SCRIPT_FILENAME"); X X apacheuser = getpwnam(OPT_APACHE_USER); X+ apachegroup = getgrnam(OPT_APACHE_GROUP); X calluser = getpwuid(getuid()); X X if (calluser->pw_uid!=apacheuser->pw_uid) X@@ -105,13 +107,13 @@ X X // Get gid and uid of the file and check it X targetuser = getpwuid(file_get_uid(path_translated)); X- if (targetuser->pw_uid < OPT_MIN_UID) X+ if (targetuser->pw_uid < OPT_MIN_UID && targetuser->pw_uid != apacheuser->pw_uid) X { X log_error ("UID of %s (%d / %s) < %d", path_translated, targetuser->pw_uid, targetuser->pw_name, OPT_MIN_UID); X error_exit(ERRCODE_LOW_UID); X } X targetgroup = getgrgid(file_get_gid(path_translated)); X- if (targetgroup->gr_gid < OPT_MIN_GID) X+ if (targetgroup->gr_gid < OPT_MIN_GID && targetgroup->gr_gid != apachegroup->gr_gid) X { X log_error ("GID of %s (%d / %s) < %d", path_translated, targetgroup->gr_gid, targetgroup->gr_name, OPT_MIN_GID); X error_exit(ERRCODE_LOW_GID); END-of-suphp/files/patch-suphp.c echo x - suphp/distinfo sed 's/^X//' >suphp/distinfo << 'END-of-suphp/distinfo' XMD5 (suphp-0.2.2.tar.gz) = c035fa4ffc73b3cb037791ab85fe94fa END-of-suphp/distinfo echo x - suphp/pkg-comment sed 's/^X//' >suphp/pkg-comment << 'END-of-suphp/pkg-comment' XsuPHP is a combination which provides a wrapper for PHP END-of-suphp/pkg-comment echo x - suphp/Makefile sed 's/^X//' >suphp/Makefile << 'END-of-suphp/Makefile' X# New ports collection makefile for: suphp X# Date created: 15 September 2002 X# Whom: Clément Laforêt <sheepkiller@cultdeadsheep.org> X# X# $FreeBSD: ports/www/suphp/Makefile,v 1.9 2002/08/07 03:07:44 pat Exp $ X# X XPORTNAME= suphp XPORTVERSION= 0.2.2 XPORTREVISION= 1 XCATEGORIES= www XMASTER_SITES= http://www.suphp.org/download/ X XMAINTAINER= sheepkiller@cultdeadsheep.org X XBUILD_DEPENDS= ${LOCALBASE}/sbin/apxs:${PORTSDIR}/www/apache13 XRUN_DEPENDS= ${LOCALBASE}/bin/php:${PORTSDIR}/lang/php4 X XUSE_REINPLACE= yes XHAS_CONFIGURE= no X XMAKE_ARGS+= APXS="${APXS}" XAPXS?= ${LOCALBASE}/sbin/apxs XWWW_USER?= www XWWW_GROUP?= www XLOG_PATH?= /var/log XPHP_PATH?= ${LOCALBASE}/bin/php X Xpre-configure: X @${ECHO} X @${ECHO} "*-------------------------------------------------------------*" X @${ECHO} " suPHP conflicts with mod_php4. It works only with php command" X @${ECHO} " line binairy." X @${ECHO} " Options :" X @${ECHO} " - WWW_USER = Apache's User (default www)" X @${ECHO} " - Define CHECK_PATH, to enable suExec-like path checking" X @${ECHO} " (based on DocumentRoot directive)." X @${ECHO} " - LOG_PATH=/path/to/your/logs. Default /var/log/." X @${ECHO} " - PHP_PATH=/path/to/bin/php. Default ${LOCALBASE}/bin/php." X @${ECHO} "*-------------------------------------------------------------*" X @${ECHO} X Xdo-configure: X @${ECHO} "Setting User to : ${WWW_USER}" X @${REINPLACE_CMD} -e 's!OPT_APACHE_USER "wwwrun"!OPT_APACHE_USER "${WWW_USER}"!' \ X ${WRKSRC}/config.h X @${ECHO} "Setting Group to : ${WWW_GROUP}" X @${REINPLACE_CMD} -e 's!OPT_APACHE_GROUP "wwwrun"!OPT_APACHE_GROUP "${WWW_USER}"!' \ X ${WRKSRC}/config.h X @${ECHO} "Setting checkpath. (if enabled)" X.if !defined(CHECK_PATH) X @${REINPLACE_CMD} -e 's!#define OPT_CHECKPATH!/*#define OPT_CHECKPATH*/!' \ X ${WRKSRC}/config.h X.endif X @${ECHO} "Setting logs path" X @${REINPLACE_CMD} -e 's,OPT_LOGFILE "/opt/apache/var/logs/suphp_log",OPT_LOGFILE "${LOG_PATH}/suphp_log",' \ X ${WRKSRC}/config.h X @${ECHO} "Setting php path" X @${REINPLACE_CMD} -e 's,OPT_PATH_TO_PHP "/usr/bin/php",OPT_PATH_TO_PHP "${PHP_PATH}",' \ X ${WRKSRC}/config.h X @${ECHO} "Setting suphp path in mod_suphp" X @${REINPLACE_CMD} -e "s,/usr/sbin/suphp,${PREFIX}/sbin/suphp," ${WRKSRC}/apache/mod_suphp.c X Xpre-install: X ${APXS} -i -a -c -n suphp ${WRKSRC}/apache/mod_suphp.c X Xpost-install: X.if !defined(NOPORTDOCS) X @${MKDIR} ${DOCSDIR} ${DOCSDIR}/apache ${DOCSDIR}/de-doc ${DOCSDIR}/de-doc/apache X ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/LICENSE ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/apache/CONFIG ${DOCSDIR}/apache X ${INSTALL_DATA} ${WRKSRC}/apache/README ${DOCSDIR}/apache X ${INSTALL_DATA} ${WRKSRC}/apache/INSTALL ${DOCSDIR}/apache X ${INSTALL_DATA} ${WRKSRC}/apache/LICENSE ${DOCSDIR}/apache X ${INSTALL_DATA} -d ${WRKSRC}/de-doc/ ${DOCSDIR} X ${INSTALL_DATA} ${WRKSRC}/de-doc/README.de ${DOCSDIR}/de-doc/ X ${INSTALL_DATA} ${WRKSRC}/de-doc/INSTALL.de ${DOCSDIR}/de-doc/ X ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/README.de ${DOCSDIR}/de-doc/apache X ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/INSTALL.de ${DOCSDIR}/de-doc/apache X ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/CONFIG.de ${DOCSDIR}/de-doc/apache X.endif X @${RM} mod_suphp.o X @${CAT} ${PKGMESSAGE} X X.include <bsd.port.mk> END-of-suphp/Makefile echo x - suphp/pkg-message sed 's/^X//' >suphp/pkg-message << 'END-of-suphp/pkg-message' X---------------------------------------------------------------- XYou have installed mod_suphp, a module that provides a wrapper Xfor PHP for Apache. X XFor help on using this module, please see the suPHP homepage: X http://www.suphp.org X XImportant hints: XUsing suPHP can break some PHP-scripts, because of Apache's CGI Xinterface. X----------------------------------------------------------------- END-of-suphp/pkg-message echo x - suphp/pkg-plist sed 's/^X//' >suphp/pkg-plist << 'END-of-suphp/pkg-plist' Xsbin/suphp Xlibexec/apache/mod_suphp.so X@exec %D/sbin/apxs -e -a -n suphp %D/%f X@unexec echo "===> If you do not plan on reinstalling suphp, you must manually remove"; echo "===> references to it in httpd.conf." X%%PORTDOCS%%share/doc/suphp/apache/CONFIG X%%PORTDOCS%%share/doc/suphp/apache/README X%%PORTDOCS%%share/doc/suphp/apache/INSTALL X%%PORTDOCS%%share/doc/suphp/apache/LICENSE X%%PORTDOCS%%share/doc/suphp/de-doc/apache/README.de X%%PORTDOCS%%share/doc/suphp/de-doc/apache/INSTALL.de X%%PORTDOCS%%share/doc/suphp/de-doc/apache/CONFIG.de X%%PORTDOCS%%share/doc/suphp/de-doc/README.de X%%PORTDOCS%%share/doc/suphp/de-doc/INSTALL.de X%%PORTDOCS%%share/doc/suphp/README X%%PORTDOCS%%share/doc/suphp/INSTALL X%%PORTDOCS%%share/doc/suphp/LICENSE X%%PORTDOCS%%@dirrm share/doc/suphp/de-doc/apache X%%PORTDOCS%%@dirrm share/doc/suphp/de-doc X%%PORTDOCS%%@dirrm share/doc/suphp/apache X%%PORTDOCS%%@dirrm share/doc/suphp/ END-of-suphp/pkg-plist echo x - suphp/pkg-descr sed 's/^X//' >suphp/pkg-descr << 'END-of-suphp/pkg-descr' XsuPHP is a combination of an Apache module (mod_suphp) and an executable Xwhich provides a wrapper for PHP. With both together, it is possible to Xexecute PHP scripts with the permissions of their owner without having Xto place a PHP binary in each user's cgi-bin directory. suPHP doesn't Xneed Apache's suExec, provides a logging function and support for Xdifferent php.ini's. X XWWW: http://www.suphp.org END-of-suphp/pkg-descr exit
State Changed From-To: open->closed New port added, thanks!