Documentation du Dr FRAPPE

Ce wiki regroupe les résultats de mes expériences en informatique accumulés au cours de mes recherches sur le net.

Dans la mesure du possible, j'ai cité mes sources ; il en manque certainement… :-)

Ceci est une ancienne révision du document !


Commandes du fichier msmtprc

Commandes générales

defaults
Définir les valeurs par défaut. Les commandes suivantes définiront les valeurs par défaut pour toutes les définitions de compte suivantes dans le fichier de configuration actuel.
account name [: account[,…]]
Commence une nouvelle définition de compte avec le nom donné. Les valeurs par défaut en cours sont renseignées. Si deux-points et une liste de comptes précédemment définis sont donnés après le nom du compte, le nouveau compte, avec les valeurs par défaut renseignées, héritera de tous les paramètres des comptes de la liste.
host hostname
Le serveur SMTP auquel envoyer le courrier. L'argument peut être un nom d'hôte ou une adresse réseau. Chaque définition de compte doit contenir cette commande.
port number
Port d'écoute du serveur SMTP. La valeur par défaut est 25 (“smtp”), sauf si TLS est utilisé sans STARTTLS, auquel cas c'est 465 (“smtps”).
source_ip [IP]
Définit une adresse IP source à laquelle lier la connexion sortante. Utile seulement dans des cas particuliers, sur les systèmes multi-home. Un argument vide le désactive.
proxy_host [IP|hostname]
Utiliser un proxy SOCKS. Tout le trafic réseau passera par cet hôte proxy, y compris les requêtes DNS, à l'exception d'une requête DNS qui pourrait être nécessaire pour résoudre le nom d'hôte proxy lui-même (cela peut être évité en utilisant une adresse IP comme nom d'hôte proxy).Un argument vide désactive l'utilisation du proxy.
proxy_port [number]
Numéro de port pour l'hôte proxy. Un argument [number] vide le réinitialise au port par défaut, qui est 1080 (“socks”).
socket [socketname]
Nom de fichier d'un socket de domaine Unix auquel se connecter. Cela remplace à la fois 'host'/'port' et 'proxy_host'/'proxy_port'.
timeout (off|seconds)
Définit ou désactive un délai d'attente du réseau, en secondes. L'argument “off” signifie qu'aucun délai d'attente ne sera défini, ce qui signifie que la valeur par défaut du système d'exploitation sera utilisée.
protocol (smtp|lmtp)
Protocole à utiliser. Actuellement, seuls SMTP et LMTP sont pris en charge. SMTP est la valeur par défaut.
domain argument
Cette commande définit l'argument de la commande SMTP EHLO (ou LMTP LHLO). La valeur par défaut est 'localhost', ce qui est stupide mais fonctionne généralement. Essayez de modifier la valeur par défaut si les e-mails sont rejetés en raison de mesures anti-SPAM. Les choix possibles sont la partie domaine de votre adresse e-mail (provider.example pour joe@provider.example) ou le nom de domaine complet de votre hébergeur (si disponible). Les modèles de substitution suivants sont pris en charge :
  • %H sera remplacé par $HOSTNAME, ou en cas d'échec par le nom d'hôte du système.
  • %C sera remplacé par le nom canonique de %H.
  • %M sera remplacé par le contenu de /etc/mailname (potentiellement, un répertoire différent est utilisé en fonction de la configuration de construction ; consultez la sortie de « msmtp –version » et recherchez l'emplacement du fichier de configuration système).

Commandes d'authentification

‘auth [(on|off|method)]’
Enable or disable authentication and optionally choose a method to use. The argument ‘on’ chooses a method automatically. Accepted methods are ‘plain’, ‘scram-sha-1’, ‘scram-sha-256’, ‘oauthbearer’, ‘xoauth2’, ‘cram-md5’, ‘gssapi’, ‘external’, ‘digest-md5’, ‘login’, and ‘ntlm’. See Chapter 5 [Authentication], page 17.
‘user [username]’
Set the user name for authentication. An empty argument unsets the user name. Authentication must be activated with the ‘auth’ command.
‘password [secret]’
Set the password for authentication. An empty argument unsets the password. Consider using the ‘passwordeval’ command or a key ring instead of this command, to avoid storing cleartext passwords in the configuration file. See Chapter 5 [Authentication], page 17.
‘passwordeval [eval]’
Set the password for authentication to the output (stdout) of the command eval. This can be used e.g. to decrypt password files on the fly or to query key rings, and thus to avoid storing cleartext passwords. Note that the eval command must not mess with standard input (stdin) because that is where msmtp reads the mail from. If in doubt, append < /dev/null to eval. See Chapter 5 [Authentication], page 17.

Commandes TLS

‘tls [(on|off)]’
Enable or disable TLS (also known as SSL) for secured connections.
‘tls_starttls [(on|off)]’
Choose the TLS variant: start TLS from within the session (‘on’, default), or tunnel the session through TLS (‘off’).
‘tls_trust_file [file]’
Activate server certificate verification using a list of trusted Certification Authorities (CAs). The default is the special value ‘system’, which selects the system default. An empty argument disables trust in CAs. If you select a file, it must be in PEM format, and you should also use ‘tls_crl_file’.
‘tls_fingerprint [fingerprint]’
Set the fingerprint of a single certificate to accept for TLS. This certificate will be trusted regardless of its contents (this overrides ‘tls_trust_file’). The fingerprint should be of type SHA256, but can for backwards compatibility also be of type SHA1 or MD5 (please avoid this). The format should be 01:23:45:67:…. Use ‘–serverinfo –tls –tls-certcheck=off –tls-fingerprint=’ to get the server certificate fingerprint.
‘tls_key_file [file]’
Send a client certificate to the server (use this together with ‘tls_cert_file’). The file must contain the private key of a certificate in PEM format. An empty argument disables this feature.
‘tls_cert_file [file]’
Send a client certificate to the server (use this together with ‘tls_key_file’). The file must contain a certificate in PEM format. An empty argument disables this feature.
‘tls_certcheck [(on|off)]’
Enable or disable checks of the server certificate. They are enabled by default. Disabling them will override ‘tls_trust_file’ and ‘tls_fingerprint’. WARNING: When the checks are disabled, TLS sessions will not be secure!
‘tls_priorities [priorities]’
Set priorities for TLS session parameters. The default is set by the TLS library and can be selected by using an empty argument to this command. The interpretation of the priorities string depends on the TLS library. Use ‘–version’ to find out which TLS library you use. For GnuTLS, see the section on Priority Strings in the manual. For libtls, the priorites string is a space-separated list of parameter strings prefixed with either PROTOCOLS=, CIPHERS=, or ECDHECURVES=. These parameter strings will be passed to the functions ‘tls_config_parse_protocols’, ‘tls_config_set_ciphers’, and ‘tls_config_set_ecdhecurves’. Unrecognized parts of the priorities string will be ignored. Example: PROTOCOLS=TLSv1.3 CIPHERS=ECDHE-RSA-AES128-SHA256 ECDHECURVES=P384.
‘tls_host_override [host]’
By default, TLS host verification uses the host name given by the ‘host’ command. This command allows one to use a different host name for verification. This is only useful in special cases.

Commandes propres au mode sendmail

‘from [address]’
Set the envelope-from address. The following substitution patterns are supported:
  • %U will be replaced by $USER, or if that fails by $LOGNAME, or if that fails by the login name of the user running msmtp.
  • %H will be replaced by $HOSTNAME, or if that fails by the host name of the system.
  • %C will be replaced by the canonical name of %H.
  • %M will be replaced by the contents of /etc/mailname (potentially a different directory is used depending on the build configuration; see the output of ‘msmtp –version’ and look for the location of the system configuration file).

To enforce the use of this envelope-from address and ignore the ‘-f’ / ‘–from’ option, see [allow from override], page 6. See Section 7.1 [Envelope-from address], page 20. Furthermore, the envelope-from address may be a wildcard pattern as used for file name matching in the shell. This is the case if it contains one of the characters ?, * or [. This allows a variety of envelope-from addresses given with the ‘–from’ option to match a single account.

‘allow_from_override (on|off)’
By default, the [–from], page 11, option overrides the [from], page 5, command. Set to ‘off’ to disable this.
‘dsn_notify (off|condition)’
Set the condition(s) under which the mail system should send DSN (Delivery Status Notification) messages. The argument ‘off’ disables explicit DSN requests, which means the mail system decides when to send DSN messages. This is the default. The condition must be ‘never’, to never request notification, or a comma separated list (no spaces!) of one or more of the following: ‘failure’, to request notification on transmission failure, ‘delay’, to be notified of message delays, ‘success’, to be notified of successful transmission. The SMTP server must support the DSN extension. See Chapter 6 [Delivery Status Notifications], page 19.
‘dsn_return (off|amount)’
This command controls how much of a mail should be returned in DSN (Delivery Status Notification) messages. The argument ‘off’ disables explicit DSN requests, which means the mail system decides how much of a mail it returns in DSN messages. This is the default. The amount must be ‘headers’, to just return the message headers, or ‘full’, to return the full mail. The SMTP server must support the DSN extension. See Chapter 6 [Delivery Status Notifications], page 19.
‘set_from_header [(auto|on|off)]’
When to set a From header: ‘auto’ adds a From header if the mail does not have one (this is the default), ‘on\’ always sets a From header and overrides any existing one, and ‘off’ never sets a From header. If the mail server rejects the mail because its From header does not match the envelope from address (a common anti-spam measure), then you might want to set this option to ‘on’. The From header is created based on the envelope-from address. Disable [allow from override], page 6, to prevent programs from setting their own envelope-from address. For compatibility with older versions, add_missing_from_header [(on|off)]’ is still supported and corresponds to the ‘auto’ and ‘off’ settings. See Section 7.3 [Header handling], page 20.
set_date_header [(auto|off)]’
When to set a Date header: ‘auto’ adds a Date header if the mail does not have one (this is the default), and ‘off’ never sets a Date header. For compatibility with older versions, ‘add_missing_date_header [(on|off)]’ is still supported and corresponds to the ‘auto’ and ‘off’ settings. See Section 7.3 [Header handling], page 20.
‘remove_bcc_headers [(on|off)]’
This command controls whether to remove Bcc headers. The default is to remove them.
‘undisclosed_recipients [(on|off)]’
When set, the original To, Cc, and Bcc headers of the mail are removed and a single new header line “To: undisclosed-recipients:;” is added. The default setting is off. See Section 7.3 [Header handling], page 20.
‘logfile [file]’
Enable logging to the specified file. An empty argument disables logging. The file name ‘-’ directs the log information to standard output. See Section 7.2 [Logging], page 20.
‘logfile_time_format [fmt]’
Set or unset the log file time format. This will be used as the format string for the strftime() function. An empty argument chooses the default (‘“%b %d %H:%M:%S”’). See Section 7.2 [Logging], page 20.
‘syslog [(on|off|facility)]’
Enable or disable syslog logging. The facility can be one of ‘LOG_USER’, ‘LOG_MAIL’, ‘LOG_LOCAL0’, . . . , ‘LOG_LOCAL7’. The default is ‘LOG_USER’. Syslog logging is disabled by default. See Section 7.2 [Logging], page 20.
‘aliases [file]’
Replace local recipients with addresses in the aliases file. The aliases file is a cleartext file containing mappings between a local address and a list of replacement addresses. The mappings are of the form: local: someone@example.com, person@domain.example Multiple replacement addresses are separated with commas. Comments start with ’#’ and continue to the end of the line. The local address ‘default’ has special significance and is matched if the local address is not found in the aliases file. If no ‘default’ alias is found, then the local address is left as is. An empty argument to the aliases command disables the replacement of local addresses. This is the default.
‘auto_from [(on|off)]’
Obsolete; you can achieve the same and more using the substitution patterns of the ‘from’ command. Enable or disable automatic envelope-from addresses. The default is ‘off’. When enabled, an envelope-from address of the form user@domain will be generated. The local part will be set to USER or, if that fails, to LOGNAME or, if that fails, to the login name of the current user. The domain part can be set with the ‘maildomain’ command; if that is empty, the address not have a domain part. See Section 7.1 [Envelope-from address], page 20.

Voir aussi