From 2ba22903f8b3219d9e0bd0abdf2e42db9a1ef834 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Sun, 10 May 2009 12:04:57 +0000 Subject: netqmail with outgoingip patch --- mail-mta/netqmail/Manifest | 36 ++ mail-mta/netqmail/files/1.06-exit.patch | 18 + mail-mta/netqmail/files/99qmail | 4 + mail-mta/netqmail/files/conf-common | 67 +++ mail-mta/netqmail/files/conf-pop3d | 29 ++ mail-mta/netqmail/files/conf-qmqpd | 15 + mail-mta/netqmail/files/conf-qmtpd | 18 + mail-mta/netqmail/files/conf-send | 6 + mail-mta/netqmail/files/conf-smtpd | 51 +++ mail-mta/netqmail/files/dot-qmail | 3 + mail-mta/netqmail/files/mailer.conf | 6 + mail-mta/netqmail/files/mkservercert | 55 +++ mail-mta/netqmail/files/outgoingip.patch | 192 +++++++++ mail-mta/netqmail/files/qmail-config-system | 72 ++++ mail-mta/netqmail/files/qmail-genrsacert.sh | 44 ++ mail-mta/netqmail/files/run-qmail-pop3d | 19 + mail-mta/netqmail/files/run-qmail-pop3d-log | 7 + mail-mta/netqmail/files/run-qmail-qmqpd | 18 + mail-mta/netqmail/files/run-qmail-qmqpd-log | 7 + mail-mta/netqmail/files/run-qmail-qmtpd | 18 + mail-mta/netqmail/files/run-qmail-qmtpd-log | 7 + mail-mta/netqmail/files/run-qmail-send | 6 + mail-mta/netqmail/files/run-qmail-send-log | 7 + mail-mta/netqmail/files/run-qmail-smtpd | 18 + mail-mta/netqmail/files/run-qmail-smtpd-log | 7 + mail-mta/netqmail/files/servercert.cnf | 35 ++ mail-mta/netqmail/files/tcp.pop3.sample | 12 + mail-mta/netqmail/files/tcp.qmqp.sample | 14 + mail-mta/netqmail/files/tcp.qmtp.sample | 23 + mail-mta/netqmail/files/tcp.smtp.sample | 79 ++++ mail-mta/netqmail/files/tcprules.d-Makefile.qmail | 3 + mail-mta/netqmail/metadata.xml | 5 + mail-mta/netqmail/netqmail-1.05-r9.ebuild | 485 ++++++++++++++++++++++ 33 files changed, 1386 insertions(+) create mode 100644 mail-mta/netqmail/Manifest create mode 100644 mail-mta/netqmail/files/1.06-exit.patch create mode 100644 mail-mta/netqmail/files/99qmail create mode 100644 mail-mta/netqmail/files/conf-common create mode 100644 mail-mta/netqmail/files/conf-pop3d create mode 100644 mail-mta/netqmail/files/conf-qmqpd create mode 100644 mail-mta/netqmail/files/conf-qmtpd create mode 100644 mail-mta/netqmail/files/conf-send create mode 100644 mail-mta/netqmail/files/conf-smtpd create mode 100644 mail-mta/netqmail/files/dot-qmail create mode 100644 mail-mta/netqmail/files/mailer.conf create mode 100644 mail-mta/netqmail/files/mkservercert create mode 100644 mail-mta/netqmail/files/outgoingip.patch create mode 100644 mail-mta/netqmail/files/qmail-config-system create mode 100644 mail-mta/netqmail/files/qmail-genrsacert.sh create mode 100644 mail-mta/netqmail/files/run-qmail-pop3d create mode 100644 mail-mta/netqmail/files/run-qmail-pop3d-log create mode 100644 mail-mta/netqmail/files/run-qmail-qmqpd create mode 100644 mail-mta/netqmail/files/run-qmail-qmqpd-log create mode 100644 mail-mta/netqmail/files/run-qmail-qmtpd create mode 100644 mail-mta/netqmail/files/run-qmail-qmtpd-log create mode 100644 mail-mta/netqmail/files/run-qmail-send create mode 100644 mail-mta/netqmail/files/run-qmail-send-log create mode 100644 mail-mta/netqmail/files/run-qmail-smtpd create mode 100644 mail-mta/netqmail/files/run-qmail-smtpd-log create mode 100644 mail-mta/netqmail/files/servercert.cnf create mode 100644 mail-mta/netqmail/files/tcp.pop3.sample create mode 100644 mail-mta/netqmail/files/tcp.qmqp.sample create mode 100644 mail-mta/netqmail/files/tcp.qmtp.sample create mode 100644 mail-mta/netqmail/files/tcp.smtp.sample create mode 100644 mail-mta/netqmail/files/tcprules.d-Makefile.qmail create mode 100644 mail-mta/netqmail/metadata.xml create mode 100644 mail-mta/netqmail/netqmail-1.05-r9.ebuild (limited to 'mail-mta') diff --git a/mail-mta/netqmail/Manifest b/mail-mta/netqmail/Manifest new file mode 100644 index 0000000..28440ce --- /dev/null +++ b/mail-mta/netqmail/Manifest @@ -0,0 +1,36 @@ +AUX 1.06-exit.patch 551 RMD160 4e37d5e052d949ce682691141a835e209de302a5 SHA1 9de0b915ab9bda742aabece4288538e4ff6b00c9 SHA256 400ab4719d145e29b08d266b38766b80d894d5473e4c4f3b5e436916a36a4333 +AUX 99qmail 137 RMD160 bb1d8b76562c60df05b1e10811d479ca24fdad48 SHA1 d370193dd2be29226fecd399c3bef93aec0011b8 SHA256 b721c405ab3a13803c4647b98a3c0ffbdfb450e4a0f9e5476c1633470b0d6e50 +AUX conf-common 2375 RMD160 d91ae642ba445e73232339f83e6664a2b311ec47 SHA1 49fed2319b8a91651f185a68832045d8be053beb SHA256 c51efbf910e000659ce38c0fa6c1647bad966a9e53a3a3f58d5049c7fec4c126 +AUX conf-pop3d 1205 RMD160 041ee68f4681a963550ea7a96600236057ba5df6 SHA1 36f2e571d0c8a6c2880753df574993c68fed0b28 SHA256 92100277f9858cd65711fcae9662ef72d40a769b84f2ed9814e2062102836d76 +AUX conf-qmqpd 463 RMD160 0270dc1ae6e9ca18b9ed1451d24207a780f22d8f SHA1 3e7e86de8e5f19395fb2ce0182be81a91fd00e53 SHA256 98ffb06e09db4329cbfb722446e18e9a127c4043b93cbbd9406cdf2c9841f381 +AUX conf-qmtpd 555 RMD160 f8dd25475f07d8396a9685a4c9f33f945be98c85 SHA1 59e81f927121054e96552fe67e7869603a51279b SHA256 c46f2d4f0819f87a6f2e49d6d3499381f2aab36edd116a2ee20bd14cb0cb64d6 +AUX conf-send 233 RMD160 acf0cb4879d20408d71db0cde93145b4bc7c3967 SHA1 f86e974d85bf3044412117ff2765d76d8f114bf1 SHA256 c4fcf9e1d82a2bcc95e943aa5f81c91cc14813c1bd9a55aec62b9e2506c50af6 +AUX conf-smtpd 2069 RMD160 cb39b3486e2b7626bdfca047909b0a77a028acb7 SHA1 3a6b104d10c2437f90e0fc3a9f4ebd5ff82653f0 SHA256 b887d8d903f5a6c809fdf2ac548d7e7ba3fd2975a94c189fb0940a3c8872c966 +AUX dot-qmail 82 RMD160 0576de46f687b2c9041fd48948a050ae82f2242e SHA1 ebdeb1c03a30654d7a7fae06cc4c9f53694905c8 SHA256 ceed2e098092a550d66778241149439871f5518ff2c71dc53ce05308b1a63a06 +AUX mailer.conf 179 RMD160 32cee87ccbf2e090d04977e7bbdb87cb705feba6 SHA1 eca04dd1f6309442e8e41380f331fdcfe70529e7 SHA256 7f248612dc9bb4ca3f901d6a50b4ffb452deb1eb543da33bca89ed776c95cf23 +AUX mkservercert 1444 RMD160 54a43b148a4f75e9f98a4748d89f641dfbc5bf4d SHA1 f2a1dfcd4951c7d1986d905ae2fe48c5131f793b SHA256 17d5f1f6122b9ef2b31af1b5d2c259601168cd1b09b75645dca634486f799d04 +AUX outgoingip.patch 6839 RMD160 032c653d395e5f599c0998e92debb09d84f90f0f SHA1 c37b50facc72f82cad6505d2db88d5eccc5418b2 SHA256 c117f5c41033f062cdc782a16403fc19725e98d92e73ab193dfd24f48c0ca5ac +AUX qmail-config-system 2085 RMD160 5365264148b8fe5bf7a04e645fd3dadfa2fc3ae8 SHA1 1f4f39e90955cf8ab23745d86da4f5d06c84a910 SHA256 d77a3b498ac2fd88f839edf7b725208446dafa54a396113ffdfbd77d9e34ac38 +AUX qmail-genrsacert.sh 1483 RMD160 eeaa4122136a149b0738a55df2bf0b0d6e405ba0 SHA1 ec85ff476e7503abf0d7dc8d403ea966636accd5 SHA256 8887a6ad9f288ffe3240a50bb6fc4d188799afd15d28ce5018d0f9e2a346a748 +AUX run-qmail-pop3d 909 RMD160 c5b6af7e31f2e4446a03a7fb41c17a89f74b8302 SHA1 5d581799f712be34ebcc02f435ce3bedb9f7eb92 SHA256 1362b1c5e1125b70841992728eacc8fe14dc0e29c9198967c6c9a970ff0c1b27 +AUX run-qmail-pop3d-log 322 RMD160 c8e371e4585d33250b8d0833d36ab31e3ef65688 SHA1 0e458d129b8030aed0fccb60b141ecf32018dbe6 SHA256 894ccd51aedffd6ac9dfc1dfd1d1d23ea23793557aa16313cb241fc2c3394ad9 +AUX run-qmail-qmqpd 839 RMD160 ebc3c76fc86224642afb15703b812378ba6e03e3 SHA1 9913ce5267fb7f97740385d35910aba4202d6162 SHA256 d368c3f6ff85f41b537da19fbc4d0a5889f497c3e7f31687ee710406d8f235de +AUX run-qmail-qmqpd-log 322 RMD160 59e26864d1f0d91338c9185a4e6a9f2461f1c1c1 SHA1 f1bd6525c5679a39b3d010cbd0b0e661897826e6 SHA256 f13b40db98ef633bf9f1d6796f47826744c62ead62ead3d31eeb31f7a22e4d5e +AUX run-qmail-qmtpd 839 RMD160 e8c1f2f65f170ec3524b511e726ebd3897cf7132 SHA1 36c167b090c08ee11c265a5b6f67d2090ebb5347 SHA256 8fc04dfe3e5e1ffb1beef4790d087222f84404a29dcf4e3203707bd764e386cd +AUX run-qmail-qmtpd-log 322 RMD160 02fbe88335d775c42f1f00e8b922cce31bf6d341 SHA1 3dbdac8a5b29127ee9136ad51448ae0958822cba SHA256 b98e8e112823458eb006bfb9543ea884410e27a97be0a240ad110ab1d4d72e52 +AUX run-qmail-send 267 RMD160 93757b9d1a1b971a0531a44e9ed2fd7109eb0720 SHA1 40e05e7d4e2ffae531983b4694c5a328144f8c93 SHA256 03c1cadb582d9810064a848424caf9fd35590260ca517dc1447d3722174aca07 +AUX run-qmail-send-log 321 RMD160 0c2b9316973fc0e63d98d1b97e94ce18569a3809 SHA1 c23e371d7ea4564fa8c453222a80f1a5891f6ddb SHA256 3977df622fae12b1f4f0fbd9695ccfdfc0063882d6d76fb2b2678351c60713ab +AUX run-qmail-smtpd 839 RMD160 47cb9d50f5dc0654ddd6a4d4244e2e3a562a03e4 SHA1 a4443a249a710ed44a9cd6cc2a38b24dc2ecbbc2 SHA256 fda1d42ad010acb316694ce6827286b3daf7bac248ced93847e97cece8ffb12f +AUX run-qmail-smtpd-log 322 RMD160 975ca41bd0eb61174ad73278ec20b8527e69fb3f SHA1 8681da6f035f6222d2407e3f52c2d10291cc2d37 SHA256 c213418ca663ef28260e982f4250d0906ac3ca7991e8380b46b96ff48277cb8c +AUX servercert.cnf 1008 RMD160 63f70e9dbc23be7609bf5a5ba5c72c0592d42cad SHA1 8244dd421b47073a7483b70cab139f9e5e600993 SHA256 da0282f96e6dfd886d565c0793975ef0f1114cd59c2f8e310b7b3e7c57d8330c +AUX tcp.pop3.sample 517 RMD160 a518f0ac6c03a546ae032613d6aef6a298290419 SHA1 86ca8c304d18b4959c491b74e444eb28227f0381 SHA256 3f04ad47c10e7466ea9bd18b38bd809066734fb9616858bf75bb95e18e28253c +AUX tcp.qmqp.sample 571 RMD160 1c8b66938e2d803a3d302f53e8046cc754153d49 SHA1 c6309da68b65db411a7243d635e18719f8070ce3 SHA256 17dc778b0ad88b42f3f15f2bc94d3448b65bd5f436c5f21a92d0012be827cecc +AUX tcp.qmtp.sample 994 RMD160 54cff0d4a0355e6a043388c95d5c3320e70116ed SHA1 55e890e28b00171be406469fd25e65ea6c7d78b0 SHA256 d5c63cdb489a4675c58d13cd3dd977b874bffcada17861eae149960cb394932c +AUX tcp.smtp.sample 3582 RMD160 ee13640487ce1660969ea53760ec86eb12083887 SHA1 e629f07c1e19a1448a8dbc76a180e81a099ce372 SHA256 93a85748d29a997a208c557d059682cfac74bc532cd5efc561afdc02b2925d10 +AUX tcprules.d-Makefile.qmail 132 RMD160 275cf670b111f0673be05c5bb6362943af34e1f2 SHA1 176f82b43e224b8d8aae22bc9bb458b263d17325 SHA256 505e202a5a28a036669e51d3fb51d3c02a3a35d76764c5e3f4fa0c43564a89d6 +DIST big-todo.103.patch 5546 RMD160 a16a429796d869b8217e42b7ddb607c95d9bbcd8 SHA1 ba5c3923ff972a4f3ddd5ae1519938a4716612d1 SHA256 afa0a249e3271badd442f0bdae39997d9fe536157d8a0d62b6706f3dfcd11a72 +DIST netqmail-1.05-tls-smtpauth-20070417.patch 67942 RMD160 81a00e06fa67a4073b1a5bf5195fbbac675cd46b SHA1 d24cb13cf1371044fc2dfe20471478f59b5524e5 SHA256 573de07d57ac6941a42dda645079213cf36fcbb7f3a8c254b8447709e5e5cd60 +DIST netqmail-1.05.tar.gz 252264 RMD160 e5bd8557c58a2686233449254b146e74389a7652 SHA1 fe4cbe97bd2f18a5ca1b36e4fbbd6c524256a829 SHA256 59788abf252e2da224542c1c8b727311335c61d990f24f4edf28f6eb5483f676 +DIST qmail-spp-0.42.tar.gz 18689 RMD160 5511722c52346692488a63bca53106d580a004c7 SHA1 76a94051b017dd331d8c791e466bb2a936ceba41 SHA256 1518e7e82d10fbbb8ecc520f51daf503edeb9c3a9fb935be65a8185e7b53808d +EBUILD netqmail-1.05-r9.ebuild 13697 RMD160 4a5e5333105ed69f33c964dd0d7e48d4ce2b255b SHA1 c067d656a46bff6afcea6748c67dea9d8dff1d68 SHA256 6696f1b95f37a94d5462863a6e69db21aef55bfa6d33bab727e8f424a2c4c3db +MISC metadata.xml 159 RMD160 aa4ad961079c26af99cc726320fc79401e65ea9a SHA1 35fb9f5820b650eb060f5c4ece62c60de1bab0e9 SHA256 b0c15ada9b1606aa2ff9da86e0b7f0bbcd31f202958e29b4d862bf81a1a374e7 diff --git a/mail-mta/netqmail/files/1.06-exit.patch b/mail-mta/netqmail/files/1.06-exit.patch new file mode 100644 index 0000000..e0e7dea --- /dev/null +++ b/mail-mta/netqmail/files/1.06-exit.patch @@ -0,0 +1,18 @@ +Index: netqmail-1.06/qmail-pw2u.c +=================================================================== +--- netqmail-1.06.orig/qmail-pw2u.c ++++ netqmail-1.06/qmail-pw2u.c +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include "substdio.h" +Index: netqmail-1.06/qmail-qmtpd.c +=================================================================== +--- netqmail-1.06.orig/qmail-qmtpd.c ++++ netqmail-1.06/qmail-qmtpd.c +@@ -1,3 +1,4 @@ ++#include + #include "stralloc.h" + #include "substdio.h" + #include "qmail.h" diff --git a/mail-mta/netqmail/files/99qmail b/mail-mta/netqmail/files/99qmail new file mode 100644 index 0000000..d9d929e --- /dev/null +++ b/mail-mta/netqmail/files/99qmail @@ -0,0 +1,4 @@ +PATH="/var/qmail/bin" +ROOTPATH="/var/qmail/bin" +CONFIG_PROTECT="/var/qmail/control /var/qmail/alias" +QMAIL_CONTROLDIR=/var/qmail/control diff --git a/mail-mta/netqmail/files/conf-common b/mail-mta/netqmail/files/conf-common new file mode 100644 index 0000000..613193c --- /dev/null +++ b/mail-mta/netqmail/files/conf-common @@ -0,0 +1,67 @@ +#!/bin/bash +# Common Configuration file for all qmail daemons +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-common,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# Qmail User IDS to run daemons as +QMAILDUID=$(id -u qmaild) +NOFILESGID=$(id -g qmaild) +QMAILLUID=$(id -u qmaill) + +# Qmail Control Dir (this is actually set in /etc/env.d/99qmail) +#QMAIL_CONTROLDIR=/var/qmail/control + +# Host and port to listen on +# We listen on the IPv4 local ip by default +TCPSERVER_HOST=0.0.0.0 +TCPSERVER_PORT=${SERVICE} + +# you do not need to specify -x, -c, -u or -g in this variable as those are +# added later +TCPSERVER_OPTS="-p -v" + +# This tells tcpserver where to file the rules cdb file +[[ -d /etc/tcprules.d/ ]] && \ + TCPSERVER_RULESCDB=/etc/tcprules.d/tcp.qmail-${SERVICE}.cdb +[[ ! -f "${TCPSERVER_RULESCDB}" ]] && \ + TCPSERVER_RULESCDB=/etc/tcp.${SERVICE}.cdb + +# we limit data and stack segments to 8mbytes, you may need to raise this if +# you are using a filter in QMAILQUEUE +SOFTLIMIT_OPTS="-m 16000000" + +# We don't have anything to set QMAILQUEUE to at the moment, so we leave it +# alone. Generally it is best to add this in your appropriate (usually SMTP) +# cdb files at /etc/tcprules.d/tcp.qmail-*.cdb instead of on a global basis, as +# otherwise outgoing mail will be checked (because qmail-queue is used for most +# parts of qmail). You can also enable this per-server by just placing it into +# the other configuration files by placing the line there instead. Please note +# that the export part is important. +#export QMAILQUEUE="" + +# tcpserver maximum concurrency, defaults to 40 in tcpserver +# this controls the maximum number of incoming connections that it will accept +if [[ -e ${QMAIL_CONTROLDIR}/concurrencyincoming ]] +then + MAXCONN=$(head -n 1 ${QMAIL_CONTROLDIR}/concurrencyincoming) +else + MAXCONN=40 +fi + +# logging directives +LOG_OPTS="t" # 't' is for timestamp +LOG_MAXSIZE=2500000 # defalts to '99999' if empty +LOG_MAXCOUNT=10 # defaults to '10' if empty + +# build LOG_OPTS from this +[[ -n "${LOG_MAXSIZE}" ]] && \ + LOG_OPTS="${LOG_OPTS} s${LOG_MAXSIZE}" +[[ -n "${LOG_MAXCOUNT}" ]] && \ + LOG_OPTS="${LOG_OPTS} n${LOG_MAXCOUNT}" + +# directory to log to +LOG_DEST=/var/log/qmail/qmail-${SERVICE}d + +# BIG FAT WARNING: +# If you disable this by uncommenting it you will turn _off_ the configuration +# sanity check do so at your own risk! +#QMAIL_DISABLE_SANITY_CHECK=1 diff --git a/mail-mta/netqmail/files/conf-pop3d b/mail-mta/netqmail/files/conf-pop3d new file mode 100644 index 0000000..4d9cfdd --- /dev/null +++ b/mail-mta/netqmail/files/conf-pop3d @@ -0,0 +1,29 @@ +# Configuration file for qmail-pop3d +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-pop3d,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# Stuff to run before tcpserver +#QMAIL_TCPSERVER_PRE="" +# Stuff to run before the authenticator +#QMAIL_POP3_PREAUTH="" +# Stuff to run after the user has authenticated successfully +#QMAIL_POP3_POSTAUTH="" + +# this should contain the FQDN of your server +# by default it pulls the value from qmail +# which should be correct +QMAIL_POP3_POP3HOST="$(<${QMAIL_CONTROLDIR}/me)" + +# If you want POP3 before SMTP, and you are using this POP3 daemon +# uncomment the next two lines +#QMAIL_TCPSERVER_PRE="${QMAIL_TCPSERVER_PRE} envdir /etc/relay-ctrl relay-ctrl-chdir" +#QMAIL_POP3_POSTAUTH="${QMAIL_POP3_POSTAUTH} /usr/bin/relay-ctrl-allow" + +# This controls what password authentication tool POP3 uses +# It must support DJB's checkpassword interface (http://cr.yp.to/checkpwd.html) +QMAIL_POP3_CHECKPASSWORD="/bin/checkpassword" +# cmd5checkpw only validates passwords from /etc/poppasswd +#QMAIL_POP3_CHECKPASSWORD="/bin/cmd5checkpw" + +# The name of the maildir in each user's directory. +# This should be the same thing that defaultdelivery points to +QMAIL_MAILDIR=".maildir" diff --git a/mail-mta/netqmail/files/conf-qmqpd b/mail-mta/netqmail/files/conf-qmqpd new file mode 100644 index 0000000..b362241 --- /dev/null +++ b/mail-mta/netqmail/files/conf-qmqpd @@ -0,0 +1,15 @@ +# Configuration file for qmail-qmqpd +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-qmqpd,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# Stuff to run before tcpserver +#QMAIL_TCPSERVER_PRE="" +# Stuff to run qmail-qmqpd +#QMAIL_QMQP_PRE="" +# Stuff to after qmail-qmqpd +#QMAIL_QMQP_POST="" + +# this turns off the IDENT grab attempt on connecting +TCPSERVER_OPTS="${TCPSERVER_OPTS} -R" + +# I don't trust /etc/services to have obscure ports +TCPSERVER_PORT=628 diff --git a/mail-mta/netqmail/files/conf-qmtpd b/mail-mta/netqmail/files/conf-qmtpd new file mode 100644 index 0000000..7116efc --- /dev/null +++ b/mail-mta/netqmail/files/conf-qmtpd @@ -0,0 +1,18 @@ +# Configuration file for qmail-qmtpd +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-qmtpd,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# For more information on making your servers talk QMTP +# see http://cr.yp.to/im/mxps.html + +# Stuff to run before tcpserver +#QMAIL_TCPSERVER_PRE="" +# Stuff to run qmail-qmtpd +#QMAIL_QMTP_PRE="" +# Stuff to after qmail-qmtpd +#QMAIL_QMTP_POST="" + +# this turns off the IDENT grab attempt on connecting +TCPSERVER_OPTS="${TCPSERVER_OPTS} -R" + +# I don't trust /etc/services to have obscure ports +TCPSERVER_PORT=209 diff --git a/mail-mta/netqmail/files/conf-send b/mail-mta/netqmail/files/conf-send new file mode 100644 index 0000000..74b2e8c --- /dev/null +++ b/mail-mta/netqmail/files/conf-send @@ -0,0 +1,6 @@ +# Configuration file for qmail-send +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-send,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# directory to log to +# override conf-common on this +LOG_DEST=/var/log/qmail/qmail-send diff --git a/mail-mta/netqmail/files/conf-smtpd b/mail-mta/netqmail/files/conf-smtpd new file mode 100644 index 0000000..cfbdad4 --- /dev/null +++ b/mail-mta/netqmail/files/conf-smtpd @@ -0,0 +1,51 @@ +# Configuration file for qmail-smtpd +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/conf-smtpd,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# Stuff to run before tcpserver +#QMAIL_TCPSERVER_PRE="" +# Stuff to run qmail-smtpd +#QMAIL_SMTP_PRE="" +# Stuff to after qmail-smtpd +#QMAIL_SMTP_POST="" + +# this turns off the IDENT grab attempt on connecting +TCPSERVER_OPTS="${TCPSERVER_OPTS} -R" + +# fixcrio inserts missing CRs at the ends of lines. See: +# http://cr.yp.to/ucspi-tcp/fixcrio.html +# http://cr.yp.to/docs/smtplf.html +# DO NOT enable this when you are using SSL/TLS (USE=ssl)! +#QMAIL_SMTP_PRE="${QMAIL_SMTP_PRE} fixcrio" + +# You might want to use rblsmtpd with this, but you need to fill in a RBL +# server here first, see http://cr.yp.to/ucspi-tcp/rblsmtpd.html for more +# details +#QMAIL_SMTP_PRE="${QMAIL_SMTP_PRE} rblsmtpd -r RBL-SERVER" + +# If you are interested in providing POP or IMAP before SMTP type relaying, +# emerge relay-ctrl, then uncomment the next 2 lines +#QMAIL_TCPSERVER_PRE="${QMAIL_TCPSERVER_PRE} envdir /etc/relay-ctrl relay-ctrl-chdir" +#QMAIL_SMTP_PRE="${QMAIL_SMTP_PRE} relay-ctrl-check" +# In /etc/courier-imap/authdaemonrc add the next line to the end: +#authmodulelist="${authmodulelist} relay-ctrl-allow" +# Then in /etc/courier-imap/{imapd,imapd-ssl,pop3d,pop3d-ssl} +# Add this at the end +#PRERUN="${PRERUN} envdir /etc/relay-ctrl relay-ctrl-chdir" + +# This next block is for SMTP-AUTH + +# WARNING: If you've installed qmail with USE=noauthcram, and you want to use +# the following programs, you proably need to install them. + +# Example using cmd5checkpw +# See the manpage for cmd5checkpw for details on the passwords +#QMAIL_SMTP_CHECKPASSWORD="/bin/cmd5checkpw" + +# Example for checkpassword-pam (emerge checkpassword-pam) +# Don't forget to make /usr/bin/checkpassword-pam sticky (see README.auth) +#QMAIL_SMTP_CHECKPASSWORD="/usr/bin/checkpassword-pam -s system-auth" + +[[ -n "${QMAIL_SMTP_CHECKPASSWORD}" ]] && { + [[ -z "${QMAIL_SMTP_POST}" ]] && QMAIL_SMTP_POST=/bin/true + QMAIL_SMTP_POST="${QMAIL_SMTP_CHECKPASSWORD} ${QMAIL_SMTP_POST}" +} diff --git a/mail-mta/netqmail/files/dot-qmail b/mail-mta/netqmail/files/dot-qmail new file mode 100644 index 0000000..81a15fc --- /dev/null +++ b/mail-mta/netqmail/files/dot-qmail @@ -0,0 +1,3 @@ +# Uncomment the next line for .forward support +#|dot-forward .forward +./.maildir/ diff --git a/mail-mta/netqmail/files/mailer.conf b/mail-mta/netqmail/files/mailer.conf new file mode 100644 index 0000000..cd4f4cd --- /dev/null +++ b/mail-mta/netqmail/files/mailer.conf @@ -0,0 +1,6 @@ +# Execute the real programs from qmail +# +sendmail /var/qmail/bin/sendmail +send-mail /var/qmail/bin/sendmail +mailq /var/qmail/bin/qmail-qread +newaliases /var/qmail/bin/newaliases diff --git a/mail-mta/netqmail/files/mkservercert b/mail-mta/netqmail/files/mkservercert new file mode 100644 index 0000000..4d74791 --- /dev/null +++ b/mail-mta/netqmail/files/mkservercert @@ -0,0 +1,55 @@ +#!/bin/bash +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/mkservercert,v 1.2 2007/05/05 05:16:58 vapier Exp $ +# Self-signed certificate generator for Qmail under Gentoo +# Robin H. Johnson - October 17, 2003 +# Based on mkimapdcert from courier-imap. + +test -x /usr/bin/openssl || exit 0 +source /etc/init.d/functions.sh || exit 1 + +filedir="/var/qmail/control" +pemfile="${filedir}/servercert.pem" +randfile="${filedir}/servercert.rand" +conffile="${filedir}/servercert.cnf" + +# file details for pemfile +mode="0640" +uid="qmaild" +gid="qmail" + +# expire on certifcate +days="365" + +if test -f $pemfile +then + eerror "$pemfile already exists." + exit 1 +fi + +ewarn "Please customize ${conffile} before continuing!" +einfo "Press ENTER to continue, or CTRL-C to stop now." +read + +# setup the temp file +cp /dev/null $pemfile +chmod 600 $pemfile +chown root $pemfile + +cleanup() { + rm -f $pemfile + rm -f $randfile + exit 1 +} + +dd if=/dev/urandom of=${randfile} bs=64 count=1 2>/dev/null +chmod 600 ${randfile} +einfo "Creating self-signed certificate" +/usr/bin/openssl req -new -x509 -days ${days} -nodes \ + -config ${conffile} -out $pemfile -keyout $pemfile -rand ${randfile} || cleanup +einfo "Certificate details" +/usr/bin/openssl x509 -subject -dates -fingerprint -noout -in $pemfile || cleanup +chown ${uid}:${gid} ${pemfile} +chmod ${mode} ${pemfile} +#qmail needs an extra item +ln -s ${pemfile} ${filedir}/clientcert.pem +rm -f $randfile diff --git a/mail-mta/netqmail/files/outgoingip.patch b/mail-mta/netqmail/files/outgoingip.patch new file mode 100644 index 0000000..af5c082 --- /dev/null +++ b/mail-mta/netqmail/files/outgoingip.patch @@ -0,0 +1,192 @@ +From: Sergio Gelato +To: Andy Repton , + Russell Nelson +Subject: Bug in Andy Repton's outgoingip patch for qmail +Date: Fri, 4 Jul 2003 14:20:43 +0200 + +I have found a bug in Andy Repton's outgoingip patch for qmail 1.03 +(http://www.qmail.org/outgoingip.patch). + +The problem is the call to stralloc_copy(&outgoingip, "0.0.0.0"); +the correct function to use is stralloc_copys(). + +An updated version of the patch follows. Besides fixing this bug, +I also added some documentation to the man pages and to qmail-showctl.c. + +Best wishes, +Sergio Gelato + +Index: qmail-control.9 +=================================================================== +RCS file: /home/software/CVSREPOS/qmail/qmail-control.9,v +retrieving revision 1.2 +retrieving revision 1.3 +diff -u -u -r1.2 -r1.3 +--- qmail-control.9 2001/08/14 17:35:30 1.2 ++++ qmail-control.9 2003/07/04 09:02:58 1.3 +@@ -57,6 +57,7 @@ + .I locals \fIme \fRqmail-send + .I mfcheck \fR0 \fRqmail-smtpd + .I morercpthosts \fR(none) \fRqmail-smtpd ++.I outgoingip \fR0.0.0.0 \fRqmail-remote + .I percenthack \fR(none) \fRqmail-send + .I plusdomain \fIme \fRqmail-inject + .I qmqpservers \fR(none) \fRqmail-qmqpc +Index: qmail-remote.8 +=================================================================== +RCS file: /home/software/CVSREPOS/qmail/qmail-remote.8,v +retrieving revision 1.1.1.1 +retrieving revision 1.2 +diff -u -u -r1.1.1.1 -r1.2 +--- qmail-remote.8 2001/05/30 16:55:45 1.1.1.1 ++++ qmail-remote.8 2003/07/04 09:02:58 1.2 +@@ -124,6 +124,13 @@ + .B qmail-remote + refuses to run. + .TP 5 ++.I outgoingip ++IP address to be used on outgoing connections. ++Default: system-defined. ++The value ++.IR 0.0.0.0 ++is equivalent to the system default. ++.TP 5 + .I smtproutes + Artificial SMTP routes. + Each route has the form +Index: qmail-remote.c +=================================================================== +RCS file: /home/software/CVSREPOS/qmail/qmail-remote.c,v +retrieving revision 1.1.1.1 +retrieving revision 1.3 +diff -u -u -r1.1.1.1 -r1.3 +--- qmail-remote.c 2001/05/30 16:55:46 1.1.1.1 ++++ qmail-remote.c 2003/07/04 11:38:57 1.3 +@@ -39,6 +39,7 @@ + static stralloc sauninit = {0}; + + stralloc helohost = {0}; ++stralloc outgoingip = {0}; + stralloc routes = {0}; + struct constmap maproutes; + stralloc host = {0}; +@@ -47,6 +48,7 @@ + saa reciplist = {0}; + + struct ip_address partner; ++struct ip_address outip; + + void out(s) char *s; { if (substdio_puts(subfdoutsmall,s) == -1) _exit(0); } + void zero() { if (substdio_put(subfdoutsmall,"\0",1) == -1) _exit(0); } +@@ -56,6 +58,7 @@ + ch = sa->s[i]; if (ch < 33) ch = '?'; if (ch > 126) ch = '?'; + if (substdio_put(subfdoutsmall,&ch,1) == -1) _exit(0); } } + ++void temp_noip() { out("Zinvalid ipaddr in control/outgoingip (#4.3.0)\n"); zerodie(); } + void temp_nomem() { out("ZOut of memory. (#4.3.0)\n"); zerodie(); } + void temp_oserr() { out("Z\ + System resources temporarily unavailable. (#4.3.0)\n"); zerodie(); } +@@ -310,6 +313,7 @@ + + void getcontrols() + { ++ int r; + if (control_init() == -1) temp_control(); + if (control_readint(&timeout,"control/timeoutremote") == -1) temp_control(); + if (control_readint(&timeoutconnect,"control/timeoutconnect") == -1) +@@ -324,6 +328,12 @@ + case 1: + if (!constmap_init(&maproutes,routes.s,routes.len,1)) temp_nomem(); break; + } ++ r = control_readline(&outgoingip,"control/outgoingip"); ++ if (-1 == r) { if (errno == error_nomem) temp_nomem(); temp_control(); } ++ if (0 == r && !stralloc_copys(&outgoingip, "0.0.0.0")) temp_nomem(); ++ if (str_equal(outgoingip.s, "0.0.0.0")) ++ { outip.d[0]=outip.d[1]=outip.d[2]=outip.d[3]=(unsigned long) 0; } ++ else if (!ip_scan(outgoingip.s, &outip)) temp_noip(); + } + + void main(argc,argv) +@@ -414,7 +424,7 @@ + smtpfd = socket(AF_INET,SOCK_STREAM,0); + if (smtpfd == -1) temp_oserr(); + +- if (timeoutconn(smtpfd,&ip.ix[i].ip,(unsigned int) port,timeoutconnect) == 0) { ++ if (timeoutconn(smtpfd,&ip.ix[i].ip,&outip,(unsigned int) port,timeoutconnect) == 0) { + tcpto_err(&ip.ix[i].ip,0); + partner = ip.ix[i].ip; + smtp(); /* does not return */ +Index: qmail-showctl.c +=================================================================== +RCS file: /home/software/CVSREPOS/qmail/qmail-showctl.c,v +retrieving revision 1.1.1.1 +retrieving revision 1.2 +diff -u -u -r1.1.1.1 -r1.2 +--- qmail-showctl.c 2001/05/30 16:55:46 1.1.1.1 ++++ qmail-showctl.c 2003/07/04 11:45:48 1.2 +@@ -230,6 +230,7 @@ + do_str("localiphost",1,"localiphost","Local IP address becomes "); + do_lst("locals","Messages for me are delivered locally.","Messages for "," are delivered locally."); + do_str("me",0,"undefined! Uh-oh","My name is "); ++ do_str("outgoingip",0,"0.0.0.0","Outgoing IP address is "); + do_lst("percenthack","The percent hack is not allowed.","The percent hack is allowed for user%host@","."); + do_str("plusdomain",1,"plusdomain","Plus domain name is "); + do_lst("qmqpservers","No QMQP servers.","QMQP server: ","."); +Index: remoteinfo.c +=================================================================== +RCS file: /home/software/CVSREPOS/qmail/remoteinfo.c,v +retrieving revision 1.1.1.1 +retrieving revision 1.2 +diff -u -u -r1.1.1.1 -r1.2 +--- remoteinfo.c 2001/05/30 16:55:47 1.1.1.1 ++++ remoteinfo.c 2003/07/03 22:28:50 1.2 +@@ -44,12 +44,12 @@ + s = socket(AF_INET,SOCK_STREAM,0); + if (s == -1) return 0; + +- byte_zero(&sin,sizeof(sin)); ++/* byte_zero(&sin,sizeof(sin)); + sin.sin_family = AF_INET; + byte_copy(&sin.sin_addr,4,ipl); + sin.sin_port = 0; +- if (bind(s,(struct sockaddr *) &sin,sizeof(sin)) == -1) { close(s); return 0; } +- if (timeoutconn(s,ipr,113,timeout) == -1) { close(s); return 0; } ++ if (bind(s,(struct sockaddr *) &sin,sizeof(sin)) == -1) { close(s); return 0; } */ ++ if (timeoutconn(s,ipr,ipl,113,timeout) == -1) { close(s); return 0; } + fcntl(s,F_SETFL,fcntl(s,F_GETFL,0) & ~O_NDELAY); + + len = 0; +Index: timeoutconn.c +=================================================================== +RCS file: /home/software/CVSREPOS/qmail/timeoutconn.c,v +retrieving revision 1.1.1.1 +retrieving revision 1.2 +diff -u -u -r1.1.1.1 -r1.2 +--- timeoutconn.c 2001/05/30 16:55:47 1.1.1.1 ++++ timeoutconn.c 2003/07/03 22:28:50 1.2 +@@ -10,9 +10,10 @@ + #include "byte.h" + #include "timeoutconn.h" + +-int timeoutconn(s,ip,port,timeout) ++int timeoutconn(s,ip,outip,port,timeout) + int s; + struct ip_address *ip; ++struct ip_address *outip; + unsigned int port; + int timeout; + { +@@ -22,6 +23,13 @@ + fd_set wfds; + struct timeval tv; + ++ /* bind() an outgoing ipaddr */ ++ byte_zero(&sin,sizeof(sin)); ++ byte_copy(&sin.sin_addr.s_addr,4,outip); ++ sin.sin_family = AF_INET; ++ ++ if (-1 == bind(s,(struct sockaddr *) &sin,sizeof(sin))) return -1; ++ + byte_zero(&sin,sizeof(sin)); + byte_copy(&sin.sin_addr,4,ip); + x = (char *) &sin.sin_port; diff --git a/mail-mta/netqmail/files/qmail-config-system b/mail-mta/netqmail/files/qmail-config-system new file mode 100644 index 0000000..345e1d0 --- /dev/null +++ b/mail-mta/netqmail/files/qmail-config-system @@ -0,0 +1,72 @@ +#!/bin/bash +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/qmail-config-system,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# This is a configuration system to make using and controlling the interesting +# parts of the qmail behavior simple. The only variable that needs to be set +# before running this is $SERVICE. + +# this is to inherit QMAIL_CONTROLDIR +. /etc/profile + +# now run +# grab the common configuration +[[ -s ${QMAIL_CONTROLDIR}/conf-common ]] && \ + . ${QMAIL_CONTROLDIR}/conf-common + +# grab the per-service configuration +[[ -s ${QMAIL_CONTROLDIR}/conf-${SERVICE}d ]] && \ + . ${QMAIL_CONTROLDIR}/conf-${SERVICE}d + +# special case for qmail-send +[[ "${SERVICE}" = send && -s ${QMAIL_CONTROLDIR}/conf-send ]] && \ + . ${QMAIL_CONTROLDIR}/conf-send + +# you may want to disable this at some point, so I give you the choice here +if [[ -z "${QMAIL_DISABLE_SANITY_CHECK}" ]] +then + # This is intended solely to stop qmail eating up all your hard disk space with logs + + CONFIG_SANITY_GOOD= + + # check simple stuff first + if [[ -z "${QMAILDUID}" || -z "${NOFILESGID}" || -z "${SERVICE}" || -z "${QMAILLUID}" ]] + then + echo "SERVICE(${SERVICE}), QMAILDUID(${QMAILDUID}), NOFILESGID(${NOFILESGID}) or "\ + "QMAILLUID(${QMAILLUID}) is unset in $0" + CONFIG_SANITY_GOOD=0 + fi + + if [[ -z "${LOG_OPTS}" || -z "${LOG_DEST}" ]] + then + echo "LOG_OPTS: ${LOG_OPTS}" + echo "LOG_DEST: ${LOG_DEST}" + echo "Error in logging setup!" + CONFIG_SANITY_GOOD=0 + fi + + if [[ "${SERVICE}" = smtp && + ! -f ${QMAIL_CONTROLDIR}/rcpthosts && + -z "${QMAIL_DISABLE_SANITY_CHECK}" ]] + then + echo "No /var/qmail/control/rcpthosts!" + echo "Refusing to start SMTP listener because it'll create an open relay" + CONFIG_SANITY_GOOD=0 + fi + + if [[ "${SERVICE}" != send && ! -f "${TCPSERVER_RULESCDB}" ]] + then + echo "No CDB file found (${TCPSERVER_RULESCDB})" + CONFIG_SANITY_GOOD=0 + fi + + if [[ -n "${CONFIG_SANITY_GOOD}" ]] + then + echo "Some error detected in ${SERVICE}, sleeping for 90 seconds for safety" + sleep 90s + exit 1 + fi +else + echo "Failed to find sanity checker!" + sleep 30s + exit 1 +fi diff --git a/mail-mta/netqmail/files/qmail-genrsacert.sh b/mail-mta/netqmail/files/qmail-genrsacert.sh new file mode 100644 index 0000000..ec75dcb --- /dev/null +++ b/mail-mta/netqmail/files/qmail-genrsacert.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/qmail-genrsacert.sh,v 1.2 2006/05/06 20:15:11 hansmi Exp $ +# Robin H. Johnson - October 17, 2003 +# +# This file generates the static temporary RSA keys needed for qmail to encrypt +# messages. It should be run from a crontab, once a day is ok on low load +# machines, but if you do lots of mail, once per hour is more reasonable if you +# do NOT create the rsa512.pem, qmail will generate it on the fly for each +# connection, which can be VERY slow. + +confdir=${ROOT}/var/qmail/control + +# the key should be 0600 +# which is readable by qmaild only! +umaskvalue="0077" +uid="qmaild" +gid="qmail" + +umask ${umaskvalue} + +# If you want to renice this process, uncomment the following line: +# renice +15 "$$" >/dev/null + +# This is a list with bits of the generated keys. They should +# be a power of 2 ideally and must be more than 64. +keys="512 1024" + +for bits in ${keys} +do + pemfile="${confdir}/rsa${bits}.pem" + tmpfile="${confdir}/rsa${bits}.pem.tmp" + + # we need to make sure that all of the operations succeed + /usr/bin/openssl genrsa -out ${tmpfile} ${bits} 2>/dev/null && \ + /bin/chown ${uid}:${gid} ${tmpfile} && \ + /bin/mv -f ${tmpfile} ${pemfile} || exit 1 + + dhfile="${confdir}/dh${bits}.pem" + dtmpfile="${confdir}/dh${bits}.pem.tmp" + + /usr/bin/openssl dhparam -2 -out ${dtmpfile} ${bits} 2>/dev/null && \ + /bin/chown ${uid}:${gid} ${dtmpfile} && \ + /bin/mv -f ${dtmpfile} ${dhfile} || exit 1 +done diff --git a/mail-mta/netqmail/files/run-qmail-pop3d b/mail-mta/netqmail/files/run-qmail-pop3d new file mode 100644 index 0000000..d166e6f --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-pop3d @@ -0,0 +1,19 @@ +#!/bin/bash +# Gentoo Startup script for qmail's POP3 daemon +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-pop3d,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# If you need to edit this file, please look at editing conf-smtpd and +# conf-common first. If you still need to change this file, you should probably +# file a bug on the bugzilla saying what you wanted to change so that +# modifications can be made possible via the configuration files. + +SERVICE=pop3 +. /var/qmail/bin/qmail-config-system && \ +exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \ + ${QMAIL_TCPSERVER_PRE} \ + /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \ + -c ${MAXCONN} \ + ${TCPSERVER_HOST} ${TCPSERVER_PORT} \ + ${QMAIL_POP3_PREAUTH} /var/qmail/bin/qmail-popup ${QMAIL_POP3_POP3HOST} \ + ${QMAIL_POP3_CHECKPASSWORD} ${QMAIL_POP3_POSTAUTH} \ + /var/qmail/bin/qmail-pop3d ${QMAIL_MAILDIR} 2>&1 diff --git a/mail-mta/netqmail/files/run-qmail-pop3d-log b/mail-mta/netqmail/files/run-qmail-pop3d-log new file mode 100644 index 0000000..3befb5b --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-pop3d-log @@ -0,0 +1,7 @@ +#!/bin/bash +# Gentoo Startup script for qmail's POP3 daemon (logging) +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-pop3d-log,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +SERVICE=pop3 +. /var/qmail/bin/qmail-config-system && \ +eval exec /usr/bin/setuidgid qmaill /usr/bin/multilog ${LOG_OPTS} ${LOG_DEST} diff --git a/mail-mta/netqmail/files/run-qmail-qmqpd b/mail-mta/netqmail/files/run-qmail-qmqpd new file mode 100644 index 0000000..19ff028 --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-qmqpd @@ -0,0 +1,18 @@ +#!/bin/bash +# Gentoo Startup script for qmail's QMQP daemon +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-qmqpd,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# If you need to edit this file, please look at editing conf-smtpd and +# conf-common first. If you still need to change this file, you should probably +# file a bug on the bugzilla saying what you wanted to change so that +# modifications can be made possible via the configuration files. + +SERVICE=qmqp +. /var/qmail/bin/qmail-config-system && \ +exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \ + ${QMAIL_TCPSERVER_PRE} \ + /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \ + -c ${MAXCONN} -u ${QMAILDUID} -g ${NOFILESGID} \ + ${TCPSERVER_HOST} ${TCPSERVER_PORT} \ + ${QMAIL_QMQP_PRE} /var/qmail/bin/qmail-${SERVICE}d ${QMAIL_QMQP_POST} \ + 2>&1 diff --git a/mail-mta/netqmail/files/run-qmail-qmqpd-log b/mail-mta/netqmail/files/run-qmail-qmqpd-log new file mode 100644 index 0000000..6167d92 --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-qmqpd-log @@ -0,0 +1,7 @@ +#!/bin/bash +# Gentoo Startup script for qmail's QMQP daemon (logging) +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-qmqpd-log,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +SERVICE=qmqp +. /var/qmail/bin/qmail-config-system && \ +eval exec /usr/bin/setuidgid qmaill /usr/bin/multilog ${LOG_OPTS} ${LOG_DEST} diff --git a/mail-mta/netqmail/files/run-qmail-qmtpd b/mail-mta/netqmail/files/run-qmail-qmtpd new file mode 100644 index 0000000..71c5207 --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-qmtpd @@ -0,0 +1,18 @@ +#!/bin/bash +# Gentoo Startup script for qmail's QMTP daemon +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-qmtpd,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# If you need to edit this file, please look at editing conf-smtpd and +# conf-common first. If you still need to change this file, you should probably +# file a bug on the bugzilla saying what you wanted to change so that +# modifications can be made possible via the configuration files. + +SERVICE=qmtp +. /var/qmail/bin/qmail-config-system && \ +exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \ + ${QMAIL_TCPSERVER_PRE} \ + /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \ + -c ${MAXCONN} -u ${QMAILDUID} -g ${NOFILESGID} \ + ${TCPSERVER_HOST} ${TCPSERVER_PORT} \ + ${QMAIL_QMTP_PRE} /var/qmail/bin/qmail-${SERVICE}d ${QMAIL_QMTP_POST} \ + 2>&1 diff --git a/mail-mta/netqmail/files/run-qmail-qmtpd-log b/mail-mta/netqmail/files/run-qmail-qmtpd-log new file mode 100644 index 0000000..a8871c2 --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-qmtpd-log @@ -0,0 +1,7 @@ +#!/bin/bash +# Gentoo Startup script for qmail's QMTP daemon (logging) +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-qmtpd-log,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +SERVICE=qmtp +. /var/qmail/bin/qmail-config-system && \ +eval exec /usr/bin/setuidgid qmaill /usr/bin/multilog ${LOG_OPTS} ${LOG_DEST} diff --git a/mail-mta/netqmail/files/run-qmail-send b/mail-mta/netqmail/files/run-qmail-send new file mode 100644 index 0000000..ccf5797 --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-send @@ -0,0 +1,6 @@ +#!/bin/sh +# Init script for qmail-send +# Copied from LWQ +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-send,v 1.1 2006/02/12 18:42:33 hansmi Exp $ +exec env - PATH="/var/qmail/bin:$PATH" \ + qmail-start "`cat /var/qmail/control/defaultdelivery`" diff --git a/mail-mta/netqmail/files/run-qmail-send-log b/mail-mta/netqmail/files/run-qmail-send-log new file mode 100644 index 0000000..d1fa08a --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-send-log @@ -0,0 +1,7 @@ +#!/bin/bash +# Gentoo Startup script for qmail's send daemon (logging) +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-send-log,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +SERVICE=send +. /var/qmail/bin/qmail-config-system && \ +eval exec /usr/bin/setuidgid qmaill /usr/bin/multilog ${LOG_OPTS} ${LOG_DEST} diff --git a/mail-mta/netqmail/files/run-qmail-smtpd b/mail-mta/netqmail/files/run-qmail-smtpd new file mode 100644 index 0000000..2be9c8c --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-smtpd @@ -0,0 +1,18 @@ +#!/bin/bash +# Gentoo Startup script for qmail's SMTP daemon +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-smtpd,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +# If you need to edit this file, please look at editing conf-smtpd and +# conf-common first. If you still need to change this file, you should probably +# file a bug on the bugzilla saying what you wanted to change so that +# modifications can be made possible via the configuration files. + +SERVICE=smtp +. /var/qmail/bin/qmail-config-system && \ +exec /usr/bin/softlimit ${SOFTLIMIT_OPTS} \ + ${QMAIL_TCPSERVER_PRE} \ + /usr/bin/tcpserver ${TCPSERVER_OPTS} -x ${TCPSERVER_RULESCDB} \ + -c ${MAXCONN} -u ${QMAILDUID} -g ${NOFILESGID} \ + ${TCPSERVER_HOST} ${TCPSERVER_PORT} \ + ${QMAIL_SMTP_PRE} /var/qmail/bin/qmail-${SERVICE}d ${QMAIL_SMTP_POST} \ + 2>&1 diff --git a/mail-mta/netqmail/files/run-qmail-smtpd-log b/mail-mta/netqmail/files/run-qmail-smtpd-log new file mode 100644 index 0000000..f45f714 --- /dev/null +++ b/mail-mta/netqmail/files/run-qmail-smtpd-log @@ -0,0 +1,7 @@ +#!/bin/bash +# Gentoo Startup script for qmail's SMTP daemon (logging) +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/run-qmail-smtpd-log,v 1.1 2006/02/12 18:42:33 hansmi Exp $ + +SERVICE=smtp +. /var/qmail/bin/qmail-config-system && \ +eval exec /usr/bin/setuidgid qmaill /usr/bin/multilog ${LOG_OPTS} ${LOG_DEST} diff --git a/mail-mta/netqmail/files/servercert.cnf b/mail-mta/netqmail/files/servercert.cnf new file mode 100644 index 0000000..735445e --- /dev/null +++ b/mail-mta/netqmail/files/servercert.cnf @@ -0,0 +1,35 @@ +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/files/servercert.cnf,v 1.1 2006/02/12 18:42:33 hansmi Exp $ +# This is the openssl config file to generate keys for qmail + +[ req ] +# you can increase this value, but be aware that it will make things much slower +# this should be a power of 2! +default_bits = 1024 +# leave the rest of these alone! +encrypt_key = yes +distinguished_name = req_dn +x509_extensions = cert_type +prompt = no + +[ req_dn ] +# 2-Letter ISO country code +C=US +# FULL name of state/province/district +# NO abbreviations! +ST=Alabama +# FULL name of city +# NO abbreviations! +L=Mobile +# Full Name of your organization +# NO abbreviations! +O=Foobar Systems +# Leave this alone unless specifically need to change it! +OU=Automatically-generated Qmail SMTP SSL key +# This should be a FQDN that resolves to the IP of your server +CN=localhost +# This should be the email address for the administrator of the server +emailAddress=postmaster@localhost + +# Leave this alone! +[ cert_type ] +nsCertType = server diff --git a/mail-mta/netqmail/files/tcp.pop3.sample b/mail-mta/netqmail/files/tcp.pop3.sample new file mode 100644 index 0000000..d6a0f69 --- /dev/null +++ b/mail-mta/netqmail/files/tcp.pop3.sample @@ -0,0 +1,12 @@ +# to update the database after changing this file, run: +# tcprules /etc/tcprules.d/tcp.qmail-pop3.cdb /etc/tcprules.d/.tcp.qmail-pop3.tmp < /etc/tcprules.d/tcp.qmail-pop3 + +# For the full documentation on the format of this file, +# see http://cr.yp.to/ucspi-tcp/tcprules.html + +#---------------------------------------------------------------- + +# Allow any client to connect to us via POP3. If people are abusing POP3 such +# as denial-of-service on POP3, you can add their IP addresses here to block +# them out. +:allow diff --git a/mail-mta/netqmail/files/tcp.qmqp.sample b/mail-mta/netqmail/files/tcp.qmqp.sample new file mode 100644 index 0000000..83d715d --- /dev/null +++ b/mail-mta/netqmail/files/tcp.qmqp.sample @@ -0,0 +1,14 @@ +# to update the database after changing this file, run: +# tcprules /etc/tcprules.d/tcp.qmail-qmqp.cdb /etc/tcprules.d/.tcp.qmail-qmqp.tmp < /etc/tcprules.d/tcp.qmail-qmqp + +# For the full documentation on the format of this file, +# see http://cr.yp.to/ucspi-tcp/tcprules.html + +#---------------------------------------------------------------- + +# QMQP is a bulk protocol and we don't want spam to ever come by it and it is +# intended to go between a few servers only so we don't trust any default +# people with it. +# see /etc/tcprules.d/tcp.qmail-smtp for more info + +:deny diff --git a/mail-mta/netqmail/files/tcp.qmtp.sample b/mail-mta/netqmail/files/tcp.qmtp.sample new file mode 100644 index 0000000..e8fa4de --- /dev/null +++ b/mail-mta/netqmail/files/tcp.qmtp.sample @@ -0,0 +1,23 @@ +# to update the database after changing this file, run: +# tcprules /etc/tcprules.d/tcp.qmail-qmtp.cdb /etc/tcprules.d/.tcp.qmail-qmtp.tmp < /etc/tcprules.d/tcp.qmail-qmtp + +# For the full documentation on the format of this file, +# see http://cr.yp.to/ucspi-tcp/tcprules.html + +#---------------------------------------------------------------- + +# We trust QMTP connections just as SMTP by default. See +# /etc/tcprules.d/tcp.qmail-smtp for more info. + +# allow relaying from localhost +127.0.0.1:allow,RELAYCLIENT="",RBLSMTPD="" + +# everybody else is not allowed to relay, and is subject to RBLSMTPD checks +:allow + +# If you are using qmail-scanner, this line here is the correct one to use +# instead (comment out the above ':allow' line FIRST) and applies that script +# to any mail coming in that is not from a host allowed to relay. You can +# change the value of the variable to any other value you desire to use custom +# scripts for example. +#:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue" diff --git a/mail-mta/netqmail/files/tcp.smtp.sample b/mail-mta/netqmail/files/tcp.smtp.sample new file mode 100644 index 0000000..f6d0b16 --- /dev/null +++ b/mail-mta/netqmail/files/tcp.smtp.sample @@ -0,0 +1,79 @@ +# to update the database after changing this file, run: +# tcprules /etc/tcprules.d/tcp.qmail-smtp.cdb /etc/tcprules.d/.tcp.qmail-smtp.tmp < /etc/tcprules.d/tcp.qmail-smtp + +# For the full documentation on the format of this file, +# see http://cr.yp.to/ucspi-tcp/tcprules.html + +#----------------------------------------------------------------- +# Short description of the rules + +# If you set 'allow', this means that our mail server will allow the specified +# IP address range to make a TCP connection to our server. + +# If you set 'deny', this means that our mail server will not allow the +# specified IP address range to make a TCP connection to our server. + +# If you set RELAYCLIENT="", this means that the listed IP address range is +# allowed to relay mail through our server. + +# If you don't set RELAYCLIENT="", this means that the listed IP address range +# will not be able to relay mail through our server. + +# If you set RBLSMTPD="", this means that the listed IP address ranges will not +# be checked against any of the RBL databases. + +# If you set RBLSMTPD="some text here", this means that an RBL lookup won't be +# performed, but the mail will be rejected with the specified text as a 4xx +# temp error message. + +# If you set RBLSMTPD="-some text here", this means that an RBL lookup won't be +# performed, but the mail will be rejected with the specified text as a 5xx +# permanent error message. + +# If you do not set RBLSMTPD="" or ="some text", then an RBL lookup will be +# performed. If the lookup is successful, then RBLSMTPD will return your custom +# error message (as specified in the -r parameter in smtpd supervise script). + +#----------------------------------------------------------------- +# Bypass open relay checking for these IP addresses: + +# These IP addresses are ones that we have setup so that they aren't RBL +# checked. We have done this because these particular servers are RBL listed, +# and for whatever reason they can't/won't fix their open relay problem, and we +# still want to be able to receive mail from them. + +# reminder text goes here for this entry so we know the story... +#111.111.111.111:allow,RBLSMTPD="" + +#----------------------------------------------------------------- +# Do not allow these IP addresses to send e-mails to us: + +#1.2.3.:allow,RBLSMTPD="-Connections refused due to spam from domain.tld" +#4.5.6.7:allow,RBLSMTPD="-Connections refused due to spam from domain2.tld" +#8.9.10.11-100:allow,RBLSMTPD="-Connections from this IP have been banned" + +#----------------------------------------------------------------- +# Allow these IP addresses to relay mail trough our server + +# IP addresses from our LAN are allowed to relay, and we won't bother doing any +# RBL checking. +#192.168.1.:allow,RELAYCLIENT="",RBLSMTPD="" + +# Connections from localhost are allowed to relay (because the Webmail server +# runs on localhost), and obviously there is no point trying to perform an RBL +# check. +127.0.0.1:allow,RELAYCLIENT="",RBLSMTPD="" + +#----------------------------------------------------------------- +# Allow everyone else to send us e-mails: + +# Everyone else can make connections to our server, but not allowed to relay. +# RBL lookups are performed. +:allow + +# If you are using qmail-scanner, this line here is the correct one to use +# instead (comment out the above ':allow' line FIRST) and applies that script +# to any mail coming in that is not from a host allowed to relay. You can +# change the value of the variable to any other value you desire to use custom +# scripts for example. +#:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue" diff --git a/mail-mta/netqmail/files/tcprules.d-Makefile.qmail b/mail-mta/netqmail/files/tcprules.d-Makefile.qmail new file mode 100644 index 0000000..d10be0f --- /dev/null +++ b/mail-mta/netqmail/files/tcprules.d-Makefile.qmail @@ -0,0 +1,3 @@ +QMAIL_CDBS = tcp.qmail-pop3.cdb tcp.qmail-qmqp.cdb tcp.qmail-qmtp.cdb tcp.qmail-smtp.cdb +CDBS += $(QMAIL_CDBS) +qmail: $(QMAIL_CDBS) diff --git a/mail-mta/netqmail/metadata.xml b/mail-mta/netqmail/metadata.xml new file mode 100644 index 0000000..0cb478b --- /dev/null +++ b/mail-mta/netqmail/metadata.xml @@ -0,0 +1,5 @@ + + + + qmail + diff --git a/mail-mta/netqmail/netqmail-1.05-r9.ebuild b/mail-mta/netqmail/netqmail-1.05-r9.ebuild new file mode 100644 index 0000000..20b6728 --- /dev/null +++ b/mail-mta/netqmail/netqmail-1.05-r9.ebuild @@ -0,0 +1,485 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-mta/netqmail/netqmail-1.05-r8.ebuild,v 1.8 2007/12/03 21:36:57 robbat2 Exp $ + +inherit eutils toolchain-funcs fixheadtails flag-o-matic + +TLS_AUTH_PATCH=20070417 +QMAIL_SPP_PATCH=0.42 + +DESCRIPTION="qmail -- a secure, reliable, efficient, simple message transfer agent" +HOMEPAGE=" + http://netqmail.org/ + http://cr.yp.to/qmail.html + http://qmail.org/ +" +SRC_URI=" + mirror://qmail/netqmail-${PV}.tar.gz + !vanilla? ( + ssl? ( http://shupp.org/patches/netqmail-${PV}-tls-smtpauth-${TLS_AUTH_PATCH}.patch ) + highvolume? ( mirror://qmail/big-todo.103.patch ) + qmail-spp? ( mirror://sourceforge/qmail-spp/qmail-spp-${QMAIL_SPP_PATCH}.tar.gz ) + ) +" + +LICENSE="public-domain" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86" +IUSE="gencertdaily highvolume mailwrapper noauthcram qmail-spp ssl vanilla" +RESTRICT="test" + +DEPEND=" + !mail-mta/qmail + sys-apps/groff + net-mail/queue-repair + ssl? ( dev-libs/openssl ) +" +RDEPEND=" + mailwrapper? ( net-mail/mailwrapper ) + !mailwrapper? ( !virtual/mta ) + sys-apps/ucspi-tcp + sys-process/daemontools + net-mail/dot-forward + !noauthcram? ( + || ( >=net-mail/checkpassword-0.90 >=net-mail/checkpassword-pam-0.99 ) + >=net-mail/cmd5checkpw-0.30 + ) + ${DEPEND} +" +PROVIDE=" + virtual/mta + virtual/mda +" + +# Important: QMAIL_CONF_SPLIT should always be a prime number! +MY_CONF_SPLIT="${QMAIL_CONF_SPLIT:-23}" + +MY_S="${S}/netqmail-${PV}" +QMAIL_SPP_S="${WORKDIR}/qmail-spp-${QMAIL_SPP_PATCH}" +TCPRULES_DIR=/etc/tcprules.d + +if use gencertdaily; then + CRON_FOLDER=cron.daily +else + CRON_FOLDER=cron.hourly +fi + +src_unpack() { + unpack netqmail-${PV}.tar.gz + use qmail-spp && \ + unpack qmail-spp-${QMAIL_SPP_PATCH}.tar.gz + + cd "${S}" + + ./collate.sh || die "patching failed" + + cd "${MY_S}" + + epatch ${FILESDIR}/outgoingip.patch + + if ! use vanilla; then + use ssl && epatch ${DISTDIR}/netqmail-${PV}-tls-smtpauth-${TLS_AUTH_PATCH}.patch + + if use highvolume; then + epatch ${DISTDIR}/big-todo.103.patch + fi + + if use qmail-spp; then + if use ssl; then + epatch ${QMAIL_SPP_S}/qmail-spp-smtpauth-tls-20060105.diff + else + epatch ${QMAIL_SPP_S}/netqmail-spp.diff + fi + fi + fi + + if [[ -n "${QMAIL_PATCH_DIR}" && -d "${QMAIL_PATCH_DIR}" ]] + then + echo + ewarn "You enabled custom patches from ${QMAIL_PATCH_DIR}." + ewarn "Be warned that you won't get any support when using " + ewarn "this feature. You're on your own from now!" + ebeep + epatch "${QMAIL_PATCH_DIR}/"* + echo + fi + + is_prime ${MY_CONF_SPLIT} || die 'QMAIL_CONF_SPLIT is not a prime number.' + einfo "Using conf-split value of ${MY_CONF_SPLIT}." + + # Fix bug #33818 but for netqmail (Bug 137015) + if use noauthcram; then + einfo "Disabling CRAM_MD5 support" + sed -e 's,^#define CRAM_MD5$,/*&*/,' -i ${MY_S}/qmail-smtpd.c + else + einfo "Enabled CRAM_MD5 support" + fi + + ht_fix_file Makefile* + append-ldflags $(bindnow-flags) + + # -DTLS is now set by the SSL/TLS patch + #use ssl && append-flags -DTLS + + # The following commands patch the conf-{cc,ld} files to use the user's + # specified CFLAGS and LDFLAGS. These rather complex commands are needed + # because a user supplied patch might apply changes to these files, too. + # Fixes Bug #165981. + echo "$(head -n 1 "${MY_S}/conf-cc" | sed -e "s#^g\?cc\s\+\(-O2\)\?#$(tc-getCC) #")" \ + "${CFLAGS}" > "${MY_S}/conf-cc.tmp" && + mv "${MY_S}/conf-cc.tmp" "${MY_S}/conf-cc" || die 'Patching conf-cc failed.' + + echo "$(head -n 1 "${MY_S}/conf-ld" | sed -e "s#^g\?cc\s\+\(-s\)\?#$(tc-getCC) #")" \ + "${LDLAGS}" > "${MY_S}/conf-ld.tmp" && + mv "${MY_S}/conf-ld.tmp" "${MY_S}/conf-ld" || die 'Patching conf-ld failed.' + + echo -n "${MY_CONF_SPLIT}" > "${MY_S}/conf-split" +} + +src_compile() { + cd "${MY_S}" + emake it man || die "make failed" +} + +src_install() { + cd "${MY_S}" + + einfo "Setting up directory hierarchy ..." + + diropts -m 755 -o root -g qmail + dodir /var/qmail/{,bin,boot,control} + + keepdir /var/qmail/users + + diropts -m 755 -o alias -g qmail + dodir /var/qmail/alias + + einfo "Installing the qmail software ..." + + insopts -o root -g qmail -m 755 + insinto /var/qmail/boot + doins home home+df proc proc+df binm1 binm1+df binm2 \ + binm2+df binm3 binm3+df + + insinto /var/qmail/bin + + insopts -o qmailq -g qmail -m 4711 + doins qmail-queue + + insopts -o root -g qmail -m 700 + doins qmail-{lspawn,start,newu,newmrh} + + insopts -o root -g qmail -m 711 + doins qmail-{getpw,local,remote,rspawn,clean,send,pw2u} splogger + + insopts -o root -g qmail -m 755 + doins bouncesaying condredirect config-fast datemail elq \ + except forward maildir2mbox maildirmake maildirwatch \ + mailsubj pinq predate preline qail qbiff \ + qmail-{inject,pop3d,popup,qmqpc,qmqpd,qmtpd,qread} \ + qmail-{qstat,showctl,smtpd,tcpok,tcpto} \ + qreceipt qsmhook sendmail tcp-env + + einfo "Installing manpages" + into /usr + doman *.[1-8] + + dodoc BLURB* CHANGES FAQ INSTALL* PIC* README* REMOVE* SECURITY \ + SENDMAIL SYSDEPS TARGETS TEST* THANKS* THOUGHTS TODO* \ + UPGRADE VERSION* + + # use the correct maildirmake + # the courier-imap one has some extensions that are nicer + [[ -e /usr/bin/maildirmake ]] && \ + MAILDIRMAKE="/usr/bin/maildirmake" || \ + MAILDIRMAKE="${D}/var/qmail/bin/maildirmake" + + einfo "Adding env.d entry for qmail" + insopts -m 644 + doenvd ${FILESDIR}/99qmail + + einfo "Creating sendmail replacement ..." + diropts -m 755 + dodir /usr/sbin /usr/lib + + if use mailwrapper + then + insinto /etc/mail + doins ${FILESDIR}/mailer.conf + else + dosym /var/qmail/bin/sendmail /usr/sbin/sendmail + dosym /var/qmail/bin/sendmail /usr/lib/sendmail + fi + + einfo "Setting up the default aliases ..." + diropts -m 700 -o alias -g qmail + ${MAILDIRMAKE} ${D}/var/qmail/alias/.maildir + keepdir /var/qmail/alias/.maildir/{cur,new,tmp} + + for i in /var/qmail/alias/.qmail-{mailer-daemon,postmaster,root} + do + if [[ ! -f ${i} ]]; then + touch ${D}${i} + fowners alias:qmail ${i} + fi + done + + einfo "Setting up maildirs by default in the account skeleton ..." + diropts -m 755 -o root -g root + insinto /etc/skel + newins ${FILESDIR}/dot-qmail .qmail.sample + fperms 644 /etc/skel/.qmail.sample + ${MAILDIRMAKE} ${D}/etc/skel/.maildir + keepdir /etc/skel/.maildir/{cur,new,tmp} + + einfo "Setting up all services (send, smtp, qmtp, qmqp, pop3) ..." + insopts -o root -g root -m 755 + diropts -m 755 -o root -g root + dodir /var/qmail/supervise + + for i in send smtpd qmtpd qmqpd pop3d; do + insopts -o root -g root -m 755 + diropts -m 755 -o root -g root + dodir /var/qmail/supervise/qmail-${i}{,/log} + fperms +t /var/qmail/supervise/qmail-${i}{,/log} + insinto /var/qmail/supervise/qmail-${i} + newins ${FILESDIR}/run-qmail-${i} run + insinto /var/qmail/supervise/qmail-${i}/log + newins ${FILESDIR}/run-qmail-${i}-log run + diropts -m 755 -o qmaill + keepdir /var/log/qmail/qmail-${i} + done + + dodir ${TCPRULES_DIR} + insinto ${TCPRULES_DIR} + newins ${FILESDIR}/tcprules.d-Makefile.qmail Makefile.qmail + for i in smtp qmtp qmqp pop3; do + newins ${FILESDIR}/tcp.${i}.sample tcp.qmail-${i} + done + + einfo "Installing some stock configuration files" + insinto /var/qmail/control + insopts -o root -g root -m 644 + doins ${FILESDIR}/conf-{common,send,qmtpd,qmqpd,pop3d} + newins ${FILESDIR}/conf-smtpd conf-smtpd + newins ${FILESDIR}/dot-qmail defaultdelivery + use ssl && \ + doins ${FILESDIR}/servercert.cnf + + einfo "Configuration sanity checker and launcher" + into /var/qmail + insopts -o root -g root -m 644 + dobin ${FILESDIR}/qmail-config-system + + if use qmail-spp; then + einfo "Installing files for qmail-spp" + insinto /var/qmail/control/ + doins ${QMAIL_SPP_S}/samples/smtpplugins + keepdir /var/qmail/plugins/ + fi + + if use ssl; then + einfo "SSL Certificate creation script" + dobin ${FILESDIR}/mkservercert + einfo "RSA key generation cronjob" + insinto /etc/${CRON_FOLDER} + doins ${FILESDIR}/qmail-genrsacert.sh + chmod +x ${D}/etc/${CRON_FOLDER}/qmail-genrsacert.sh + + # for some files + keepdir /var/qmail/control/tlshosts/ + fi +} + +rootmailfixup() { + # so you can check mail as root easily + local TMPCMD="ln -sf /var/qmail/alias/.maildir/ ${ROOT}/root/.maildir" + if [[ -d "${ROOT}/root/.maildir" && ! -L "${ROOT}/root/.maildir" ]] ; then + elog "Previously the qmail ebuilds created /root/.maildir/ but not" + elog "every mail was delivered there. If the directory does not" + elog "contain any mail, please delete it and run:" + elog "${TMPCMD}" + else + ${TMPCMD} + fi + chown -R alias:qmail ${ROOT}/var/qmail/alias/.maildir 2>/dev/null +} + +buildtcprules() { + for i in smtp qmtp qmqp pop3; do + # please note that we don't check if it exists + # as we want it to make the cdb files anyway! + f=tcp.qmail-${i} + src=${ROOT}${TCPRULES_DIR}/${f} + cdb=${ROOT}${TCPRULES_DIR}/${f}.cdb + tmp=${ROOT}${TCPRULES_DIR}/.${f}.tmp + [[ -e ${src} ]] && tcprules ${cdb} ${tmp} < ${src} + done +} + +pkg_postinst() { + einfo "Setting up the message queue hierarchy ..." + /usr/bin/queue-repair.py \ + --create --split "${MY_CONF_SPLIT}" \ + $(use highvolume && echo '--bigtodo' || echo '--no-bigtodo') \ + ${ROOT}/var/qmail >/dev/null || \ + die 'queue-repair failed' + + rootmailfixup + buildtcprules + + # for good measure + env-update + + elog "To setup qmail to run out-of-the-box on your system, run:" + elog "emerge --config =${CATEGORY}/${PF}" + elog + elog "To start qmail at boot you have to add svscan to your startup" + elog "and create the following links:" + elog "ln -s /var/qmail/supervise/qmail-send /service/qmail-send" + elog "ln -s /var/qmail/supervise/qmail-smtpd /service/qmail-smtpd" + elog + elog "To start the pop3 server as well, create the following link:" + elog "ln -s /var/qmail/supervise/qmail-pop3d /service/qmail-pop3d" + elog + elog "Additionally, the QMTP and QMQP protocols are supported, " + elog "and can be started as:" + elog "ln -s /var/qmail/supervise/qmail-qmtpd /service/qmail-qmtpd" + elog "ln -s /var/qmail/supervise/qmail-qmqpd /service/qmail-qmqpd" + elog + elog "Additionally, if you wish to run qmail right now, you should " + elog "run this before anything else:" + elog "source /etc/profile" + elog + elog "If you are looking for documentation, check those links:" + elog "http://www.gentoo.org/doc/en/qmail-howto.xml" + elog " -- qmail/vpopmail Virtual Mail Hosting System Guide" + elog "http://www.lifewithqmail.com/" + elog " -- Life with qmail" +} + +pkg_preinst() { + mkdir -p ${TCPRULES_DIR} + for proto in smtp qmtp qmqp pop3; do + for ext in '' .cdb; do + old="/etc/tcp.${proto}${ext}" + new="${TCPRULES_DIR}/tcp.qmail-${proto}${ext}" + fail=0 + if [[ -f "$old" && ! -f "$new" ]]; then + einfo "Moving $old to $new" + cp $old $new || fail=1 + else + fail=1 + fi + if [[ "${fail}" = 1 && -f ${old} ]]; then + eerror "Error moving $old to $new, be sure to check the" + eerror "configuration! You may have already moved the files," + eerror "in which case you can delete $old" + fi + done + done +} + +# Candidate for eclass +pkg_setup() { + # keep in sync with mini-qmail pkg + einfo "Creating groups and users" + enewgroup qmail 201 + enewuser alias 200 -1 /var/qmail/alias 200 + enewuser qmaild 201 -1 /var/qmail 200 + enewuser qmaill 202 -1 /var/qmail 200 + enewuser qmailp 203 -1 /var/qmail 200 + enewuser qmailq 204 -1 /var/qmail 201 + enewuser qmailr 205 -1 /var/qmail 201 + enewuser qmails 206 -1 /var/qmail 201 +} + +pkg_config() { + # avoid some weird locale problems + export LC_ALL=C + + if [[ ${ROOT} = / ]] ; then + if [[ ! -f ${ROOT}var/qmail/control/me ]] ; then + export qhost=$(hostname --fqdn) + ${ROOT}var/qmail/bin/config-fast $qhost + fi + else + ewarn "Skipping some configuration as it MUST be run on the final host" + fi + + einfo "Accepting relaying by default from all ips configured on this machine." + LOCALIPS=$(/sbin/ifconfig | grep inet | cut -d' ' -f 12 -s | cut -b 6-20) + TCPSTRING=":allow,RELAYCLIENT=\"\",RBLSMTPD=\"\"" + for ip in $LOCALIPS; do + myline="${ip}${TCPSTRING}" + for proto in smtp qmtp qmqp; do + f="${ROOT}${TCPRULES_DIR}/tcp.qmail-${proto}" + egrep -q "${myline}" ${f} || echo "${myline}" >>${f} + done + done + + buildtcprules + + if use ssl; then + ebegin "Generating RSA keys for SSL/TLS, this can take some time" + ${ROOT}/etc/${CRON_FOLDER}/qmail-genrsacert.sh + eend $? + einfo "Creating a self-signed ssl-certificate:" + ${ROOT}/var/qmail/bin/mkservercert + einfo "If you want to have a properly signed certificate " + einfo "instead, do the following:" + # space at the end of the string because of the current implementation + # of einfo + einfo "openssl req -new -nodes -out req.pem \\ " + einfo " -config /var/qmail/control/servercert.cnf \\ " + einfo " -keyout /var/qmail/control/servercert.pem" + einfo "Send req.pem to your CA to obtain signed_req.pem, and do:" + einfo "cat signed_req.pem >> /var/qmail/control/servercert.pem" + fi +} + +# --- TODO: The following code can be moved to prime.eclass -- +# Original Author: Michael Hanselmann +# Purpose: Functions for prime numbers + +# Prints a list of primes between min and max inclusive +# +# Note: this functions gets very slow when used with large numbers. +# +# Syntax: primes +primes() { + local min=${1} max=${2} + local result= primelist=2 i p + + [[ ${min} -le 2 ]] && result="${result} 2" + + for ((i = 3; i <= max; i += 2)) + do + for p in ${primelist} + do + [[ $[i % p] == 0 || $[p * p] -gt ${i} ]] && \ + break + done + if [[ $[i % p] != 0 ]] + then + primelist="${primelist} ${i}" + [[ ${i} -ge ${min} ]] && \ + result="${result} ${i}" + fi + done + + echo ${result} +} + +# Checks wether a number is a prime number +# +# Syntax: is_prime +is_prime() { + local number=${1} i + for i in $(primes ${number} ${number}) + do + [[ ${i} == ${number} ]] && return 0 + done + return 1 +} +# --- end of prime.eclass --- -- cgit v1.2.3