diff --git a/www/bozohttpd/Makefile b/www/bozohttpd/Makefile index 6ccd604efc26..f3288ef2a1ba 100644 --- a/www/bozohttpd/Makefile +++ b/www/bozohttpd/Makefile @@ -1,68 +1,75 @@ PORTNAME= bozohttpd DISTVERSION= 20240126 +PORTREVISION= 1 CATEGORIES= www MASTER_SITES= http://eterna23.net/bozohttpd/ MAINTAINER= ports@FreeBSD.org COMMENT= Bozotic HTTP server from NetBSD WWW= http://eterna23.net/bozohttpd/ LICENSE= BSD2CLAUSE USES= cpe uidfix tar:bzip2 CPE_VENDOR= eterna USE_RC_SUBR= bozohttpd MAKE_ARGS= LDADD="${LIBS}" PLIST_FILES= bin/bozohttpd \ share/man/man8/bozohttpd.8.gz -OPTIONS_DEFINE= BLACKLIST CGI DAEMON DEBUG DIRINDEX\ +OPTIONS_DEFINE= BLOCKLIST CGI DAEMON DEBUG DIRINDEX\ DYNAMIC HTPASSWD LUA SSL USER -OPTIONS_DEFAULT= BLACKLIST CGI DAEMON DEBUG DIRINDEX\ +OPTIONS_DEFAULT= BLOCKLIST CGI DAEMON DEBUG DIRINDEX\ DYNAMIC HTPASSWD LUA SSL USER -BLACKLIST_DESC= Report Unauthorized and Forbidden accesses to blacklistd +BLOCKLIST_DESC= Report Unauthorized and Forbidden accesses to blocklistd CGI_DESC= Common Gateway Interface (CGI) support (-C, -c, -E, -e) DAEMON_DESC= Optional daemon mode (-b) DEBUG_DESC= Debug support (-d) DIRINDEX_DESC= Automatic directory index if index.html is missing (-X) DYNAMIC_DESC= Dynamic content based on file suffixes (-C, -M) HTPASSWD_DESC= Basic authentication with .htpasswd files LUA_DESC= Lua scripts for dynamic content (-L) SSL_DESC= SSL/TLS for HTTPS requests (-Z, -z) USER_DESC= Optional /~user transformation (-e, -p, -u) -BLACKLIST_CFLAGS_OFF= -DNO_BLACKLIST_SUPPORT -BLACKLIST_LIBS= -lblacklist +BLOCKLIST_CFLAGS_OFF= -DNO_BLOCKLIST_SUPPORT +BLOCKLIST_LIBS= -lblocklist CGI_CFLAGS_OFF= -DNO_CGIBIN_SUPPORT DAEMON_CFLAGS_OFF= -DNO_DAEMON_MODE DEBUG_CFLAGS_OFF= -DNO_DEBUG DIRINDEX_CFLAGS_OFF= -DNO_DIRINDEX_SUPPORT DYNAMIC_CFLAGS_OFF= -DNO_DYNAMIC_CONTENT HTPASSWD_CFLAGS= -DDO_HTPASSWD HTPASSWD_LIBS= -lcrypt LUA_USES= lua LUA_CFLAGS= -I${LUA_INCDIR} LUA_CFLAGS_OFF= -DNO_LUA_SUPPORT LUA_LDFLAGS= -L${LUA_LIBDIR} LUA_LIBS= -llua-${LUA_VER} SSL_USES= ssl SSL_CFLAGS= -I${OPENSSLINC} SSL_CFLAGS_OFF= -DNO_SSL_SUPPORT SSL_LDFLAGS= -L${OPENSSLLIB} SSL_LIBS= -lcrypto -lssl USER_CFLAGS_OFF= -DNO_USER_SUPPORT .include +.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1500000 +BLOCKLIST_CFLAGS_OFF= -DNO_BLACKLIST_SUPPORT +BLOCKLIST_LIBS= -lblacklist +EXTRA_PATCHES= ${FILESDIR}/blacklist-patches +.endif + .if ${OPSYS} == FreeBSD CFLAGS+= -Wno-error=unused-but-set-variable .endif .if ( ${OPSYS} == FreeBSD && ${SSL_DEFAULT} == base ) || ${SSL_DEFAULT:Mopenssl3*} CFLAGS+= -DOPENSSL_API_COMPAT=0x10100000L .endif .include diff --git a/www/bozohttpd/files/blacklist-patches/patch-Makefile b/www/bozohttpd/files/blacklist-patches/patch-Makefile new file mode 100644 index 000000000000..0a36f47b9dd0 --- /dev/null +++ b/www/bozohttpd/files/blacklist-patches/patch-Makefile @@ -0,0 +1,11 @@ +--- Makefile.orig 2024-02-04 05:55:04 UTC ++++ Makefile +@@ -14,7 +14,7 @@ + # NO_SSL_SUPPORT /* don't support ssl (https) */ + # DO_HTPASSWD /* support .htpasswd files */ + # NO_LUA_SUPPORT /* don't support Lua for dynamic content */ +-# NO_BLOCKLIST_SUPPORT /* don't support blocklist */ ++# NO_BLACKLIST_SUPPORT /* don't support blocklist */ + # + # other system specific defines: + # HAVE_NBUTIL_H /* netbsd compat is in diff --git a/www/bozohttpd/files/patch-auth-bozo.c b/www/bozohttpd/files/blacklist-patches/patch-auth-bozo.c similarity index 100% rename from www/bozohttpd/files/patch-auth-bozo.c rename to www/bozohttpd/files/blacklist-patches/patch-auth-bozo.c diff --git a/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.8 b/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.8 new file mode 100644 index 000000000000..6a0ab80202df --- /dev/null +++ b/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.8 @@ -0,0 +1,56 @@ +--- bozohttpd.8.orig 2024-02-04 05:55:04 UTC ++++ bozohttpd.8 +@@ -475,21 +489,21 @@ It may require linking with the crypt library, using + on the compiler command line to enable this support. + It may require linking with the crypt library, using + .Dq -lcrypt . +-.Ss BLOCKLIST SUPPORT ++.Ss BLACKLIST SUPPORT + On +-.Nx , ++.Fx , + .Nm + supports +-.Xr blocklistd 8 ++.Xr blacklistd 8 + by default. + The support can be disabled with the +-.Dq -DNO_BLOCKLIST_SUPPORT ++.Dq -DNO_BLACKLIST_SUPPORT + compilation option. + .Pp + Upon occurrence, + .Nm + reports two HTTP status codes to +-.Xr blocklistd 8 ++.Xr blacklistd 8 + as failures: + .Em 401 + (``Unauthorized'') +@@ -501,7 +515,7 @@ A successful authorization decreases the counter kept + is the one received upon authorization failure with the + HTTP Basic Authorization mechanism. + A successful authorization decreases the counter kept by +-.Xr blocklistd 8 . ++.Xr blacklistd 8 . + .Pp + Note that the implementation of the HTTP Basic Authorization mechanism + uses a redirection; a status code +@@ -510,7 +524,7 @@ is reported as two failures to + Therefore, a single authorization failure of + .Pa .htpasswd + is reported as two failures to +-.Xr blocklistd 8 , ++.Xr blacklistd 8 , + but no failures are recorded upon successful authorization + due to the decrease of the failure counter. + .Ss SSL SUPPORT +@@ -821,7 +835,7 @@ provided support for + .An Jukka Ruohonen + .Aq Mt jruoho@NetBSD.org + provided support for +-.Xr blocklistd 8 ++.Xr blacklistd 8 + .It + .An Thor Lancelot Simon + .Aq Mt tls@NetBSD.org diff --git a/www/bozohttpd/files/patch-bozohttpd.c b/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.c similarity index 100% rename from www/bozohttpd/files/patch-bozohttpd.c rename to www/bozohttpd/files/blacklist-patches/patch-bozohttpd.c diff --git a/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.h b/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.h new file mode 100644 index 000000000000..02c1a830f508 --- /dev/null +++ b/www/bozohttpd/files/blacklist-patches/patch-bozohttpd.h @@ -0,0 +1,13 @@ +--- bozohttpd.h.orig 2024-02-04 05:55:04 UTC ++++ bozohttpd.h +@@ -44,8 +44,8 @@ + #include + #endif + +-#ifndef NO_BLOCKLIST_SUPPORT +-#include ++#ifndef NO_BLACKLIST_SUPPORT ++#include + void pfilter_notify(const int, const int); + #endif + diff --git a/www/bozohttpd/files/patch-Makefile b/www/bozohttpd/files/patch-Makefile index c55ab1918696..641bf920fd6e 100644 --- a/www/bozohttpd/files/patch-Makefile +++ b/www/bozohttpd/files/patch-Makefile @@ -1,47 +1,38 @@ --- Makefile.orig 2024-02-04 05:55:04 UTC +++ Makefile -@@ -14,7 +14,7 @@ - # NO_SSL_SUPPORT /* don't support ssl (https) */ - # DO_HTPASSWD /* support .htpasswd files */ - # NO_LUA_SUPPORT /* don't support Lua for dynamic content */ --# NO_BLOCKLIST_SUPPORT /* don't support blocklist */ -+# NO_BLACKLIST_SUPPORT /* don't support blocklist */ - # - # other system specific defines: - # HAVE_NBUTIL_H /* netbsd compat is in @@ -24,22 +24,19 @@ # for setting CFLAGS relevant to your make, eg # % make COPTS="-DDO_HTPASSWD" -COPTS+= -DDO_HTPASSWD PROG= bozohttpd -LINKS= ${BINDIR}/bozohttpd ${BINDIR}/httpd MAN= bozohttpd.8 -MLINKS+=bozohttpd.8 httpd.8 SRCS= bozohttpd.c ssl-bozo.c auth-bozo.c cgi-bozo.c daemon-bozo.c \ tilde-luzah-bozo.c dir-index-bozo.c content-bozo.c lua-bozo.c SRCS+= main.c COPTS.ssl-bozo.c+=-Wno-error=deprecated-declarations -LDADD= -lblocklist -lcrypt -llua -lm -DPADD= ${LIBBLOCKLIST} ${LIBCRYPT} ${LIBLUA} ${LIBM} - WARNS?= 4 +BINDIR=$(PREFIX)/bin +MANDIR=$(PREFIX)/share/man/man + .if defined(.OS.MAKE) OPSYS= ${.OS.MAKE} .else @@ -50,9 +47,6 @@ LDADD+= -lnbutil CPPFLAGS+= -DHAVE_NBUTIL_H LDADD+= -lnbutil .endif - -LDADD+= -lssl -lcrypto -DPADD+= ${LIBSSL} ${LIBCRYPTO} # # Build release things. diff --git a/www/bozohttpd/files/patch-bozohttpd.8 b/www/bozohttpd/files/patch-bozohttpd.8 index 8f3e84e155e1..063f5a46946d 100644 --- a/www/bozohttpd/files/patch-bozohttpd.8 +++ b/www/bozohttpd/files/patch-bozohttpd.8 @@ -1,153 +1,99 @@ --- bozohttpd.8.orig 2024-02-04 05:55:04 UTC +++ bozohttpd.8 @@ -373,12 +373,26 @@ and 4 in the case of .Fl C and 4 in the case of .Fl M . ) +.Ss DEFAULT CONFIGURATION +On +.Fx , +.Nm +can be enabled as the default web server by adding the following options to +.Pa /etc/rc.conf +: +.Bd -literal +bozohttpd_enable (bool): Set it to "YES" to enable bozohttpd. + Default is "NO". +bozohttpd_flags (str): Options to pass to bozohttpd. + Default is "-b -t /var/empty -U nobody /". + The last argument, slashdir, is required. +.Ed .Ss INETD CONFIGURATION As .Nm -uses +normally uses .Xr inetd 8 -by default to process incoming TCP connections for HTTP requests +to process incoming TCP connections for HTTP requests (but see the .Fl b option), @@ -390,8 +404,8 @@ entry would be: .Xr inetd.conf 5 entry would be: .Bd -literal -http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd /var/www -http stream tcp6 nowait:600 _httpd /usr/libexec/httpd httpd /var/www +http stream tcp nowait:600 www /usr/local/bin/bozohttpd httpd /var/www +http stream tcp6 nowait:600 www /usr/local/bin/bozohttpd httpd /var/www .Ed .Pp This would serve web pages from @@ -405,7 +419,7 @@ Using the default of 40. .Pp Using the -.Nx +.Fx .Xr inetd 8 , you can provide multiple IP-address based HTTP servers by having multiple listening ports with different configurations. @@ -457,15 +471,15 @@ On .Ed .Pp On -.Nx , +.Fx , the -.Xr pwhash 1 +.Xr openssl-passwd 1 utility may be used to generate hashed passwords. .Pp -While +While the +.Fx +port of .Nm -distributed with -.Nx has support for HTTP Basic Authorization enabled by default, in the portable distribution it is excluded. Compile -@@ -475,21 +489,21 @@ It may require linking with the crypt library, using - on the compiler command line to enable this support. - It may require linking with the crypt library, using - .Dq -lcrypt . --.Ss BLOCKLIST SUPPORT -+.Ss BLACKLIST SUPPORT - On --.Nx , -+.Fx , - .Nm - supports --.Xr blocklistd 8 -+.Xr blacklistd 8 - by default. - The support can be disabled with the --.Dq -DNO_BLOCKLIST_SUPPORT -+.Dq -DNO_BLACKLIST_SUPPORT - compilation option. - .Pp - Upon occurrence, - .Nm - reports two HTTP status codes to --.Xr blocklistd 8 -+.Xr blacklistd 8 - as failures: - .Em 401 - (``Unauthorized'') -@@ -501,7 +515,7 @@ A successful authorization decreases the counter kept - is the one received upon authorization failure with the - HTTP Basic Authorization mechanism. - A successful authorization decreases the counter kept by --.Xr blocklistd 8 . -+.Xr blacklistd 8 . - .Pp - Note that the implementation of the HTTP Basic Authorization mechanism - uses a redirection; a status code -@@ -510,7 +524,7 @@ is reported as two failures to - Therefore, a single authorization failure of - .Pa .htpasswd - is reported as two failures to --.Xr blocklistd 8 , -+.Xr blacklistd 8 , - but no failures are recorded upon successful authorization - due to the decrease of the failure counter. - .Ss SSL SUPPORT @@ -603,7 +617,7 @@ entry like: .Xr inetd.conf 5 entry like: .Bd -literal -http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd -v /var/vroot /var/www +http stream tcp nowait:600 www /usr/local/bin/bozohttpd httpd -v /var/vroot /var/www .Ed .Pp and inside @@ -621,7 +635,7 @@ Typically this will be like: option to specify a CGI handler for a particular file type. Typically this will be like: .Bd -literal -httpd -C .php /usr/pkg/bin/php-cgi /var/www +bozohttpd -C .php /usr/pkg/bin/php-cgi /var/www .Ed .Pp Note that a plain script interpreter can not be used directly as a cgihandler, @@ -634,7 +648,7 @@ It would be invoked like: .Pp It would be invoked like: .Bd -literal -httpd -C .pl /www-scripts/bin/run.perl /var/www +bozohttpd -C .pl /www-scripts/bin/run.perl /var/www .Ed and the script could look like: .Bd -literal -@@ -821,7 +835,7 @@ provided support for - .An Jukka Ruohonen - .Aq Mt jruoho@NetBSD.org - provided support for --.Xr blocklistd 8 -+.Xr blacklistd 8 - .It - .An Thor Lancelot Simon - .Aq Mt tls@NetBSD.org diff --git a/www/bozohttpd/files/patch-bozohttpd.h b/www/bozohttpd/files/patch-bozohttpd.h index 6bb8356bab47..13c79e20b639 100644 --- a/www/bozohttpd/files/patch-bozohttpd.h +++ b/www/bozohttpd/files/patch-bozohttpd.h @@ -1,22 +1,11 @@ --- bozohttpd.h.orig 2024-02-04 05:55:04 UTC +++ bozohttpd.h -@@ -44,8 +44,8 @@ - #include - #endif - --#ifndef NO_BLOCKLIST_SUPPORT --#include -+#ifndef NO_BLACKLIST_SUPPORT -+#include - void pfilter_notify(const int, const int); - #endif - @@ -130,7 +130,7 @@ typedef struct bozohttpd_t { unsigned ssl_timeout; /* ssl timeout */ unsigned initial_timeout;/* first line timeout */ unsigned header_timeout; /* header lines timeout */ - unsigned request_timeout;/* total session timeout */ + int request_timeout;/* total session timeout */ char *ssl_min_proto; /* minimum ssl protocol level */ #ifndef NO_LUA_SUPPORT int process_lua; /* use the Lua handler */