~mapperr/dockerfiles

b2372951e110babc407ca5181b1680345c1f37d1 — mapperr 3 years ago 4012f3e
Fix davmail ssl
6 files changed, 59 insertions(+), 15 deletions(-)

M davmail/Dockerfile -rw-r--r-- => -rwxr-xr-x
A davmail/build.sh
M davmail/entrypoint.sh
A davmail/run.sh
M soju/Dockerfile -rw-r--r-- => -rwxr-xr-x
M soju/README.md -rw-r--r-- => -rwxr-xr-x
M davmail/Dockerfile => davmail/Dockerfile +3 -3
@@ 1,6 1,6 @@
FROM openjdk:14
RUN yum update && \
    yum install -y unzip && \
FROM openjdk:14-alpine
RUN apk update && \
    apk add curl unzip && \
    curl -L -o /davmail-5.5.1-3299.zip https://sourceforge.net/projects/davmail/files/davmail/5.5.1/davmail-5.5.1-3299.zip && \
    unzip -d /davmail /davmail-5.5.1-3299.zip && \
    rm -f /davmail-5.5.1-3299.zip

A davmail/build.sh => davmail/build.sh +4 -0
@@ 0,0 1,4 @@
#! /bin/sh

docker build -t mapperr/davmail .


M davmail/entrypoint.sh => davmail/entrypoint.sh +21 -12
@@ 1,26 1,35 @@
#! /bin/sh

PASS=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo ''`
certfile="/cert/davmail.p12"
passfile="/cert/davmail.p12.pass"

keytool -genkey -keyalg rsa \
    -keysize 4096 \
    -storepass $PASS \
    -keystore /davmail.p12 \
    -storetype pkcs12 \
    -validity 36000 \
    -dname cn=davmail
if [ -f "$certfile" ] && [ -f "$passfile" ]; then
    certpass=`cat $passfile`

else
    certpass=`head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16 ; echo ''`
    echo "$certpass" > "$passfile"

    keytool -genkey -keyalg rsa \
        -keysize 4096 \
        -storepass $certpass \
        -keystore $certfile \
        -storetype pkcs12 \
        -validity 36000 \
        -dname cn=davmail
fi

echo "certificate fingerprint:"
keytool -list -keystore /davmail.p12 -storepass $PASS -v | grep SHA
keytool -list -keystore $certfile -storepass $certpass -v | grep SHA

test -r /davmail.properties && cp /davmail.properties dm.properties

cat <<EOF >> /dm.properties

davmail.ssl.keystoreType=PKCS12
davmail.ssl.keyPass=$PASS
davmail.ssl.keystoreFile=/davmail.p12
davmail.ssl.keystorePass=$PASS
davmail.ssl.keyPass=$certpass
davmail.ssl.keystoreFile=$certfile
davmail.ssl.keystorePass=$certpass
EOF

/davmail/davmail /dm.properties

A davmail/run.sh => davmail/run.sh +31 -0
@@ 0,0 1,31 @@
#! /bin/sh

# taken from gradlew
PRG="$0"
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
SCRIPTDIR="`pwd -P`"

IMAGE="mapperr/davmail"
CONTNAME="davmail"

docker run -d \
--name ${CONTNAME} \
--restart always \
-p 40143:1143 \
-p 40025:1025 \
-p 40080:1080 \
-v ${SCRIPTDIR}/cert:/cert \
-v ${SCRIPTDIR}/davmail.properties:/davmail.properties \
${IMAGE}



M soju/Dockerfile => soju/Dockerfile +0 -0
M soju/README.md => soju/README.md +0 -0