From 9056ac5ca0fadfa778ae21013ff3a7bf4010e383 Mon Sep 17 00:00:00 2001 From: Nicolas Thill Date: Wed, 19 Oct 2005 00:16:27 +0000 Subject: [PATCH] add a patch to provide a descent PATH to cgi, split in 3 packages (w/o ssl, w/ matrixssl & w/ openssl), add a restart command to init-script. SVN-Revision: 2174 --- openwrt/package/Makefile | 10 +++- openwrt/package/mini_httpd/Config.in | 60 +++++++++++++++++++ openwrt/package/mini_httpd/Makefile | 57 +++++++++++++++++- .../mini_httpd/files/mini_httpd-ssl.conf | 7 +++ .../package/mini_httpd/files/mini_httpd.conf | 4 +- .../package/mini_httpd/files/mini_httpd.init | 13 ++-- .../ipkg/mini-httpd-matrixssl.conffiles | 3 + .../ipkg/mini-httpd-matrixssl.control | 9 +++ .../ipkg/mini-httpd-openssl.conffiles | 3 + .../ipkg/mini-httpd-openssl.control | 9 +++ .../mini_httpd/ipkg/mini-httpd.conffiles | 1 - .../mini_httpd/ipkg/mini-httpd.control | 4 +- .../mini_httpd/patches/001-cgi_path.patch | 16 +++++ .../mini_httpd/patches/500-matrixssl.patch | 10 ++-- 14 files changed, 187 insertions(+), 19 deletions(-) create mode 100644 openwrt/package/mini_httpd/files/mini_httpd-ssl.conf create mode 100644 openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.conffiles create mode 100644 openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.control create mode 100644 openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.conffiles create mode 100644 openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.control create mode 100644 openwrt/package/mini_httpd/patches/001-cgi_path.patch diff --git a/openwrt/package/Makefile b/openwrt/package/Makefile index 3c5662022d..5e5087d925 100644 --- a/openwrt/package/Makefile +++ b/openwrt/package/Makefile @@ -107,7 +107,7 @@ package-$(BR2_PACKAGE_MARADNS) += maradns package-$(BR2_PACKAGE_MATRIXSSL) += matrixssl package-$(BR2_PACKAGE_MICROCOM) += microcom package-$(BR2_PACKAGE_MICROPERL) += microperl -package-$(BR2_PACKAGE_MINI_HTTPD) += mini_httpd +package-$(BR2_COMPILE_MINI_HTTPD) += mini_httpd package-$(BR2_PACKAGE_MINI_SENDMAIL) += mini_sendmail package-$(BR2_PACKAGE_MONIT) += monit package-$(BR2_PACKAGE_MPD) += mpd @@ -248,7 +248,6 @@ libvorbis-compile: libogg-compile libxml2-compile: zlib-compile libxslt-compile: libxml2-compile lighttpd-compile: openssl-compile pcre-compile -mini_httpd-compile: matrixssl-compile mt-daapd-compile: howl-compile libgdbm-compile libid3tag-compile mtr-compile: ncurses-compile mysql-compile: ncurses-compile zlib-compile @@ -314,6 +313,13 @@ ifneq ($(BR2_PACKAGE_FREERADIUS_MOD_SQL_PGSQL),) freeradius-compile: postgresql-compile endif +ifneq ($(BR2_PACKAGE_MINI_HTTPD_MATRIXSSL),) +mini_httpd-compile: matrixssl-compile +endif +ifneq ($(BR2_PACKAGE_MINI_HTTPD_OPENSSL),) +mini_httpd-compile: openssl-compile +endif + ifneq ($(BR2_PACKAGE_MPD_MP3),) mpd-compile: libid3tag-compile libmad-compile endif diff --git a/openwrt/package/mini_httpd/Config.in b/openwrt/package/mini_httpd/Config.in index 484924f791..fb319ae12a 100644 --- a/openwrt/package/mini_httpd/Config.in +++ b/openwrt/package/mini_httpd/Config.in @@ -1,6 +1,66 @@ +config BR2_COMPILE_MINI_HTTPD + bool + default n + depends BR2_PACKAGE_MINI_HTTPD || BR2_PACKAGE_MINI_HTTPD_MATRIXSSL || BR2_PACKAGE_MINI_HTTPD_OPENSSL + config BR2_PACKAGE_MINI_HTTPD tristate "mini-httpd - A small web server" default m if CONFIG_DEVEL + select BR2_COMPILE_MINI_HTTPD + help + mini_httpd is a small HTTP server. Its performance is not great, but for + low or medium traffic sites it's quite adequate. It implements all the + basic features of an HTTP server, including: + + * GET, HEAD, and POST methods. + * CGI. + * Basic authentication. + * Security against ".." filename snooping. + * The common MIME types. + * Trailing-slash redirection. + * index.html, index.htm, index.cgi + * Directory listings. + * Multihoming / virtual hosting. + * Standard logging. + * Custom error pages. + + It can also be configured to do IPv6. + + http://www.acme.com/software/mini_httpd/ + + +config BR2_PACKAGE_MINI_HTTPD_MATRIXSSL + tristate "mini-httpd-matrixssl - A small web server, built with SSL support using MatrixSSL" + default m if CONFIG_DEVEL + select BR2_COMPILE_MINI_HTTPD + select BR2_PACKAGE_LIBMATRIXSSL + help + mini_httpd is a small HTTP server. Its performance is not great, but for + low or medium traffic sites it's quite adequate. It implements all the + basic features of an HTTP server, including: + + * GET, HEAD, and POST methods. + * CGI. + * Basic authentication. + * Security against ".." filename snooping. + * The common MIME types. + * Trailing-slash redirection. + * index.html, index.htm, index.cgi + * Directory listings. + * Multihoming / virtual hosting. + * Standard logging. + * Custom error pages. + + It can also be configured to do SSL/HTTPS and IPv6. + + http://www.acme.com/software/mini_httpd/ + + +config BR2_PACKAGE_MINI_HTTPD_OPENSSL + tristate "mini-httpd-openssl - A small web server, built with SSL support using OpenSSL" + default m if CONFIG_DEVEL + select BR2_COMPILE_MINI_HTTPD + select BR2_PACKAGE_LIBOPENSSL help mini_httpd is a small HTTP server. Its performance is not great, but for low or medium traffic sites it's quite adequate. It implements all the diff --git a/openwrt/package/mini_httpd/Makefile b/openwrt/package/mini_httpd/Makefile index aa9d89b1bd..2261b54cd6 100644 --- a/openwrt/package/mini_httpd/Makefile +++ b/openwrt/package/mini_httpd/Makefile @@ -16,6 +16,8 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/mini_httpd-$(PKG_VERSION) include $(TOPDIR)/package/rules.mk $(eval $(call PKG_template,MINI_HTTPD,mini-httpd,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) +$(eval $(call PKG_template,MINI_HTTPD_MATRIXSSL,mini-httpd-matrixssl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) +$(eval $(call PKG_template,MINI_HTTPD_OPENSSL,mini-httpd-openssl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH))) $(PKG_BUILD_DIR)/.configured: @@ -23,18 +25,43 @@ $(PKG_BUILD_DIR)/.configured: touch $@ $(PKG_BUILD_DIR)/.built: + # with MatrixSSL +ifneq ($(BR2_PACKAGE_MINI_HTTPD_MATRIXSSL),) $(MAKE) -C $(PKG_BUILD_DIR) \ CC=$(TARGET_CC) \ OFLAGS="$(TARGET_CFLAGS)" \ + SSL_DEFS="-DUSE_SSL -DHAVE_MATRIXSSL" \ SSL_INC="-I$(STAGING_DIR)/usr/include" \ SSL_LIBS="-L$(STAGING_DIR)/usr/lib -lmatrixssl" \ + SSL_OBJS="matrixssl_helper.o" \ all + (cd $(PKG_BUILD_DIR); mv mini_httpd mini_httpd-matrixssl; ) + $(MAKE) -C $(PKG_BUILD_DIR) clean +endif + # with OpenSSL +ifneq ($(BR2_PACKAGE_MINI_HTTPD_OPENSSL),) + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC=$(TARGET_CC) \ + OFLAGS="$(TARGET_CFLAGS)" \ + SSL_DEFS="-DUSE_SSL -DHAVE_OPENSSL" \ + SSL_INC="-I$(STAGING_DIR)/usr/include" \ + SSL_LIBS="-L$(STAGING_DIR)/usr/lib -lssl -lcrypto" \ + all + (cd $(PKG_BUILD_DIR); mv mini_httpd mini_httpd-openssl; ) + $(MAKE) -C $(PKG_BUILD_DIR) clean +endif + # without SSL +ifneq ($(BR2_PACKAGE_MINI_HTTPD),) + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC=$(TARGET_CC) \ + OFLAGS="$(TARGET_CFLAGS)" \ + all +endif touch $@ $(IPKG_MINI_HTTPD): install -d -m0755 $(IDIR_MINI_HTTPD)/etc - install -m0644 ./files/mini_httpd.conf $(IDIR_MINI_HTTPD)/etc/ - install -m0600 ./files/mini_httpd.pem $(IDIR_MINI_HTTPD)/etc/ + install -m0644 ./files/mini_httpd.conf $(IDIR_MINI_HTTPD)/etc/mini_httpd.conf install -d -m0755 $(IDIR_MINI_HTTPD)/etc/default install -m0644 ./files/mini_httpd.default $(IDIR_MINI_HTTPD)/etc/default/mini_httpd install -d -m0755 $(IDIR_MINI_HTTPD)/etc/init.d @@ -43,3 +70,29 @@ $(IPKG_MINI_HTTPD): install -m0755 $(PKG_BUILD_DIR)/mini_httpd $(IDIR_MINI_HTTPD)/usr/sbin/ $(RSTRIP) $(IDIR_MINI_HTTPD) $(IPKG_BUILD) $(IDIR_MINI_HTTPD) $(PACKAGE_DIR) + +$(IPKG_MINI_HTTPD_MATRIXSSL): + install -d -m0755 $(IDIR_MINI_HTTPD_MATRIXSSL)/etc + install -m0644 ./files/mini_httpd-ssl.conf $(IDIR_MINI_HTTPD_MATRIXSSL)/etc/mini_httpd.conf + install -m0600 ./files/mini_httpd.pem $(IDIR_MINI_HTTPD_MATRIXSSL)/etc/ + install -d -m0755 $(IDIR_MINI_HTTPD_MATRIXSSL)/etc/default + install -m0644 ./files/mini_httpd.default $(IDIR_MINI_HTTPD_MATRIXSSL)/etc/default/mini_httpd + install -d -m0755 $(IDIR_MINI_HTTPD_MATRIXSSL)/etc/init.d + install -m0755 ./files/mini_httpd.init $(IDIR_MINI_HTTPD_MATRIXSSL)/etc/init.d/mini_httpd + install -d -m0755 $(IDIR_MINI_HTTPD_MATRIXSSL)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/mini_httpd-matrixssl $(IDIR_MINI_HTTPD_MATRIXSSL)/usr/sbin/mini_httpd + $(RSTRIP) $(IDIR_MINI_HTTPD_MATRIXSSL) + $(IPKG_BUILD) $(IDIR_MINI_HTTPD_MATRIXSSL) $(PACKAGE_DIR) + +$(IPKG_MINI_HTTPD_OPENSSL): + install -d -m0755 $(IDIR_MINI_HTTPD_OPENSSL)/etc + install -m0644 ./files/mini_httpd-ssl.conf $(IDIR_MINI_HTTPD_OPENSSL)/etc/mini_httpd.conf + install -m0600 ./files/mini_httpd.pem $(IDIR_MINI_HTTPD_OPENSSL)/etc/ + install -d -m0755 $(IDIR_MINI_HTTPD_OPENSSL)/etc/default + install -m0644 ./files/mini_httpd.default $(IDIR_MINI_HTTPD_OPENSSL)/etc/default/mini_httpd + install -d -m0755 $(IDIR_MINI_HTTPD_OPENSSL)/etc/init.d + install -m0755 ./files/mini_httpd.init $(IDIR_MINI_HTTPD_OPENSSL)/etc/init.d/mini_httpd + install -d -m0755 $(IDIR_MINI_HTTPD_OPENSSL)/usr/sbin + install -m0755 $(PKG_BUILD_DIR)/mini_httpd-openssl $(IDIR_MINI_HTTPD_OPENSSL)/usr/sbin/mini_httpd + $(RSTRIP) $(IDIR_MINI_HTTPD_OPENSSL) + $(IPKG_BUILD) $(IDIR_MINI_HTTPD_OPENSSL) $(PACKAGE_DIR) diff --git a/openwrt/package/mini_httpd/files/mini_httpd-ssl.conf b/openwrt/package/mini_httpd/files/mini_httpd-ssl.conf new file mode 100644 index 0000000000..1cd7022d54 --- /dev/null +++ b/openwrt/package/mini_httpd/files/mini_httpd-ssl.conf @@ -0,0 +1,7 @@ +cgipat=cgi-bin/**|**.sh +dir=/www +nochroot +pidfile=/var/run/mini_httpd.pid +user=root +ssl +certfile=/etc/mini_httpd.pem diff --git a/openwrt/package/mini_httpd/files/mini_httpd.conf b/openwrt/package/mini_httpd/files/mini_httpd.conf index 2e784520ac..d636a4378b 100644 --- a/openwrt/package/mini_httpd/files/mini_httpd.conf +++ b/openwrt/package/mini_httpd/files/mini_httpd.conf @@ -1,7 +1,5 @@ -cgipat=cgi-bin/* +cgipat=cgi-bin/**|**.sh dir=/www nochroot pidfile=/var/run/mini_httpd.pid user=root -ssl -certfile=/etc/mini_httpd.pem diff --git a/openwrt/package/mini_httpd/files/mini_httpd.init b/openwrt/package/mini_httpd/files/mini_httpd.init index a6905591db..77bd6fd3b7 100644 --- a/openwrt/package/mini_httpd/files/mini_httpd.init +++ b/openwrt/package/mini_httpd/files/mini_httpd.init @@ -1,20 +1,25 @@ #!/bin/sh -DEFAULT=/etc/default/mini_httpd +BIN=mini_httpd +DEFAULT=/etc/default/$BIN RUN_D=/var/run -PID_F=$RUN_D/mini_httpd.pid +PID_F=$RUN_D/$BIN.pid [ -f $DEFAULT ] && . $DEFAULT case $1 in start) [ -d $RUN_D ] || mkdir -p $RUN_D - mini_httpd $OPTIONS + $BIN $OPTIONS 2>/dev/null ;; stop) [ -f $PID_F ] && kill $(cat $PID_F) ;; + restart) + $0 stop + $0 start + ;; *) - echo "usage: $0 (start|stop)" + echo "usage: $0 (start|stop|restart)" exit 1 esac diff --git a/openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.conffiles b/openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.conffiles new file mode 100644 index 0000000000..36a86b957c --- /dev/null +++ b/openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.conffiles @@ -0,0 +1,3 @@ +/etc/default/mini_httpd +/etc/mini_httpd.conf +/etc/mini_httpd.pem diff --git a/openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.control b/openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.control new file mode 100644 index 0000000000..9212997154 --- /dev/null +++ b/openwrt/package/mini_httpd/ipkg/mini-httpd-matrixssl.control @@ -0,0 +1,9 @@ +Package: mini-httpd-matrixssl +Priority: optional +Section: net +Version: [TBDL] +Architecture: [TBDL] +Maintainer: OpenWrt Developers Team +Source: buildroot internal +Description: A small HTTP server, built with SSL support using MatrixSSL. +Depends: libmatrixssl diff --git a/openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.conffiles b/openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.conffiles new file mode 100644 index 0000000000..36a86b957c --- /dev/null +++ b/openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.conffiles @@ -0,0 +1,3 @@ +/etc/default/mini_httpd +/etc/mini_httpd.conf +/etc/mini_httpd.pem diff --git a/openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.control b/openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.control new file mode 100644 index 0000000000..97bc916a80 --- /dev/null +++ b/openwrt/package/mini_httpd/ipkg/mini-httpd-openssl.control @@ -0,0 +1,9 @@ +Package: mini-httpd-openssl +Priority: optional +Section: net +Version: [TBDL] +Architecture: [TBDL] +Maintainer: OpenWrt Developers Team +Source: buildroot internal +Description: A small HTTP server, built with SSL support using OpenSSL. +Depends: libopenssl diff --git a/openwrt/package/mini_httpd/ipkg/mini-httpd.conffiles b/openwrt/package/mini_httpd/ipkg/mini-httpd.conffiles index 36a86b957c..d1123c2a37 100644 --- a/openwrt/package/mini_httpd/ipkg/mini-httpd.conffiles +++ b/openwrt/package/mini_httpd/ipkg/mini-httpd.conffiles @@ -1,3 +1,2 @@ /etc/default/mini_httpd /etc/mini_httpd.conf -/etc/mini_httpd.pem diff --git a/openwrt/package/mini_httpd/ipkg/mini-httpd.control b/openwrt/package/mini_httpd/ipkg/mini-httpd.control index 5084053179..2082aad7e2 100644 --- a/openwrt/package/mini_httpd/ipkg/mini-httpd.control +++ b/openwrt/package/mini_httpd/ipkg/mini-httpd.control @@ -3,7 +3,7 @@ Priority: optional Section: net Version: [TBDL] Architecture: [TBDL] -Maintainer: OpenWrt Developers Team -Source: http://openwrt.org/cgi-bin/viewcvs.cgi/openwrt/package/mini_httpd/ +Maintainer: OpenWrt Developers Team +Source: buildroot internal Description: A small HTTP server, built with SSL support using MatrixSSL. Depends: libmatrixssl diff --git a/openwrt/package/mini_httpd/patches/001-cgi_path.patch b/openwrt/package/mini_httpd/patches/001-cgi_path.patch new file mode 100644 index 0000000000..c847d948b4 --- /dev/null +++ b/openwrt/package/mini_httpd/patches/001-cgi_path.patch @@ -0,0 +1,16 @@ +diff -ruN mini_httpd-1.19-old/mini_httpd.c mini_httpd-1.19-new/mini_httpd.c +--- mini_httpd-1.19-old/mini_httpd.c 2005-10-19 01:11:24.000000000 +0200 ++++ mini_httpd-1.19-new/mini_httpd.c 2005-10-19 01:13:05.000000000 +0200 +@@ -138,10 +138,10 @@ + #define CGI_NICE 10 + #endif /* CGI_NICE */ + #ifndef CGI_PATH +-#define CGI_PATH "/usr/local/bin:/usr/ucb:/bin:/usr/bin" ++#define CGI_PATH "/usr/bin:/bin:/usr/sbin:/sbin" + #endif /* CGI_PATH */ + #ifndef CGI_LD_LIBRARY_PATH +-#define CGI_LD_LIBRARY_PATH "/usr/local/lib:/usr/lib" ++#define CGI_LD_LIBRARY_PATH "/usr/lib:/lib" + #endif /* CGI_LD_LIBRARY_PATH */ + #ifndef AUTH_FILE + #define AUTH_FILE ".htpasswd" diff --git a/openwrt/package/mini_httpd/patches/500-matrixssl.patch b/openwrt/package/mini_httpd/patches/500-matrixssl.patch index e2d83af88e..0ab8d68331 100644 --- a/openwrt/package/mini_httpd/patches/500-matrixssl.patch +++ b/openwrt/package/mini_httpd/patches/500-matrixssl.patch @@ -14,11 +14,11 @@ diff -ruN mini_httpd-1.19-orig/Makefile mini_httpd-1.19-3/Makefile +#SSL_OBJS = + +# MatrixSSL -+SSL_TREE = -+SSL_DEFS = -DUSE_SSL -DHAVE_MATRIXSSL -+SSL_INC = -+SSL_LIBS = -lmatrixssl -+SSL_OBJS = matrixssl_helper.o ++#SSL_TREE = ++#SSL_DEFS = -DUSE_SSL -DHAVE_MATRIXSSL ++#SSL_INC = ++#SSL_LIBS = -lmatrixssl ++#SSL_OBJS = matrixssl_helper.o -BINDIR = /usr/local/sbin