summaryrefslogtreecommitdiff
path: root/community/dbmail
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-07-19 01:10:32 -0700
committerroot <root@rshg054.dnsready.net>2013-07-19 01:10:32 -0700
commit8fbc0076a4827ddc6af92e0b9daa4c4c31450808 (patch)
tree03fd0e2921ebd53228d9a93e32ed3976b636cbea /community/dbmail
parente445a313723389ba9ee1fded025c567dae5b21ea (diff)
Fri Jul 19 01:09:18 PDT 2013
Diffstat (limited to 'community/dbmail')
-rw-r--r--community/dbmail/PKGBUILD71
-rw-r--r--community/dbmail/dbmail-2.2.10-pam-support.patch251
-rw-r--r--community/dbmail/dbmail-imapd.service11
-rw-r--r--community/dbmail/dbmail-imapd.xinetd13
-rw-r--r--community/dbmail/dbmail-lmtpd.service11
-rw-r--r--community/dbmail/dbmail-lmtpd.xinetd13
-rw-r--r--community/dbmail/dbmail-pop3d.service11
-rw-r--r--community/dbmail/dbmail-pop3d.xinetd13
-rw-r--r--community/dbmail/dbmail-timsieved.service11
-rw-r--r--community/dbmail/dbmail-timsieved.xinetd15
-rw-r--r--community/dbmail/dbmail.tmpfiles1
11 files changed, 421 insertions, 0 deletions
diff --git a/community/dbmail/PKGBUILD b/community/dbmail/PKGBUILD
new file mode 100644
index 000000000..bfe8cfe44
--- /dev/null
+++ b/community/dbmail/PKGBUILD
@@ -0,0 +1,71 @@
+# $Id: PKGBUILD 93423 2013-07-03 11:48:53Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Sebastian Faltoni <sebastian.faltoni@gmail.com>
+
+pkgname=dbmail
+pkgver=3.0.3pre
+pkgrel=2
+pkgdesc="Fast and scalable sql based mail services"
+arch=('i686' 'x86_64')
+depends=('gmime24' 'libzdb' 'mhash' 'libevent')
+makedepends=('asciidoc' 'xmlto' 'docbook-xsl' 'docbook-xml' 'postgresql-libs>=8.4.1'
+ 'sqlite' 'libmysqlclient' 'libldap>=2.4.18' 'libsieve'
+ 'git')
+optdepends=('libldap: for LDAP authentication'
+ 'libsieve: for dbmail-sieve'
+ 'python2-mysql2pgsql: migrate from MySQL to PostreSQL')
+url="http://www.dbmail.org"
+license=('GPL')
+options=('!libtool' 'zipman')
+backup=(etc/xinetd.d/dbmail-imapd
+ etc/xinetd.d/dbmail-pop3d
+ etc/xinetd.d/dbmail-lmtpd
+ etc/xinetd.d/dbmail-timsieved)
+#source=(http://www.dbmail.org/download/3.0/dbmail-${pkgver/_/-}.tar.gz
+source=("$pkgname-$pkgver::git://git.subdir.eu/paul/dbmail#branch=dbmail_3_0"
+ dbmail.tmpfiles
+ dbmail-imapd.service
+ dbmail-lmtpd.service
+ dbmail-pop3d.service
+ dbmail-timsieved.service
+ dbmail-imapd.xinetd
+ dbmail-lmtpd.xinetd
+ dbmail-pop3d.xinetd
+ dbmail-timsieved.xinetd)
+md5sums=('SKIP'
+ 'c4b5793c5422b62a675d4c66ff7e9300'
+ '5a6297cb03c8d0b424f978ea1d7402de'
+ '070db88538af9833f003f4cb516d337b'
+ '422f0399f97a780b7cab84443e8f429a'
+ '15c7d367d4242aebac5f87649a2250aa'
+ '890de13361afbdf4fed12d6d7eb53e66'
+ '961593658cd596297d03d25eb9c9e98f'
+ '4cb764894abd3914802e90602bf90a0c'
+ 'e78dc86355f9aaf24590bc7c6611162f')
+
+build() {
+ cd $srcdir/dbmail-${pkgver/_/-}/
+ [ -f Makefile ] || ./configure --prefix=/usr --sbindir=/usr/bin \
+ --with-ldap --with-sieve
+ make
+}
+
+package() {
+ cd $srcdir/dbmail-${pkgver/_/-}/
+ make DESTDIR=$pkgdir install
+ (cd man && make && make install DESTDIR=$pkgdir)
+
+ mkdir $pkgdir/etc
+ install -Dm644 dbmail.conf $pkgdir/etc/dbmail.conf.sample
+ mkdir $pkgdir/usr/share/dbmail
+ cp -r sql/* $pkgdir/usr/share/dbmail/
+ cp -a contrib $pkgdir/usr/share/dbmail/
+ cp dbmail.schema $pkgdir/usr/share/dbmail/
+
+ for i in dbmail-imapd dbmail-lmtpd dbmail-pop3d dbmail-timsieved; do
+ install -Dm0644 $srcdir/$i.service $pkgdir/usr/lib/systemd/system/$i.service
+ install -Dm0644 $srcdir/$i.xinetd $pkgdir/etc/xinetd.d/$i
+ done
+
+ install -Dm0644 $srcdir/dbmail.tmpfiles $pkgdir/usr/lib/tmpfiles.d/dbmail.conf
+}
diff --git a/community/dbmail/dbmail-2.2.10-pam-support.patch b/community/dbmail/dbmail-2.2.10-pam-support.patch
new file mode 100644
index 000000000..805a7f609
--- /dev/null
+++ b/community/dbmail/dbmail-2.2.10-pam-support.patch
@@ -0,0 +1,251 @@
+diff -wbBur dbmail-2.2.10/configure.in dbmail-2.2.10.pam/configure.in
+--- dbmail-2.2.10/configure.in 2008-03-24 17:49:33.000000000 +0300
++++ dbmail-2.2.10.pam/configure.in 2008-09-18 16:43:04.000000000 +0400
+@@ -78,6 +78,13 @@
+
+ AC_SUBST(CRYPTLIB)
+
++dnl Check for PAM
++AC_SUBST(PAMLIBS,"")
++AC_CHECK_HEADERS(security/pam_appl.h,
++ [AC_CHECK_LIB(pam,pam_start,
++ [AC_DEFINE(HAVE_PAM,1,[Define if you have PAN including devel headers])
++ PAMLIBS="-lpam"],,)])
++
+ AC_SUBST(MYSQLLIB)
+ AC_SUBST(MYSQLALIB)
+ AC_SUBST(MYSQLLTLIB)
+diff -wbBur dbmail-2.2.10/dbmail-user.c dbmail-2.2.10.pam/dbmail-user.c
+--- dbmail-2.2.10/dbmail-user.c 2008-03-24 17:49:33.000000000 +0300
++++ dbmail-2.2.10.pam/dbmail-user.c 2008-09-18 16:43:04.000000000 +0400
+@@ -157,7 +157,7 @@
+ "md5", "md5-raw", "md5sum", "md5sum-raw",
+ "md5-hash", "md5-hash-raw", "md5-digest", "md5-digest-raw",
+ "md5-base64", "md5-base64-raw", "md5base64", "md5base64-raw",
+- "shadow", "", NULL
++ "shadow", "pam", "", NULL
+ };
+
+ /* These must correspond to the easy text names. */
+@@ -166,7 +166,7 @@
+ MD5_HASH, MD5_HASH_RAW, MD5_DIGEST, MD5_DIGEST_RAW,
+ MD5_HASH, MD5_HASH_RAW, MD5_DIGEST, MD5_DIGEST_RAW,
+ MD5_BASE64, MD5_BASE64_RAW, MD5_BASE64, MD5_BASE64_RAW,
+- SHADOW, PLAINTEXT, PWTYPE_NULL
++ SHADOW, PWTYPE_PAM, PLAINTEXT, PWTYPE_NULL
+ };
+
+ memset(pw, 0, 50);
+@@ -251,6 +251,12 @@
+ *enctype = "crypt";
+ }
+ break;
++#ifdef HAVE_PAM
++ case PWTYPE_PAM:
++ null_strncpy(pw, passwd, 49);
++ *enctype = "pam";
++ break;
++#endif
+ default:
+ qerrorf("Error: password type not supported [%s].\n",
+ passwdtype);
+diff -wbBur dbmail-2.2.10/dbmail-user.h dbmail-2.2.10.pam/dbmail-user.h
+--- dbmail-2.2.10/dbmail-user.h 2008-03-24 17:49:33.000000000 +0300
++++ dbmail-2.2.10.pam/dbmail-user.h 2008-09-18 16:43:04.000000000 +0400
+@@ -34,7 +34,7 @@
+ typedef enum {
+ PLAINTEXT = 0, PLAINTEXT_RAW, CRYPT, CRYPT_RAW,
+ MD5_HASH, MD5_HASH_RAW, MD5_DIGEST, MD5_DIGEST_RAW,
+- MD5_BASE64, MD5_BASE64_RAW, SHADOW, PWTYPE_NULL
++ MD5_BASE64, MD5_BASE64_RAW, SHADOW, PWTYPE_PAM, PWTYPE_NULL
+ } pwtype_t;
+
+ int mkpassword(const char * const user, const char * const passwd,
+diff -wbBur dbmail-2.2.10/modules/authsql.c dbmail-2.2.10.pam/modules/authsql.c
+--- dbmail-2.2.10/modules/authsql.c 2008-03-24 17:49:33.000000000 +0300
++++ dbmail-2.2.10.pam/modules/authsql.c 2008-09-18 16:43:04.000000000 +0400
+@@ -27,6 +27,19 @@
+ #include "dbmail.h"
+ #define THIS_MODULE "auth"
+
++#ifdef HAVE_PAM
++#include <security/pam_appl.h>
++
++#ifndef DEFAULT_DBMAIL_PAM_SERVICE
++#define DEFAULT_DBMAIL_PAM_SERVICE "dbmail"
++#endif
++
++#ifndef DEFAULT_DBMAIL_PAM_TTL
++#define DEFAULT_DBMAIL_PAM_TTL 60
++#endif
++
++#endif
++
+ extern db_param_t _db_params;
+ #define DBPFX _db_params.pfx
+
+@@ -49,17 +62,80 @@
+ */
+ static int __auth_query(const char *thequery);
+
++#ifdef HAVE_PAM
++
++static char *pam_password = NULL; /* Workaround for Solaris 2.6 brokenness */
++static pam_handle_t *pamh = NULL;
++static int pam_ttl = DEFAULT_DBMAIL_PAM_TTL;
++static char *pam_service = DEFAULT_DBMAIL_PAM_SERVICE;
++static time_t pamh_created = 0;
++/*
++ * A simple "conversation" function returning the supplied password.
++ * Has a bit to much error control, but this is my first PAM application
++ * so I'd rather check everything than make any mistakes. The function
++ * expects a single converstation message of type PAM_PROMPT_ECHO_OFF.
++ */
++static int
++password_conversation(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr)
++{
++ if (num_msg != 1 || msg[0]->msg_style != PAM_PROMPT_ECHO_OFF) {
++ TRACE(TRACE_ERROR, "Unexpected PAM converstaion '%d/%s'", msg[0]->msg_style, msg[0]->msg);
++ return PAM_CONV_ERR;
++ }
++ if (!appdata_ptr) {
++ /* Workaround for Solaris 2.6 where the PAM library is broken
++ * and does not pass appdata_ptr to the conversation routine
++ */
++ appdata_ptr = pam_password;
++ }
++ if (!appdata_ptr) {
++ TRACE(TRACE_ERROR, "ERROR: No password available to password_converstation!");
++ return PAM_CONV_ERR;
++ }
++ *resp = calloc(num_msg, sizeof(struct pam_response));
++ if (!*resp) {
++ TRACE(TRACE_ERROR, "Out of memory!");
++ return PAM_CONV_ERR;
++ }
++ (*resp)[0].resp = strdup((char *) appdata_ptr);
++ (*resp)[0].resp_retcode = 0;
++
++ return ((*resp)[0].resp ? PAM_SUCCESS : PAM_CONV_ERR);
++}
++
++static struct pam_conv conv =
++{
++ &password_conversation,
++ NULL
++};
++
++#endif
++
++
+ int auth_connect()
+ {
+ /* this function is only called after a connection has been made
+ * if, in the future this is not the case, db.h should export a
+ * function that enables checking for the database connection
+ */
++#ifdef HAVE_PAM
++
++#endif
+ return 0;
+ }
+
+ int auth_disconnect()
+ {
++#ifdef HAVE_PAM
++ int retval=PAM_SUCCESS;
++ if (pamh) {
++ retval = pam_end(pamh, retval);
++ if (retval != PAM_SUCCESS) {
++ pamh = NULL;
++ TRACE(TRACE_ERROR, "failed to release PAM authenticator");
++ }
++ }
++#endif
+ return 0;
+ }
+
+@@ -458,7 +534,71 @@
+ is_validated = (strncmp(md5str, query_result, 32) == 0) ? 1 : 0;
+ g_free(md5str);
+ }
++#ifdef HAVE_PAM
++ else if (strcasecmp(query_result, "pam") == 0) {
++ int retval=0;
++ TRACE(TRACE_DEBUG, "validating using pam for user [%s] pass:[%s]",real_username,password);
++ conv.appdata_ptr = (char *) password;
++ pam_password= password;
++ if (pam_ttl == 0) {
++ /* Create PAM connection */
++ retval = pam_start(pam_service, real_username, &conv, &pamh);
++ if (retval != PAM_SUCCESS) {
++ TRACE(TRACE_ERROR, "failed to create PAM authenticator");
++ goto pam_error;
++ }
++ } else if (!pamh || (time(NULL) - pamh_created) >= pam_ttl || pamh_created > time(NULL)) {
++ /* Close previous PAM connection */
++ if (pamh) {
++ retval = pam_end(pamh, retval);
++ if (retval != PAM_SUCCESS) {
++ TRACE(TRACE_WARNING, "failed to release PAM authenticator");
++ }
++ pamh = NULL;
++ }
++ /* Initialize persistent PAM connection */
++ retval = pam_start(pam_service, "dbmail@", &conv, &pamh);
++ if (retval != PAM_SUCCESS) {
++ TRACE(TRACE_ERROR, "failed to create PAM authenticator");
++ goto pam_error;
++ }
++ pamh_created = time(NULL);
++ }
++ retval = PAM_SUCCESS;
++ if (pam_ttl != 0) {
++ if (retval == PAM_SUCCESS)
++ retval = pam_set_item(pamh, PAM_USER, real_username);
++ if (retval == PAM_SUCCESS)
++ retval = pam_set_item(pamh, PAM_CONV, &conv);
++ }
++ if (retval == PAM_SUCCESS)
++ retval = pam_authenticate(pamh, 0);
++ if (retval == PAM_SUCCESS ) //&& !no_acct_mgmt
++ retval = pam_acct_mgmt(pamh, 0);
++ if (retval == PAM_SUCCESS) {
++ is_validated=1;
++ } else {
++pam_error:
++ is_validated=0;
++ }
++ /* cleanup */
++ retval = PAM_SUCCESS;
++#ifdef PAM_AUTHTOK
++ if (pam_ttl != 0) {
++ if (retval == PAM_SUCCESS)
++ retval = pam_set_item(pamh, PAM_AUTHTOK, NULL);
++ }
++#endif
++ if (pam_ttl == 0 || retval != PAM_SUCCESS) {
++ retval = pam_end(pamh, retval);
++ if (retval != PAM_SUCCESS) {
++ TRACE(TRACE_WARNING, "failed to release PAM authenticator\n");
++ }
++ pamh = NULL;
++ }
+
++ }
++#endif
+ if (is_validated) {
+ db_user_log_login(*user_idnr);
+ } else {
+diff -wbBur dbmail-2.2.10/modules/Makefile.am dbmail-2.2.10.pam/modules/Makefile.am
+--- dbmail-2.2.10/modules/Makefile.am 2008-03-24 17:49:33.000000000 +0300
++++ dbmail-2.2.10.pam/modules/Makefile.am 2008-09-18 16:44:53.000000000 +0400
+@@ -60,7 +60,7 @@
+
+ # This one is always built.
+ libauth_sql_la_SOURCES = authsql.c
+-libauth_sql_la_LIBADD = @CRYPTLIB@
++libauth_sql_la_LIBADD = @CRYPTLIB@ @PAMLIBS@
+
+ if LDAP
+ libauth_ldap_la_SOURCES = authldap.c
diff --git a/community/dbmail/dbmail-imapd.service b/community/dbmail/dbmail-imapd.service
new file mode 100644
index 000000000..bc3319fd0
--- /dev/null
+++ b/community/dbmail/dbmail-imapd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail Imap Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=/run/dbmail/dbmail-imapd.pid
+ExecStart=/usr/bin/dbmail-imapd -p /run/dbmail/dbmail-imapd.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/community/dbmail/dbmail-imapd.xinetd b/community/dbmail/dbmail-imapd.xinetd
new file mode 100644
index 000000000..20f7d607d
--- /dev/null
+++ b/community/dbmail/dbmail-imapd.xinetd
@@ -0,0 +1,13 @@
+service imap
+{
+ socket_type = stream
+ wait = no
+ user = nobody
+ server = /usr/bin/dbmail-imapd
+ protocol = tcp
+ server_args = -n
+ log_on_failure += USERID
+ disable = yes
+# env = EVENT_NOEPOLL=yes
+# instances = 200
+}
diff --git a/community/dbmail/dbmail-lmtpd.service b/community/dbmail/dbmail-lmtpd.service
new file mode 100644
index 000000000..570ba1ec7
--- /dev/null
+++ b/community/dbmail/dbmail-lmtpd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail LMTP Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=/run/dbmail/dbmail-lmtpd.pid
+ExecStart=/usr/bin/dbmail-lmtpd -p /run/dbmail/dbmail-lmtpd.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/community/dbmail/dbmail-lmtpd.xinetd b/community/dbmail/dbmail-lmtpd.xinetd
new file mode 100644
index 000000000..0a0e05620
--- /dev/null
+++ b/community/dbmail/dbmail-lmtpd.xinetd
@@ -0,0 +1,13 @@
+service lmtp
+{
+ port = 24
+ type = UNLISTED
+ socket_type = stream
+ wait = no
+ user = nobody
+ server = /usr/bin/dbmail-lmtpd
+ protocol = tcp
+ server_args = -n
+ log_on_failure += USERID
+ disable = yes
+}
diff --git a/community/dbmail/dbmail-pop3d.service b/community/dbmail/dbmail-pop3d.service
new file mode 100644
index 000000000..edfa2570a
--- /dev/null
+++ b/community/dbmail/dbmail-pop3d.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail pop3 Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=/run/dbmail/dbmail-pop3d.pid
+ExecStart=/usr/bin/dbmail-pop3d -p /run/dbmail/dbmail-pop3d.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/community/dbmail/dbmail-pop3d.xinetd b/community/dbmail/dbmail-pop3d.xinetd
new file mode 100644
index 000000000..f073aca8b
--- /dev/null
+++ b/community/dbmail/dbmail-pop3d.xinetd
@@ -0,0 +1,13 @@
+service pop3
+{
+ socket_type = stream
+ wait = no
+ user = nobody
+ server = /usr/bin/dbmail-pop3d
+ protocol = tcp
+ server_args = -n
+ log_on_failure += USERID
+ disable = yes
+# env = EVENT_NOEPOLL=yes
+# instances = 200
+}
diff --git a/community/dbmail/dbmail-timsieved.service b/community/dbmail/dbmail-timsieved.service
new file mode 100644
index 000000000..32623e038
--- /dev/null
+++ b/community/dbmail/dbmail-timsieved.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=DBMail Sieve Server
+After=syslog.target network.target mysqld.service postgresql.service
+
+[Service]
+Type=forking
+PIDFile=/run/dbmail/dbmail-timsieved.pid
+ExecStart=/usr/bin/dbmail-timsieved -p /run/dbmail/dbmail-timsieved.pid
+
+[Install]
+WantedBy=multi-user.target
diff --git a/community/dbmail/dbmail-timsieved.xinetd b/community/dbmail/dbmail-timsieved.xinetd
new file mode 100644
index 000000000..69f6dd66b
--- /dev/null
+++ b/community/dbmail/dbmail-timsieved.xinetd
@@ -0,0 +1,15 @@
+service sieve
+{
+# port = 2000
+# type = UNLISTED
+ socket_type = stream
+ wait = no
+ user = nobody
+ server = /usr/bin/dbmail-timsieved
+ protocol = tcp
+ server_args = -n
+ log_on_failure += USERID
+ disable = yes
+# env = EVENT_NOEPOLL=yes
+# instances = 200
+}
diff --git a/community/dbmail/dbmail.tmpfiles b/community/dbmail/dbmail.tmpfiles
new file mode 100644
index 000000000..4b97c91f5
--- /dev/null
+++ b/community/dbmail/dbmail.tmpfiles
@@ -0,0 +1 @@
+d /run/dbmail 0755 nobody nobody -