Ero sivun ”Postfixadmin” versioiden välillä
Rivi 55: | Rivi 55: | ||
https://<subdomain.domain.tld>/postfixadmin | https://<subdomain.domain.tld>/postfixadmin | ||
+ | |||
+ | == Integrointi Postfixin kanssa == | ||
+ | |||
+ | * Varmista että Postfix toimii normaalisti | ||
+ | * Varmista että MySQL on asennettu ja toimii | ||
+ | |||
+ | Avaa main.cf tiedosto ja lisää alla oleva tiedostoon | ||
+ | |||
+ | nano /etc/postfix/main.cf | ||
+ | |||
+ | <pre> | ||
+ | virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf | ||
+ | virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf | ||
+ | virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf | ||
+ | relay_domains = mysql:/etc/postfix/mysql_relay_domains.cf | ||
+ | virtual_mailbox_limit = 51200000 | ||
+ | virtual_minimum_uid = 5000 | ||
+ | virtual_uid_maps = static:5000 | ||
+ | virtual_gid_maps = static:5000 | ||
+ | virtual_mailbox_base = /home/vmail | ||
+ | virtual_transport = virtual | ||
+ | </pre> | ||
+ | |||
+ | Luo tiedosto mysql_virtual_mailbox_domains.cf konfigurointi hakemistoon | ||
+ | |||
+ | <pre> | ||
+ | user = postfix | ||
+ | password = salasana | ||
+ | hosts = 127.0.0.1 | ||
+ | dbname = postfixadmin | ||
+ | table = domain | ||
+ | select_field = domain | ||
+ | where_field = domain | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | Luo tiedosto mysql_virtual_domain_maps.cf postfixin konfigurointi hakemistoon | ||
+ | |||
+ | /etc/postfix/mysql_virtual_domain_maps.cf | ||
+ | |||
+ | <pre> | ||
+ | user = postfix | ||
+ | password = salasana | ||
+ | hosts = 127.0.0.1 | ||
+ | dbname = postfixadmin | ||
+ | table = domain | ||
+ | select_field = domain | ||
+ | where_field = domain | ||
+ | </pre> | ||
+ | |||
+ | Luo tiedosto mysql_virtual_alias_maps.cf postfixin konfigurointi hakemistoon | ||
+ | |||
+ | /etc/postfix/mysql_virtual_alias_maps.cf | ||
+ | |||
+ | <pre> | ||
+ | hosts = 127.0.0.1 | ||
+ | user = salasana | ||
+ | password = RuxA4TWGMvtE7pqK | ||
+ | dbname = postfixadmin | ||
+ | #table = alias | ||
+ | #select_field = goto | ||
+ | #where_field = address | ||
+ | query = SELECT goto FROM alias WHERE address='%s' AND active = 1 | ||
+ | </pre> | ||
+ | |||
+ | Luo tiedosto mysql_relay_domains.cf postfixin konfigurointi hakemistoon | ||
+ | |||
+ | /etc/postfix/mysql_relay_domains.cf | ||
+ | |||
+ | <pre> | ||
+ | user = postfixadmin | ||
+ | password = salasana | ||
+ | hosts = 127.0.0.1 | ||
+ | dbname = postfixadmin | ||
+ | #table = domain | ||
+ | #select_field = domain | ||
+ | #where_field = domain | ||
+ | #additional_conditions = and backupmx = '1' | ||
+ | |||
+ | query = SELECT domain FROM domain WHERE domain='%s' and backupmx = 1 | ||
+ | </pre> | ||
+ | |||
+ | Luo tiedosto mysql_relay_domains_maps.cf postfixin konfigurointi hakemistoon | ||
+ | |||
+ | /etc/postfix/mysql_relay_domains_maps.cf | ||
+ | |||
+ | <pre> | ||
+ | user = postfixadmin | ||
+ | password = salasana | ||
+ | hosts = 127.0.0.1 | ||
+ | dbname = postfixadmin | ||
+ | table = domain | ||
+ | select_field = domain | ||
+ | where_field = domain | ||
+ | additional_conditions = and backupmx = '1' | ||
+ | </pre> | ||
+ | |||
+ | Luo tiedosto mysql_virtual_mailbox_limit_maps.cf postfixin konfigurointi hakemistoon | ||
+ | |||
+ | /etc/postfix/mysql_virtual_mailbox_limit_maps.cf | ||
+ | |||
+ | <pre> | ||
+ | user = postfixadmin | ||
+ | password = salasana | ||
+ | hosts = 127.0.0.1 | ||
+ | dbname = postfixadmin | ||
+ | table = mailbox | ||
+ | select_field = quota | ||
+ | where_field = username | ||
+ | #additional_conditions = and active = '1' | ||
+ | </pre> |
Versio 10. lokakuuta 2015 kello 16.47
{{#allow-groups:user}}
Postfix Admin on web-pohjainen käyttöliittymä jossa hallitaan postilaatikoita, virtuaalisia verkkotunnuksia ja aliaksia. Siinä on tuki lomavastajalle myös.
Vaatimukset
Asenna nämä ennen Postfixadminin asennusta
- Nginx / Apache2
- PHP5-fpm / PHP5-common
- PHP5-mcrypt
- PHP5-imap
- PHP5-mysql
- PHP5-intl
- Mysql-server
- Mysql-client
- Postfix
Asennus ja konfigurointi
Luo tietokanta postfixadmin ja käyttäjä sekä salasana jolla kaikki oikeudet tietokantaan postfixadmin.
Lataa Postfixadmin wget:illä:
wget 'http://downloads.sourceforge.net/project/postfixadmin/postfixadmin/postfixadmin-2.3.6/postfixadmin-2.3.6.tar.gz?use_mirror=garr'
Pura postfixadmin
mv postfixadmin-2.3.6.tar.gz\?use_mirror=garr pfa.tar.gz
tar -zxvf pfa.tar.gz
Muokkaa postfixin konfigurointitiedostoa config.inc.php:tä:
$CONF['configured'] = true; $CONF['postfix_admin_url'] = 'https://<subdomain.domain.tld>/postfixadmin/'; $CONF['database_type'] = 'mysqli'; $CONF['database_host'] = 'localhost'; $CONF['database_user'] = 'postfix_admin'; $CONF['database_password'] = '<dbpassword1>'; $CONF['database_name'] = 'postfix'; $CONF['domain_path'] = 'YES'; $CONF['domain_in_mailbox'] = 'NO'; $CONF['fetchmail'] = 'NO';
Siirry tämän jälkeen selaimella:
https://<subdomain.domain.tld>/postfixadmin/setup.php
ja sivun alaosassa setup.php:ssä annan adminin salasana ja generoi salasana hash. Kopioi tämä ja liitä config.inc.php tiedostoon:
$CONF['setup_password'] = '<hash>';
Tämän jälkeen kirjaudu:
https://<subdomain.domain.tld>/postfixadmin
Integrointi Postfixin kanssa
- Varmista että Postfix toimii normaalisti
- Varmista että MySQL on asennettu ja toimii
Avaa main.cf tiedosto ja lisää alla oleva tiedostoon
nano /etc/postfix/main.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_mailbox_domains.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf relay_domains = mysql:/etc/postfix/mysql_relay_domains.cf virtual_mailbox_limit = 51200000 virtual_minimum_uid = 5000 virtual_uid_maps = static:5000 virtual_gid_maps = static:5000 virtual_mailbox_base = /home/vmail virtual_transport = virtual
Luo tiedosto mysql_virtual_mailbox_domains.cf konfigurointi hakemistoon
user = postfix password = salasana hosts = 127.0.0.1 dbname = postfixadmin table = domain select_field = domain where_field = domain
Luo tiedosto mysql_virtual_domain_maps.cf postfixin konfigurointi hakemistoon
/etc/postfix/mysql_virtual_domain_maps.cf
user = postfix password = salasana hosts = 127.0.0.1 dbname = postfixadmin table = domain select_field = domain where_field = domain
Luo tiedosto mysql_virtual_alias_maps.cf postfixin konfigurointi hakemistoon
/etc/postfix/mysql_virtual_alias_maps.cf
hosts = 127.0.0.1 user = salasana password = RuxA4TWGMvtE7pqK dbname = postfixadmin #table = alias #select_field = goto #where_field = address query = SELECT goto FROM alias WHERE address='%s' AND active = 1
Luo tiedosto mysql_relay_domains.cf postfixin konfigurointi hakemistoon
/etc/postfix/mysql_relay_domains.cf
user = postfixadmin password = salasana hosts = 127.0.0.1 dbname = postfixadmin #table = domain #select_field = domain #where_field = domain #additional_conditions = and backupmx = '1' query = SELECT domain FROM domain WHERE domain='%s' and backupmx = 1
Luo tiedosto mysql_relay_domains_maps.cf postfixin konfigurointi hakemistoon
/etc/postfix/mysql_relay_domains_maps.cf
user = postfixadmin password = salasana hosts = 127.0.0.1 dbname = postfixadmin table = domain select_field = domain where_field = domain additional_conditions = and backupmx = '1'
Luo tiedosto mysql_virtual_mailbox_limit_maps.cf postfixin konfigurointi hakemistoon
/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
user = postfixadmin password = salasana hosts = 127.0.0.1 dbname = postfixadmin table = mailbox select_field = quota where_field = username #additional_conditions = and active = '1'