1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2026-03-22 18:47:23 +01:00

working dockerization

This commit is contained in:
Christian Ertler
2015-02-22 11:36:10 +01:00
parent cf4b05c0a5
commit dfe5d2781d
23 changed files with 299 additions and 95 deletions

View File

@@ -0,0 +1,15 @@
#!/bin/bash
# for a chrooted server: "-u bind -t /var/lib/named"
# Don't modify this line, change or create /etc/default/bind9.
OPTIONS=""
RESOLVCONF=no
test -f /etc/default/bind9 && . /etc/default/bind9
# dirs under /var/run can go away on reboots.
mkdir -p /var/run/named
chmod 775 /var/run/named
chown root:bind /var/run/named >/dev/null 2>&1 || true
exec named -f $OPTIONS 2>&1

View File

@@ -1,3 +1,3 @@
#!/bin/bash
/usr/sbin/dovecot -F -c /etc/dovecot/dovecot.conf &> /var/log/dovecot.log
exec /usr/sbin/dovecot -F -c /etc/dovecot/dovecot.conf &> /var/log/dovecot.log

View File

@@ -0,0 +1,21 @@
#!/bin/bash
NAME=fail2ban
DAEMON=/usr/bin/$NAME-server
# Ad-hoc way to parse out socket file name
SOCKFILE=`grep -h '^[^#]*socket *=' /etc/$NAME/$NAME.conf /etc/$NAME/$NAME.local 2>/dev/null \
| tail -n 1 | sed -e 's/.*socket *= *//g' -e 's/ *$//g'`
[ -z "$SOCKFILE" ] && SOCKFILE='/tmp/fail2ban.sock'
# Assure that /var/run/fail2ban exists
[ -d /var/run/fail2ban ] || mkdir -p /var/run/fail2ban
# Run as root by default.
FAIL2BAN_USER=root
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
DAEMON_ARGS="$FAIL2BAN_OPTS"
exec $DAEMON -f $DAEMON_ARGS 2>&1

View File

@@ -0,0 +1,14 @@
#!/bin/bash
NAME=mailinabox
DAEMON=/usr/local/bin/mailinabox-daemon
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
exec $DAEMON 2>&1

View File

@@ -0,0 +1,3 @@
#!/bin/sh
exec /sbin/setuser memcache /usr/bin/memcached >>/var/log/memcached.log 2>&1

View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec /usr/sbin/nginx -c /etc/nginx/nginx.conf -g "daemon off;" 2>&1

View File

@@ -0,0 +1,15 @@
#!/bin/bash
NAME=nsd
DAEMON=/usr/sbin/$NAME
CONFFILE=/etc/nsd/nsd.conf
DAEMON_ARGS="-d -c $CONFFILE"
# reconfigure since the ip may have changed
# if it fails runit will retry anyway, but
# don't do this on first start
if [ -f /var/lib/mailinabox/api.key ]; then
/usr/local/mailinabox/tools/dns_update
fi
exec $DAEMON $DAEMON_ARGS 2>&1

View File

@@ -0,0 +1,25 @@
#!/bin/bash
DAEMON=/usr/sbin/opendkim
NAME=opendkim
USER=opendkim
RUNDIR=/var/run/$NAME
SOCKET=local:$RUNDIR/$NAME.sock
# Include opendkim defaults if available
if [ -f /etc/default/opendkim ] ; then
. /etc/default/opendkim
fi
if [ -f /etc/opendkim.conf ]; then
CONFIG_SOCKET=`awk '$1 == "Socket" { print $2 }' /etc/opendkim.conf`
fi
# This can be set via Socket option in config file, so it's not required
if [ -n "$SOCKET" -a -z "$CONFIG_SOCKET" ]; then
DAEMON_OPTS="-p $SOCKET $DAEMON_OPTS"
fi
DAEMON_OPTS="-f -x /etc/opendkim.conf -u $USER $DAEMON_OPTS"
exec $DAEMON $DAEMON_OPTS 2>&1

View File

@@ -0,0 +1,25 @@
#!/bin/sh
DAEMON=/usr/sbin/opendmarc
NAME=opendmarc
USER=opendmarc
RUNDIR=/var/run/$NAME
SOCKET=local:$RUNDIR/$NAME.sock
# Include opendkim defaults if available
if [ -f /etc/default/opendmarc ] ; then
. /etc/default/opendmarc
fi
if [ -f /etc/opendmarc.conf ]; then
CONFIG_SOCKET=`awk '$1 == "Socket" { print $2 }' /etc/opendmarc.conf`
fi
# This can be set via Socket option in config file, so it's not required
if [ -n "$SOCKET" -a -z "$CONFIG_SOCKET" ]; then
DAEMON_OPTS="-p $SOCKET $DAEMON_OPTS"
fi
DAEMON_OPTS="-f -c /etc/opendmarc.conf -u $USER $DAEMON_OPTS"
exec $DAEMON $DAEMON_OPTS 2>&1

View File

@@ -0,0 +1,10 @@
#!/bin/bash
NAME=php5-fpm
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS="--fpm-config /etc/php5/fpm/php-fpm.conf -F"
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
exec $DAEMON $DAEMON_ARGS 2>&1

View File

@@ -0,0 +1,12 @@
#!/bin/bash
exec 1>&2
test -f /etc/default/postfix && . /etc/default/postfix
command_directory=`postconf -h command_directory`
daemon_directory=`$command_directory/postconf -h daemon_directory`
# make consistency check
$command_directory/postfix check 2>&1
# run Postfix
exec $daemon_directory/master 2>&1

View File

@@ -0,0 +1,9 @@
#!/bin/bash
# Read config file if it is present.
if [ -r /etc/default/postgrey ]
then
. /etc/default/postgrey
fi
exec /usr/sbin/postgrey $POSTGREY_OPTS 2>&1

View File

@@ -0,0 +1,3 @@
#!/bin/bash
exec rsyslogd -n 2>&1

View File

@@ -1,3 +0,0 @@
#!/bin/bash
rsyslogd -n

View File

@@ -0,0 +1,60 @@
#!/bin/bash
NAME='spampd'
PROGRAM=/usr/sbin/spampd
if [ -f /etc/default/$NAME ]; then
. /etc/default/$NAME
fi
istrue () {
ANS=$(echo $1 | tr A-Z a-z)
[ "$ANS" = 'yes' -o "$ANS" = 'true' -o "$ANS" = 'enable' -o "$ANS" = '1' ]
}
#
# Calculate final commandline
#
S_TAGALL=''
S_AWL=''
S_LOCALONLY=''
istrue "$TAGALL" \
&& S_TAGALL='--tagall'
istrue "$AUTOWHITELIST" \
&& S_AWL='--auto-whitelist'
istrue "$LOCALONLY" \
&& S_LOCALONLY='--L'
istrue "$LOGINET" \
&& LOGTARGET="inet" \
|| LOGTARGET="unix"
ARGS="${S_LOCALONLY} ${S_AWL} ${S_TAGALL} "
[ -n "${LISTENPORT}" ] && ARGS="${ARGS} --port=${LISTENPORT}"
[ -n "${LISTENHOST}" ] && ARGS="${ARGS} --host=${LISTENHOST}"
[ -n "${DESTPORT}" ] && ARGS="${ARGS} --relayport=${DESTPORT}"
[ -n "${DESTHOST}" ] && ARGS="${ARGS} --relayhost=${DESTHOST}"
[ -n "${PIDFILE}" ] && ARGS="${ARGS} --pid=${PIDFILE}"
[ -n "${CHILDREN}" ] && ARGS="${ARGS} --children=${CHILDREN}"
[ -n "${USERID}" ] && ARGS="${ARGS} --user=${USERID}"
[ -n "${GRPID}" ] && ARGS="${ARGS} --group=${GRPID}"
[ -n "${LOGTARGET}" ] && ARGS="${ARGS} --logsock=${LOGTARGET}"
[ -n "${ADDOPTS}" ] && ARGS="${ARGS} ${ADDOPTS}"
# Don't daemonize
ARGS="${ARGS} --nodetach"
exec $PROGRAM $ARGS 2>&1