Giter Club home page Giter Club logo

postfixadmin's Introduction

hardware/postfixadmin

postfixadmin

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)
  • MariaDB/PostgreSQL driver
  • With PHP7

Built-time variables

  • VERSION : version of postfixadmin
  • GPG_SHORTID : short gpg key ID
  • GPG_FINGERPRINT : fingerprint of signing key
  • SHA256_HASH : SHA256 hash of Postfixadmin archive

Ports

  • 8888

Environment variables

Variable Description Type Default value
UID postfixadmin user id optional 991
GID postfixadmin group id optional 991
DBDRIVER Database type: mysql, pgsql optional mysql
DBHOST Database instance ip/hostname optional mariadb
DBPORT Database instance port optional 3306
DBUSER Database database username optional postfix
DBNAME Database database name optional postfix
DBPASS Database database password or location of a file containing it required null
SMTPHOST SMTP server ip/hostname optional mailserver
DOMAIN Mail domain optional domainname value
ENCRYPTION Passwords encryption method optional dovecot:SHA512-CRYPT
PASSVAL_MIN_LEN Passwords validation: minimum password length optional 5
PASSVAL_MIN_CHAR Passwords validation: must contain at least characters optional 3
PASSVAL_MIN_DIGIT Passwords validation: must contain at least digits optional 2
PAGE_SIZE Number of entries (mailboxes, alias, etc) that you would like to see in one page. optional 10
QUOTA_MULTIPLIER Number of bytes required to represent a single quota unit. You can either use '1000000', '1024000' or '1048576' optional 1024000
FETCHMAIL_EXTRA_OPTIONS Allows to pass additional options to fetchmail optional NO
  • If you use this docker image and hardware/mailserver with fetchmail support enabled, a dedicated port (10025) is available with less restrictions for delivery. Use FETCHMAIL_EXTRA_OPTIONS environment variable for that purpose. Example :
postfixadmin:
  environment:
    FETCHMAIL_EXTRA_OPTIONS="smtp localhost/10025"

Docker-compose.yml

# Full example :
# https://github.com/hardware/mailserver/blob/master/docker-compose.sample.yml

postfixadmin:
  image: hardware/postfixadmin
  container_name: postfixadmin
  domainname: domain.tld
  hostname: mail
  environment:
    - DBPASS=xxxxxxx
  depends_on:
    - mailserver
    - mariadb # postgres (adjust accordingly)

How to setup

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

postfixadmin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postfixadmin's Issues

Error about db

DEBUG INFORMATION:
Invalid query: Table 'postfix.config' doesn't exist

nginx not running

supervise tries to start nginx every second but it does not start:

2017/02/16 09:24:54 [emerg] 775#0: open() "/var/lib/nginx/logs/error.log" failed (13: Permission denied)
nginx: [alert] could not open error log file: open() "/var/lib/nginx/logs/error.log" failed (13: Permission denied)

I don't understand where is the problem - I checked the permissions and all files theme to be owned by 991 with the correct permissions. Even with permissions 0666 on /var/lib/nginx/logs/error.log nginx can not start.

Some console output:

/var/log # ls -lahR
.:
total 16
drwxrwxrwx    6 991      991         4.0K Feb 16 06:21 .
drwxrwxrwx   17 root     root        4.0K Feb 16 06:21 ..
drwxrwxrwx    2 991      991         4.0K Feb 16 06:53 nginx
drwxr-xr-x    2 991      991         4.0K Feb 16 06:21 php7

./nginx:
total 12
drwxrwxrwx    2 991      991         4.0K Feb 16 06:53 .
drwxrwxrwx    6 991      991         4.0K Feb 16 06:21 ..
-rw-rw-rw-    1 991      991            1 Feb 16 09:21 error.log

./php7:
total 12
drwxr-xr-x    2 991      991         4.0K Feb 16 06:21 .
drwxrwxrwx    6 991      991         4.0K Feb 16 06:21 ..
-rw-------    1 991      991          531 Feb 16 09:18 error.log

And the service config from my docker-compose.yml

version: '2'
services:
  postfixadmin:
    image: hardware/postfixadmin
    domainname: domain.tld
    hostname: mail
    restart: always
    environment:
      - 'DBPASS=xxx'
    depends_on:
      - mailserver
      - mariadb
    networks:
      - back

Am I missing something or is your image broken?

Password hashing does not work

I don’t know how it’s possible that this (apparently) works for other people, but for me I cannot log into postfixadmin because the password hashing does not work. The function pacrypt() in /postfixadmin/functions.inc.php makes the following call in line 964:

$dovepasstest = " -t " . escapeshellarg($pw_db);

This will generate a command like this:

/usr/bin/doveadm pw -s SHA256-CRYPT -t '$5$abcdef'

This will fail with this error message:

Fatal: Missing {scheme} prefix from hash

It can be fixed by changing the line to:

$dovepasstest = " -t " . escapeshellarg("{{$method}}$pw_db");

for example using the command:

sed -ri /postfixadmin/functions.inc.php -e 's/escapeshellarg\(\$pw_db\)/escapeshellarg("{{\$method}}\$pw_db")/'

A temporary workaround is to include that command in the cmd parameter, for example using docker-compose:

command:
    - sh
    - -c
    - sed -ri /postfixadmin/functions.inc.php -e 's/escapeshellarg\(\$$pw_db\)/escapeshellarg("{{\$$method}}\$$pw_db")/' && run.sh

Mise a jour de la base de donnée

Salut,

J'ai mis à jour mes images dockers qui dataient un peu et voici ce que me met Postfixadmin :

ERROR: The PostfixAdmin database layout is outdated (you have r1795, but r1835 is expected). Please run setup.php to upgrade the database.

Sais-tu comment je dois procéder pour exécuter ce setup.php ?
J'ai essayer d’exécuter cette commande dans le container postfixadmin dans une console sh mais il me dit qu'il ne connait pas php ...


root@mail:/home/cyprien/docker/dockerfiles# docker exec -it af90cbeb6f2a sh
/ # ls
bin           etc           lib           media         postfixadmin  root          sbin          sys           usr
dev           home          log           mnt           proc          run           srv           tmp           var
/ # cd postfixadmin/
/postfixadmin # ls
ADDITIONS              backup.php             css                    index.php              scripts                tests
CHANGELOG.TXT          broadcast-message.php  debian                 languages              sendmail.php           upgrade.php
DOCUMENTS              calendar.js            delete.php             list-virtual.php       setup.php              users
GPL-LICENSE.TXT        common.php             edit.php               list.php               smarty                 vacation.php
INSTALL.TXT            config.inc.php         editactive.php         login.php              smarty.inc.php         variables.inc.php
LICENSE.TXT            config.local.php       functions.inc.php      main.php               templates              viewlog.php
VIRTUAL_VACATION       configs                images                 model                  templates_c            xmlrpc.php
/postfixadmin # php setup.php
sh: php: not found

Une idée ? :)

Port not accessible

I have deployed this server on cent os and opened the port 8888 for my network, but i am not able to access the port, niether i see it opened on my machine, is there any setting to be done with this docker container in docker-compose.yml

setup_password is not persisted

setup_password is saved in /postfixadmin/config.inc.php, which is not persisted when the container is updated/recreated, so it is reset to an empty password. This is a security risk, as it enables users to create an admin account.

The best solution that I can see is to set setup_password to some bogus by default so that setup.php cannot be used, and make the setup script ask for a plaintext password, whose hash is then saved in config.inc.php.

Error: Depends on: multibyte string - NOT FOUND

Salut Hardware,

J'ai suivi ton tuto pour l'installation via docker mais j'ai quelques soucis lorsque je vais sur la page postfixadmin.domain.tld/setup.php :

image

Et lorsque je lance la commande suivante :

docker exec -ti postfixadmin sh setup

sh: can't open 'setup'

Enfin lorsque je souhaite me loguer sur la page postfixadmin.domain.tld/login.php
Voici la réponse, il y a un problème avec la base de données :

Invalid query: Table 'postfix.domain' doesn't exist
Check your error_log for the failed query.

  mailserver:
    image: hardware/mailserver
    container_name: mailserver
    domainname: mondomaine
    hostname: mail
    links:
      - db-mail:mariadb
    ports:
      - "25:25"     # SMTP                - Required
      - "143:143"   # IMAP       STARTTLS - For webmails/desktop clients
      - "465:465"   # SMTPS      SSL/TLS  - Enabled for compatibility reason, otherwise disabled
      - "587:587"   # Submission STARTTLS - For webmails/desktop clients
      - "993:993"   # IMAPS      SSL/TLS  - For webmails/desktop clients
      - "4190:4190" # SIEVE      STARTTLS - Optional, but recommended for mail filtering
    environment:
      - DBPASS=monMDP
    volumes:
      - /home/cyprien/docker/containers/mail:/var/mail
      - /home/cyprien/docker/containers/opendkim:/etc/opendkim/keys

  # Control panel
  postfixadmin:
    image: hardware/postfixadmin
    container_name: postfixadmin
    domainname: mondomaine
    hostname: mail
    links:
      - db-mail:mariadb
    environment:
      - DBPASS=monMDP

  # Webmail
  rainloop:
    image: hardware/rainloop
    container_name: rainloop
    links:
      - mailserver:mailserver
      - db-mail:mariadb
    volumes:
      - /home/cyprien/docker/containers/rainloop:/rainloop/data

  # Database
  db-mail:
    image: mariadb:10.1
    container_name: db-mail
    environment:
      - MYSQL_ROOT_PASSWORD=monMDP
      - MYSQL_DATABASE=postfix
      - MYSQL_USER=postfix
      - MYSQL_PASSWORD=monMDP
    volumes:
      - /home/cyprien/docker/containers/mysql/db:/var/lib/mysql

Merci pour ton travail ;)

Discussion: Official docker image

It looks like postfixadmin will have an official image available anytime soon.
https://github.com/postfixadmin/docker

Is there any thought about using the official image in the future?

Not that it really makes a difference to me, but maybe just to simplify your life and be one less project for you manage.

What do you think about it?

[]'s

Getting error about module loading mysqlnd.so

[20-Feb-2017 15:48:24] NOTICE: PHP message: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php7.1/modules/mysqlnd.so' - Error relocating /usr/lib/php7.1/modules/mysqlnd.so: BIO_new_mem_buf: symbol not found in Unknown on line 0

Started this with docker-compose.yml:

postfixadmin:
  image: hardware/postfixadmin
  container_name: postfixadmin
  domainname: domain.ltd
  hostname: mail
  restart: always
  environment:
    - DBPASS=xxxxxxxxxx
  links:
    - mailserver
    - mariadb

postfixadmin assumes mysql database is running on localhost

I have mysql database running on another server with xx.xx.xx.187 and postfixadmin running on xx.xx.xx.186.

In docker-compose.yml I have the following postfixadmin service.

  postfixadmin:
    image: hardware/postfixadmin
    container_name: postfixadmin
    domainname: domain.tld
    hostname: mail
    restart: always
    ports:
      - 8888:8888
    environment:
      - "DBHOST=xx.xx.xx.187"
      - "DBPORT=3306"
      - "DBNAME=postfix"
      - "DBUSER=postfix"
      - "DBPASS=password"
    depends_on:
      - mailserver

However I got the following error on setup.php

Error: Can't connect to database
Please edit the $CONF['database_*'] parameters in config.local.php.
DEBUG INFORMATION:
Connect: Access denied for user 'postfix'@'xx.xx.xx.186' (using password: YES)

The config.local.php inside the container is correct with xx.xx.xx.187

$CONF['database_type'] = 'mysqli';                                                                                                                                             
$CONF['database_host'] = 'xx.xx.xx.187';                                                                                                                                      
$CONF['database_user'] = 'postfix';                                                                                                                                            
$CONF['database_password'] = 'password';                                                                                                                                       
$CONF['database_name'] = 'postfix';     

I am wondering if there are somewhere hard-coded db host as localhost? I am not a php guy and couldn't figure out myself. Thanks.

DB Port

DBPORT no working with postfixadmin.
Your changes set connection uri to "$server:$host"
Howewer, postfix admin use mysqli connection :

function db_connect ($ignore_errors = 0) {
...
} elseif ($CONF['database_type'] == "mysqli") {
        if (function_exists ("mysqli_connect")) {
            $link = @mysqli_connect ($CONF['database_host'], $CONF['database_user'], $CONF['database_password']) or $error_text .= ("<p />DEBUG INFORMATION:<br />Connect: " .  mysqli_connect_error () . "$DEBUG_TEXT");
            if ($link) {
                @mysqli_query($link,"SET CHARACTER SET utf8");
                @mysqli_query($link,"SET COLLATION_CONNECTION='utf8_general_ci'");
                @mysqli_select_db ($link, $CONF['database_name']) or $error_text .= ("<p />DEBUG INFORMATION:<br />MySQLi Select Database: " .  mysqli_error ($link) . "$DEBUG_TEXT");
            }
        } else {
            $error_text .= "<p />DEBUG INFORMATION:<br />MySQL 4.1 functions not available! (php5-mysqli installed?)<br />database_type = 'mysqli' in config.inc.php, are you using a different database? $DEBUG_TEXT";
        }
...
}

Mysqli constructor :
http://php.net/manual/fr/mysqli.construct.php
($host, $username, $password, $dbname, $port)

Searching solution without editing postfix original code. Maybe submit on the original project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.