Skip to content

Commit

Permalink
Update postfixadmin 3.3.4, update alpine:3.13 and php8 (#9)
Browse files Browse the repository at this point in the history
* update to alpine:3.13 and php8

* update postfixadmin to 3.3.4

* install new dependency: php8-pdo, php8-pdo_pgsql and php8-pdo_mysql

* temporary workaround for doveadm pw reading server.key.
See also postfixadmin/postfixadmin#398.

* run upgrade.php at start

* Update HASH lenght check. The HASH generated by setup.php is now 60 characters long.
  • Loading branch information
SaraSmiseth authored Jan 24, 2021
1 parent a5cabda commit ec0f9e7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
28 changes: 16 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
FROM alpine:3.12
FROM alpine:3.13

LABEL description="PostfixAdmin is a web based interface used to manage mailboxes" \
maintainer="Hardware <[email protected]>"

ARG VERSION=3.2.4
ARG SHA256_HASH="f61a64b32052c46f40cba466e5e384de0efab8c343c91569bcc5ebfd3694811e"
ARG VERSION=3.3.4
ARG SHA256_HASH="8720ab6945d6526abffb18e8c5cb0f33a4fe884aa03749d55f0707e45f92b7eb"

RUN set -eux; \
apk add --no-cache \
su-exec \
dovecot \
tini \
\
php7 \
php7-fpm \
php7-imap \
php7-mbstring \
php7-mysqli \
php7-pgsql \
php7-phar \
php7-session \
php8 \
php8-fpm \
php8-imap \
php8-mbstring \
php8-mysqli \
php8-pdo \
php8-pdo_mysql \
php8-pdo_pgsql \
php8-pgsql \
php8-phar \
php8-session \
; \
\
PFA_TARBALL="postfixadmin-${VERSION}.tar.gz"; \
Expand All @@ -28,7 +31,8 @@ RUN set -eux; \
\
mkdir /postfixadmin; \
tar -xzf ${PFA_TARBALL} --strip-components=1 -C /postfixadmin; \
rm -f ${PFA_TARBALL}
rm -f ${PFA_TARBALL}; \
chmod 644 /etc/ssl/dovecot/server.key

COPY bin /usr/local/bin
RUN chmod +x /usr/local/bin/*
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

![postfixadmin](http://i.imgur.com/UCtvKHR.png "postfixadmin")

### What is this ?
### What is this?

PostfixAdmin is a web based interface used to manage mailboxes, virtual domains and aliases. It also features support for vacation/out-of-the-office messages.

### Features

- Lightweight & secure image (no root process)
- Based on Alpine Linux
- Latest Postfixadmin version (3.2)
- Latest Postfixadmin version (3.3.4)
- MariaDB/PostgreSQL driver
- With PHP7
- With PHP8

### Built-time variables

Expand Down
4 changes: 3 additions & 1 deletion bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,7 @@ cat > /postfixadmin/config.local.php <<EOF
?>
EOF

# Upgrade
php8 /postfixadmin/public/upgrade.php
# RUN !
exec su-exec $UID:$GID php7 -S 0.0.0.0:8888 -t /postfixadmin/public
exec su-exec $UID:$GID php8 -S 0.0.0.0:8888 -t /postfixadmin/public
12 changes: 7 additions & 5 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ CGREEN="${CSI}1;32m"

read -rp "> Postfixadmin setup hash : " HASH

# MD5(salt) : SHA1( MD5(salt) : PASSWORD );
# 32 1 40
# Exemple : ffdeb741c58db80d060ddb170af4623a:54e0ac9a55d69c5e53d214c7ad7f1e3df40a3caa
while [ ${#HASH} -ne 73 ]; do
# postfixadmin uses the function password_hash with PASSWORD_DEFAULT since version 3.3.0.
# password_hash() creates a new password hash using a strong one-way hashing algorithm.
# PASSWORD_DEFAULT - Use the bcrypt algorithm (default as of PHP 5.5.0). Note that this constant is designed to change over time as new and stronger algorithms are added to PHP.
# PASSWORD_BCRYPT - Use the CRYPT_BLOWFISH algorithm to create the hash. This will produce a standard crypt() compatible hash using the "$2y$" identifier. The result will always be a 60 character string, or false on failure.
# See also: https://www.php.net/manual/en/function.password-hash.php
while [ ${#HASH} -ne 60 ]; do
echo -e "${CRED}\n/!\ Invalid HASH !${CEND}" 1>&2
read -rp "> Postfixadmin setup hash : " HASH
echo ""
done

sed -i "s|\($CONF\['setup_password'\].*=\).*|\1 '${HASH}';|" /postfixadmin/config.inc.php

echo -e "${CGREEN}Setup done.${CEND}"
echo -e "${CGREEN}Setup done.${CEND}"

0 comments on commit ec0f9e7

Please sign in to comment.