Debian Jessie/exim4 versendet Emails an root@domain.local

Debian macht sich hervorragend als Web- und Mailserver. Schau auch in den " Tipps und Tricks"-Bereich.
Antworten
Alfex
Beiträge: 16
Registriert: 02.09.2015 19:53:38

Debian Jessie/exim4 versendet Emails an root@domain.local

Beitrag von Alfex » 26.03.2019 10:00:47

Hallo,

mein Debian Jessie 8.11 Server auf dem exim4 installiert ist versucht E-Mails an root@meinedomain.local zu versenden.
Der Server soll generell lediglich E-Mails versenden was er für seinen regulären Aufgabenzweck auch tut. Es ist die Monitoringsoftware Check_MK installiert.

Aufgefallen ist mir das ganze nur weil ich während dem Troubleshooting für ein anderes Problem auf unserem MS Exchange 2016 Server, die ganzen gescheiterten Versuche vom Debian Server zum Vorschein kamen.

Die /etc/aliases habe ich kontrolliert aber ist angeblich für exim4 gar nicht relevant habe ich gelesen?

Reproduzieren kann ich das ganze jederzeit indem ich an root eine EMail sende (Befehl: mail -s "test" root < /dev/null)

Wo kann ich die relevante Einstellung finden und diese E-Mails an eine gültige existierende versenden?

Alfex
Beiträge: 16
Registriert: 02.09.2015 19:53:38

Re: Debian Jessie/exim4 versendet Emails an root@domain.local [gelöst]

Beitrag von Alfex » 26.03.2019 14:20:52

Nach sehr viel Googlesuche habe ich eine Lösung gefunden, Quelle:
https://blog.dhampir.no/content/make-ex ... -smarthost

Hier die Beschreibung:
Make exim4 on Debian respect .forward and /etc/aliases when using a smarthost

When configured to send all mail through a smarthost, exim4 on Debian will not respect your /etc/aliases file, nor will it care about your users’ ~/.forward files. This is due to the numbering, and consequently the sorting, of the files in /etc/exim4/conf.d/router/.

If you look at 200_exim4-config_primary, you’ll see it handles smarthost routing in smarthost and satellite mode, and that it ends with “no_more”. This means any routes following it will only apply to the local_domains list. Thus, 400_exim4-config_system_aliases and 600_exim4-config_userforward will not be processed for outgoing mail. Not what I want.

To get around this without moving the default files around, I concatenated both the mentioned files into a file called 175_cathedral-config_system_aliases and modified it to apply to the qualify domain. You can name it whatever you want, as long as it starts with a number in between 150 and 200.

Make sure you’ve got your config (dpkg-reconfigure exim4-config) set to “Split configuration into small files”, add your custom file, then run update-exim4.conf and restart exim4.

This is the resulting file, if you just want to copy and paste it:

Code: Alles auswählen

.ifdef DCconfig_smarthost DCconfig_satellite

cathedral_aliases:
  debug_print = "R: cathedral_aliases for $local_part@$domain"
  driver = redirect
  domains = $qualify_domain
  allow_fail
  allow_defer
  data = ${lookup{$local_part}lsearch{/etc/aliases}}
  .ifdef SYSTEM_ALIASES_USER
  user = SYSTEM_ALIASES_USER
  .endif
  .ifdef SYSTEM_ALIASES_GROUP
  group = SYSTEM_ALIASES_GROUP
  .endif
  .ifdef SYSTEM_ALIASES_FILE_TRANSPORT
  file_transport = SYSTEM_ALIASES_FILE_TRANSPORT
  .endif
  .ifdef SYSTEM_ALIASES_PIPE_TRANSPORT
  pipe_transport = SYSTEM_ALIASES_PIPE_TRANSPORT
  .endif
  .ifdef SYSTEM_ALIASES_DIRECTORY_TRANSPORT
  directory_transport = SYSTEM_ALIASES_DIRECTORY_TRANSPORT
  .endif

cathedral_userforward:
  debug_print = "R: cathedral_userforward for $local_part@$domain"
  driver = redirect
  domains = $qualify_domain
  check_local_user
  file = $home/.forward
  require_files = $local_part:$home/.forward
  no_verify
  no_expn
  check_ancestor
  allow_filter
  forbid_smtp_code = true
  directory_transport = address_directory
  file_transport = address_file
  pipe_transport = address_pipe
  reply_transport = address_reply
  skip_syntax_errors
  syntax_errors_to = real-$local_part@$domain
  syntax_errors_text = \
    This is an automatically generated message. An error has\n\
    been found in your .forward file. Details of the error are\n\
    reported below. While this error persists, you will receive\n\
    a copy of this message for every message that is addressed\n\
    to you. If your .forward file is a filter file, or if it is\n\
    a non-filter file containing no valid forwarding addresses,\n\
    a copy of each incoming message will be put in your normal\n\
    mailbox. If a non-filter file contains at least one valid\n\
    forwarding address, forwarding to the valid addresses will\n\
    happen, and those will be the only deliveries that occur.

.endif
Ich musste meine Config noch wie dort erwähnt auf einzelne Dateien umstellen und jetzt scheint es zu funktionieren!

Antworten