Annexes:ConfPostfix

De WikiFr_dbSQWare
Révision datée du 6 juin 2024 à 10:15 par Ymauger (discussion | contributions) (Approche 1)
Aller à : navigation, rechercher

Ici nous vous proposerons deux approches de la configuration pour l'envoi de mails, si jamais vous avez vos méthodes en interne de les changer pas. C'est deux configurations utiliseront Postfix pour l'envoi de mails
'Site principal Postfix'.

Installation de Postfix

Cas de la machine dbSQWare

Si vous avez choisi d'utiliser la vmsqwarebox ou suivi notre guide d'installation d'un socle dbSQWare vous avez déjà Postfix installé. Une mise à jour suffira :

dbsqware@vmsqwarebox:/home/dbsqware $ sudo dnf update

Cas d'un serveur linux

D'un système linux à l'autre l'installation peut varier ici nous prenons une machine Rocky Linux 9

[admin@RockyLinux9 ~]#  sudo dnf update

[admin@RockyLinux9 ~]#  sudo dnf install postfix
Last metadata expiration check: 0:16:31 ago on Thu 06 Jun 2024 03:29:07 AM EDT.
Dependencies resolved.
===========================================================================================================================================================================================================
 Package                                        Architecture                                  Version                                               Repository                                        Size
===========================================================================================================================================================================================================
Installing:
 postfix                                        x86_64                                        2:3.5.9-24.el9                                        appstream                                        1.4 M

Transaction Summary
===========================================================================================================================================================================================================
Install  1 Package

Total download size: 1.4 M
Installed size: 4.4 M
Is this ok [y/N]:y
Downloading Packages:
postfix-3.5.9-24.el9.x86_64.rpm                                                                                                                                            3.6 MB/s | 1.4 MB     00:00
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                      2.1 MB/s | 1.4 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                   1/1
  Running scriptlet: postfix-2:3.5.9-24.el9.x86_64                                                                                                                                                     1/1
  Installing       : postfix-2:3.5.9-24.el9.x86_64                                                                                                                                                     1/1
  Running scriptlet: postfix-2:3.5.9-24.el9.x86_64                                                                                                                                                     1/1
  Verifying        : postfix-2:3.5.9-24.el9.x86_64                                                                                                                                                     1/1

Installed:
  postfix-2:3.5.9-24.el9.x86_64

Complete!

Cas d'un serveur Windows avec Cygwin


Attention.png
Warning:
Actuellement le paquet postfix pour Cygwin ne semble pas fonctionner..


Mise en place


Information.png
Information:
Nous ne traiterons que le cas d'envois de mails via une connexion authentifiée.


Approche 1


Note.png
Note:
Dans ce cas là chaque serveur se connecte à un relais externe.

Configuration générale de postfix, variables à modifier :

[admin@RockyLinux9 ~]#  vi /etc/postfix/main.cf
...
myhostname = fqdn.example.com
...
relayhost  =   [votre.relais.externe]:587

A ajouter à la fin du fichier :

# enable SASL authentication
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes

Si vous avez besoin de certificats, ajoutez également :

# where to find CA certificates
#smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
[admin@RockyLinux9 ~]#  vi /etc/postfix/sasl_passwd
[votre.relais.externe] username:password

Il faut notifier postfix de cette nouvelle "route" de messagerie

postmap /etc/postfix/sasl_passwd

Configuration de postfix

Approche 2


Information.png
Information:
Dans ce cas là ; la vmsqwarebox se connecte à un relais externe, les autres serveur utilisent la vmsqwarebox comme relayhost.


Configuration de la vmsqwarebox


Note.png
Note:
vous pouvez également réaliser cette configuration sur un autre serveur que la vmsqwarebox.


Configuration des clients du relais


Note.png
Note:
Si vous avez déjà un relayhost en interne appliquez également cette configuration à la vmsqwarebox.