Outils pour utilisateurs

Outils du site


tutoriaux:install-email-server:install-email-server-part-3

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
tutoriaux:install-email-server-part-3 [2022/08/04 11:01] – [Configure PostfixAdmin] fratertutoriaux:install-email-server:install-email-server-part-3 [2023/01/06 18:22] (Version actuelle) – créée - modification externe 127.0.0.1
Ligne 1: Ligne 1:
 ====== Build Email Server From Scratch on Debian – Part 3 - Create Virtual Mailboxes ====== ====== Build Email Server From Scratch on Debian – Part 3 - Create Virtual Mailboxes ======
  
-In previous articles, we discussed how to set up your own mail server on Debian from scratch. In [[tutoriaux:install-email-server-part-1|part 1]] and [[tutoriaux:install-email-server-part-2|part 2]] of this tutorial series, we learned how to set up **Postfix SMTP server** and **Dovecot IMAP server**, but so far we can only have email addresses for users with local Unix account. This tutorial is going to show you how to create virtual mailboxes on Debian mail server with **PostfixAdmin**, which is an open-source web-based interface to configure and manage a Postfix-based email server for many domains and users.+In previous articles, we discussed how to set up your own mail server on Debian from scratch. In [[tutoriaux:install-email-server:install-email-server-part-1|part 1]] and [[tutoriaux:install-email-server:install-email-server-part-2|part 2]] of this tutorial series, we learned how to set up **Postfix SMTP server** and **Dovecot IMAP server**, but so far we can only have email addresses for users with local Unix account. This tutorial is going to show you how to create virtual mailboxes on Debian mail server with **PostfixAdmin**, which is an open-source web-based interface to configure and manage a Postfix-based email server for many domains and users.
  
 With **virtual mailboxes**, we don’t need to create local Unix account for each email address. If you are going to set up a mail server for a company or organization, it’s always better to have an easy way to create virtual mailboxes in a web-based interface, which also allows users to change their passwords. That’s where PostfixAdmin comes in. With **virtual mailboxes**, we don’t need to create local Unix account for each email address. If you are going to set up a mail server for a company or organization, it’s always better to have an easy way to create virtual mailboxes in a web-based interface, which also allows users to change their passwords. That’s where PostfixAdmin comes in.
Ligne 15: Ligne 15:
   * command line client postfixadmin-cli for those who don’t want to click around in a web interface 😉   * command line client postfixadmin-cli for those who don’t want to click around in a web interface 😉
  
-<WRAP center round info 80%>+<WRAP round info>
 Once you finish part 3, you can no longer use local Unix accounts as email addresses. You must create email addresses from the PostfixAdmin web interface. Once you finish part 3, you can no longer use local Unix accounts as email addresses. You must create email addresses from the PostfixAdmin web interface.
 </WRAP> </WRAP>
Ligne 21: Ligne 21:
 ==== Requirements ==== ==== Requirements ====
  
-I assume that you have followed [[tutoriaux:install-email-server-part-1|part 1]] and [[tutoriaux:install-email-server-part-2|part 2]] of this tutorial series. If you followed mail server tutorials on other websites, I recommend purging your configurations (''sudo apt purge postfix dovecot-core'') and start over with my tutorial series, so you are not going to be confused by different setup processes.+I assume that you have followed [[tutoriaux:install-email-server:install-email-server-part-1|part 1]] and [[tutoriaux:install-email-server:install-email-server-part-2|part 2]] of this tutorial series. If you followed mail server tutorials on other websites, I recommend purging your configurations (''sudo apt purge postfix dovecot-core'') and start over with my tutorial series, so you are not going to be confused by different setup processes.
  
 Once the above requirements are met, let’s install and configure PostfixAdmin. Once the above requirements are met, let’s install and configure PostfixAdmin.
Ligne 39: Ligne 39:
 Sample output: Sample output:
  
-{{ :tutoriaux:pasted:20220802-101434.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-mysql-status.png |}}
  
 If it’s not running, start it with this command: If it’s not running, start it with this command:
Ligne 55: Ligne 55:
 When it asks you to enter MariaDB root password, press Enter key as the root password isn’t set yet. Your root account is already secured, so you should answer n to not set password. When it asks you to enter MariaDB root password, press Enter key as the root password isn’t set yet. Your root account is already secured, so you should answer n to not set password.
  
-{{ :tutoriaux:pasted:20220802-101730.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-mysql-secure-setup-1.png |}}
  
 Next, you can press ''Enter'' to answer all remaining questions, which will remove anonymous user, disable remote root login and remove test database. This step is a basic requirement for MariaDB database security. (Notice that Y is __capitalized__, which means it is the default answer. ) Next, you can press ''Enter'' to answer all remaining questions, which will remove anonymous user, disable remote root login and remove test database. This step is a basic requirement for MariaDB database security. (Notice that Y is __capitalized__, which means it is the default answer. )
  
-{{ :tutoriaux:pasted:20220802-101816.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-mysql-secure-setup-2.png |}}
  
 ===== Download PostfixAdmin on Debian Server ===== ===== Download PostfixAdmin on Debian Server =====
Ligne 255: Ligne 255:
 To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Debian server. To encrypt the HTTP traffic, we can enable HTTPS by installing a free TLS certificate issued from Let’s Encrypt. Run the following command to install Let’s Encrypt client (certbot) on Debian server.
  
-Normally this step should have been performed during the [[tutoriaux:install-email-server-part-2#obtaining_tls_certificate_with_apache_web_server|previous part]].+Normally this step should have been performed during the [[tutoriaux:install-email-server:install-email-server-part-2#obtaining_tls_certificate_with_apache_web_server|previous part]].
  
 <code bash>sudo apt install certbot</code> <code bash>sudo apt install certbot</code>
Ligne 290: Ligne 290:
 The certificate should now be obtained and automatically installed, which is indicated by the message below. The certificate should now be obtained and automatically installed, which is indicated by the message below.
  
-{{ :tutoriaux:debian-tls-certibot-success.png |}}+{{ tutoriaux:debian-email:debian-tls-certibot-success.png |}}
 ===== Enable Statistics in Dovecot ===== ===== Enable Statistics in Dovecot =====
  
Ligne 299: Ligne 299:
 Add the following lines to the end of this file. Add the following lines to the end of this file.
  
-<code>+<code ini>
 service stats { service stats {
     unix_listener stats-reader {     unix_listener stats-reader {
Ligne 329: Ligne 329:
 Go to ''postfixadmin.example.com/setup.php'' to run the web-based setup wizard. First, you need to create a setup password for PostfixAdmin. Go to ''postfixadmin.example.com/setup.php'' to run the web-based setup wizard. First, you need to create a setup password for PostfixAdmin.
  
-{{ :tutoriaux:pasted:20220802-131751.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-postfixadmin-setup.png |}}
  
 After creating the password hash, PostfixAdmin will display a line like below. After creating the password hash, PostfixAdmin will display a line like below.
  
-{{ :tutoriaux:pasted:20220802-131915.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-postfixadmin-passwordkey.png |}}
  
 <code php> <code php>
Ligne 345: Ligne 345:
 Add the line displayed on PostfixAdmin setup page to the end of the file like below. Add the line displayed on PostfixAdmin setup page to the end of the file like below.
  
-{{ :tutoriaux:pasted:20220802-132448.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-postfixadmin-config.png |}}
  
 After saving the file, you need to refresh the PostfixAdmin setup page and enter the setup password again, then create the admin account.  Please don’t use a Gmail, Yahoo Mail, or Microsoft email address for the admin account, or you might not be able to log in later. Use an email address on your own domain. You can create the email address later in PostfixAdmin. After saving the file, you need to refresh the PostfixAdmin setup page and enter the setup password again, then create the admin account.  Please don’t use a Gmail, Yahoo Mail, or Microsoft email address for the admin account, or you might not be able to log in later. Use an email address on your own domain. You can create the email address later in PostfixAdmin.
  
-{{ :tutoriaux:pasted:20220802-132722.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-postfixadmin-add-admin.png |}}
  
 Once the superadmin account is created, you can log into PostfixAdmin at ''postfixadmin.example.com/login.php''. Once the superadmin account is created, you can log into PostfixAdmin at ''postfixadmin.example.com/login.php''.
  
-{{ :tutoriaux:pasted:20220802-132926.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-postfixadmin-login.png |}}
  
 ===== Configure Postfix to Use MySQL/MariaDB Database ===== ===== Configure Postfix to Use MySQL/MariaDB Database =====
Ligne 369: Ligne 369:
 Add the following lines at the end of this file. Add the following lines at the end of this file.
  
-<code>+<code ini>
 virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
 virtual_mailbox_maps = virtual_mailbox_maps =
Ligne 388: Ligne 388:
 We want to use dovecot to deliver incoming emails to the virtual users’ message store, so also add the following line at the end of this file. We want to use dovecot to deliver incoming emails to the virtual users’ message store, so also add the following line at the end of this file.
  
-<code>virtual_transport = lmtp:unix:private/dovecot-lmtp</code>+<code ini>virtual_transport = lmtp:unix:private/dovecot-lmtp</code>
  
-{{ :tutoriaux:pasted:20220802-125410.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-dovecot-transport.png |}}
  
 Save and close the file. Next, we need to create the ''.cf'' files one by one. Create the sql directory. Save and close the file. Next, we need to create the ''.cf'' files one by one. Create the sql directory.
Ligne 402: Ligne 402:
 Add the following content. Replace ''password'' with the postfixadmin password you set in Step 2. Add the following content. Replace ''password'' with the postfixadmin password you set in Step 2.
  
-<code>+<code ini>
 user = postfixadmin user = postfixadmin
 password = postfixadmin_password password = postfixadmin_password
Ligne 420: Ligne 420:
 Add the following content. Add the following content.
  
-<code>+<code ini>
 user = postfixadmin user = postfixadmin
 password = postfixadmin_password password = postfixadmin_password
Ligne 435: Ligne 435:
 Add the following content. Add the following content.
  
-<code>+<code ini>
 user = postfixadmin user = postfixadmin
 password = postfixadmin_password password = postfixadmin_password
Ligne 449: Ligne 449:
 Add the following content. Add the following content.
  
-<code>+<code ini>
 user = postfixadmin user = postfixadmin
 password = postfixadmin_password password = postfixadmin_password
Ligne 464: Ligne 464:
 Add the following content. Add the following content.
  
-<code>+<code ini>
 user = postfixadmin user = postfixadmin
 password = postfixadmin_password password = postfixadmin_password
Ligne 478: Ligne 478:
 Add the following content. Add the following content.
  
-<code>+<code ini>
 # handles catch-all settings of target-domain # handles catch-all settings of target-domain
 user = postfixadmin user = postfixadmin
Ligne 500: Ligne 500:
 Sample output: Sample output:
  
-<code>mydestination = $myhostname, linuxbabe.com, localhost.$mydomain, localhost</code>+<code ini>mydestination = $myhostname, linuxbabe.com, localhost.$mydomain, localhost</code>
  
 The ''mydestination'' parameter contains a list of domain names that will receive emails delivered to local Unix accounts. In part 1, we added the apex domain name (like linuxbabe.com) to ''mydestination''. Since we are going to use virtual mailbox, we need to remove the apex domain name from the list by issuing the following command. The ''mydestination'' parameter contains a list of domain names that will receive emails delivered to local Unix accounts. In part 1, we added the apex domain name (like linuxbabe.com) to ''mydestination''. Since we are going to use virtual mailbox, we need to remove the apex domain name from the list by issuing the following command.
Ligne 512: Ligne 512:
 Add the following lines at the end of this file. Add the following lines at the end of this file.
  
-<code>+<code ini>
 virtual_mailbox_base = /var/vmail virtual_mailbox_base = /var/vmail
 virtual_minimum_uid = 2000 virtual_minimum_uid = 2000
Ligne 554: Ligne 554:
 <code>mail_home = /var/vmail/%d/%n/</code> <code>mail_home = /var/vmail/%d/%n/</code>
  
-{{ :tutoriaux:pasted:20220802-133310.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-box-location.png |}}
  
 Save and close the file. Then edit the //10-auth.conf// file. Save and close the file. Then edit the //10-auth.conf// file.
Ligne 583: Ligne 583:
 auth_debug_passwords = yes</code> auth_debug_passwords = yes</code>
  
-{{ :tutoriaux:pasted:20220802-133339.png |}}+{{ tutoriaux:debian-email:debian-virtualmail-auth-config.png |}}
  
 Save and close the file. Save and close the file.
Ligne 612: Ligne 612:
 Log in to PostfixAdmin web interface as the admin. Click the ''Domain List'' tab and select ''New Domain'' to add a domain. You can choose how many aliases and mailboxes are allowed for this domain. Log in to PostfixAdmin web interface as the admin. Click the ''Domain List'' tab and select ''New Domain'' to add a domain. You can choose how many aliases and mailboxes are allowed for this domain.
  
-[[debian postfixadmin add domain]]+[[..:debian_postfixadmin_add_domain]]
  
 Then click ''Virtual List'' tab and select ''Add Mailbox'' to add a new email address for your domain. Then click ''Virtual List'' tab and select ''Add Mailbox'' to add a new email address for your domain.
  
-[[debian postfixadmin Create a new mailbox]]+[[..:debian_postfixadmin_create_a_new_mailbox]]
  
 Next, you can open your desktop email client such as Mozilla Thunderbird and add a mail account. Next, you can open your desktop email client such as Mozilla Thunderbird and add a mail account.
Ligne 623: Ligne 623:
   * In the outgoing section, select SMTP protocol, enter ''mail.your-domain.com'' as the server name, choose port 587 and STARTTLS. Choose ''normal password'' as the authentication method.   * In the outgoing section, select SMTP protocol, enter ''mail.your-domain.com'' as the server name, choose port 587 and STARTTLS. Choose ''normal password'' as the authentication method.
  
-[[thunderbird-mail-client-configuration]]+[[..:thunderbird-mail-client-configuration]]
  
-<WRAP center round tip 60%>+<WRAP round tip>
 You can also use port 993 with SSL/TLS encryption for IMAP, and use port 465 with SSL/TLS encryption for SMTP. You should **not** use port 25 as the SMTP port in mail clients to submit outgoing emails. You can also use port 993 with SSL/TLS encryption for IMAP, and use port 465 with SSL/TLS encryption for SMTP. You should **not** use port 25 as the SMTP port in mail clients to submit outgoing emails.
 </WRAP> </WRAP>
Ligne 666: Ligne 666:
 If you see the “relay access denied” error when trying to send emails from a mail client, it’s most likely that you use port 25 as the SMTP port in your mail client. As I said a while ago, you should use port 587 or 465 as the SMTP port in mail clients (Mozilla Thunberbird, Microsoft Outlook, etc) to submit outgoing emails. Port 25 should be used for SMTP server to SMTP server communications. If you see the “relay access denied” error when trying to send emails from a mail client, it’s most likely that you use port 25 as the SMTP port in your mail client. As I said a while ago, you should use port 587 or 465 as the SMTP port in mail clients (Mozilla Thunberbird, Microsoft Outlook, etc) to submit outgoing emails. Port 25 should be used for SMTP server to SMTP server communications.
  
-[[postfix dovecot relay access denied]]+[[..:postfix_dovecot_relay_access_denied]]
  
 ==== iOS Mail App ==== ==== iOS Mail App ====
tutoriaux/install-email-server/install-email-server-part-3.txt · Dernière modification : 2023/01/06 18:22 de 127.0.0.1