hardware / mailserver

:warning: UNMAINTAINED - Simple and full-featured mail server using Docker
https://store.docker.com/community/images/hardware/mailserver
MIT License
1.29k stars 322 forks source link

Postfixadmin create superadmin account #397

Closed Haikyy closed 5 years ago

Haikyy commented 5 years ago

Classification

Reproducibility

Description

Same strange behavior on latest and stable version When I try to create a superadmin account on https://postfixadmin.domain.tld/setup.php I enter the setup password (respecting the conditions) then the form to create a super admin account appears. I fill the form: 2019-08-17-121530_1920x1080_scrot

then it brings me to the previous page to set again the setup password: "Setup password must be specified If you didn't set up a setup password yet, enter the password you want to use."

I can add the hash setup_passord with success when I run: docker exec -ti postfixadmin setup

I also tried to add the hash setup_password in config.local.php, commit the new container, rerun everything with the new postfixadmin container, but it doesn't work, the webpage is loaded without css, I'm a beginner with docker, I've maybe missed a config to integrate a modified container correctly

Steps to reproduce

  1. just the basic install: docker pull > docker-compose > TXT record > postfixadmin webpage

Expected results

Postfix setup password saved Postfix admin account created

Actual results

Nothing happens, bring back to the previous page to reset a setup password

Debugging information

docker logs mailserver
[INFO] MariaDB/PostgreSQL hostname not found in /etc/hosts
[INFO] Container IP found, adding a new record in /etc/hosts
[INFO] Redis hostname not found in /etc/hosts
[INFO] Container IP found, adding a new record in /etc/hosts
[INFO] Traefik SSL certificates not used
[INFO] No Let's encrypt live directory found
[INFO] Using /var/mail/ssl//selfsigned/ folder
[INFO] No SSL certificates found, generating a new selfsigned certificate
Generating a RSA private key
..........................................++++
...................++++
writing new private key to '/var/mail/ssl.../privkey.pem'
-----
[INFO] Setting up container
[INFO] Creating DKIM keys for domain myDomain.tld
[INFO] Debug mode is disabled
[INFO] ClamAV is enabled
[INFO] Fetchmail forwarding is disabled
[INFO] Automatic GPG encryption is disabled
[INFO] ManageSieve protocol is enabled
[INFO] DKIM/ARC signing is enabled
[INFO] Greylisting policy is enabled
[INFO] Ratelimiting policy is disabled
[INFO] POP3 protocol is disabled
[INFO] Unbound DNS resolver is enabled
[INFO] clamav-unofficial-sigs is disabled (user configuration not found)
[INFO] Finished container setup
[INFO] Starting services

Configuration (docker-compose.yml, traefik.toml...etc)

Just the basis needed

Tested on Debian 9 in a vps

hardware commented 5 years ago

I just tested with the latest build of hardware/postfixadmin on docker hub and everything works fine for me. Look in container's log maybe.

https://github.com/hardware/mailserver/wiki/Postfixadmin-initial-configuration

Haikyy commented 5 years ago

My docker logs postfixamin and mariadb don't give me anything interesting. I still have the same issue after a complete os reset. I add the hash setup_password with: docker exec -ti postfixadmin setup output: setup done; but the setup_password is not recognized or it misses the write access on the database, same for admin account informations I suppose.

Could you give me the logs I have to look for ?

hardware commented 5 years ago

Could you give me the logs I have to look for ?

Apart from postfixamin and mariadb, I don't have any other logs in mind.

output: setup done

Well, that means you have entered a valid string. Do you find the hash in /postfixadmin/config.inc.php (inside posfixadmin container) ?

read -rp "> Postfixadmin setup hash : " HASH

# MD5(salt) : SHA1( MD5(salt) : PASSWORD );
#    32     1              40
# Exemple : ffdeb741c58db80d060ddb170af4623a:54e0ac9a55d69c5e53d214c7ad7f1e3df40a3caa
while [ ${#HASH} -ne 73 ]; 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}"

it misses the write access on the database

That's not possible because SQL migrations are correctly executed at this stage, you can retrieve all the tables in your database.

Which version of mariadb do you use ?

Haikyy commented 5 years ago

After 20h afk, I tried again by regenerate the hash and it worked without did anything. Is there a relative reason with the dkim TXT record propagation time ? I could met the same issue again because I'll install some others dockers and reset the os, I'll try your solution another time but I close this one atm. my version of mariadb:10.2

Thank you for your fast feedback