1 votos

¿Por qué esta expansión de cadena Exim para una variable de entorno no funciona?

El problema

En resumen, mediante la siguiente línea en mi Exim de transporte no es el resultado de la cadena de expansión (inserción) de la TESTVAR variable de entorno:

headers_add = "X-TESTVAR: ${env{TESTVAR}{$value}{The TESTVAR environment variable was not found}}"

Nunca me $value, siempre tengo "La TESTVAR variable de entorno no fue encontrado".

¿Qué estoy haciendo mal?


Medio ambiente:

account@example.com [~]# cat /etc/redhat-release
CentOS release 6.10 (Final)

Exim versión:

account@example.com [~]# exim --version
Exim version 4.91 #1 built 11-May-2018 09:49:25
Copyright (c) University of Cambridge, 1995 - 2018
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2018
Berkeley DB: Berkeley DB 4.7.25: (September 12, 2013)
Support for: crypteq iconv() IPv6 PAM Perl OpenSSL Content_Scanning DKIM DNSSEC Event I18N OCSP PRDR SPF Experimental_SRS
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch dbm dbmjz dbmnz dnsdb passwd sqlite
Authenticators: cram_md5 dovecot plaintext spa
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir autoreply lmtp pipe smtp
Malware: f-protd f-prot6d drweb fsecure sophie clamd avast sock cmdline
Configure owner: 0:0
Size of off_t: 8
2019-03-08 19:04:22 cwd=/home/account 2 args: exim --version
Configuration file is /etc/exim.conf

El transporte relevante de mi exim.conf:

dovecot_virtual_delivery:
  driver = lmtp
  socket = /var/run/dovecot/lmtp
  batch_max = 200
  rcpt_include_affixes
  delivery_date_add
  envelope_to_add
  return_path_add
  headers_add = "X-TESTVAR: ${env{TESTVAR}{$value}{The TESTVAR environment variable was not found}}"

Los comandos que se ejecuta para enviar el correo electrónico:

account@example.com [~]# export TESTVAR=hello
account@example.com [~]# echo $TESTVAR
hello
account@example.com [~]# exim -t
to:me@example.com
Hi there, this email should have a header named "X-TESTVAR" and it should have a value of "hello".
account@example.com [~]# 

La resultante de correo electrónico:

Return-Path: <account@host.example.com>
Delivered-To: me@example.com
Received: from host.example.com
    by host.example.com with LMTP id IH+3MCUQg1waLwAAx771+g
    for <me@example.com>; Fri, 08 Mar 2019 19:00:21 -0600
Return-path: <account@host.example.com>
Envelope-to: me@example.com
Delivery-date: Fri, 08 Mar 2019 19:00:21 -0600
Received: from account by host.example.com with local (Exim 4.91)
    (envelope-from <account@host.example.com>)
    id 1h2QLV-0004Mo-Ee
    for me@example.com; Fri, 08 Mar 2019 19:00:21 -0600
to:me@example.com
Message-Id: <E1h2QLV-0004Mo-Ee@host.example.com>
From: account@host.example.com
Date: Fri, 08 Mar 2019 19:00:20 -0600
X-TESTVAR: The TESTVAR environment variable was not found

Hi there, this email should have a header named "X-TESTVAR" and it should have a value of "hello".

1voto

rinogo Puntos 128

Estás buscando el ajuste keep_environment . Especifica qué variables de entorno son confiables y se debe permitir su uso dentro de la ejecución de Exim. ( Documentacion )

Si su exim.conf contiene esta línea:

 keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR
 

Cambia esto a esto:

 keep_environment = X-SOURCE : X-SOURCE-ARGS : X-SOURCE-DIR : TESTVAR
 

EnMiMaquinaFunciona.com

EnMiMaquinaFunciona es una comunidad de administradores de sistemas en la que puedes resolver tus problemas y dudas.
Puedes consultar las preguntas de otros sysadmin, hacer tus propias preguntas o resolver las de los demás.

Powered by: