Postfix Admin-1

Postfix Admin Tool - PostfixAdmin2014/08/23http://www.server-world.info/en/note?os=CentOS_6&p=mail&f=10

[root@mail ~]# mysql -u root -p 

Enter password: Welcome to the MySQL monitor.  Commands end with ; or \g. Your MySQL connection id is 10 Server version: 5.1.73 Source distribution  Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.  Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

# create "postfixadmin" DB ( input any password you like on 'password' section )

mysql> create database postfixadmin; 

Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on postfixadmin.* to postfixadmin@'localhost' identified by 'password'; 

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges; 

Query OK, 0 rows affected (0.00 sec)

mysql> exit 

Bye

[5]

Install PostfixAdmin. Download the latest one, make sure on here .

yum -y install php56w-mysql php56w-imap

yum -y install php72w-mysql php72w-imap

[root@mail ~]# yum -y install php-mysql php-imap

[root@mail ~]# wget http://ftp.jaist.ac.jp/pub/sourceforge/p/po/postfixadmin/postfixadmin/postfixadmin-2.91/postfixadmin-2.91.tar.gz

 OR             wget https://sourceforge.net/projects/postfixadmin/files/latest/download -O postfixadmin.tar.gz

 tar zxvf postfixadmin.tar.gz 

 mv postfixadmin-3.1 /var/www/html/postfixadmin 

 vi /var/www/html/postfixadmin/config.inc.php

# line 25: change

$CONF['configured'] = true;

# line 30: change later (input here after [5] section, password hash was generated on it)

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

# line 34: change

$CONF['default_language'] = 'ja';

# line 85-87: change to info for PostfixAdmin DB

$CONF['database_user'] = 'postfixadmin';

$CONF['database_password'] = 'password';

$CONF['database_name'] = 'postfixadmin';

[root@mail ~]# vi /etc/httpd/conf.d/postfixadmin.conf

# create new

<Directory /var/www/html/postfixadmin/>

    Order Deny,Allow

    Deny from all

    # IP address you permit to access

    Allow from all

</Directory>

#

 mkdir -p /var/www/html/postfixadmin/templates_c

 chmod 777 /var/www/html/postfixadmin/templates_c

 cd /var/www/html/

 chown -R root.apache postfixadmin

[root@mail ~]# chgrp -R apache /var/www/html/postfixadmin/templates_c 

                        systemctl restart httpd

          s

[root@mail ~]# /etc/rc.d/init.d/httpd restart 

Stopping httpd:                  [  OK  ] Starting httpd:                  [  OK  ]

[6]

Access to the "http://(your server's hostname or IP address)/postfixadmin/setup.php". Then, scroll down the screen and input any password you like on the setup password fields. Next Click "Generate password hash" button.

[7]

The password hash is generated like follows. Back to [5] section and edit [config.inc.php] to input the password hash.

[8]

Cotinue to set admin account. Input the password you set above for [Admin] field, and input any password you like for [password] field, if it's Ok all, Click [Add admin] button.

# vi /var/www/html/postfixadmin/config.inc.php

Line 30: $CONF['setup_password'] = 'de177e35654bde7195edb0a8d907279e:5304910a9d847e525824101bfe3c799bef0f0aa8';

                                                 ---OR----

Creat Admin Passwd-command

bash /var/www/html/postfixadmin/scripts/postfixadmin-cli admin add admin@your_domain_name.com --password strong_password22 --password2 strong_password22 --superadmin 1 --active 1

[9]

Admin user is added. Initial settings is just completed.

[10]

Access to "http://(your server's hostname or IP address)/postfixadmin/login.php", then login with a admin user.

OR

http://(your server's hostname or IP address)/mailadmin/login.php

[11]

Just logined. It's possible to configure Postfix on here.

-----------------------------------------

vim /var/www/html/postfixadmin/config.inc.php

[root@mail1 postfixadmin]# vi config.inc.php $CONF['configured'] = false; ↓ # 変更 $CONF['configured'] = true;  $CONF['default_language'] = 'en'; ↓ # 変更 $CONF['default_language'] = 'ja';  #---ここからは(3)で作成した情報を入力する--- $CONF['database_type'] = 'mysql'; $CONF['database_host'] = 'localhost'; $CONF['database_user'] = 'postfixadmin'; $CONF['database_password'] = 'postfixadmin'; $CONF['database_name'] = 'postfix'; $CONF['database_prefix'] = ''; #---ここまで---  $CONF['page_size'] = '10'; ↓ # 変更(任意) $CONF['page_size'] = '100';  $CONF['domain_path'] = 'NO'; ↓ # 変更(任意) $CONF['domain_path'] = 'YES';  $CONF['quota'] = 'NO'; ↓ # 変更(任意) $CONF['quota'] = 'YES'; ← # PostfixAdminから個人(バーチャルメールアカウント)ごとのメールボックスサイズを指定する  $CONF['quota_multiplier'] = '1024000'; ← # 「quota」をYESにした場合の1MBのサイズを指定  $CONF['show_footer_text'] = 'YES'; ↓変更(任意) $CONF['show_footer_text'] = 'Postfix Admin'; ← # フッターを指定  $CONF['footer_link'] = 'http://change-this-to-your.domain.tld'; ↓変更(任意) $CONF['footer_link'] = 'http://www.example.com/postfixadmin/'; ← # トップページを指定

-----------------------------------------------------------

#############################################################

vim /var/www/html/postfixadmin/config.inc.php

 

$CONF[‘configured’] = true;

$CONF[‘setup_password’] = ‘YOUR-STRONG-PASSWORD’;

$CONF[‘database_type’] = ‘mysqli’;

$CONF[‘database_host’] = ‘localhost’;

$CONF[‘database_user’] = ‘postfixadmin’;

$CONF[‘database_password’] = ‘yourPASSword’;

$CONF[‘database_name’] = ‘postfixadmin’;

$CONF[‘show_password’] = ‘YES’;

$CONF[‘page_size’] = ’30’;

$CONF[‘default_aliases’] = array (

‘abuse’ => ‘abuse@ceae.info’,

‘hostmaster’ => ‘hostmaster@worldcm.net’,

‘postmaster’ => ‘postmaster@ worldcm.net’,

‘webmaster’ => ‘webmaster@ worldcm.net’

);

$CONF[‘domain_path’] = ‘NO’;

$CONF[‘domain_in_mailbox’] = ‘YES’;

$CONF[‘maildir_name_hook’] = ‘NO’;

$CONF[‘transport’] = ‘YES’;

$CONF[‘vacation’] = ‘YES’;

$CONF[‘vacation_domain’] = ‘autoreply. worldcm.net’;

$CONF[‘vacation_control’] =’YES’;

 

 

If your domain do not exist, activate this

$CONF['emailcheck_resolve_domain']='NO';

--------------

##############

Reset Postfix Admin password

1. Get the Encrypted Version of the string that you want to set as password :

dovecot -s MD5-CRYPT -p <yournewpassword> | sed ‘s/{MD5-CRYPT}//’

2. Copy the output

3. Login to Mysql database

4. Use database Vmail or whatever in your case.

5.Run the following query :

update admin set password='<above copied output>’ where username = ‘<username>’

####################

Admin password Lost

doveadm pw -s SHA512-CRYPT -p YOUR_NEW_PASSWORD

And edit database :

docker exec -it mariadb bash

# mysql -u root -p

mysql> use postfix;

mysql> UPDATE admin SET password = '{SHA512-CRYPT}HASH' WHERE username = 'user@domain.tld';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> quit

exit

##################

Postfixadmin

 

1. Делаем шифрованный пароль при помощи команды

       dovecot pw -s MD5-CRYPT -p password | sed 's/{MD5-CRYPT}//'

2. Заходи в mysql

              mysql -u root –p

3. Выбираем базу

               use postfixadmin;

4. Смотрим учетку администратора.

        select * from admin;

5. Меняем пароль

              update admin set password='хеш пароль' where username='admin@blablabla.ru';

-----------------------------------------------------

Ubuntu 11.1 

dovecot

doveadm pw -s MD5-CRYPT -p YOUR_PASSWORD | sed 's/{MD5-CRYPT}//'

$1$ZbwsgmXZ$W.Rg5Cr8SuP663u41xTja/

# mysql -u postfix_admin -p

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mail               |

+--------------------+

2 rows in set (0.00 sec)

mysql> use mail;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

mysql> show tables;

+-----------------------+

| Tables_in_mail        |

+-----------------------+

| admin                 |

| alias                 |

| alias_domain          |

| config                |

| domain                |

| domain_admins         |

| fetchmail             |

| log                   |

| mailbox               |

| quota                 |

| quota2                |

| vacation              |

| vacation_notification |

+-----------------------+

13 rows in set (0.00 sec)

select * from admin;

1

select * from admin;

mysql> select * from admin;

+-----------------------------------+------------------------------------+---------------------+---------------------+--------+

| username                          | password                           | created             | modified            | active |

+-----------------------------------+------------------------------------+---------------------+---------------------+--------+

| arielfx@emang.ganteng.de          | $1$f383ade6$zU86FBNFzlJHStY5LLLEB/ | 2014-03-09 18:02:58 | 2015-02-16 21:03:50 |      0 |

+-----------------------------------+------------------------------------+---------------------+---------------------+--------+

1 rows in set (0.00 sec)

 

mysql>

mysql> update admin set password='$1$ZbwsgmXZ$W.Rg5Cr8SuP663u41xTja/' where username='arielfx@emang.ganteng.de';

--------

---------http://www.server-world.info/en/note?os=CentOS_6&p=mail&f=10