mail
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| mail [2014/01/04 17:25] – créée mirtouf | mail [2017/11/26 10:42] (Version actuelle) – [3.1. main.cf] Modification DH mirtouf | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| ====== Héberger ses mails ====== | ====== Héberger ses mails ====== | ||
| + | Ce petit guide est destiné aux jeunes fruités qui ne désirent plus être dépendants des services privateurs des géants du net. | ||
| + | Par convention, votre serveur mail s' | ||
| + | Vous aurez au final: | ||
| + | * la clique postfix / dovecot / rspamd pour gérer le flux des messages | ||
| + | * modoboa pour gérer les comptes | ||
| + | * nginx et uwsgi pour vous servir modoboa et rspamd | ||
| + | * ainsi que pleins de truc cools (sieve, antispam, messages d' | ||
| + | |||
| + | ===== 0. Prérequis ===== | ||
| + | - Savoir se connecter via ssh | ||
| + | - Savoir utiliser un éditeur de texte | ||
| + | - Comprendre les bases de l' | ||
| + | - Savoir créer les enregistrements DNS qui vont bien: SPF, DKIM, PTR, TLSA, etc. | ||
| + | - Savoir générer un certificat TLS qui tient la route | ||
| + | - Savoir créer une base Mysql | ||
| + | - Savoir gérer un pare-feu | ||
| + | - Et utiliser sudo... | ||
| + | |||
| + | **Important: | ||
| + | |||
| + | Sources des logiciels: | ||
| + | * Debian Stretch | ||
| + | * Rspamd 1.6.x | ||
| + | * Modoboa 1.9.x | ||
| + | |||
| + | ===== 1. La base de travail ===== | ||
| + | On créé un utilisateur vmail qui va se charger de stocker les messages: | ||
| + | < | ||
| + | groupadd -g 5000 vmail | ||
| + | useradd -u 5000 -g vmail -s / | ||
| + | </ | ||
| + | |||
| + | On installe les paquets pour postfix: | ||
| + | < | ||
| + | apt install postfix postfix-mysql postfix-pcre | ||
| + | </ | ||
| + | |||
| + | puis dovecot: | ||
| + | < | ||
| + | apt install dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-mysql dovecot-pop3d dovecot-sieve | ||
| + | </ | ||
| + | |||
| + | puis mariadb: | ||
| + | < | ||
| + | apt install mariadb-server | ||
| + | </ | ||
| + | |||
| + | puis nginx et uwsgi: | ||
| + | < | ||
| + | apt install nginx-full uwsgi-python | ||
| + | </ | ||
| + | |||
| + | puis redis-server: | ||
| + | < | ||
| + | apt install redis-server | ||
| + | </ | ||
| + | |||
| + | puis clamav: | ||
| + | < | ||
| + | apt install clamav clamav-daemon | ||
| + | </ | ||
| + | |||
| + | puis [[https:// | ||
| + | |||
| + | et enfin pour modoboa: | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | De façon optionnelle: | ||
| + | gpg FIXME | ||
| + | |||
| + | ===== 2. Installation et configuration de modoboa ===== | ||
| + | ==== 2.1. Installation de modoboa via pip ==== | ||
| + | C'est du python et donc il faut mieux travailler dans un // | ||
| + | Avec votre utilisateur non privilégié il faut passer dans un environnement virtuel pour installer modoboa: | ||
| + | < | ||
| + | virtualenv env | ||
| + | source env/ | ||
| + | pip install -U pip | ||
| + | pip install modoboa | ||
| + | pip install mysqlclient | ||
| + | </ | ||
| + | |||
| + | ==== 2.2. Déploiement de modoboa ==== | ||
| + | Ensuite il faut déployer une instance (référez-vous à la [[https:// | ||
| + | < | ||
| + | |||
| + | pour de belles statistiques (utilisateur privilégié au besoin): | ||
| + | < | ||
| + | où ce chemin sera renseigné dans l' | ||
| + | |||
| + | on n' | ||
| + | < | ||
| + | Ces fichiers devront être placés dans un sous-dossier du dossier / | ||
| + | Veuillez noter que selon votre configuration, | ||
| + | |||
| + | ==== 2.3. Crontab pour modoboa ==== | ||
| + | Le fichier à éditer dans / | ||
| + | < | ||
| + | # Modoboa specific cron jobs | ||
| + | # | ||
| + | PYTHON=/ | ||
| + | INSTANCE=/ | ||
| + | # Operations on mailboxes | ||
| + | * | ||
| + | # Sessions table cleanup | ||
| + | 0 | ||
| + | # Logs table cleanup | ||
| + | 0 | ||
| + | # Logs parsing | ||
| + | */5 | ||
| + | # DNSBL checks | ||
| + | */30 * | ||
| + | # Public API communication | ||
| + | 0 | ||
| + | # Statistics update | ||
| + | 0 * * * * root $PYTHON $INSTANCE/ | ||
| + | # Generation of radicale file (from_file) rights | ||
| + | */ | ||
| + | </ | ||
| + | :!: Tout n'est pas forcément nécessaire et notamment la dernière ligne. | ||
| + | |||
| + | Par défaut l' | ||
| + | |||
| + | ===== 3. Postfix ===== | ||
| + | ==== 3.1. main.cf ==== | ||
| + | Pour postfix c'est assez simple, le main.cf (avec une mise en forme qui plairait à hardware): | ||
| + | < | ||
| + | ####################### | ||
| + | ## GENERALS SETTINGS ## | ||
| + | ####################### | ||
| + | |||
| + | smtpd_banner | ||
| + | compatibility_level | ||
| + | biff = no | ||
| + | append_at_myorigin | ||
| + | append_dot_mydomain | ||
| + | # was " | ||
| + | readme_directory | ||
| + | allow_percent_hack | ||
| + | delay_warning_time | ||
| + | mailbox_command | ||
| + | recipient_delimiter | ||
| + | disable_vrfy_command = yes | ||
| + | message_size_limit | ||
| + | # | ||
| + | |||
| + | inet_interfaces = all | ||
| + | inet_protocols = all | ||
| + | |||
| + | myhostname | ||
| + | mydomain | ||
| + | myorigin | ||
| + | # | ||
| + | mydestination = | ||
| + | mynetworks | ||
| + | |||
| + | alias_maps = hash:/ | ||
| + | alias_database = hash:/ | ||
| + | |||
| + | # Tuning | ||
| + | local_destination_concurrency_limit = 20 | ||
| + | smtp_host_lookup = native | ||
| + | |||
| + | ############### | ||
| + | ## SMTP/UTF8 ## | ||
| + | ############### | ||
| + | |||
| + | smtputf8_enable = yes | ||
| + | |||
| + | # The default is to enable " | ||
| + | # only for Postfix sendmail command-line submissions and address | ||
| + | # verification probes. | ||
| + | # https:// | ||
| + | # smtputf8_autodetect_classes = all | ||
| + | |||
| + | ################### | ||
| + | ## RATE LIMITING ## | ||
| + | ################### | ||
| + | |||
| + | # Allow to avoid 421 error when send bulk mail | ||
| + | default_destination_rate_delay = 1s | ||
| + | default_destination_recipient_limit = 10 | ||
| + | |||
| + | # concurrency_limit has no effect when rate_delay is turned on. | ||
| + | # It specifies a delay BETWEEN deliveries, meaning the deliveries | ||
| + | # cannot be in parallel. | ||
| + | # default_destination_concurrency_limit=2 | ||
| + | |||
| + | #################### | ||
| + | ## TLS PARAMETERS ## | ||
| + | #################### | ||
| + | |||
| + | # Smtp ( OUTGOING ) | ||
| + | smtp_tls_loglevel | ||
| + | smtp_tls_security_level | ||
| + | smtp_dns_support_level | ||
| + | smtp_tls_CAfile | ||
| + | smtp_tls_protocols | ||
| + | smtp_tls_mandatory_protocols = !SSLv2, !SSLv3 | ||
| + | smtp_tls_mandatory_ciphers | ||
| + | smtp_tls_note_starttls_offer = yes | ||
| + | |||
| + | # Smtpd ( INCOMING ) | ||
| + | smtpd_tls_loglevel | ||
| + | smtpd_tls_auth_only | ||
| + | smtpd_tls_security_level | ||
| + | smtpd_tls_received_header | ||
| + | smtpd_tls_protocols | ||
| + | smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3 | ||
| + | smtpd_tls_mandatory_ciphers | ||
| + | smtpd_tls_exclude_ciphers | ||
| + | tls_high_cipherlist | ||
| + | smtpd_tls_CAfile | ||
| + | smtpd_tls_cert_file | ||
| + | smtpd_tls_key_file | ||
| + | smtpd_tls_dh1024_param_file | ||
| + | |||
| + | tls_preempt_cipherlist = yes | ||
| + | tls_random_source | ||
| + | |||
| + | smtp_tls_session_cache_database | ||
| + | smtpd_tls_session_cache_database = btree: | ||
| + | mtpd_tls_session_cache_timeout | ||
| + | lmtp_tls_session_cache_database | ||
| + | |||
| + | ##################### | ||
| + | ## SASL PARAMETERS ## | ||
| + | ##################### | ||
| + | |||
| + | smtpd_sasl_auth_enable | ||
| + | smtpd_sasl_type | ||
| + | smtpd_sasl_path | ||
| + | smtpd_sasl_security_options | ||
| + | smtpd_sasl_tls_security_options = $smtpd_sasl_security_options | ||
| + | smtpd_sasl_local_domain | ||
| + | # was " | ||
| + | smtpd_sasl_authenticated_header = yes | ||
| + | |||
| + | smtpd_sender_login_maps | ||
| + | | ||
| + | | ||
| + | broken_sasl_auth_clients = yes | ||
| + | |||
| + | ############################## | ||
| + | ## VIRTUALS MAPS PARAMETERS ## | ||
| + | ############################## | ||
| + | |||
| + | virtual_uid_maps | ||
| + | virtual_gid_maps | ||
| + | virtual_minimum_uid | ||
| + | virtual_mailbox_base | ||
| + | virtual_transport | ||
| + | # | ||
| + | virtual_mailbox_domains = mysql:/ | ||
| + | virtual_alias_maps | ||
| + | virtual_alias_domains | ||
| + | relay_domains | ||
| + | transport_maps | ||
| + | mysql:/ | ||
| + | mysql:/ | ||
| + | hash:/ | ||
| + | |||
| + | ###################### | ||
| + | ## ERRORS REPORTING ## | ||
| + | ###################### | ||
| + | |||
| + | # notify_classes = bounce, delay, resource, software | ||
| + | notify_classes = resource, software | ||
| + | |||
| + | error_notice_recipient | ||
| + | # delay_notice_recipient | ||
| + | # bounce_notice_recipient | ||
| + | # 2bounce_notice_recipient = postmaster@domaine.tld | ||
| + | |||
| + | ################## | ||
| + | ## RESTRICTIONS ## | ||
| + | ################## | ||
| + | |||
| + | ## | ||
| + | # Access restrictions for mail relay control that the Postfix SMTP server applies | ||
| + | # in the context of the RCPT TO command, before smtpd_recipient_restrictions | ||
| + | ## | ||
| + | |||
| + | # * permit_mynetworks : Permit the request when the client IP address matches any trusted network | ||
| + | # * permit_sasl_authenticated : Permit the request when the client is successfully authenticated | ||
| + | # * reject_unauth_destination : No one else, reject all others relaying requests | ||
| + | |||
| + | smtpd_relay_restrictions= | ||
| + | permit_mynetworks, | ||
| + | permit_sasl_authenticated, | ||
| + | reject_unauth_destination | ||
| + | |||
| + | ## | ||
| + | # Restrictions that the Postfix SMTP server applies in the context | ||
| + | # of a client MAIL FROM command | ||
| + | ## | ||
| + | |||
| + | # * reject_non_fqdn_sender : Reject when the MAIL FROM address is not in fully-qualified domain form | ||
| + | # * reject_unknown_sender_domain : Reject when the MAIL FROM domain has no DNS MX, no DNS A record or a malformed MX record | ||
| + | # * reject_sender_login_mismatch: | ||
| + | # * reject_rhsbl_sender : Reject when the MAIL FROM domain is blacklisted in dbl.spamhaus.org | ||
| + | |||
| + | smtpd_sender_restrictions= | ||
| + | reject_non_fqdn_sender, | ||
| + | reject_unknown_sender_domain, | ||
| + | reject_sender_login_mismatch, | ||
| + | reject_rhsbl_sender dbl.spamhaus.org | ||
| + | |||
| + | ## | ||
| + | # Restrictions that the Postfix SMTP server applies in the context | ||
| + | # of a client RCPT TO command, after smtpd_relay_restrictions | ||
| + | ## | ||
| + | |||
| + | # * permit_mynetworks : Permit the request when the client IP address matches any trusted network | ||
| + | # * permit_sasl_authenticated : Permit the request when the client is successfully authenticated | ||
| + | # * reject_unknown_recipient_domain : Reject when the RCPT TO domain has no DNS MX or no DNS A record or a malformed MX record | ||
| + | # * reject_non_fqdn_recipient : Reject when the RCPT TO address is not in fully-qualified domain form | ||
| + | # * reject_unlisted_recipient : Reject when the RCPT TO address is not listed in the list of valid recipients for its domain | ||
| + | # * reject_rbl_client : Reject connections from IP addresses blacklisted in zen.spamhaus.org | ||
| + | |||
| + | smtpd_recipient_restrictions= | ||
| + | permit_mynetworks, | ||
| + | permit_sasl_authenticated, | ||
| + | reject_unknown_recipient_domain, | ||
| + | reject_non_fqdn_recipient, | ||
| + | reject_unlisted_recipient, | ||
| + | check_recipient_access | ||
| + | mysql:/ | ||
| + | mysql:/ | ||
| + | reject_unauth_destination | ||
| + | reject_unverified_recipient | ||
| + | reject_rbl_client zen.spamhaus.org | ||
| + | |||
| + | ## | ||
| + | # Restrictions that the Postfix SMTP server applies in the context of a client HELO command | ||
| + | ## | ||
| + | |||
| + | # Fully enforce helo restriction | ||
| + | # without " | ||
| + | # smtpd_helo_restrictions by not sending HELO or EHLO | ||
| + | smtpd_helo_required = yes | ||
| + | strict_rfc821_envelopes = yes | ||
| + | |||
| + | # Wait until the RCPT TO command before evaluating restrictions | ||
| + | smtpd_delay_reject = yes | ||
| + | |||
| + | # Filtrage | ||
| + | receive_override_options = no_address_mappings | ||
| + | |||
| + | # * permit_mynetworks : Permit the request when the client IP address matches any trusted network | ||
| + | # * permit_sasl_authenticated : Permit the request when the client is successfully authenticated | ||
| + | # * reject_invalid_helo_hostname : Reject the request when the HELO or EHLO hostname is malformed | ||
| + | # * reject_non_fqdn_helo_hostname : Reject the request when the HELO or EHLO hostname is not in fully-qualified domain | ||
| + | |||
| + | smtpd_helo_restrictions = | ||
| + | permit_mynetworks, | ||
| + | permit_sasl_authenticated, | ||
| + | reject_invalid_helo_hostname, | ||
| + | reject_non_fqdn_helo_hostname | ||
| + | |||
| + | # Requirements for the connecting server | ||
| + | smtpd_client_restrictions = | ||
| + | permit_mynetworks, | ||
| + | permit_sasl_authenticated, | ||
| + | permit_auth_destination | ||
| + | reject_rbl_client bl.spamcop.net, | ||
| + | reject_rbl_client dnsbl.njabl.org, | ||
| + | reject_rbl_client cbl.abuseat.org, | ||
| + | reject_rbl_client sbl-xbl.spamhaus.org, | ||
| + | reject_rbl_client zen.spamhaus.org, | ||
| + | reject_rbl_client dnsbl.sorbs.net, | ||
| + | permit | ||
| + | |||
| + | |||
| + | ############ | ||
| + | ## RSPAMD ## | ||
| + | ############ | ||
| + | |||
| + | milter_protocol | ||
| + | milter_mail_macros | ||
| + | milter_default_action = accept | ||
| + | smtpd_milters | ||
| + | non_smtpd_milters | ||
| + | |||
| + | ############ | ||
| + | ## ZEYPLE ## | ||
| + | ############ | ||
| + | |||
| + | content_filter = zeyple | ||
| + | |||
| + | ####################### | ||
| + | ## YOUR CUSTOM RULES ## | ||
| + | ####################### | ||
| + | </ | ||
| + | :!: Veuillez noter que / | ||
| + | |||
| + | Le fichier Diffie-Hellman contient ceci et est préférentiellement choisi car audité de façon régulière: | ||
| + | < | ||
| + | -----BEGIN DH PARAMETERS----- | ||
| + | MIIBCAKCAQEA////////// | ||
| + | +8yTnc4kmz75fS/ | ||
| + | 87VXE15/ | ||
| + | YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi | ||
| + | 7MA0BM0oNC9hkXL+nOmFg/ | ||
| + | ssbzSibBsu/ | ||
| + | -----END DH PARAMETERS----- | ||
| + | </ | ||
| + | ==== 3.2. master.cf ==== | ||
| + | Le master.cf: | ||
| + | < | ||
| + | # | ||
| + | # Postfix master process configuration file. For details on the format | ||
| + | # of the file, see the master(5) manual page (command: "man 5 master" | ||
| + | # on-line: http:// | ||
| + | # | ||
| + | # Do not forget to execute " | ||
| + | # | ||
| + | # ========================================================================== | ||
| + | # service type private unpriv | ||
| + | # | ||
| + | # ========================================================================== | ||
| + | smtp inet n | ||
| + | #smtp inet n | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | submission inet n | ||
| + | -o smtpd_enforce_tls=yes | ||
| + | -o smtpd_sasl_auth_enable=yes | ||
| + | -o smtpd_client_restrictions=permit_sasl_authenticated, | ||
| + | #628 | ||
| + | pickup | ||
| + | -o content_filter= | ||
| + | -o receive_override_options=no_header_body_checks | ||
| + | cleanup | ||
| + | qmgr unix n | ||
| + | #qmgr | ||
| + | tlsmgr | ||
| + | rewrite | ||
| + | bounce | ||
| + | defer | ||
| + | trace | ||
| + | verify | ||
| + | flush | ||
| + | proxymap | ||
| + | proxywrite unix - | ||
| + | smtp unix - | ||
| + | relay | ||
| + | -o smtp_fallback_relay= | ||
| + | showq | ||
| + | error | ||
| + | retry | ||
| + | discard | ||
| + | local | ||
| + | virtual | ||
| + | lmtp unix - | ||
| + | anvil | ||
| + | scache | ||
| + | # | ||
| + | # ==================================================================== | ||
| + | # Interfaces to non-Postfix software. Be sure to examine the manual | ||
| + | # pages of the non-Postfix software to find out what options it wants. | ||
| + | # | ||
| + | # Many of the following services use the Postfix pipe(8) delivery | ||
| + | # agent. | ||
| + | # and other message envelope options. | ||
| + | # ==================================================================== | ||
| + | # | ||
| + | # maildrop. See the Postfix MAILDROP_README file for details. | ||
| + | # Also specify in main.cf: maildrop_destination_recipient_limit=1 | ||
| + | # | ||
| + | maildrop | ||
| + | flags=DRhu user=vmail argv=/ | ||
| + | # | ||
| + | # ==================================================================== | ||
| + | # | ||
| + | # Recent Cyrus versions can use the existing " | ||
| + | # | ||
| + | # Specify in cyrus.conf: | ||
| + | # | ||
| + | # | ||
| + | # Specify in main.cf one or more of the following: | ||
| + | # mailbox_transport = lmtp: | ||
| + | # virtual_transport = lmtp: | ||
| + | # | ||
| + | # ==================================================================== | ||
| + | # | ||
| + | # Cyrus 2.1.5 (Amos Gouaux) | ||
| + | # Also specify in main.cf: cyrus_destination_recipient_limit=1 | ||
| + | # | ||
| + | # | ||
| + | # user=cyrus argv=/ | ||
| + | # | ||
| + | # ==================================================================== | ||
| + | # Old example of delivery via Cyrus. | ||
| + | # | ||
| + | #old-cyrus unix - | ||
| + | # flags=R user=cyrus argv=/ | ||
| + | # | ||
| + | # ==================================================================== | ||
| + | # | ||
| + | # See the Postfix UUCP_README file for configuration details. | ||
| + | # | ||
| + | uucp unix - | ||
| + | flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) | ||
| + | # | ||
| + | # Other external delivery methods. | ||
| + | # | ||
| + | ifmail | ||
| + | flags=F user=ftn argv=/ | ||
| + | bsmtp | ||
| + | flags=Fq. user=bsmtp argv=/ | ||
| + | scalemail-backend unix - n n - 2 pipe | ||
| + | flags=R user=scalemail argv=/ | ||
| + | mailman | ||
| + | flags=FR user=list argv=/ | ||
| + | ${nexthop} ${user} | ||
| + | dovecot | ||
| + | flags=DRhu user=vmail: | ||
| + | dane | ||
| + | -o smtp_dns_support_level=dnssec | ||
| + | -o smtp_tls_security_level=dane | ||
| + | |||
| + | # Modoboa DMARC | ||
| + | dmarc-rua-parser unix - | ||
| + | flags= user=vmail: | ||
| + | |||
| + | # Zeyple | ||
| + | zeyple | ||
| + | user=zeyple argv=/ | ||
| + | |||
| + | 127.0.0.1: | ||
| + | -o content_filter= | ||
| + | -o receive_override_options=no_unknown_recipient_checks, | ||
| + | -o smtpd_helo_restrictions= | ||
| + | -o smtpd_client_restrictions= | ||
| + | -o smtpd_sender_restrictions= | ||
| + | -o smtpd_recipient_restrictions=permit_mynetworks, | ||
| + | -o mynetworks=127.0.0.0/ | ||
| + | -o smtpd_authorized_xforward_hosts=127.0.0.0/ | ||
| + | |||
| + | # Vacation (modoboa) | ||
| + | autoreply | ||
| + | | ||
| + | </ | ||
| + | |||
| + | ==== 3.3. Complément DMARC ==== | ||
| + | Il faut ajouter le fichier suivant dans / | ||
| + | < | ||
| + | adresse_dmarc_enregistrement_DNS@domaine.tld dmarc-rua-parser: | ||
| + | </ | ||
| + | puis un coup de postmap bien placé: | ||
| + | < | ||
| + | postmap / | ||
| + | </ | ||
| + | ===== 4.Dovecot ===== | ||
| + | ==== 4.1. Configuration générale ==== | ||
| + | La configuration générale de dovecot dans / | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | disable_plaintext_auth = no | ||
| + | auth_cache_ttl = 1 hour | ||
| + | auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_@ | ||
| + | auth_mechanisms = plain login | ||
| + | !include auth-sql.conf.ext | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | service director { | ||
| + | unix_listener login/ | ||
| + | } | ||
| + | fifo_listener login/ | ||
| + | } | ||
| + | unix_listener director-userdb { | ||
| + | } | ||
| + | inet_listener { | ||
| + | } | ||
| + | } | ||
| + | service imap-login { | ||
| + | } | ||
| + | service pop3-login { | ||
| + | } | ||
| + | protocol lmtp { | ||
| + | } | ||
| + | |||
| + | log_path = / | ||
| + | info_log_path = / | ||
| + | auth_verbose = yes | ||
| + | auth_verbose_passwords = sha1 | ||
| + | plugin { | ||
| + | } | ||
| + | log_timestamp = " | ||
| + | </ | ||
| + | |||
| + | ==> | ||
| + | < | ||
| + | mail_location = maildir: | ||
| + | namespace inbox { | ||
| + | inbox = yes | ||
| + | } | ||
| + | mail_uid = 5000 | ||
| + | mail_gid = 5000 | ||
| + | mail_privileged_group = mail | ||
| + | valid_chroot_dirs = / | ||
| + | mail_plugins = $mail_plugins quota | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | service imap-login { | ||
| + | inet_listener imap { | ||
| + | port = 143 | ||
| + | } | ||
| + | inet_listener imaps { | ||
| + | port = 993 | ||
| + | ssl = yes | ||
| + | } | ||
| + | } | ||
| + | service pop3-login { | ||
| + | inet_listener pop3 { | ||
| + | port = 110 | ||
| + | } | ||
| + | inet_listener pop3s { | ||
| + | port = 995 | ||
| + | ssl = yes | ||
| + | } | ||
| + | } | ||
| + | service lmtp { | ||
| + | unix_listener / | ||
| + | mode = 0600 | ||
| + | user = postfix | ||
| + | group = postfix | ||
| + | } | ||
| + | user = vmail | ||
| + | } | ||
| + | service imap { | ||
| + | executable = imap postlogin | ||
| + | } | ||
| + | service pop3 { | ||
| + | executable = pop3 postlogin | ||
| + | } | ||
| + | service auth { | ||
| + | unix_listener auth-userdb { | ||
| + | } | ||
| + | unix_listener / | ||
| + | mode = 0666 | ||
| + | user = postfix | ||
| + | group = postfix | ||
| + | } | ||
| + | } | ||
| + | service auth-worker { | ||
| + | } | ||
| + | service dict { | ||
| + | unix_listener dict { | ||
| + | mode = 0600 | ||
| + | user = vmail | ||
| + | } | ||
| + | } | ||
| + | service postlogin { | ||
| + | executable = script-login / | ||
| + | user = modoboa | ||
| + | unix_listener postlogin { | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | ssl = required | ||
| + | ssl_cert = </ | ||
| + | ssl_key = </ | ||
| + | ssl_dh_parameters_length = 2048 | ||
| + | ssl_cipher_list = ECDHE-RSA-AES128-GCM-SHA256: | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | postmaster_address = postmaster@domaine.tld | ||
| + | quota_full_tempfail = yes | ||
| + | recipient_delimiter = + | ||
| + | lda_mailbox_autocreate = yes | ||
| + | lda_mailbox_autosubscribe = yes | ||
| + | protocol lda { | ||
| + | log_path = / | ||
| + | info_log_path = / | ||
| + | mail_plugins = quota sieve | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | namespace inbox { | ||
| + | mailbox Drafts { | ||
| + | auto = subscribe | ||
| + | special_use = \Drafts | ||
| + | } | ||
| + | mailbox Junk { | ||
| + | auto = subscribe | ||
| + | special_use = \Junk | ||
| + | } | ||
| + | mailbox Trash { | ||
| + | auto = subscribe | ||
| + | special_use = \Trash | ||
| + | } | ||
| + | mailbox Sent { | ||
| + | auto = subscribe | ||
| + | special_use = \Sent | ||
| + | } | ||
| + | mailbox "Sent Messages" | ||
| + | auto = subscribe | ||
| + | special_use = \Sent | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | protocol imap { | ||
| + | mail_plugins = $mail_plugins imap_quota imap_sieve | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | protocol lmtp { | ||
| + | postmaster_address = postmaster@domaine.tld | ||
| + | mail_plugins = $mail_plugins sieve quota | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | protocols = $protocols sieve | ||
| + | service managesieve-login { | ||
| + | inet_listener sieve { | ||
| + | port = 4190 | ||
| + | } | ||
| + | service_count = 1 | ||
| + | process_min_avail = 0 | ||
| + | vsz_limit = 64M | ||
| + | } | ||
| + | service managesieve { | ||
| + | } | ||
| + | protocol sieve { | ||
| + | managesieve_max_line_length = 65536 | ||
| + | mail_max_userip_connections = 10 | ||
| + | mail_plugins = | ||
| + | managesieve_logout_format = bytes=%i/%o | ||
| + | managesieve_implementation_string = Dovecot Pigeonhole | ||
| + | managesieve_max_compile_errors = 5 | ||
| + | log_path=/ | ||
| + | info_log_path=/ | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | protocol pop3 { | ||
| + | mail_plugins = $mail_plugins | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | plugin { | ||
| + | } | ||
| + | plugin { | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | plugin { | ||
| + | } | ||
| + | plugin { | ||
| + | quota_warning = storage=75%% / | ||
| + | quota_warning2 = storage=90%% / | ||
| + | } | ||
| + | plugin { | ||
| + | quota = maildir: | ||
| + | } | ||
| + | plugin { | ||
| + | quota = dict:User quota:: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | plugin { | ||
| + | sieve = ~/ | ||
| + | sieve_dir = ~/sieve | ||
| + | sieve_default = / | ||
| + | sieve_global = / | ||
| + | sieve_plugins = sieve_imapsieve sieve_extprograms | ||
| + | imapsieve_mailbox1_name = Spam | ||
| + | imapsieve_mailbox1_causes = COPY | ||
| + | imapsieve_mailbox1_before = file:/ | ||
| + | imapsieve_mailbox2_name = * | ||
| + | imapsieve_mailbox2_from = Spam | ||
| + | imapsieve_mailbox2_causes = COPY | ||
| + | imapsieve_mailbox2_before = file:/ | ||
| + | sieve_pipe_bin_dir = / | ||
| + | sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment | ||
| + | recipient_delimiter = + | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | plugin { | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = checkpassword | ||
| + | args = / | ||
| + | } | ||
| + | userdb { | ||
| + | driver = prefetch | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = passwd-file | ||
| + | deny = yes | ||
| + | args = / | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = dict | ||
| + | args = / | ||
| + | } | ||
| + | userdb { | ||
| + | driver = dict | ||
| + | args = / | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = passwd-file | ||
| + | master = yes | ||
| + | args = / | ||
| + | pass = yes | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = passwd-file | ||
| + | args = scheme=CRYPT username_format=%u / | ||
| + | } | ||
| + | userdb { | ||
| + | driver = passwd-file | ||
| + | args = username_format=%u / | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = sql | ||
| + | args = / | ||
| + | } | ||
| + | userdb { | ||
| + | driver = sql | ||
| + | args = / | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = pam | ||
| + | } | ||
| + | userdb { | ||
| + | driver = passwd | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | passdb { | ||
| + | driver = vpopmail | ||
| + | args = | ||
| + | } | ||
| + | userdb { | ||
| + | driver = vpopmail | ||
| + | args = quota_template=quota_rule=*: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== 4.2. Gestion de la db ==== | ||
| + | Les autres fichiers utiles tels ==>/ | ||
| + | < | ||
| + | default_pass_scheme = MD5 | ||
| + | iterate_prefix = userdb/ | ||
| + | key passdb { | ||
| + | key = passdb/%u | ||
| + | format = json | ||
| + | } | ||
| + | key userdb { | ||
| + | key = userdb/%u | ||
| + | format = json | ||
| + | } | ||
| + | key quota { | ||
| + | key = userdb/ | ||
| + | default_value = 100M | ||
| + | } | ||
| + | passdb_objects = passdb | ||
| + | userdb_objects = userdb | ||
| + | userdb_fields { | ||
| + | quota_rule = *: | ||
| + | mail = maildir: | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | connect = host=127.0.0.1 dbname=DB user=USER password=PWD | ||
| + | map { | ||
| + | pattern = priv/ | ||
| + | table = admin_quota | ||
| + | username_field = username | ||
| + | value_field = bytes | ||
| + | } | ||
| + | map { | ||
| + | pattern = priv/ | ||
| + | table = admin_quota | ||
| + | username_field = username | ||
| + | value_field = messages | ||
| + | } | ||
| + | map { | ||
| + | pattern = shared/ | ||
| + | table = expires | ||
| + | value_field = expire_stamp | ||
| + | fields { | ||
| + | username = $user | ||
| + | mailbox = $mailbox | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | driver = mysql | ||
| + | connect = host=127.0.0.1 dbname=DB user=USER password=PWD | ||
| + | default_pass_scheme = CRYPT | ||
| + | password_query = SELECT email AS user, password FROM core_user WHERE email=' | ||
| + | user_query = SELECT '/ | ||
| + | iterate_query = SELECT email AS user FROM core_user | ||
| + | </ | ||
| + | |||
| + | ==== 4.3. scripts utiles ==== | ||
| + | Il faut aussi des scripts utiles: | ||
| + | ==>/ | ||
| + | < | ||
| + | #!/bin/sh | ||
| + | |||
| + | DBNAME=DB | ||
| + | DBUSER=USER | ||
| + | DBPASSWORD=PWD | ||
| + | |||
| + | echo " | ||
| + | |||
| + | exec " | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | #!/bin/sh | ||
| + | PERCENT=$1 | ||
| + | USER=$2 | ||
| + | cat << EOF | / | ||
| + | From: postmaster@domaine.tld | ||
| + | Subject: quota warning | ||
| + | |||
| + | Your mailbox is now $PERCENT% full. | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | ==== 4.4 antispam ==== | ||
| + | Pour l' | ||
| + | ==>/ | ||
| + | < | ||
| + | require [" | ||
| + | |||
| + | if environment :matches " | ||
| + | set " | ||
| + | } | ||
| + | |||
| + | if string " | ||
| + | stop; | ||
| + | } | ||
| + | |||
| + | if environment :matches " | ||
| + | set " | ||
| + | } | ||
| + | |||
| + | pipe :copy " | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | require [" | ||
| + | |||
| + | if environment :matches " | ||
| + | set " | ||
| + | } | ||
| + | |||
| + | pipe :copy " | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | # rspamd client reads piped ham message from the standard input | ||
| + | exec / | ||
| + | </ | ||
| + | |||
| + | ==>/ | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | # rspamd client reads piped spam message from the standard input | ||
| + | exec / | ||
| + | </ | ||
| + | |||
| + | ===== 5. nginx et uwsgi ===== | ||
| + | ==== 5.1. configuration du domaine principal ==== | ||
| + | Le domaine principal mail.domaine.tld sera configuré de cette façon: | ||
| + | < | ||
| + | server { | ||
| + | listen 80; | ||
| + | # listen [::]:80 ipv6only=on; | ||
| + | root / | ||
| + | |||
| + | # Make site accessible from http:// | ||
| + | server_name mail.domaine.tld localhost; | ||
| + | |||
| + | if ($ssl_protocol = "" | ||
| + | rewrite ^/ | ||
| + | } | ||
| + | } | ||
| + | |||
| + | server { | ||
| + | listen 443 ssl http2; | ||
| + | # listen [::]:443 ssl http2; | ||
| + | ssl on; | ||
| + | keepalive_timeout 70; | ||
| + | |||
| + | server_name mail.domaine.tld localhost; | ||
| + | root / | ||
| + | |||
| + | ssl_certificate / | ||
| + | ssl_certificate_key / | ||
| + | |||
| + | access_log | ||
| + | error_log / | ||
| + | |||
| + | location / | ||
| + | autoindex on; | ||
| + | alias / | ||
| + | } | ||
| + | |||
| + | # Whether or not Modoboa uses a media directory depends on how | ||
| + | # you configured Modoboa. It does not hurt to have this. | ||
| + | location /media/ { | ||
| + | autoindex on; | ||
| + | alias / | ||
| + | } | ||
| + | |||
| + | # This denies access to any file that begins with | ||
| + | # " | ||
| + | # Modoboa installed from scratch would not contain any such | ||
| + | # files, but you never know what the future holds. | ||
| + | location ~ /\.ht { | ||
| + | deny all; | ||
| + | } | ||
| + | |||
| + | location / { | ||
| + | include uwsgi_params; | ||
| + | uwsgi_pass unix:/ | ||
| + | uwsgi_param UWSGI_SCRIPT instance.wsgi: | ||
| + | uwsgi_param UWSGI_SCHEME https; | ||
| + | } | ||
| + | |||
| + | location /rspamd/ { | ||
| + | proxy_pass | ||
| + | proxy_set_header Host $host; | ||
| + | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== 5.2. uwsgi ==== | ||
| + | et le fichier nécessaire pour uwsgi (à adapter à votre utilisation): | ||
| + | < | ||
| + | [uwsgi] | ||
| + | plugins = python | ||
| + | chdir = / | ||
| + | venv = / | ||
| + | module = < | ||
| + | master = true | ||
| + | harakiri = 60 | ||
| + | processes = 2 | ||
| + | vhost = true | ||
| + | no-default-app = true | ||
| + | </ | ||
| + | |||
| + | Je précise qu'il faudra modifier la configuration TLS par défaut de nginx que je trouve trop lâche mais je vous laisse faire vos choix. | ||
| + | |||
| + | ===== 6. Rspamd ===== | ||
| + | ==== 6.1. Configuration ==== | ||
| + | Les fichiers de configuration de rspamd ne doivent pas être modifiés, il faut soit les compléter (dossier local.d) ou les remplacer (override.d), | ||
| + | ==>/ | ||
| + | < | ||
| + | worker " | ||
| + | count = 1; | ||
| + | } | ||
| + | |||
| + | multimap { | ||
| + | # ip - matches source IP of message (radix map) | ||
| + | # from - matches envelope from (or header From if envelope from is absent) | ||
| + | # rcpt - matches any of envelope rcpt or header To if envelope info is missing | ||
| + | # header - matches any header specified (must have header = " | ||
| + | # dnsbl - matches source IP against some DNS blacklist (consider using RBL module for this) | ||
| + | local_bl_ip { type = " | ||
| + | local_bl_from { type = " | ||
| + | local_bl_rcpt { type = " | ||
| + | local_wl_ip { type = " | ||
| + | local_wl_from { type = " | ||
| + | local_wl_rcpt { type = " | ||
| + | } | ||
| + | |||
| + | metric { | ||
| + | name = " | ||
| + | group { | ||
| + | name = " | ||
| + | symbol { | ||
| + | weight = 3; | ||
| + | description = " | ||
| + | name = " | ||
| + | } | ||
| + | symbol { | ||
| + | weight = 3; | ||
| + | description = " | ||
| + | name = " | ||
| + | } | ||
| + | symbol { | ||
| + | weight = 3; | ||
| + | description = " | ||
| + | name = " | ||
| + | } | ||
| + | symbol { | ||
| + | weight = -10; | ||
| + | description = " | ||
| + | name = " | ||
| + | } | ||
| + | symbol { | ||
| + | weight = -5; | ||
| + | description = " | ||
| + | name = " | ||
| + | } | ||
| + | symbol { | ||
| + | weight = -5; | ||
| + | description = " | ||
| + | name = " | ||
| + | } | ||
| + | } | ||
| + | |||
| + | } | ||
| + | </ | ||
| + | |||
| + | Les fichiers créés pour l' | ||
| + | ==> / | ||
| + | < | ||
| + | # multiple scanners could be checked, for each we create a configuration block with an arbitrary name | ||
| + | clamav { | ||
| + | enabled = true; | ||
| + | # If set force this action if any virus is found (default unset: no action is forced) | ||
| + | action = " | ||
| + | # if `true` only messages with non-image attachments will be checked (default true) | ||
| + | attachments_only = false; | ||
| + | # If `max_size` is set, messages > n bytes in size are not scanned | ||
| + | #max_size = 20000000; | ||
| + | # symbol to add (add it to metric if you want non-zero weight) | ||
| + | symbol = " | ||
| + | # type of scanner: " | ||
| + | type = " | ||
| + | # If set true, log message is emitted for clean messages | ||
| + | #log_clean = false; | ||
| + | # For " | ||
| + | #product_id = 12345; | ||
| + | # For " | ||
| + | log_clean = true; | ||
| + | # servers to query (if port is unspecified, | ||
| + | # can be specified multiple times to pool servers | ||
| + | # can be set to a path to a unix socket | ||
| + | servers = " | ||
| + | # if `patterns` is specified virus name will be matched against provided regexes and the related | ||
| + | # symbol will be yielded if a match is found. If no match is found, default symbol is yielded. | ||
| + | patterns { | ||
| + | # symbol_name = " | ||
| + | JUST_EICAR = " | ||
| + | } | ||
| + | # `whitelist` points to a map of IP addresses. Mail from these addresses is not scanned. | ||
| + | #whitelist = "/ | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # local.d/ | ||
| + | |||
| + | # If false, messages with empty envelope from are not signed | ||
| + | allow_envfrom_empty = false; | ||
| + | # If true, envelope/ | ||
| + | allow_hdrfrom_mismatch = false; | ||
| + | # If true, multiple from headers are allowed (but only first is used) | ||
| + | allow_hdrfrom_multiple = true; | ||
| + | # If true, username does not need to contain matching domain | ||
| + | allow_username_mismatch = true; | ||
| + | # If false, messages from authenticated users are not selected for signing | ||
| + | auth_only = true; | ||
| + | # Default path to key, can include ' | ||
| + | path = "/ | ||
| + | # Default selector to use | ||
| + | selector = " | ||
| + | # If false, messages from local networks are not selected for signing | ||
| + | sign_local = true; | ||
| + | # Symbol to add when message is signed | ||
| + | symbol_signed = " | ||
| + | # Whether to fallback to global config | ||
| + | try_fallback = true; | ||
| + | # Domain to use for ARC signing: can be " | ||
| + | use_domain = " | ||
| + | # Whether to normalise domains to eSLD | ||
| + | use_esld = false; | ||
| + | # Whether to get keys from Redis | ||
| + | use_redis = false; | ||
| + | # Hash for ARC keys in Redis | ||
| + | key_prefix = " | ||
| + | # map of domains -> names of selectors (since rspamd 1.5.3) | ||
| + | # | ||
| + | # map of domains -> paths to keys (since rspamd 1.5.3) | ||
| + | #path_map = "/ | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | servers = " | ||
| + | backend = " | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # If false, messages with empty envelope from are not signed | ||
| + | allow_envfrom_empty = true; | ||
| + | |||
| + | # If true, envelope/ | ||
| + | allow_hdrfrom_mismatch = false; | ||
| + | |||
| + | # If true, multiple from headers are allowed (but only first is used) | ||
| + | allow_hdrfrom_multiple = true; | ||
| + | |||
| + | # If true, username does not need to contain matching domain | ||
| + | allow_username_mismatch = true; | ||
| + | |||
| + | # If false, messages from authenticated users are not selected for signing | ||
| + | auth_only = true; | ||
| + | |||
| + | # Default path to key, can include ' | ||
| + | path = "/ | ||
| + | |||
| + | # Default selector to use | ||
| + | selector = " | ||
| + | |||
| + | # If false, messages from local networks are not selected for signing | ||
| + | sign_local = true; | ||
| + | |||
| + | # Map file of IP addresses/ | ||
| + | # sign_networks = "/ | ||
| + | |||
| + | # Symbol to add when message is signed | ||
| + | symbol = " | ||
| + | |||
| + | # Whether to fallback to global config | ||
| + | try_fallback = true; | ||
| + | |||
| + | # Domain to use for DKIM signing: can be " | ||
| + | use_domain = " | ||
| + | |||
| + | # Domain to use for DKIM signing when sender is in sign_networks (" | ||
| + | # | ||
| + | |||
| + | # Domain to use for DKIM signing when sender is a local IP (" | ||
| + | # | ||
| + | |||
| + | # Whether to normalise domains to eSLD | ||
| + | use_esld = falsee; | ||
| + | |||
| + | # Whether to get keys from Redis | ||
| + | use_redis = false; | ||
| + | |||
| + | # Hash for DKIM keys in Redis | ||
| + | key_prefix = " | ||
| + | |||
| + | # map of domains -> names of selectors (since rspamd 1.5.3) | ||
| + | # | ||
| + | |||
| + | # map of domains -> paths to keys (since rspamd 1.5.3) | ||
| + | #path_map = "/ | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | dmarc { | ||
| + | # Enables storing reporting information to redis | ||
| + | reporting = true; | ||
| + | # If Redis server is not configured below, settings from redis {} will be used | ||
| + | #servers = " | ||
| + | # Alternatively set read_servers / write_servers to split reads and writes | ||
| + | # To set custom prefix for redis keys: | ||
| + | # | ||
| + | # Actions to enforce based on DMARC disposition (empty by default) | ||
| + | actions = { | ||
| + | quarantine = " | ||
| + | reject = " | ||
| + | } | ||
| + | # Ignore " | ||
| + | # no_sampling_domains = "/ | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | servers = " | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | greylist { | ||
| + | servers = " | ||
| + | # | ||
| + | # | ||
| + | # ] | ||
| + | # | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # Whitelist for greylist | ||
| + | debian.org | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | ip_score { | ||
| + | # servers = " | ||
| + | # threshold = 100; | ||
| + | # reject_score = 3; | ||
| + | # no_action_score = -2; | ||
| + | # add_header_score = 1; | ||
| + | # whitelist = " | ||
| + | # how each action is treated in scoring | ||
| + | actions { | ||
| + | reject = 1.0; | ||
| + | "add header" | ||
| + | " | ||
| + | "no action" | ||
| + | } | ||
| + | # how each component is evaluated | ||
| + | scores { | ||
| + | asn = 0.5; | ||
| + | country = 0.1; | ||
| + | ipnet = 0.8; | ||
| + | ip = 1.0; | ||
| + | } | ||
| + | # prefix for asn hashes | ||
| + | asn_prefix = " | ||
| + | # prefix for country hashes | ||
| + | country_prefix = " | ||
| + | # hash table in redis used for storing scores | ||
| + | hash = " | ||
| + | # prefix for subnet hashes | ||
| + | ipnet_prefix = " | ||
| + | # minimum number of messages to be scored | ||
| + | lower_bound = 10; | ||
| + | # the metric to score (usually " | ||
| + | metric = " | ||
| + | # upper and lower bounds at which to cap total score | ||
| + | #max_score = 10; | ||
| + | #min_score = -5; | ||
| + | # Amount to divide subscores by before applying tanh | ||
| + | score_divisor = 10; | ||
| + | # list of servers (or configure redis globally) | ||
| + | #servers = " | ||
| + | # symbol to be inserted | ||
| + | symbol = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # A remplir | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # A remplir | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # A remplir | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # A remplir | ||
| + | debian.org | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # A remplir | ||
| + | ::1 | ||
| + | 127.0.0.1 | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # A remplir | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | actions { | ||
| + | reject = 20; | ||
| + | # soft_reject = 15; | ||
| + | rewrite_subject = 8; | ||
| + | add_header = 6; | ||
| + | greylist = 4; | ||
| + | } | ||
| + | |||
| + | subject = "*** SPAM *** %s"; | ||
| + | |||
| + | symbol " | ||
| + | score = 1.0; | ||
| + | description = "No connectable MX"; | ||
| + | one_shot = " | ||
| + | } | ||
| + | |||
| + | symbol " | ||
| + | score = 2.0; | ||
| + | description = "No MX record"; | ||
| + | one_shot = " | ||
| + | } | ||
| + | |||
| + | symbol " | ||
| + | score = -0.5; | ||
| + | description = "MX was ok"; | ||
| + | one_shot = " | ||
| + | } | ||
| + | |||
| + | symbol " | ||
| + | weight = 2.0; | ||
| + | description = "IP reputation"; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | use = [" | ||
| + | |||
| + | skip_local = false; | ||
| + | skip_authenticated = true; | ||
| + | extended_spam_headers = true; | ||
| + | |||
| + | routines { | ||
| + | spam-header { | ||
| + | header = " | ||
| + | remove = 1; | ||
| + | value = " | ||
| + | } | ||
| + | x-spam-level { | ||
| + | header = " | ||
| + | remove = 1; | ||
| + | char = " | ||
| + | } | ||
| + | x-spam-status { | ||
| + | header = " | ||
| + | remove = 1; | ||
| + | } | ||
| + | x-virus { | ||
| + | header = " | ||
| + | remove = 1; | ||
| + | symbols = [" | ||
| + | } | ||
| + | authentication-results { | ||
| + | header = " | ||
| + | remove = 1; | ||
| + | spf_symbols { | ||
| + | pass = " | ||
| + | fail = " | ||
| + | softfail = " | ||
| + | neutral = " | ||
| + | temperror = " | ||
| + | none = " | ||
| + | permerror = " | ||
| + | } | ||
| + | dkim_symbols { | ||
| + | pass = " | ||
| + | fail = " | ||
| + | temperror = " | ||
| + | none = " | ||
| + | permerror = " | ||
| + | } | ||
| + | dmarc_symbols { | ||
| + | pass = " | ||
| + | permerror = " | ||
| + | temperror = " | ||
| + | none = " | ||
| + | reject = " | ||
| + | softfail = " | ||
| + | quarantine = " | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | # Extensions that are treated as ' | ||
| + | # Number is score multiply factor | ||
| + | bad_extensions = { | ||
| + | scr = 4, | ||
| + | lnk = 4, | ||
| + | exe = 1, | ||
| + | jar = 2, | ||
| + | com = 4, | ||
| + | bat = 4, | ||
| + | ace = 4, | ||
| + | arj = 4, | ||
| + | cab = 3, | ||
| + | }; | ||
| + | |||
| + | # Extensions that are particularly penalized for archives | ||
| + | bad_archive_extensions = { | ||
| + | pptx = 0.5, | ||
| + | docx = 0.5, | ||
| + | xlsx = 0.5, | ||
| + | pdf = 1.0, | ||
| + | jar = 3, | ||
| + | js = 0.5, | ||
| + | vbs = 7, | ||
| + | }; | ||
| + | |||
| + | # Used to detect another archive in archive | ||
| + | archive_extensions = { | ||
| + | zip = 1, | ||
| + | arj = 1, | ||
| + | rar = 1, | ||
| + | ace = 1, | ||
| + | 7z = 1, | ||
| + | cab = 1, | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | enabled = true; | ||
| + | timeout = 1.0; | ||
| + | symbol_bad_mx = " | ||
| + | symbol_no_mx = " | ||
| + | symbol_good_mx = " | ||
| + | expire = 86400; | ||
| + | expire_novalid = 7200; | ||
| + | greylist_invalid = false; | ||
| + | key_prefix = " | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | map_watch_interval = 1min; | ||
| + | dns { | ||
| + | enable_dnssec = true; | ||
| + | timeout = 4s; | ||
| + | retransmits = 5; | ||
| + | nameserver = " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | rates { | ||
| + | # Limit for all mail per recipient (rate 2 per minute) | ||
| + | to = "2 / 1m"; | ||
| + | # Limit for all mail per one source ip (rate 3 per minute) | ||
| + | to_ip = "3 / 1m"; | ||
| + | # Limit for all mail per one source ip and from address (rate 2 per minute) | ||
| + | to_ip_from = "2 / 1m"; | ||
| + | # Limit for all bounce mail (rate 2 per hour) | ||
| + | bounce_to = "2 / 1h"; | ||
| + | # Limit for bounce mail per one source ip (rate 1 per hour) | ||
| + | bounce_to_ip = "1 / 1h"; | ||
| + | # Limit for all mail per authenticated user (rate 2 per minute) | ||
| + | user = "2 / 1m"; | ||
| + | } | ||
| + | |||
| + | whitelisted_rcpts = " | ||
| + | max_rcpt = 5; | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | servers = " | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | classifier " | ||
| + | tokenizer { | ||
| + | name = " | ||
| + | } | ||
| + | |||
| + | backend = " | ||
| + | servers = " | ||
| + | min_tokens = 11; | ||
| + | min_learns = 10; | ||
| + | autolearn = true; | ||
| + | |||
| + | per_user = <<EOD | ||
| + | return function(task) | ||
| + | local rcpt = task: | ||
| + | |||
| + | if rcpt then | ||
| + | one_rcpt = rcpt[1] | ||
| + | if one_rcpt[' | ||
| + | return one_rcpt[' | ||
| + | end | ||
| + | end | ||
| + | |||
| + | return nil | ||
| + | end | ||
| + | EOD | ||
| + | |||
| + | statfile { | ||
| + | symbol = " | ||
| + | spam = false; | ||
| + | } | ||
| + | statfile { | ||
| + | symbol = " | ||
| + | spam = true; | ||
| + | } | ||
| + | learn_condition =<< | ||
| + | return function(task, | ||
| + | local prob = task: | ||
| + | |||
| + | if prob then | ||
| + | local in_class = false | ||
| + | local cl | ||
| + | if is_spam then | ||
| + | cl = ' | ||
| + | in_class = prob >= 0.95 | ||
| + | else | ||
| + | cl = ' | ||
| + | in_class = prob <= 0.05 | ||
| + | end | ||
| + | |||
| + | if in_class then | ||
| + | return false, | ||
| + | cl, math.abs((prob - 0.5) * 200.0)) | ||
| + | end | ||
| + | end | ||
| + | |||
| + | return true | ||
| + | end | ||
| + | EOD | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==> / | ||
| + | < | ||
| + | password = " | ||
| + | enable_password = " | ||
| + | </ | ||
| + | q1 et q2 sont les mots de passe à modifier. | ||
| + | |||
| + | ==== 6.2. Commandes utiles ==== | ||
| + | Changer les mots de passe q1 et q2: | ||
| + | < | ||
| + | rspamadm pw | ||
| + | </ | ||
| + | |||
| + | Générer une clef privée qui doit être absolument être lisible par l' | ||
| + | < | ||
| + | rspamadm dkim_keygen -s ' | ||
| + | </ | ||
| + | avec l' | ||
mail.1388856339.txt.gz · Dernière modification : de mirtouf
