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

POSTFIXADMIN_SETUP_PASSWORD does nothing #63

Open
alaw005 opened this issue May 28, 2023 · 7 comments
Open

POSTFIXADMIN_SETUP_PASSWORD does nothing #63

alaw005 opened this issue May 28, 2023 · 7 comments

Comments

@alaw005
Copy link

alaw005 commented May 28, 2023

I set the POSTFIXADMIN_SETUP_PASSWORD using environment variable but this appears to do nothing as I can't login to setup.php page using the specified password.

@alaw005
Copy link
Author

alaw005 commented May 28, 2023

The following is a work around

Install using docker compose

docker-compose.yml file is

ersion: "3.9"

services:

  postfixadmin:
    image: postfixadmin
    ports:
      - "8080:80"
    environment:
      POSTFIXADMIN_DB_TYPE: sqlite
    volumes:
      - dovecot-postfixadmin:/var/www

  dovecot:
    image: dovecot/dovecot:2.3.20
    ports:
      - "143:143"
    volumes:
      - dovecot-config:/etc/dovecot
      - dovecot-mail:/srv/mail

volumes:
  dovecot-config:
  dovecot-mail:
  dovecot-postfixadmin:

Note the POSTFIXADMIN_SETUP_PASSWORD environment variable for specifying a setup_password does
not work so need to do the following to generate it and get postfixadmin going.

docker compose up -d

Navigate to webpage

http://dockerhost.local:8080/setup.php

Enter setup password in relevant section

Copy the hash generated

Edit /var/www/html/config.local.php from the volume created by docker compose

(or connect to container and edit within container)

Add the generated hash to relevant row:

$CONF['setup_password'] = 'copiedhashfromabove';

Now restart docker (noting will only be saved if using volumes)

You can now connect to the setup.php page again and create and admin user

http://dockerhost.local:8080/setup.php

Once admin user is created can log into postfix admin using

http://dockerhost.local:8080

@CodeWithMa
Copy link

You have set the environment variable to copiedhashfromabove. Not to the plain text password.

@MP-ICT-Diensten
Copy link

I don't get it (yet), for test I tried a very simple password: abc123 with Postfix Admin 3.3.14 docker

Generated the hash and below the result:
$CONF['setup_password'] = '$2y$10$HXhaKIRzTAGG3teqgTi4NuP94Qhl2sA2cab5SYQ9deonZc6jZxeh2';

The docker env var is like this:
POSTFIXADMIN_SETUP_PASSWORD: vi

But after starting the docker this is shown during startup and that does not have the complete password, only the first part of it.:
$CONF['setup_password'] = '$2y$10';

Besides this duiring startup this message is shown:
WARN[0000] The "HXhaKIRzTAGG3teqgTi4NuP94Qhl2sA2cab5SYQ9deonZc6jZxeh2" variable is not set. Defaulting to a blank string.

@DavidGoodwin
Copy link
Member

Hi - The problem is that your setup password contains a dollar, and that's being (incorrectly) expanded by a shell (or perhaps PHP) somewhere (hence the 'WARN[0000] The "HXhaKIRzTAGG3teqgTi4NuP94Qhl2sA2cab5SYQ9deonZc6jZxeh2" ... warning).

@MP-ICT-Diensten
Copy link

MP-ICT-Diensten commented Dec 4, 2024

The hashed password has the multiple $ in it, but that I cannot influence, in above example the password was abc123 and does not have a $ in it.

What i see is that with every hashed password the hashed password starts always with $2y$10$...etc...etc

For now I resolved the issue by using

# Copy config,local.php file out of container
docker cp pfa1:/var/www/html/config.local.php config.local.php

# edit the config file to have the correct config line:
#  $CONF['setup_password'] = '$2y$10$HXhaKIRzTAGG3teqgTi4NuP94Qhl2sA2cab5SYQ9deonZc6jZxeh2';
vi config.local.php

# copy the saved file back into the  container
docker cp config.local.php pfa1:/var/www/html/config.local.php

#Start container / go to setup.php page

@gabviv73
Copy link

The value of POSTFIXADMIN_SETUP_PASSWORD is the password hash, not the password itself you write in the text box of setup.php

In docker-compose.yml the dollar sign must be doubled, so if you have a string like:

$2y$10$g9EpToj2t3dNKPsFLOhmNu2d48/6ltCTdin5LRAvWNMNXtPtF9/26

You have tio write in your docker-compose.yml:

POSTFIXADMIN_SETUP_PASSWORD: $$2y$$10$$g9EpToj2t3dNKPsFLOhmNu2d48/6ltCTdin5LRAvWNMNXtPtF9/26

Please update the documentation.

@DavidGoodwin
Copy link
Member

see ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants