Archived
mmc-agent
This commit is contained in:
1 parent
f689d38735
commit
234448a2f6
7 files changed
+99
-20
No files matched your search
+16
-4
@@ -25,14 +25,17 @@ RUN /sbin/enable-service dnsmasq
|
|||||||
# Use baseimage-docker's init system.
|
# Use baseimage-docker's init system.
|
||||||
CMD ["/sbin/my_init"]
|
CMD ["/sbin/my_init"]
|
||||||
|
|
||||||
|
# Add Mandriva MDS repository
|
||||||
|
RUN echo "deb http://mds.mandriva.org/pub/mds/debian wheezy main" >> /etc/apt/sources.list
|
||||||
|
|
||||||
# Resynchronize the package index files from their sources
|
# Resynchronize the package index files from their sources
|
||||||
RUN apt-get -y update
|
RUN apt-get -y update
|
||||||
|
|
||||||
# Install openldap (slapd) and ldap-utils
|
# Install openldap (slapd),ldap-utils and mmc tools
|
||||||
RUN LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends mmc-agent slapd ldap-utils
|
RUN LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends mmc-agent python-mmc-mail slapd ldap-utils
|
||||||
|
|
||||||
# Expose ldap default port
|
# Expose ldap and mmc-agent default ports
|
||||||
EXPOSE 389
|
EXPOSE 389 7080
|
||||||
|
|
||||||
# Create TLS certificats directory
|
# Create TLS certificats directory
|
||||||
RUN mkdir /etc/ldap/ssl
|
RUN mkdir /etc/ldap/ssl
|
||||||
@@ -40,6 +43,15 @@ RUN mkdir /etc/ldap/ssl
|
|||||||
# Add config directory
|
# Add config directory
|
||||||
RUN mkdir /etc/ldap/config
|
RUN mkdir /etc/ldap/config
|
||||||
ADD service/slapd/config /etc/ldap/config
|
ADD service/slapd/config /etc/ldap/config
|
||||||
|
ADD service/mmc-agent/assets /etc/ldap/config
|
||||||
|
|
||||||
|
# mmc-agent config on container start
|
||||||
|
RUN mkdir -p /etc/my_init.d
|
||||||
|
ADD service/mmc-agent/install.sh /etc/my_init.d/mmc-agent.sh
|
||||||
|
|
||||||
|
# Add mmc-agent deamon
|
||||||
|
RUN mkdir /etc/service/mmc-agent
|
||||||
|
ADD service/mmc-agent/mmc-agent.sh /etc/service/mmc-agent/run
|
||||||
|
|
||||||
# Add slapd deamon
|
# Add slapd deamon
|
||||||
RUN mkdir /etc/service/slapd
|
RUN mkdir /etc/service/slapd
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# copy mds ldap schema
|
|
||||||
cp /usr/share/doc/python-mmc-base/contrib/ldap/mmc.schema /etc/ldap/schema/
|
|
||||||
cp /usr/share/doc/python-mmc-base/contrib/ldap/mail.schema /etc/ldap/schema/
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[userdefault]
|
||||||
|
mailbox = /home/vmail/%uid%/
|
||||||
|
mailuserquota = 204800
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
include /etc/ldap/schema/core.schema
|
||||||
|
include /etc/ldap/schema/cosine.schema
|
||||||
|
include /etc/ldap/schema/nis.schema
|
||||||
|
include /etc/ldap/schema/inetorgperson.schema
|
||||||
|
include /usr/share/doc/mmc/contrib/base/mmc.schema
|
||||||
|
include /usr/share/doc/mmc/contrib/mail/mail.schema
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -e Exit immediately if a command exits with a non-zero status
|
||||||
|
set -e
|
||||||
|
|
||||||
|
WITH_MMC_AGENT=${WITH_MMC_AGENT}
|
||||||
|
LDAP_DOMAIN=${LDAP_DOMAIN}
|
||||||
|
LDAP_ADMIN_PWD=${LDAP_ADMIN_PWD}
|
||||||
|
|
||||||
|
if [ "$WITH_MMC_AGENT" = true ]; then
|
||||||
|
|
||||||
|
mkdir -p /etc/ldap/schema/converted
|
||||||
|
slaptest -f /etc/ldap/config/convert_to_ldif -F /etc/ldap/schema/converted
|
||||||
|
|
||||||
|
sed -i -e 's/^dn:.*$/dn: cn=mmc,cn=schema,cn=config/; s/^cn:.*$/cn: mmc/; /^structuralObjectClass:.*$/d; /^entryUUID:.*$/d; /^creatorsName:.*$/d; /^createTimestamp:.*$/d; /^entryCSN:.*$/d; /^modifiersName:.*$/d; /^modifyTimestamp:.*$/d' /etc/ldap/schema/converted/cn\=config/cn\=schema/cn=\{4\}mmc.ldif
|
||||||
|
|
||||||
|
sed -i -e 's/^dn:.*$/dn: cn=mail,cn=schema,cn=config/; s/^cn:.*$/cn: mail/; /^structuralObjectClass:.*$/d; /^entryUUID:.*$/d; /^creatorsName:.*$/d; /^createTimestamp:.*$/d; /^entryCSN:.*$/d; /^modifiersName:.*$/d; /^modifyTimestamp:.*$/d' /etc/ldap/schema/converted/cn\=config/cn\=schema/cn=\{5\}mail.ldif
|
||||||
|
|
||||||
|
# Base config
|
||||||
|
getBaseDn () {
|
||||||
|
IFS="."
|
||||||
|
export IFS
|
||||||
|
|
||||||
|
domain=$1
|
||||||
|
init=1
|
||||||
|
|
||||||
|
for s in $domain; do
|
||||||
|
dc="dc=$s"
|
||||||
|
if [ "$init" -eq 1 ]; then
|
||||||
|
baseDn=$dc
|
||||||
|
init=0
|
||||||
|
else
|
||||||
|
baseDn="$baseDn,$dc"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get base dn from ldap domain
|
||||||
|
getBaseDn ${LDAP_DOMAIN}
|
||||||
|
|
||||||
|
sed -i -e "s/dc=mandriva, dc=com/$baseDn/" /etc/mmc/plugins/base.ini
|
||||||
|
sed -i -e "s/password = secret/password = $LDAP_ADMIN_PWD/" /etc/mmc/plugins/base.ini
|
||||||
|
|
||||||
|
mkdir /home/archives
|
||||||
|
|
||||||
|
# Mail plugin
|
||||||
|
sed -i -e 's/vDomainSupport = 0/vDomainSupport = 1/g' /etc/mmc/plugins/mail.ini
|
||||||
|
sed -i -e 's/vAliasesSupport = 0/vAliasesSupport = 1/g' /etc/mmc/plugins/mail.ini
|
||||||
|
cat /etc/ldap/config/append_to_mail.ini >> /etc/mmc/plugins/mail.ini
|
||||||
|
|
||||||
|
fi
|
||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# -e Exit immediately if a command exits with a non-zero status
|
||||||
|
set -e
|
||||||
|
|
||||||
|
WITH_MMC_AGENT=${WITH_MMC_AGENT}
|
||||||
|
|
||||||
|
if [ "$WITH_MMC_AGENT" = true ]; then
|
||||||
|
|
||||||
|
if [ -e /etc/ldap/config/docker_bootstrapped ]; then
|
||||||
|
exec /usr/sbin/mmc-agent -d
|
||||||
|
else
|
||||||
|
sleep 3s
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
sleep 1d
|
||||||
|
fi
|
||||||
@@ -49,16 +49,13 @@ if [ ! -e /etc/ldap/config/docker_bootstrapped ]; then
|
|||||||
slapd -h "ldapi:///" -u openldap -g openldap
|
slapd -h "ldapi:///" -u openldap -g openldap
|
||||||
chown -R openldap:openldap /etc/ldap
|
chown -R openldap:openldap /etc/ldap
|
||||||
|
|
||||||
# Add mds ldap schema
|
if [ "$WITH_MMC_AGENT" = true ]; then
|
||||||
cp /usr/share/doc/mmc/contrib/base/mmc.schema /etc/ldap/schema/
|
|
||||||
cp /usr/share/doc/mmc/contrib/mail/mail.schema /etc/ldap/schema/
|
|
||||||
|
|
||||||
echo "include /etc/ldap/schema/mmc.schema" >> convert_schemas
|
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/converted/cn\=config/cn\=schema/cn=\{4\}mmc.ldif -Q
|
||||||
echo "include /etc/ldap/schema/mail.schema" >> convert_schemas
|
ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/ldap/schema/converted/cn\=config/cn\=schema/cn=\{5\}mail.ldif -Q
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
slaptest -f convert_schemas
|
|
||||||
ldapadd -Y EXTERNAL -H ldapi:/// -f cn\=config/cn\=schema/cn\=\{0\}mmc.ldif
|
|
||||||
ldapadd -Y EXTERNAL -H ldapi:/// -f cn\=config/cn\=schema/cn\=\{0\}mail.ldif
|
|
||||||
|
|
||||||
# TLS
|
# TLS
|
||||||
if [ -e /etc/ldap/ssl/ldap.crt ] && [ -e /etc/ldap/ssl/ldap.key ] && [ -e /etc/ldap/ssl/ca.crt ]; then
|
if [ -e /etc/ldap/ssl/ldap.crt ] && [ -e /etc/ldap/ssl/ldap.key ] && [ -e /etc/ldap/ssl/ca.crt ]; then
|
||||||
@@ -98,4 +95,4 @@ status "starting slapd on default port 389"
|
|||||||
set -x
|
set -x
|
||||||
#with debug:
|
#with debug:
|
||||||
#exec /usr/sbin/slapd -h "ldap:///" -u openldap -g openldap -d -1
|
#exec /usr/sbin/slapd -h "ldap:///" -u openldap -g openldap -d -1
|
||||||
exec /usr/sbin/slapd -h "ldap:///" -u openldap -g openldap
|
exec /usr/sbin/slapd -h "ldap:///" -u openldap -g openldap -d -0
|
||||||
Reference in new issue
Block a user