Date: Thu, 22 Mar 2018 18:05:24 +0000 (UTC) From: Matthias Andree <mandree@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r465301 - in head/net: . nuster nuster/files Message-ID: <201803221805.w2MI5Onj022775@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mandree Date: Thu Mar 22 18:05:24 2018 New Revision: 465301 URL: https://svnweb.freebsd.org/changeset/ports/465301 Log: Add new port net/nuster, a web caching proxy server based on HAProxy Nuster is a simple yet powerful web caching proxy server based on HAProxy. It is 100% compatible with HAProxy, and takes full advantage of the ACL functionality of HAProxy to provide fine-grained caching policy based on the content of request, response or server status. WWW: https://github.com/jiangwenyuan/nuster PR: 225721 Submitted by: Felix Hanley Added: head/net/nuster/ head/net/nuster/Makefile (contents, props changed) head/net/nuster/distinfo (contents, props changed) head/net/nuster/files/ head/net/nuster/files/nuster.in (contents, props changed) head/net/nuster/files/patch-src_haproxy.c (contents, props changed) head/net/nuster/files/patch-src_ssl__sock.c (contents, props changed) head/net/nuster/pkg-descr (contents, props changed) head/net/nuster/pkg-plist (contents, props changed) Modified: head/net/Makefile Modified: head/net/Makefile ============================================================================== --- head/net/Makefile Thu Mar 22 18:01:06 2018 (r465300) +++ head/net/Makefile Thu Mar 22 18:05:24 2018 (r465301) @@ -502,6 +502,7 @@ SUBDIR += ntpa SUBDIR += ntraceroute SUBDIR += nusoap + SUBDIR += nuster SUBDIR += nxproxy SUBDIR += nyancat SUBDIR += nylon Added: head/net/nuster/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/Makefile Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,65 @@ +# Created by: Felix Hanley +# $FreeBSD$ + +PORTNAME= nuster +PORTVERSION= 1.7.9.4 +DISTVERSIONPREFIX= v +CATEGORIES= net www + +MAINTAINER= felix@userspace.com.au +COMMENT= Web caching proxy server based on haproxy + +LICENSE= GPLv2 LGPL21 +LICENSE_COMB= multi + +USES= cpe gmake +USE_RC_SUBR= nuster +USE_GITHUB= yes +GH_ACCOUNT= jiangwenyuan + +MAKE_ARGS= TARGET=freebsd DEFINE=-DFREEBSD_PORTS USE_GETADDRINFO=1 \ + USE_ZLIB=1 USE_CPU_AFFINITY=1 USE_ACCEPT4=1 \ + CC="${CC}" DEBUG_CFLAGS="" CPU_CFLAGS="${CFLAGS}" + +OPTIONS_DEFINE= DOCS EXAMPLES LUA OPENSSL DEVICEATLAS +OPTIONS_RADIO= PCRE +OPTIONS_RADIO_PCRE= DPCRE SPCRE +DPCRE_DESC= Link dynamically +SPCRE_DESC= Link statically +DEVICEATLAS_DESC= DeviceAtlas Device Detection support +OPTIONS_DEFAULT= SPCRE OPENSSL + +DPCRE_LIB_DEPENDS= libpcre.so:devel/pcre +DPCRE_MAKE_ARGS= USE_PCRE=1 USE_PCRE_JIT=1 +SPCRE_LIB_DEPENDS= libpcre.so:devel/pcre +SPCRE_MAKE_ARGS= USE_PCRE=1 USE_STATIC_PCRE=1 USE_PCRE_JIT=1 +DEVICEATLAS_LIB_DEPENDS= libda.so:net/deviceatlas-enterprise-c +DEVICEATLAS_MAKE_ARGS= USE_DEVICEATLAS=1 DEVICEATLAS_LIB=${LOCALBASE}/lib DEVICEATLAS_INC=${LOCALBASE}/include +OPENSSL_USES= ssl +OPENSSL_MAKE_ARGS= USE_OPENSSL=1 SSL_LIB=${OPENSSLLIB} SSL_INC=${OPENSSLINC} +LUA_USES= lua:53 +LUA_MAKE_ARGS= USE_LUA=1 LUA_INC=${LUA_INCDIR} LUA_LIB=${LUA_LIBDIR} LUA_LIB_NAME=lua-${LUA_VER} + +.include <bsd.port.pre.mk> + +.if ${ARCH} == "amd64" || ${ARCH} == "i386" +MAKE_ARGS+= USE_REGPARM=1 +.endif + +.if ${PORT_OPTIONS:MOPENSSL} && ${SSL_DEFAULT:Mopenssl-devel} +BROKEN= Does not build with openssl-devel +.endif + +post-build: + cd ${WRKSRC}/contrib/halog && ${MAKE_CMD} ${MAKE_ENV} + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/haproxy ${STAGEDIR}${PREFIX}/sbin/nuster + ${INSTALL_PROGRAM} ${WRKSRC}/contrib/halog/halog ${STAGEDIR}${PREFIX}/sbin/ + ${INSTALL_MAN} ${WRKSRC}/doc/haproxy.1 ${STAGEDIR}${MAN1PREFIX}/man/man1/nuster.1 + ${MKDIR} ${STAGEDIR}${DOCSDIR} + (cd ${WRKSRC}/doc/ && ${COPYTREE_SHARE} \* ${STAGEDIR}${DOCSDIR}) + ${MKDIR} ${STAGEDIR}${EXAMPLESDIR} + (cd ${WRKSRC}/examples/ && ${COPYTREE_SHARE} \* ${STAGEDIR}${EXAMPLESDIR}) + +.include <bsd.port.post.mk> Added: head/net/nuster/distinfo ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/distinfo Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,3 @@ +TIMESTAMP = 1514921615 +SHA256 (jiangwenyuan-nuster-v1.7.9.4_GH0.tar.gz) = 5dbd09734607c8e17fb9949064e5d2e866b8d3b75accc51b25c65b5a7d73e181 +SIZE (jiangwenyuan-nuster-v1.7.9.4_GH0.tar.gz) = 1785266 Added: head/net/nuster/files/nuster.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/files/nuster.in Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,122 @@ +#!/bin/sh + +# PROVIDE: nuster +# REQUIRE: DAEMON LOGIN +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf to enable nuster: +# +# nuster_enable (bool): default: "NO" +# Set to "YES" to enable nuster +# nuster_pidfile (str): default: /var/run/nuster.pid +# Set to the full path of the pid file +# nuster_config (str): default: %%PREFIX%%/etc/nuster.conf +# Set to the full path of the config file +# nuster_flags (str): default: Autogenerated using pidfile and config options +# Set to override with your own options +# nuster_profiles (str): default: empty +# Set to space-separated list of profiles: for each profile separate nuster +# process will be spawned, with nuster-${profile}.conf config file. +# You can override default pidfile and config file for each profile with +# nuster_${profile}_config and nuster_${profile}_pidfile. + +. /etc/rc.subr + +name="nuster" +rcvar=nuster_enable +command="%%PREFIX%%/sbin/nuster" +extra_commands="reload configtest hardstop hardreload" +reload_cmd="nuster_reload" +hardreload_cmd="nuster_reload" +hardreload_precmd="def_hardreload_option" +stop_cmd="nuster_stop" +hardstop_cmd="nuster_stop" +hardstop_precmd="def_hardstop_signal" + +: ${nuster_enable:="NO"} +: ${nuster_config:="%%PREFIX%%/etc/${name}.conf"} +pidfile=${nuster_pidfile:-"/var/run/nuster.pid"} + +def_hardreload_option() +{ + reload_opt="-st" +} + +def_hardstop_signal() +{ + sig_stop="TERM" +} + +load_rc_config $name + +is_valid_profile() { + local profile + for profile in $nuster_profiles; do + if [ "$profile" = "$1" ]; then + return 0 + fi + done + return 1 +} + +if [ -n "$2" ]; then + profile=$2 + if ! is_valid_profile $profile; then + echo "$0: no such profile ($profile) defined in ${name}_profiles." + exit 1 + fi + eval nuster_config="\${nuster_${profile}_config:-%%PREFIX%%/etc/nuster-${profile}.conf}" + eval pidfile="\${nuster_${profile}_pidfile:-/var/run/nuster-${profile}.pid}" +else + if [ "x${nuster_profiles}" != "x" -a "x$1" != "x" ]; then + for profile in ${nuster_profiles}; do + echo "===> ${name} profile: ${profile}" + %%PREFIX%%/etc/rc.d/nuster $1 ${profile} + retcode="$?" + if [ ${retcode} -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + exit 0 + fi +fi + +: ${nuster_flags:="-q -f ${nuster_config} -p ${pidfile}"} +configtest_cmd="$command -c -f $nuster_config" +start_precmd="$command -q -c -f $nuster_config" +required_files=$nuster_config +sig_stop=SIGUSR1 +reload_opt="-sf" + +nuster_reload() +{ + ${command} -q -c -f ${nuster_config} + if [ $? -ne 0 ]; then + err 1 "Error found in ${nuster_config} - not reloading current process!" + fi + rc_pid=$(check_pidfile ${pidfile} ${command}) + if [ $rc_pid ]; then + ${command} ${nuster_flags} $reload_opt $(cat ${pidfile}) + else + _run_rc_notrunning + return 1 + fi +} + +nuster_stop() +{ + rc_pid=$(check_pidfile ${pidfile} ${command}) + if [ $rc_pid ]; then + rc_pid=$(cat ${pidfile}) + kill -$sig_stop $rc_pid + wait_for_pids $rc_pid + else + _run_rc_notrunning + return 1 + fi +} + +run_rc_command "$1" Added: head/net/nuster/files/patch-src_haproxy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/files/patch-src_haproxy.c Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,24 @@ +X-Git-Url: http://git.haproxy.org/?p=haproxy.git;a=blobdiff_plain;f=src%2Fhaproxy.c;h=30e850c4ac4719b71adccb3b6bd41248ef5bb470;hp=7af4ab479c761a43b2fa64d2124388dbf5c21fc3;hb=97148f60b8feec39b76768d1bcfab6d755c12164;hpb=0d00593361b91017b894c4c7d5e24721a7838d6e + +--- src/haproxy.c.orig 2018-02-05 02:24:58 UTC ++++ src/haproxy.c +@@ -2031,7 +2031,18 @@ int main(int argc, char **argv) + proc < LONGBITS && /* only the first 32/64 processes may be pinned */ + global.cpu_map[proc]) /* only do this if the process has a CPU map */ + #ifdef __FreeBSD__ +- cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(unsigned long), (void *)&global.cpu_map[proc]); ++ { ++ cpuset_t cpuset; ++ int i; ++ unsigned long cpu_map = global.cpu_map[proc]; ++ ++ CPU_ZERO(&cpuset); ++ while ((i = ffsl(cpu_map)) > 0) { ++ CPU_SET(i - 1, &cpuset); ++ cpu_map &= ~(1 << (i - 1)); ++ } ++ ret = cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, sizeof(cpuset), &cpuset); ++ } + #else + sched_setaffinity(0, sizeof(unsigned long), (void *)&global.cpu_map[proc]); + #endif Added: head/net/nuster/files/patch-src_ssl__sock.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/files/patch-src_ssl__sock.c Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,45 @@ +--- src/ssl_sock.c.orig 2017-07-07 09:49:34 UTC ++++ src/ssl_sock.c +@@ -794,8 +794,11 @@ static int ssl_sock_load_ocsp(SSL_CTX *c + ocsp = NULL; + + #ifndef SSL_CTX_get_tlsext_status_cb ++#ifndef SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB ++#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB 128 ++#endif + # define SSL_CTX_get_tlsext_status_cb(ctx, cb) \ +- *cb = (void (*) (void))ctx->tlsext_status_cb; ++ *cb = SSL_CTX_ctrl(ctx,SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB,0, (void (**)(void))cb) + #endif + SSL_CTX_get_tlsext_status_cb(ctx, &callback); + +@@ -823,7 +826,10 @@ static int ssl_sock_load_ocsp(SSL_CTX *c + int key_type; + EVP_PKEY *pkey; + +-#ifdef SSL_CTX_get_tlsext_status_arg ++#if defined(SSL_CTX_get_tlsext_status_arg) || defined(LIBRESSL_VERSION_NUMBER) ++#ifndef SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG ++#define SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG 129 ++#endif + SSL_CTX_ctrl(ctx, SSL_CTRL_GET_TLSEXT_STATUS_REQ_CB_ARG, 0, &cb_arg); + #else + cb_arg = ctx->tlsext_status_arg; +@@ -3539,7 +3545,7 @@ int ssl_sock_handshake(struct connection + OSSL_HANDSHAKE_STATE state = SSL_get_state((SSL *)conn->xprt_ctx); + empty_handshake = state == TLS_ST_BEFORE; + #else +- empty_handshake = !((SSL *)conn->xprt_ctx)->packet_length; ++ empty_handshake = SSL_state((SSL *)conn->xprt_ctx) == SSL_ST_BEFORE; + #endif + + if (empty_handshake) { +@@ -3617,7 +3623,7 @@ int ssl_sock_handshake(struct connection + state = SSL_get_state((SSL *)conn->xprt_ctx); + empty_handshake = state == TLS_ST_BEFORE; + #else +- empty_handshake = !((SSL *)conn->xprt_ctx)->packet_length; ++ empty_handshake = SSL_state((SSL *)conn->xprt_ctx) == SSL_ST_BEFORE; + #endif + if (empty_handshake) { + if (!errno) { Added: head/net/nuster/pkg-descr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/pkg-descr Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,6 @@ +Nuster is a simple yet powerful web caching proxy server based on HAProxy. It +is 100% compatible with HAProxy, and takes full advantage of the ACL +functionality of HAProxy to provide fine-grained caching policy based on the +content of request, response or server status. + +WWW: https://github.com/jiangwenyuan/nuster Added: head/net/nuster/pkg-plist ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/net/nuster/pkg-plist Thu Mar 22 18:05:24 2018 (r465301) @@ -0,0 +1,101 @@ +man/man1/nuster.1.gz +sbin/halog +sbin/nuster +%%PORTDOCS%%%%DOCSDIR%%/51Degrees-device-detection.txt +%%PORTDOCS%%%%DOCSDIR%%/DeviceAtlas-device-detection.txt +%%PORTDOCS%%%%DOCSDIR%%/SPOE.txt +%%PORTDOCS%%%%DOCSDIR%%/WURFL-device-detection.txt +%%PORTDOCS%%%%DOCSDIR%%/acl.fig +%%PORTDOCS%%%%DOCSDIR%%/architecture.txt +%%PORTDOCS%%%%DOCSDIR%%/close-options.txt +%%PORTDOCS%%%%DOCSDIR%%/coding-style.txt +%%PORTDOCS%%%%DOCSDIR%%/configuration.txt +%%PORTDOCS%%%%DOCSDIR%%/cookie-options.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/backends-v0.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/backends.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/be-fe-changes.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/binding-possibilities.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/buffer-redesign.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/buffers.fig +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/config-language.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/connection-reuse.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/connection-sharing.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/dynamic-buffers.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/entities-v2.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/how-it-works.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/http2.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/http_load_time.url +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/rate-shaping.txt +%%PORTDOCS%%%%DOCSDIR%%/design-thoughts/sess_par_sec.txt +%%PORTDOCS%%%%DOCSDIR%%/gpl.txt +%%PORTDOCS%%%%DOCSDIR%%/haproxy.1 +%%PORTDOCS%%%%DOCSDIR%%/internals/acl.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/body-parsing.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/buffer-operations.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/buffer-ops.fig +%%PORTDOCS%%%%DOCSDIR%%/internals/connect-status.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/connection-header.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/connection-scale.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/entities-v2.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/entities.fig +%%PORTDOCS%%%%DOCSDIR%%/internals/entities.pdf +%%PORTDOCS%%%%DOCSDIR%%/internals/entities.svg +%%PORTDOCS%%%%DOCSDIR%%/internals/entities.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/filters.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/hashing.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/header-parser-speed.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/header-tree.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/http-cookies.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/http-docs.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/http-parsing.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/list.fig +%%PORTDOCS%%%%DOCSDIR%%/internals/lua_socket.fig +%%PORTDOCS%%%%DOCSDIR%%/internals/lua_socket.pdf +%%PORTDOCS%%%%DOCSDIR%%/internals/naming.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/pattern.dia +%%PORTDOCS%%%%DOCSDIR%%/internals/pattern.pdf +%%PORTDOCS%%%%DOCSDIR%%/internals/polling-states.fig +%%PORTDOCS%%%%DOCSDIR%%/internals/repartition-be-fe-fi.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/sequence.fig +%%PORTDOCS%%%%DOCSDIR%%/internals/stats-v2.txt +%%PORTDOCS%%%%DOCSDIR%%/internals/stream-sock-states.fig +%%PORTDOCS%%%%DOCSDIR%%/intro.txt +%%PORTDOCS%%%%DOCSDIR%%/lgpl.txt +%%PORTDOCS%%%%DOCSDIR%%/linux-syn-cookies.txt +%%PORTDOCS%%%%DOCSDIR%%/lua-api/Makefile +%%PORTDOCS%%%%DOCSDIR%%/lua-api/_static/channel.fig +%%PORTDOCS%%%%DOCSDIR%%/lua-api/_static/channel.png +%%PORTDOCS%%%%DOCSDIR%%/lua-api/conf.py +%%PORTDOCS%%%%DOCSDIR%%/lua-api/index.rst +%%PORTDOCS%%%%DOCSDIR%%/lua.txt +%%PORTDOCS%%%%DOCSDIR%%/management.txt +%%PORTDOCS%%%%DOCSDIR%%/netscaler-client-ip-insertion-protocol.txt +%%PORTDOCS%%%%DOCSDIR%%/network-namespaces.txt +%%PORTDOCS%%%%DOCSDIR%%/proxy-protocol.txt +%%PORTDOCS%%%%DOCSDIR%%/queuing.fig +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/acl-content-sw.cfg +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/auth.cfg +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/check +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/check.conf +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/content-sw-sample.cfg +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/debug2ansi +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/debug2html +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/debugfind +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/400.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/403.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/408.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/500.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/502.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/503.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/504.http +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/errorfiles/README +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/haproxy.init +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/haproxy.spec +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/haproxy.vim +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/init.haproxy +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/option-http_proxy.cfg +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/seamless_reload.txt +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/ssl.cfg +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/stats_haproxy.sh +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/transparent_proxy.cfg +%%PORTEXAMPLES%%%%EXAMPLESDIR%%/wurfl-example.cfg
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803221805.w2MI5Onj022775>