Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opendbx support #9

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 37 additions & 2 deletions Dockerfile.tmpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<? } ?>

ARG opendkim_ver=<?= explode('-', $var['version'])[0].'-'.explode('-', $var['version'])[1]."\n"; ?>
ARG opendbx_ver=1.4.6
ARG s6_overlay_ver=3.1.5.0


Expand All @@ -34,17 +35,19 @@
<? } ?>
&& update-ca-certificates \
\
# Install OpenDKIM dependencies
# Install OpenDKIM and OpenDBX dependencies
<? if ($isAlpineImage) { ?>
&& apk add --no-cache --force \
libcrypto3 libssl3 \
libmilter \
libpq mariadb-connector-c sqlite-libs \
# Perl and OpenSSL required for opendkim-* utilities
openssl perl \
<? } else { ?>
&& apt-get install -y --no-install-recommends --no-install-suggests \
libssl1.1 \
libmilter1.0.1 \
libmariadb3 libpq5 libsqlite3-0 \
libbsd0 \
<? } ?>
\
Expand All @@ -60,21 +63,50 @@
$toolDeps \
<? } ?>
\
# Install OpenDKIM build dependencies
# Install OpenDKIM and OpenDBX build dependencies
<? if ($isAlpineImage) { ?>
&& apk add --no-cache --virtual .build-deps \
openssl-dev \
libmilter-dev \
db-dev mariadb-connector-c-dev postgresql-dev sqlite-dev readline-dev \
<? } else { ?>
&& buildDeps=" \
libssl-dev \
libmilter-dev \
libbsd-dev \
libdb-dev libmariadb-dev libmariadb-dev-compat libpq-dev \
libsqlite3-dev libreadline-dev \
" \
&& apt-get install -y --no-install-recommends --no-install-suggests \
$buildDeps \
<? } ?>
\
# Download and prepare OpenDBX sources
&& curl -fL -o /tmp/opendbx.tar.gz \
https://linuxnetworks.de/opendbx/download/opendbx-${opendbx_ver}.tar.gz \
&& tar -xzf /tmp/opendbx.tar.gz -C /tmp/ \
&& cd /tmp/opendbx-* \
\
# Build OpenDBX from sources
&& CXXFLAGS="-std=c++14" \
CPPFLAGS="-I/usr/include/mysql -I/usr/include/postgresql" \
./configure \
--prefix=/usr \
--disable-static \
--with-backends="mysql pgsql sqlite3" \
# No documentation included to keep image size smaller
--docdir=/tmp/opendbx/doc \
--htmldir=/tmp/opendbx/html \
--infodir=/tmp/opendbx/info \
--mandir=/tmp/opendbx/man \
&& make \
\
# Install OpenDBX
&& make install \
# Preserve license
&& install -d /usr/share/licenses/opendbx/ \
&& mv COPYING /usr/share/licenses/opendbx/ \
\
# Download and prepare OpenDKIM sources
&& curl -fL -o /tmp/opendkim.tar.gz \
https://github.com/trusteddomainproject/OpenDKIM/archive/refs/tags/${opendkim_ver}.tar.gz \
Expand All @@ -86,6 +118,9 @@
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendkim \
--with-odbx \
--with-openssl \
--with-sql-backend \
# No documentation included to keep image size smaller
--docdir=/tmp/opendkim/doc \
--htmldir=/tmp/opendkim/html \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ endif
node_modules/.bin/bats \
--timing $(if $(call eq,$(CI),),--pretty,--formatter tap) \
--print-output-on-failure \
tests/main.bats
tests/*.bats



Expand Down
36 changes: 34 additions & 2 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
FROM alpine:3.18

ARG opendkim_ver=2.11.0-Beta2
ARG opendbx_ver=1.4.6
ARG s6_overlay_ver=3.1.5.0


Expand All @@ -16,21 +17,49 @@ RUN apk update \
ca-certificates \
&& update-ca-certificates \
\
# Install OpenDKIM dependencies
# Install OpenDKIM and OpenDBX dependencies
&& apk add --no-cache --force \
libcrypto3 libssl3 \
libmilter \
libpq mariadb-connector-c sqlite-libs \
# Perl and OpenSSL required for opendkim-* utilities
openssl perl \
\
# Install tools for building
&& apk add --no-cache --virtual .tool-deps \
autoconf automake curl g++ libtool make \
\
# Install OpenDKIM build dependencies
# Install OpenDKIM and OpenDBX build dependencies
&& apk add --no-cache --virtual .build-deps \
openssl-dev \
libmilter-dev \
db-dev mariadb-connector-c-dev postgresql-dev sqlite-dev readline-dev \
\
# Download and prepare OpenDBX sources
&& curl -fL -o /tmp/opendbx.tar.gz \
https://linuxnetworks.de/opendbx/download/opendbx-${opendbx_ver}.tar.gz \
&& tar -xzf /tmp/opendbx.tar.gz -C /tmp/ \
&& cd /tmp/opendbx-* \
\
# Build OpenDBX from sources
&& CXXFLAGS="-std=c++14" \
CPPFLAGS="-I/usr/include/mysql -I/usr/include/postgresql" \
./configure \
--prefix=/usr \
--disable-static \
--with-backends="mysql pgsql sqlite3" \
# No documentation included to keep image size smaller
--docdir=/tmp/opendbx/doc \
--htmldir=/tmp/opendbx/html \
--infodir=/tmp/opendbx/info \
--mandir=/tmp/opendbx/man \
&& make \
\
# Install OpenDBX
&& make install \
# Preserve license
&& install -d /usr/share/licenses/opendbx/ \
&& mv COPYING /usr/share/licenses/opendbx/ \
\
# Download and prepare OpenDKIM sources
&& curl -fL -o /tmp/opendkim.tar.gz \
Expand All @@ -43,6 +72,9 @@ RUN apk update \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendkim \
--with-odbx \
--with-openssl \
--with-sql-backend \
# No documentation included to keep image size smaller
--docdir=/tmp/opendkim/doc \
--htmldir=/tmp/opendkim/html \
Expand Down
37 changes: 35 additions & 2 deletions debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
FROM debian:bullseye-slim

ARG opendkim_ver=2.11.0-Beta2
ARG opendbx_ver=1.4.6
ARG s6_overlay_ver=3.1.5.0


Expand All @@ -16,10 +17,11 @@ RUN apt-get update \
ca-certificates \
&& update-ca-certificates \
\
# Install OpenDKIM dependencies
# Install OpenDKIM and OpenDBX dependencies
&& apt-get install -y --no-install-recommends --no-install-suggests \
libssl1.1 \
libmilter1.0.1 \
libmariadb3 libpq5 libsqlite3-0 \
libbsd0 \
\
# Install tools for building
Expand All @@ -29,15 +31,43 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
$toolDeps \
\
# Install OpenDKIM build dependencies
# Install OpenDKIM and OpenDBX build dependencies
&& buildDeps=" \
libssl-dev \
libmilter-dev \
libbsd-dev \
libdb-dev libmariadb-dev libmariadb-dev-compat libpq-dev \
libsqlite3-dev libreadline-dev \
" \
&& apt-get install -y --no-install-recommends --no-install-suggests \
$buildDeps \
\
# Download and prepare OpenDBX sources
&& curl -fL -o /tmp/opendbx.tar.gz \
https://linuxnetworks.de/opendbx/download/opendbx-${opendbx_ver}.tar.gz \
&& tar -xzf /tmp/opendbx.tar.gz -C /tmp/ \
&& cd /tmp/opendbx-* \
\
# Build OpenDBX from sources
&& CXXFLAGS="-std=c++14" \
CPPFLAGS="-I/usr/include/mysql -I/usr/include/postgresql" \
./configure \
--prefix=/usr \
--disable-static \
--with-backends="mysql pgsql sqlite3" \
# No documentation included to keep image size smaller
--docdir=/tmp/opendbx/doc \
--htmldir=/tmp/opendbx/html \
--infodir=/tmp/opendbx/info \
--mandir=/tmp/opendbx/man \
&& make \
\
# Install OpenDBX
&& make install \
# Preserve license
&& install -d /usr/share/licenses/opendbx/ \
&& mv COPYING /usr/share/licenses/opendbx/ \
\
# Download and prepare OpenDKIM sources
&& curl -fL -o /tmp/opendkim.tar.gz \
https://github.com/trusteddomainproject/OpenDKIM/archive/refs/tags/${opendkim_ver}.tar.gz \
Expand All @@ -49,6 +79,9 @@ RUN apt-get update \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc/opendkim \
--with-odbx \
--with-openssl \
--with-sql-backend \
# No documentation included to keep image size smaller
--docdir=/tmp/opendkim/doc \
--htmldir=/tmp/opendkim/html \
Expand Down
7 changes: 7 additions & 0 deletions tests/main.bats
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
[ "$actual" == "$expected" ]
}

@test "opendkim: uses OpenDBX" {
run docker run --rm --pull never --entrypoint sh $IMAGE -c \
"opendkim -V | grep 'USE_ODBX'"
[ "$status" -eq 0 ]
[ "$output" != '' ]
}

@test "opendkim-genkey: runs ok" {
run docker run --rm --pull never --entrypoint sh $IMAGE -c \
'opendkim-genkey && [ -f default.private ] && [ -f default.txt ]'
Expand Down
Loading