diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-18 14:36:50 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-05-18 14:36:50 +0000 |
commit | 3beca4265af9bc5d5370a0474b6374cf743ae76d (patch) | |
tree | b2e618a26ed0a7179b335a45c5b260e50a67ca1a | |
parent | 68abd577ab4695c04d76c458bf5b0988d8258754 (diff) | |
download | alpine_aports-3beca4265af9bc5d5370a0474b6374cf743ae76d.tar.bz2 alpine_aports-3beca4265af9bc5d5370a0474b6374cf743ae76d.tar.xz alpine_aports-3beca4265af9bc5d5370a0474b6374cf743ae76d.zip |
extra/gross: new aport
Greylisting of suspicious sources
http://code.google.com/p/gross/
-rw-r--r-- | extra/gross/APKBUILD | 54 | ||||
-rw-r--r-- | extra/gross/gross-1.0.1-configure.ac.patch | 20 | ||||
-rw-r--r-- | extra/gross/gross-1.0.1-default-conf.patch | 17 | ||||
-rw-r--r-- | extra/gross/gross-1.0.1-user.patch | 72 | ||||
-rw-r--r-- | extra/gross/gross.confd | 6 | ||||
-rw-r--r-- | extra/gross/gross.initd | 35 | ||||
-rw-r--r-- | extra/gross/gross.post-install | 2 | ||||
-rw-r--r-- | extra/gross/gross.pre-install | 3 |
8 files changed, 209 insertions, 0 deletions
diff --git a/extra/gross/APKBUILD b/extra/gross/APKBUILD new file mode 100644 index 0000000000..986c0eb913 --- /dev/null +++ b/extra/gross/APKBUILD | |||
@@ -0,0 +1,54 @@ | |||
1 | # Contributor: Carlo Landmeter <clandmeter@gmail.com> | ||
2 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> | ||
3 | pkgname=gross | ||
4 | pkgver=1.0.1 | ||
5 | pkgrel=0 | ||
6 | pkgdesc="Greylisting of suspicious sources" | ||
7 | url="http://code.google.com/p/gross/" | ||
8 | license="BSD" | ||
9 | depends="uclibc c-ares" | ||
10 | makedepends="c-ares-dev autoconf automake libtool sed" | ||
11 | install="$pkgname.pre-install $pkgname.post-install" | ||
12 | subpackages="$pkgname-doc $pkgname-dev" | ||
13 | source="http://gross.googlecode.com/files/$pkgname-$pkgver.tar.gz | ||
14 | $pkgname.initd | ||
15 | $pkgname.confd | ||
16 | gross-1.0.1-configure.ac.patch | ||
17 | gross-1.0.1-default-conf.patch | ||
18 | gross-1.0.1-user.patch | ||
19 | $install" | ||
20 | |||
21 | build() { | ||
22 | cd "$srcdir/$pkgname-$pkgver" | ||
23 | |||
24 | for _i in ../*.patch; do | ||
25 | msg "Applying $_i..." | ||
26 | patch -p1 < $_i || return 1 | ||
27 | done | ||
28 | msg "Running autotools..." | ||
29 | aclocal --force && autoconf && automake --add-missing \ | ||
30 | && libtoolize --force --copy || return 1 | ||
31 | |||
32 | export lt_SED='/bin/sed' | ||
33 | export lt_cv_path_SED='/bin/sed' | ||
34 | ./configure --prefix=/usr \ | ||
35 | --sysconfdir=/etc \ | ||
36 | --mandir=/usr/share/man \ | ||
37 | --infodir=/usr/share/info | ||
38 | |||
39 | make -j1 || return 1 | ||
40 | make -j1 DESTDIR="$pkgdir" install | ||
41 | |||
42 | install -dD "$pkgdir"/var/run/gross | ||
43 | install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/gross | ||
44 | install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/gross | ||
45 | } | ||
46 | |||
47 | md5sums="f8f81b36850dcda30cb81799b9cee3b6 gross-1.0.1.tar.gz | ||
48 | 37b83bd0d94f66c733d5562c0327b70f gross.initd | ||
49 | 5ca1c6e51c3243236e6564480b20279b gross.confd | ||
50 | bb75b119ac96b8f99831ce6df810003f gross-1.0.1-configure.ac.patch | ||
51 | 7c504b653c71dcf7b192bc487b3516fd gross-1.0.1-default-conf.patch | ||
52 | 16e184d59d520db565388f010cc75e83 gross-1.0.1-user.patch | ||
53 | 4b55d1c5534167946cc11376d1b05c34 gross.post-install | ||
54 | 8f6e45b98888dbb9971f7681bf431f6f gross.pre-install" | ||
diff --git a/extra/gross/gross-1.0.1-configure.ac.patch b/extra/gross/gross-1.0.1-configure.ac.patch new file mode 100644 index 0000000000..80f9ea7762 --- /dev/null +++ b/extra/gross/gross-1.0.1-configure.ac.patch | |||
@@ -0,0 +1,20 @@ | |||
1 | --- a/configure.ac.orig 2008-05-29 16:18:56 +0000 | ||
2 | +++ b/configure.ac 2008-05-30 09:10:48 +0000 | ||
3 | @@ -52,7 +52,7 @@ | ||
4 | then | ||
5 | AC_DEFINE([USE_SEM_OPEN], [], [Use sem_open() instead of sem_init()]) | ||
6 | else | ||
7 | - AC_SEARCH_LIBS(sem_init, [rt], , | ||
8 | + AC_SEARCH_LIBS(sem_init, [rt pthread], , | ||
9 | AC_MSG_ERROR([Can't compile without semaphores.]) | ||
10 | ) | ||
11 | fi | ||
12 | @@ -101,7 +101,7 @@ | ||
13 | AC_MSG_CHECKING([whether to disable dnsbl checking]) | ||
14 | AC_ARG_ENABLE(dnsbl, | ||
15 | AC_HELP_STRING([--disable-dnsbl], [Disable dnsbl checking]), | ||
16 | - [AC_MSG_RESULT([yes]) ; dnsbl="no"], | ||
17 | + [AC_MSG_RESULT([yes]) ; dnsbl="$enableval"], | ||
18 | [AC_MSG_RESULT([no]) ; dnsbl="yes"] | ||
19 | ) | ||
20 | |||
diff --git a/extra/gross/gross-1.0.1-default-conf.patch b/extra/gross/gross-1.0.1-default-conf.patch new file mode 100644 index 0000000000..39cd90709d --- /dev/null +++ b/extra/gross/gross-1.0.1-default-conf.patch | |||
@@ -0,0 +1,17 @@ | |||
1 | diff -ru gross-1.0.1.orig/doc/examples/grossd.conf gross-1.0.1/doc/examples/grossd.conf | ||
2 | --- gross-1.0.1.orig/doc/examples/grossd.conf 2008-06-03 09:27:37 +0000 | ||
3 | +++ gross-1.0.1/doc/examples/grossd.conf 2008-06-03 09:31:33 +0000 | ||
4 | @@ -71,11 +71,13 @@ | ||
5 | # 'statefile' is the full path of the file that the server will use to | ||
6 | # store the state information. | ||
7 | # statefile = /var/db/grossd.state | ||
8 | +statefile = /var/db/gross/state | ||
9 | |||
10 | # 'pidfile' is the full path of the file grossd writes its pid into. | ||
11 | # You can set parameter 'check', if you want to keep grossd | ||
12 | # from starting if pidfile already exists. | ||
13 | # pidfile = /var/run/grossd.pid;check | ||
14 | +pidfile = /var/run/gross/grossd.pid | ||
15 | |||
16 | # 'log_method' is used to list all the possible logging facilities. | ||
17 | # currently only syslog is implemented | ||
diff --git a/extra/gross/gross-1.0.1-user.patch b/extra/gross/gross-1.0.1-user.patch new file mode 100644 index 0000000000..a20279f003 --- /dev/null +++ b/extra/gross/gross-1.0.1-user.patch | |||
@@ -0,0 +1,72 @@ | |||
1 | Index: src/gross.c | ||
2 | =================================================================== | ||
3 | --- a/src/gross.c (revision 491) | ||
4 | +++ b/src/gross.c (working copy) | ||
5 | @@ -553,7 +553,7 @@ | ||
6 | void | ||
7 | usage(void) | ||
8 | { | ||
9 | - printf("Usage: grossd [-CDdhnPprV] [-f configfile]\n"); | ||
10 | + printf("Usage: grossd [-CDdhnPpruV] [-f configfile]\n"); | ||
11 | printf(" -C create statefile and exit\n"); | ||
12 | printf(" -D Enable debug logging (insane verbosity with -DD)\n"); | ||
13 | printf(" -d Run grossd as a foreground process\n"); | ||
14 | @@ -563,6 +563,7 @@ | ||
15 | printf(" -p file write the process id in a pidfile\n"); | ||
16 | printf(" -P file same as -p, but pid file must not exist\n"); | ||
17 | printf(" -r disable replication\n"); | ||
18 | + printf(" -u user run gross as user\n"); | ||
19 | printf(" -V version information\n"); | ||
20 | exit(EXIT_USAGE); | ||
21 | } | ||
22 | @@ -612,6 +613,7 @@ | ||
23 | pool_limits_t limits; | ||
24 | sigset_t mask, oldmask; | ||
25 | struct passwd *pwd; | ||
26 | + char *user = "nobody"; | ||
27 | |||
28 | #ifdef DNSBL | ||
29 | dns_check_info_t *dns_check_info; | ||
30 | @@ -623,7 +625,7 @@ | ||
31 | daemon_shutdown(EXIT_FATAL, "Couldn't initialize context"); | ||
32 | |||
33 | /* command line arguments */ | ||
34 | - while ((c = getopt(argc, argv, ":drf:VCDnp:P:")) != -1) { | ||
35 | + while ((c = getopt(argc, argv, ":drf:VCDnp:P:u:")) != -1) { | ||
36 | switch (c) { | ||
37 | case 'd': | ||
38 | ctx->config.flags |= FLG_NODAEMON; | ||
39 | @@ -663,6 +665,9 @@ | ||
40 | ctx->config.flags |= FLG_CHECK_PIDFILE; | ||
41 | ctx->config.flags |= FLG_CREATE_PIDFILE; | ||
42 | break; | ||
43 | + case 'u': | ||
44 | + user = optarg; | ||
45 | + break; | ||
46 | case 'h': | ||
47 | usage(); | ||
48 | break; | ||
49 | @@ -675,16 +680,16 @@ | ||
50 | |||
51 | /* grossd doesn't need to be running as root */ | ||
52 | if (geteuid() == 0) { | ||
53 | - logstr(GLOG_DEBUG, "Running as root: setuid() to 'nobody'"); | ||
54 | - pwd = getpwnam("nobody"); | ||
55 | + logstr(GLOG_DEBUG, "Running as root: setuid() to '%s'", user); | ||
56 | + pwd = getpwnam(user); | ||
57 | if (NULL == pwd) | ||
58 | - daemon_shutdown(EXIT_FATAL, "Running as root: can't find user 'nobody'"); | ||
59 | + daemon_shutdown(EXIT_FATAL, "Running as root: can't find user '%s'", user); | ||
60 | if (setgid(pwd->pw_gid) != 0) | ||
61 | - daemon_shutdown(EXIT_FATAL, "Running as root: can't setgid(%d) to 'nobody': %s", | ||
62 | - pwd->pw_gid, strerror(errno)); | ||
63 | + daemon_shutdown(EXIT_FATAL, "Running as root: can't setgid(%d) to '%s': %s", | ||
64 | + pwd->pw_gid, user, strerror(errno)); | ||
65 | if (setuid(pwd->pw_uid) != 0) | ||
66 | - daemon_shutdown(EXIT_FATAL, "Running as root: can't setuid(%d) to 'nobody': %s", | ||
67 | - pwd->pw_uid, strerror(errno)); | ||
68 | + daemon_shutdown(EXIT_FATAL, "Running as root: can't setuid(%d) to '%s': %s", | ||
69 | + pwd->pw_uid, user, strerror(errno)); | ||
70 | } | ||
71 | |||
72 | config = default_config(); | ||
diff --git a/extra/gross/gross.confd b/extra/gross/gross.confd new file mode 100644 index 0000000000..646e12f9d7 --- /dev/null +++ b/extra/gross/gross.confd | |||
@@ -0,0 +1,6 @@ | |||
1 | # | ||
2 | # Specify daemon $OPTS here. | ||
3 | # | ||
4 | |||
5 | OPTS="" | ||
6 | |||
diff --git a/extra/gross/gross.initd b/extra/gross/gross.initd new file mode 100644 index 0000000000..c67293e17f --- /dev/null +++ b/extra/gross/gross.initd | |||
@@ -0,0 +1,35 @@ | |||
1 | #!/sbin/runscript | ||
2 | |||
3 | NAME="grossd" | ||
4 | DAEMON="/usr/sbin/$NAME" | ||
5 | USER="gross" | ||
6 | GROUP="gross" | ||
7 | |||
8 | depend() { | ||
9 | need net | ||
10 | } | ||
11 | |||
12 | check_config() { | ||
13 | if [ ! -f /var/db/gross/state ] ; then | ||
14 | einfo "Generating Gross database..." | ||
15 | install -dD -o${USER} -g${GROUP} /var/db/gross | ||
16 | ${DAEMON} -Cu ${USER} > /dev/null | ||
17 | fi | ||
18 | } | ||
19 | |||
20 | start() { | ||
21 | check_config || return 1 | ||
22 | ebegin "Starting ${NAME}" | ||
23 | start-stop-daemon --start --quiet --background \ | ||
24 | --exec ${DAEMON} -- \ | ||
25 | -p /var/run/gross/grossd.pid \ | ||
26 | -u ${USER} ${OPTS} | ||
27 | eend $? | ||
28 | } | ||
29 | |||
30 | stop() { | ||
31 | ebegin "Stopping ${NAME}" | ||
32 | start-stop-daemon --stop --pidfile /var/run/gross/grossd.pid | ||
33 | eend $? | ||
34 | } | ||
35 | |||
diff --git a/extra/gross/gross.post-install b/extra/gross/gross.post-install new file mode 100644 index 0000000000..df06670a41 --- /dev/null +++ b/extra/gross/gross.post-install | |||
@@ -0,0 +1,2 @@ | |||
1 | #!/bin/sh | ||
2 | chown -R gross:gross /var/run/gross | ||
diff --git a/extra/gross/gross.pre-install b/extra/gross/gross.pre-install new file mode 100644 index 0000000000..c3844d7a5e --- /dev/null +++ b/extra/gross/gross.pre-install | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | adduser -H -s /bin/false -D gross 2>/dev/null | ||
3 | exit 0 | ||