Skip to content

Instantly share code, notes, and snippets.

@ashb
Created April 29, 2013 22:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashb/5485262 to your computer and use it in GitHub Desktop.
Save ashb/5485262 to your computer and use it in GitHub Desktop.
ITERATION = 04ash
dovecot:
apt-get install libssl-dev libmysqlclient-dev
./configure --with-mysql --with-ssl=openssl --with-sql=plugin --with-ioloop=best --disable-rpath --disable-static --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info/ --with-moduledir=/usr/lib/dovecot/modules
make install DESTDIR=/tmp/installdir
fpm -s dir -t deb -n dovecot -v 2.0.14 --iteration $ITERATION -C /tmp/installdir/ -p dovecot-VERSION_ARCH.deb -d "libmysqlclient16" -d "libc6 (>= 2.11.1)" -d "libssl0.9.8" -x dovecot-config etc usr/bin usr/sbin usr/lib usr/share/doc usr/share/man
fpm -s dir -t deb -n dovecot-dev -v 2.0.14 --iteration $ITERATION -C /tmp/installdir/ -d "dovecot (>= 2.0.14-01ash)" usr/lib/dovecot/dovecot-config usr/include usr/share/aclocal
dovecot-pigeonhole:
# With the above -dev pacakge installed
./configure --disable-static --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info/
make install DESTDIR=/tmp/installdir
fpm -s dir -t deb -n deovecot-pigeonhole -v 0.2.3 --iteration $(ITERATION) -C /tmp/installdir/ -x usr/include -d "dovecot (>= 2.0.14-01ash)"
dovecot-antispam-plugin:
./autogen.sh -n
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info/
make all install DESTDIR=/tmp/installdir
fpm -s dir -t deb -n deovecot-antispam -v 2.0-43880985e3dd --iteration $(ITERATION) -C /tmp/installdir/ -d "dovecot (>= 2.0.14-01ash)"
dspam:
apt-cache policy libmysqlclient-dev | grep -qF '***'
./configure --prefix=/usr --sysconfdir=/etc/dspam --localstatedir=/var --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info/ --enable-virtual-users --enable-static --enable-domain-scale --with-storage-driver=mysql_drv,mysql_drv --with-mysql-includes=/usr/include/mysql --with-mysql-libraries=/usr/lib/mysql --enable-daemon --enable-virtual-users --enable-syslog --with-logdir=/var/log/dspam --with-dspam-home=/var/spool/dspam --enable-split-configuration --enable-preferences-extension --enable-debug
# Apply debian patches here
@echo "$$dspam_patch_003_diff" | patch -p1
@echo "$$dspam_patch_008_diff" | patch -p1
@echo "$$dspam_patch_010_diff" | patch -p1
make all install DESTDIR=/tmp/installdir
mkdir -p /tmp/installdir/usr/share/dbconfig-common/data/libdspam7-drv-mysql
cat src/tools.mysql_drv/mysql_objects-4.1.sql > /tmp/installdir/usr/share/dbconfig-common/data/libdspam7-drv-mysql/install
cat src/tools.mysql_drv/virtual_users.sql >> /tmp/installdir/usr/share/dbconfig-common/data/libdspam7-drv-mysql/install
@echo "$$dspam_postinst" >> postinst
fpm -s dir -t deb -n dspam -v 3.10.1 --iteration $(ITERATION) -C /tmp/installdir -d "libmysqlclient16" -x usr/lib/pkgconfig -x usr/include -x css* --post-install postinst
fpm -s dir -t deb -n dspam-dev -v 3.10.1 --iteration $(ITERATION) -C /tmp/installdir -d "dpsam (>= 3.10.1)" usr/lib/pkgconfig usr/include
rm postinst
dcc:
./configure --bindir=/usr/bin --mandir=/usr/share/man/ --libexecdir=/usr/lib/dcc --disable-dccm
make
make install -n BINDIR=/tmp/installdir/usr/bin MANDIR=/tmp/installdir/usr/share/man/ DCC_BINDIR=/tmp/installdir/usr/lib/dcc CGI_BIN=/tmp/installdir/var/dcc/cgi-bin HD=/tmp/installdir/var/dcc
fpm -s dir -t deb -n dcc -v 1.3.140 --iteration 04ash -C /tmp/installdir/
# Patches and other file litterals for packages
define dspam_postinst
#!/bin/sh
set -e
case "$$1" in
configure)
if [ -z "`getent group dspam`" ]; then
addgroup --quiet --system dspam
adduser --quiet --system --ingroup dspam --home /var/spool/dspam \
--no-create-home --disabled-password \
--gecos 'DSPAM' dspam
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
endef
export dspam_postinst
define dspam_patch_003_diff
Description: Debian default configuration
Author: Debian DSPAM Maintainers <pkg-dspam-misc@lists.alioth.debian.org>
Forwarded: not-needed
--- a/src/dspam.conf.in
+++ b/src/dspam.conf.in
@@ -19,7 +19,7 @@
#
# Options include:
#
-# libmysql_drv.so libpgsql_drv.so libsqlite_drv.so
+# libmysql_drv.so libpgsql_drv.so
# libsqlite3_drv.so libhash_drv.so
#
# IMPORTANT: Switching storage drivers requires more than merely changing
@@ -143,11 +143,10 @@
#
Trust root
Trust dspam
-Trust apache
+Trust www-data
Trust mail
-Trust mailnull
-Trust smmsp
Trust daemon
+Trust amavis
#Trust nobody
#Trust majordomo
@@ -286,7 +285,7 @@
# defaults.
#
Preference "trainingMode=TEFT" # { TOE | TUM | TEFT | NOTRAIN } -> default:teft
-Preference "spamAction=quarantine" # { quarantine | tag | deliver } -> default:quarantine
+Preference "spamAction=tag" # { quarantine | tag | deliver } -> default:quarantine
Preference "spamSubject=[SPAM]" # { string } -> default:[SPAM]
Preference "statisticalSedation=5" # { 0 - 10 } -> default:0
Preference "enableBNR=on" # { on | off } -> default:off
@@ -346,19 +345,19 @@
# Storage driver settings: Specific to a particular storage driver. Uncomment
# the configuration specific to your installation, if applicable.
#
-#MySQLServer /var/lib/mysql/mysql.sock
-#MySQLPort
-#MySQLUser dspam
-#MySQLPass changeme
-#MySQLDb dspam
-#MySQLCompress true
-#MySQLReconnect true
+MySQLServer /var/run/mysqld/mysqld.sock
+#MySQLPort 3306
+MySQLUser _DBC_DBUSER_
+MySQLPass _DBC_DBPASS_
+MySQLDb _DBC_DBNAME_
+MySQLCompress true
+MySQLReconnect true
# If you are using replication for clustering, you can also specify a separate
# server to perform all writes to.
#
-#MySQLWriteServer /var/lib/mysql/mysql.sock
-#MySQLWritePort
+#MySQLWriteServer /var/run/mysqld/mysqld.sock
+#MySQLWritePort 3306
#MySQLWriteUser dspam
#MySQLWritePass changeme
#MySQLWriteDb dspam_write
@@ -405,11 +404,11 @@
# in /var/run/postgresql/.s.PGSQL.5432 specify just the path where the socket
# resits (without .s.PGSQL.5432).
-#PgSQLServer /var/run/postgresql/
-#PgSQLPort
-#PgSQLUser dspam
-#PgSQLPass changeme
-#PgSQLDb dspam
+PgSQLServer 127.0.0.1
+PgSQLPort 5432
+PgSQLUser _DBC_DBUSER_
+PgSQLPass _DBC_DBPASS_
+PgSQLDb _DBC_DBNAME_
# If you're running DSPAM in client/server (daemon) mode, uncomment the
# setting below to override the default connection cache size (the number
@@ -803,7 +802,7 @@
#ServerHost 127.0.0.1
#ServerPort 24
#ServerQueueSize 32
-#ServerPID /var/run/dspam.pid
+#ServerPID /var/run/dspam/dspam.pid
#
# ServerMode specifies the type of LMTP server to start. This can be one of:
@@ -839,14 +838,14 @@
# you are running the client and server on the same machine, as it eliminates
# much of the bandwidth overhead.
#
-#ServerDomainSocketPath "/tmp/dspam.sock"
+#ServerDomainSocketPath "/var/run/dspam/dspam.sock"
#
# Client Mode: If you are running DSPAM in client/server mode, uncomment and
# set these variables. A ClientHost beginning with a / will be treated as
# a domain socket.
#
-#ClientHost /tmp/dspam.sock
+#ClientHost /var/run/dspam/dspam.sock
#ClientIdent "secret@Relay1"
#
#ClientHost 127.0.0.1
@@ -900,7 +899,7 @@
# --- Split Configuration File Support ---
# Include a directory with configuration items.
-#Include /etc/dspam/dspam.d/
+Include /etc/dspam/dspam.d/
# --- ---
endef
export dspam_patch_003_diff
define dspam_patch_008_diff
Description: txt files are installed in /etc/dspam/txt
Author: Debian DSPAM Maintainers <pkg-dspam-misc@lists.alioth.debian.org>
Forwarded: not-needed
--- a/src/dspam.c
+++ b/src/dspam.c
@@ -1538,7 +1538,7 @@
time(&now);
- snprintf(msgfile, sizeof(msgfile), "%s/txt/%s", _ds_read_attribute(agent_config, "Home"), filename);
+ snprintf(msgfile, sizeof(msgfile), "/etc/dspam/txt/%s", filename);
f = fopen(msgfile, "r");
if (!f) {
LOG(LOG_ERR, ERR_IO_FILE_OPEN, filename, strerror(errno));
endef
export dspam_patch_008_diff
define dspam_patch_010_diff
Description: Debian default port is set to 2424 as dspam daemon is run by an
unpriviledge user
Author: Debian DSPAM Maintainers <pkg-dspam-misc@lists.alioth.debian.org>
Forwarded: not-needed
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -98,7 +98,7 @@
int domain = 0; /* listening on domain socket? */
int listener; /* listener fd */
int i;
- int port = 24, queue = 32; /* default port and queue size */
+ int port = 2424, queue = 32; /* default port and queue size */
signal(SIGPIPE, SIG_IGN);
signal(SIGINT, process_signal);
--- a/src/dspam.conf.in
+++ b/src/dspam.conf.in
@@ -68,7 +68,7 @@
# the syntax: DeliveryHost.domain.com 1.2.3.4
#
#DeliveryHost 127.0.0.1
-#DeliveryPort 24
+#DeliveryPort 2424
#DeliveryIdent localhost
#DeliveryProto LMTP
@@ -799,8 +799,12 @@
# ServerHost: Not enabling ServerHost will bind DSPAM server to all available
# interfaces.
#
+# ServerPort: Default upstream configuration is to run dspam daemon on port
+# 24. On Debian, dspam being run as a unprivileged user, default port is
+# set to 2424.
+#
#ServerHost 127.0.0.1
-#ServerPort 24
+#ServerPort 2424
#ServerQueueSize 32
#ServerPID /var/run/dspam/dspam.pid
@@ -849,7 +853,7 @@
#ClientIdent "secret@Relay1"
#
#ClientHost 127.0.0.1
-#ClientPort 24
+#ClientPort 2424
#ClientIdent "secret@Relay1"
# --- RABL ---
endef
export dspam_patch_010_diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment