summaryrefslogtreecommitdiff
path: root/community/pound
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /community/pound
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'community/pound')
-rw-r--r--community/pound/ChangeLog22
-rw-r--r--community/pound/PKGBUILD41
-rw-r--r--community/pound/pound-2.5-openssl.patch290
-rw-r--r--community/pound/pound.cfg85
-rwxr-xr-xcommunity/pound/pound.init38
-rwxr-xr-xcommunity/pound/pound.runit24
6 files changed, 500 insertions, 0 deletions
diff --git a/community/pound/ChangeLog b/community/pound/ChangeLog
new file mode 100644
index 000000000..1a9677113
--- /dev/null
+++ b/community/pound/ChangeLog
@@ -0,0 +1,22 @@
+
+2009-03-22 Douglas Soares de Andrade <douglas@archlinux.org>
+
+ * Updated for i686: 2.4.4
+ * Fixed an issue with the rc.d pound script
+
+2008-06-22 Mateusz Herych <heniekk@gmail.com>
+
+ * Adding for x86_64 community - 2.4.3
+
+2008-06-22 Douglas Soares de Andrade <dsa@aur.archlinux.org>
+
+ * Adding for i686 community - 2.4.3
+
+2008-05-22 Mateusz Herych <heniekk@gmail.com>
+
+ * Adding to community for x86_64
+
+2008-05-21 Douglas Soares de Andrade <dsa@aur.archlinux.org>
+
+ * Adding to community for i686
+
diff --git a/community/pound/PKGBUILD b/community/pound/PKGBUILD
new file mode 100644
index 000000000..02d82fec0
--- /dev/null
+++ b/community/pound/PKGBUILD
@@ -0,0 +1,41 @@
+# $Id: PKGBUILD 24210 2010-08-23 09:28:35Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Maintainer: Douglas Soares de Andrade <dsa@aur.archlinux.org>
+# Contributor: Roberto Alsina <ralsina@kde.org>
+
+pkgname=pound
+pkgver=2.5
+pkgrel=2
+pkgdesc="A reverse proxy, load balancer, and SSL wrapper"
+arch=('i686' 'x86_64')
+url="http://www.apsis.ch/pound/index_html"
+license=('GPL')
+depends=('pcre' 'openssl')
+backup=(etc/pound/pound.cfg)
+source=(http://www.apsis.ch/pound/Pound-$pkgver.tgz
+ pound.init
+ pound.runit
+ pound.cfg
+ pound-2.5-openssl.patch)
+md5sums=('8a39f5902094619afcda7d12d9d8342c'
+ '4df8548f106fca08323e8e4071beaa43'
+ '716cc0bf334b594751bece24c7d1df2d'
+ '8937808acd22c6391ebe4340af8df854'
+ 'c2c48dc395ffc045f9d35394992292d0')
+
+build() {
+ cd $srcdir/Pound-$pkgver
+ # Patch to build against OpenSSL 1.0.0 (Thanks Fedora!)
+ patch -p1 -i $srcdir/pound-2.5-openssl.patch || return 1
+ ./configure --prefix=/usr --sysconfdir=/etc/pound
+ make || return 1
+ install -d $pkgdir/usr/sbin
+ make DESTDIR=$pkgdir install || return 1
+ chown root.root -R $pkgdir/usr
+ install -d $pkgdir/etc/rc.d
+ install -m0755 $srcdir/pound.init $pkgdir/etc/rc.d/pound
+ install -d $pkgdir/etc/sv
+ install -d $pkgdir/etc/sv/pound
+ install -m0755 $srcdir/pound.runit $pkgdir/etc/sv/pound/run
+ install -D -m0644 $srcdir/pound.cfg $pkgdir/etc/pound/pound.cfg
+}
diff --git a/community/pound/pound-2.5-openssl.patch b/community/pound/pound-2.5-openssl.patch
new file mode 100644
index 000000000..efefd5487
--- /dev/null
+++ b/community/pound/pound-2.5-openssl.patch
@@ -0,0 +1,290 @@
+diff -up Pound-2.5/config.c.openssl Pound-2.5/config.c
+--- Pound-2.5/config.c.openssl 2010-02-10 12:23:09.000000000 +0100
++++ Pound-2.5/config.c 2010-02-10 12:23:07.000000000 +0100
+@@ -431,14 +431,22 @@ t_hash(const TABNODE *e)
+ res = (res ^ *k++) * 16777619;
+ return res;
+ }
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++static IMPLEMENT_LHASH_HASH_FN(t, TABNODE)
++#else
+ static IMPLEMENT_LHASH_HASH_FN(t_hash, const TABNODE *)
++#endif
+
+ static int
+ t_cmp(const TABNODE *d1, const TABNODE *d2)
+ {
+ return strcmp(d1->key, d2->key);
+ }
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++static IMPLEMENT_LHASH_COMP_FN(t, TABNODE)
++#else
+ static IMPLEMENT_LHASH_COMP_FN(t_cmp, const TABNODE *)
++#endif
+
+ /*
+ * parse a service
+@@ -460,7 +468,11 @@ parse_service(const char *svc_name)
+ pthread_mutex_init(&res->mut, NULL);
+ if(svc_name)
+ strncpy(res->name, svc_name, KEY_SIZE);
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ if((res->sessions = LHM_lh_new(TABNODE, t)) == NULL)
++#else
+ if((res->sessions = lh_new(LHASH_HASH_FN(t_hash), LHASH_COMP_FN(t_cmp))) == NULL)
++#endif
+ conf_err("lh_new failed - aborted");
+ ign_case = ignore_case;
+ while(conf_fgets(lin, MAXBUF)) {
+diff -up Pound-2.5/pound.h.openssl Pound-2.5/pound.h
+--- Pound-2.5/pound.h.openssl 2010-02-02 12:49:02.000000000 +0100
++++ Pound-2.5/pound.h 2010-02-10 12:15:18.000000000 +0100
+@@ -322,6 +322,10 @@ typedef struct _tn {
+ /* maximal session key size */
+ #define KEY_SIZE 127
+
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++DECLARE_LHASH_OF(TABNODE);
++#endif
++
+ /* service definition */
+ typedef struct _service {
+ char name[KEY_SIZE + 1]; /* symbolic name */
+@@ -337,7 +341,11 @@ typedef struct _service {
+ int sess_ttl; /* session time-to-live */
+ regex_t sess_start; /* pattern to identify the session data */
+ regex_t sess_pat; /* pattern to match the session data */
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ LHASH_OF(TABNODE) *sessions; /* currently active sessions */
++#else
+ LHASH *sessions; /* currently active sessions */
++#endif
+ int dynscale; /* true if the back-ends should be dynamically rescaled */
+ int disabled; /* true if the service is disabled */
+ struct _service *next;
+diff -up Pound-2.5/svc.c.openssl Pound-2.5/svc.c
+--- Pound-2.5/svc.c.openssl 2010-02-02 12:49:02.000000000 +0100
++++ Pound-2.5/svc.c 2010-02-10 12:13:29.000000000 +0100
+@@ -27,12 +27,17 @@
+
+ #include "pound.h"
+
++#ifndef LHASH_OF
++#define LHASH_OF(x) LHASH
++#define CHECKED_LHASH_OF(type, h) h
++#endif
++
+ /*
+ * Add a new key/content pair to a hash table
+ * the table should be already locked
+ */
+ static void
+-t_add(LHASH *const tab, const char *key, const void *content, const size_t cont_len)
++t_add(LHASH_OF(TABNODE) *const tab, const char *key, const void *content, const size_t cont_len)
+ {
+ TABNODE *t, *old;
+
+@@ -53,7 +58,11 @@ t_add(LHASH *const tab, const char *key,
+ }
+ memcpy(t->content, content, cont_len);
+ t->last_acc = time(NULL);
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ if((old = LHM_lh_insert(TABNODE, tab, t)) != NULL) {
++#else
+ if((old = (TABNODE *)lh_insert(tab, t)) != NULL) {
++#endif
+ free(old->key);
+ free(old->content);
+ free(old);
+@@ -68,12 +77,16 @@ t_add(LHASH *const tab, const char *key,
+ * side-effect: update the time of last access
+ */
+ static void *
+-t_find(LHASH *const tab, char *const key)
++t_find(LHASH_OF(TABNODE) *const tab, char *const key)
+ {
+ TABNODE t, *res;
+
+ t.key = key;
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ if((res = LHM_lh_retrieve(TABNODE, tab, &t)) != NULL) {
++#else
+ if((res = (TABNODE *)lh_retrieve(tab, &t)) != NULL) {
++#endif
+ res->last_acc = time(NULL);
+ return res->content;
+ }
+@@ -84,12 +97,16 @@ t_find(LHASH *const tab, char *const key
+ * Delete a key
+ */
+ static void
+-t_remove(LHASH *const tab, char *const key)
++t_remove(LHASH_OF(TABNODE) *const tab, char *const key)
+ {
+ TABNODE t, *res;
+
+ t.key = key;
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ if((res = LHM_lh_delete(TABNODE, tab, &t)) != NULL) {
++#else
+ if((res = (TABNODE *)lh_delete(tab, &t)) != NULL) {
++#endif
+ free(res->key);
+ free(res->content);
+ free(res);
+@@ -98,59 +115,75 @@ t_remove(LHASH *const tab, char *const k
+ }
+
+ typedef struct {
+- LHASH *tab;
++ LHASH_OF(TABNODE) *tab;
+ time_t lim;
+ void *content;
+ int cont_len;
+ } ALL_ARG;
+
+ static void
+-t_old(TABNODE *t, void *arg)
++t_old_doall_arg(TABNODE *t, ALL_ARG *a)
+ {
+- ALL_ARG *a;
+-
+- a = (ALL_ARG *)arg;
+ if(t->last_acc < a->lim)
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ LHM_lh_delete(TABNODE, a->tab, t);
++#else
+ lh_delete(a->tab, t);
++#endif
+ return;
+ }
+-IMPLEMENT_LHASH_DOALL_ARG_FN(t_old, TABNODE *, void *)
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++IMPLEMENT_LHASH_DOALL_ARG_FN(t_old, TABNODE, ALL_ARG)
++#else
++#define t_old t_old_doall_arg
++IMPLEMENT_LHASH_DOALL_ARG_FN(t_old, TABNODE *, ALL_ARG *)
++#endif
+
+ /*
+ * Expire all old nodes
+ */
+ static void
+-t_expire(LHASH *const tab, const time_t lim)
++t_expire(LHASH_OF(TABNODE) *const tab, const time_t lim)
+ {
+ ALL_ARG a;
+ int down_load;
+
+ a.tab = tab;
+ a.lim = lim;
+- down_load = tab->down_load;
+- tab->down_load = 0;
++ down_load = CHECKED_LHASH_OF(TABNODE, tab)->down_load;
++ CHECKED_LHASH_OF(TABNODE, tab)->down_load = 0;
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ LHM_lh_doall_arg(TABNODE, tab, LHASH_DOALL_ARG_FN(t_old), ALL_ARG, &a);
++#else
+ lh_doall_arg(tab, LHASH_DOALL_ARG_FN(t_old), &a);
+- tab->down_load = down_load;
++#endif
++ CHECKED_LHASH_OF(TABNODE, tab)->down_load = down_load;
+ return;
+ }
+
+ static void
+-t_cont(TABNODE *t, void *arg)
++t_cont_doall_arg(TABNODE *t, ALL_ARG *a)
+ {
+- ALL_ARG *a;
+-
+- a = (ALL_ARG *)arg;
+ if(memcmp(t->content, a->content, a->cont_len) == 0)
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ LHM_lh_delete(TABNODE, a->tab, t);
++#else
+ lh_delete(a->tab, t);
++#endif
+ return;
+ }
+-IMPLEMENT_LHASH_DOALL_ARG_FN(t_cont, TABNODE *, void *)
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++IMPLEMENT_LHASH_DOALL_ARG_FN(t_cont, TABNODE, ALL_ARG)
++#else
++#define t_cont t_cont_doall_arg
++IMPLEMENT_LHASH_DOALL_ARG_FN(t_cont, TABNODE *, ALL_ARG *)
++#endif
+
+ /*
+ * Remove all nodes with the given content
+ */
+ static void
+-t_clean(LHASH *const tab, void *const content, const size_t cont_len)
++t_clean(LHASH_OF(TABNODE) *const tab, void *const content, const size_t cont_len)
+ {
+ ALL_ARG a;
+ int down_load;
+@@ -158,10 +191,14 @@ t_clean(LHASH *const tab, void *const co
+ a.tab = tab;
+ a.content = content;
+ a.cont_len = cont_len;
+- down_load = tab->down_load;
+- tab->down_load = 0;
++ down_load = CHECKED_LHASH_OF(TABNODE, tab)->down_load;
++ CHECKED_LHASH_OF(TABNODE, tab)->down_load = 0;
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ LHM_lh_doall_arg(TABNODE, tab, LHASH_DOALL_ARG_FN(t_cont), ALL_ARG, &a);
++#else
+ lh_doall_arg(tab, LHASH_DOALL_ARG_FN(t_cont), &a);
+- tab->down_load = down_load;
++#endif
++ CHECKED_LHASH_OF(TABNODE, tab)->down_load = down_load;
+ return;
+ }
+
+@@ -1410,13 +1447,11 @@ typedef struct {
+ } DUMP_ARG;
+
+ static void
+-t_dump(TABNODE *t, void *arg)
++t_dump_doall_arg(TABNODE *t, DUMP_ARG *a)
+ {
+- DUMP_ARG *a;
+ BACKEND *be, *bep;
+ int n_be, sz;
+
+- a = (DUMP_ARG *)arg;
+ memcpy(&bep, t->content, sizeof(bep));
+ for(n_be = 0, be = a->backends; be; be = be->next, n_be++)
+ if(be == bep)
+@@ -1432,19 +1467,28 @@ t_dump(TABNODE *t, void *arg)
+ return;
+ }
+
+-IMPLEMENT_LHASH_DOALL_ARG_FN(t_dump, TABNODE *, void *)
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++IMPLEMENT_LHASH_DOALL_ARG_FN(t_dump, TABNODE, DUMP_ARG)
++#else
++#define t_dump t_dump_doall_arg
++IMPLEMENT_LHASH_DOALL_ARG_FN(t_dump, TABNODE *, DUMP_ARG *)
++#endif
+
+ /*
+ * write sessions to the control socket
+ */
+ static void
+-dump_sess(const int control_sock, LHASH *const sess, BACKEND *const backends)
++dump_sess(const int control_sock, LHASH_OF(TABNODE) *const sess, BACKEND *const backends)
+ {
+ DUMP_ARG a;
+
+ a.control_sock = control_sock;
+ a.backends = backends;
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++ LHM_lh_doall_arg(TABNODE, sess, LHASH_DOALL_ARG_FN(t_dump), DUMP_ARG, &a);
++#else
+ lh_doall_arg(sess, LHASH_DOALL_ARG_FN(t_dump), &a);
++#endif
+ return;
+ }
+
diff --git a/community/pound/pound.cfg b/community/pound/pound.cfg
new file mode 100644
index 000000000..fda8a07f4
--- /dev/null
+++ b/community/pound/pound.cfg
@@ -0,0 +1,85 @@
+###############################################################################
+## Pound configration file
+###############################################################################
+##
+##
+## GLOBAL SETTINGS
+##
+## Specify the user and group Pound will run as.
+#User "http"
+#Group "http"
+##
+## Specify the directory that Pound will chroot to at runtime.
+#RootJail "/"
+##
+## Have Pound run in the foreground (if 0) or as a daemon (if 1).
+#Daemon 1
+##
+## Specify the log facility to use.
+#LogFacility daemon
+##
+## Specify the logging level.
+#LogLevel 1
+##
+## Ignore case when matching URLs.
+#IgnoreCase 0
+##
+## Enable or disable the dynamic rescaling code.
+#DynScale 0
+##
+## Specify how often Pound will check for resurected back-end hosts.
+#Alive 30
+##
+## Specify for how long Pound will wait for a client request.
+#Client 10
+##
+## How long should Pound wait for a response from the back-end.
+#TimeOut 15
+##
+## How long should Pound wait for a connection to the back-end.
+#ConnTO 15
+##
+## How long should Pound continue to answer interrupted connections.
+#Grace 30
+##
+## Use an OpenSSL hardware acceleration card.
+#SSLEngine "name"
+##
+## Set the control socket path.
+#Control "/tmp/poundctl.socket"
+##
+##
+## LISTENERS
+##
+## Configure services and backends for the HTTP reverse proxy.
+#ListenHTTP
+# Address 10.0.0.1
+# Port 80
+# Service
+# BackEnd
+# Address 127.0.0.1
+# Port 8080
+# End
+# BackEnd
+# Address 127.0.0.1
+# Port 8081
+# End
+# End
+#End
+##
+## Configure services and backends for the HTTPS reverse proxy.
+#ListenHTTPS
+# Address 10.0.0.1
+# Port 443
+# Cert "/etc/ssl/certs/pound.pem"
+# Service
+# BackEnd
+# Address 127.0.0.1
+# Port 8080
+# End
+# BackEnd
+# Address 127.0.0.1
+# Port 8081
+# End
+# End
+#End
diff --git a/community/pound/pound.init b/community/pound/pound.init
new file mode 100755
index 000000000..369d6626d
--- /dev/null
+++ b/community/pound/pound.init
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting Pound"
+ /usr/sbin/pound -f /etc/pound/pound.cfg -p /var/run/pound.pid &
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon pound
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Pound"
+ [ -f /var/run/pound.pid ] && kill `cat /var/run/pound.pid`
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm -f /var/run/pound.pid
+ rm_daemon pound
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/community/pound/pound.runit b/community/pound/pound.runit
new file mode 100755
index 000000000..2e0be991e
--- /dev/null
+++ b/community/pound/pound.runit
@@ -0,0 +1,24 @@
+#!/bin/sh
+exec 2>&1
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+BIN=/usr/sbin/pound
+OPTS="-f /etc/pound/pound.cfg -p /var/run/pound.pid"
+SVC=pound
+
+PID=`pidof $BIN`
+if [ -z "$PID" ]
+then
+ if [ -f /var/run/$SVC.pid ]
+ then
+ rm /var/run/$SVC.pid
+ rm_daemon $SVC
+ fi
+ echo "Starting $SVC daemon"
+ $BIN $OPTS
+else
+ [ -z $PID ] || exec watchpid $PID
+fi
+