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

Setup password quoting #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You can configure this through the following environment variables when running
* POSTFIXADMIN\_DB\_PORT=... - port for the database (optional)
* POSTFIXADMIN\_DB\_PASSWORD=... - mysqli/pgsql only (db server user password)
* POSTFIXADMIN_ENCRYPT=... - database password encryption (e.g. md5crypt, SHA512-CRYPT)
* POSTFIXADMIN\_SETUP\_PASSWORD=... - generated from setup.php or `php -r "echo password_hash('mysecretpassword', PASSWORD_DEFAULT);"`
* POSTFIXADMIN\_SETUP\_PASSWORD=... - generated from setup.php or `php -r "echo password_hash('mysecretpassword', PASSWORD_DEFAULT);"`

Note: An SQLite database is probably not recommended for production use, but is a quick and easy way to try out the software without dependencies.

Expand Down Expand Up @@ -88,14 +88,19 @@ docker run -e POSTFIXADMIN_DB_USER_FILE=/run/secrets/postfix-db-user

All environment vars are supporting the secret's docker strategy.

Note, the POSTFIXADMIN_SETUP_PASSWORD varaible contains dollar signs, so needs quoting to avoid variable expansion. See also #63

### Example docker run

Setup password is : mysecretpassword

```bash
docker run -e POSTFIXADMIN_DB_TYPE=mysqli \
-e POSTFIXADMIN_DB_HOST=whatever \
-e POSTFIXADMIN_DB_USER=user \
-e POSTFIXADMIN_DB_PASSWORD=changeme \
-e POSTFIXADMIN_DB_NAME=postfixadmin \
-e POSTFIXADMIN_SETUP_PASSWORD='$2y$10$3ycavDC7g.JQrxZRRDZ5IuS2O2Y6Rpl79XWTDnbI5nPREYfUIf6dK' \
-e POSTFIXADMIN_SMTP_SERVER=postfix \
-e POSTFIXADMIN_SMTP_PORT=25 \
-e POSTFIXADMIN_ENCRYPT=md5crypt \
Expand All @@ -106,6 +111,7 @@ docker run -e POSTFIXADMIN_DB_TYPE=mysqli \
postfixadmin
```

Then visit http://localhost:8080/setup.php. Use mysecretpassword to login to the page.

## Existing setup / with config.local.php

Expand Down Expand Up @@ -133,14 +139,22 @@ Once the container is running, try visiting :

Try something like the below in a **docker-compose.yml** file; changing the usernames/passwords as required.

Then run : `docker-compose up`
This is using a POSTFIXADMIN_SETUP_PASSWORD of 'mysecretpassword'. Note a $ is changed to $$ to get around variable expansion issues ( see #63 )

## Steps

1. `docker compose up`
2. `docker compose logs -f postfixadmin` (it may take about 30s for the database to build, and the web ui to be ready)
3. Point your web browser at http://localhost:8000/setup.php - login with your setup password (mysecretpassword).
4. Add a super admin account ....
5. Visit http://localhost:8000/login.php and login with your new admin account, add mailboxes etc.


```yaml
version: '3'

services:
db:
image: mysql:5.7
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: notSecureChangeMe
Expand All @@ -162,6 +176,7 @@ services:
POSTFIXADMIN_DB_NAME: postfixadmin
POSTFIXADMIN_DB_PASSWORD: postfixadminPassword
POSTFIXADMIN_SMTP_SERVER: postfix
POSTFIXADMIN_SETUP_PASSWORD: $$2y$$10$$8./sbCrwpLGeWv/6auLtC.ROq/pRpm573QNdISESNqZ9p0uoL3eq6
POSTFIXADMIN_SMTP_PORT: 25
POSTFIXADMIN_ENCRYPT: md5crypt

Expand Down
Loading