Get the most detail from Exim log debug output for pipe commands

157 Views Asked by At

How do you see the most detail from Exim's output?

I'm specifically trying to debug a pipe/external command on a Red Hat based OS.

I've got a good amount of Exim debug logs, but it doesn't seem to be enough.

Our exim transport works fine with our integration of Mailman2, but Mailman3 required us to implement it with a rootless container. I'm unclear what part of the process allows them to work, or how to see the commands fail more than I already do.

Our old, working exim.conf transport:

mailman_virtual_transport:
    driver = pipe
    command = /usr/local/cpanel/3rdparty/mailman/mail/mailman \
              '${if def:local_part_suffix \
                    {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
                    {post}}' \
              ${perl{untaint}{${lc:$local_part}_${lc:$domain}}}
    current_directory = /usr/local/cpanel/3rdparty/mailman
    home_directory = /usr/local/cpanel/3rdparty/mailman
    user = mailman
    group = mailman

We're unable to use the Docker-suggested Exim transport definition due to our non-root security needs:

mailman3_transport:
  driver = smtp
  protocol = lmtp
  allow_localhost
  hosts = localhost
  port = MM3_LMTP_PORT
  rcpt_include_affixes = true

So we're using this transport using driver pipe:

mailman3_virtual_transport:
    driver = pipe
    command = /usr/bin/podman exec -i mailman-core /usr/bin/mailman --run-as-root \
              '${if def:local_part_suffix \
                    {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} \
                    {inject}}' \
              '-f' '-' \
              ${perl{untaint}{${lc:$local_part}\@${lc:$domain}}}
    user = MM3_GID
    group = MM3_UID

It works fine for regular mailing list sending of email (inject -f - listname), but does not work for the majordomo-like aliases, which worked fine in our Mailman2 usage, e.g. an alias file containing:

...
[email protected]: "|/usr/bin/podman exec -i -t mailman-core mailman --run-as-root subscribe m3mailman3_mailman3.test"
...
*: mailman3

So the command that allows mail to be successfully transferred is this:

/usr/bin/podman exec -i mailman-core /usr/bin/mailman --run-as-root inject -f - [email protected]

The output of a successfull normal send-email-to-the-list command:

557025 direct command after expansion:
557025   argv[0] = '/usr/bin/podman'
557025   argv[1] = 'exec'
557025   argv[2] = '-i'
557025   argv[3] = 'mailman-core'
557025   argv[4] = '/usr/bin/mailman'
557025   argv[5] = '--run-as-root'
557025   argv[6] = 'inject'
557025   argv[7] = '-f'
557025   argv[8] = '-'
557025   argv[9] = '[email protected]'
557025 delivery-local forking for pipe-tpt-cmd
557025 delivery-local forked for pipe-tpt-cmd: 557026
557025 delivery-local forking for pipe-tpt-output
557025 delivery-local forked for pipe-tpt-output: 557027
557025 Writing message to pipe
557025 writing data block fd=9 size=54 timeout=3600
557025 cannot use sendfile for body: spoolfile not wireformat
557025 writing data block fd=9 size=610 timeout=3600
557025 writing data block fd=9 size=1 timeout=3600
557027 postfork: pipe-tpt-output
557027 set_process_info: 557027 reading output from |/usr/bin/podman exec -i mailman-core /usr/bin/mailman --run-as-root '${if def:local_part_suffix {${sg{$local_part_suffix}{-(\\w+)(\\+.*)?}{\$1}}} {inject}}' '-f' '-' ${perl{untaint}{${lc:$local_part}\@${lc:$domain}}}
557026 postfork: pipe-tpt-cmd
557020 search_tidyup called
557020 SMTP>>(close on process exit)
557020 >>>>>>>>>>>>>>>> Exim pid=557020 (daemon-accept) terminating with rc=0 >>>>>>>>>>>>>>>>
555764 child 557020 ended: status=0x0
555764   normal exit, 0
555764 0 SMTP accept processes now running
555764 Listening...
557025 mailman3_virtual_transport transport yielded 0
557025 search_tidyup called
557022 journalling [email protected]
557022 mailman3_virtual_transport transport returned OK for [email protected]
557022 post-process [email protected] (0)
557022 [email protected] delivered
557022 LOG: MAIN
557022   => m3list <[email protected]> R=mailman3_router T=mailman3_virtual_transport
557022 >>>>>>>>>>>>>>>> deliveries are done >>>>>>>>>>>>>>>>

However, when attempting the aliases, it doesn't work. E.g., trying:

/usr/bin/podman exec -i mailman-core /usr/bin/mailman --run-as-root inject -f - [email protected]

Results:

2023-06-07 08:57:47 1q6tfX-002e31-2G <= [email protected] H=localhost (10-2-66-113.cprapid.com) [127.0.0.1]:55270 P=esmtpa A=dovecot_login:[email protected] S=1237 [email protected] T="Re: subscribe" for [email protected]
2023-06-07 08:57:49 1q6tfX-002e31-2G ** [email protected] <[email protected]> R=mailman3_virtual_router_suffixed T=mailman3_virtual_transport: Child process of mailman3_virtual_transport transport returned 2 from command: /usr/bin/podman
2023-06-07 08:57:49 1q6tfX-002e31-2G Completed
08:57:47 630607 direct command after expansion:
08:57:47 630607   argv[0] = '/usr/bin/podman'
08:57:47 630607   argv[1] = 'exec'
08:57:47 630607   argv[2] = '-i'
08:57:47 630607   argv[3] = 'mailman-core'
08:57:47 630607   argv[4] = '/usr/bin/mailman'
08:57:47 630607   argv[5] = '--run-as-root'
08:57:47 630607   argv[6] = 'inject'
08:57:47 630607   argv[7] = '-f'
08:57:47 630607   argv[8] = '-'
08:57:47 630607   argv[9] = '[email protected]'

08:57:47 630607 delivery-local forking for pipe-tpt-cmd
08:57:47 630607 delivery-local forked for pipe-tpt-cmd: 630608
08:57:47 630607 delivery-local forking for pipe-tpt-output
08:57:47 630607 delivery-local forked for pipe-tpt-output: 630609
08:57:47 630607 Writing message to pipe
08:57:47 630607  ╭considering: From ${if def:return_path{$return_path}{MAILER-DAEMON}} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607  ├───────text: From
08:57:47 630607  ├considering: ${if def:return_path{$return_path}{MAILER-DAEMON}} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607  ├──condition: def:return_path
08:57:47 630607  ├─────result: true
08:57:47 630607   ╭considering: $return_path}{MAILER-DAEMON}} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607   ├considering: }{MAILER-DAEMON}} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607   ├──expanding: $return_path
08:57:47 630607   ╰─────result: [email protected]
08:57:47 630607              ╰──(tainted)
08:57:47 630607   ╭───scanning: MAILER-DAEMON}} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607   ├───────text: MAILER-DAEMON
08:57:47 630607   ├───scanning: }} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607   ├──expanding: MAILER-DAEMON
08:57:47 630607   ├─────result: MAILER-DAEMON
08:57:47 630607   ╰───skipping: result is not used
08:57:47 630607  ├───item-res: [email protected]
08:57:47 630607             ╰──(tainted)
08:57:47 630607  ├considering:  ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607  ├───────text:
08:57:47 630607  ├considering: ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607  ├considering:
08:57:47 630607
08:57:47 630607  ├───────text:
08:57:47 630607
08:57:47 630607  ├──expanding: From ${if def:return_path{$return_path}{MAILER-DAEMON}} ${tod_bsdinbox}
08:57:47 630607
08:57:47 630607  ╰─────result: From [email protected] Wed Jun 07 08:57:47 2023
08:57:47 630607
08:57:47 630607             ╰──(tainted)
08:57:47 630607 writing data block fd=9 size=56 timeout=3600
08:57:47 630607 cannot use sendfile for body: spoolfile not wireformat
08:57:47 630607 writing data block fd=9 size=1237 timeout=3600
08:57:47 630607 writing data block fd=9 size=1 timeout=3600
08:57:47 630608 postfork: pipe-tpt-cmd
08:57:47 630609 postfork: pipe-tpt-output
08:57:47 630609 set_process_info: 630609 reading output from |/usr/bin/podman exec -i mailman-core /usr/bin/mailman --run-as-root 'inject' '-f' '-' ${perl{untaint}{${lc:$local_part$local_part_suffix}\@${lc:$domain}}}
08:57:47 630603 search_tidyup called
08:57:47 630603 SMTP>>(close on process exit)
08:57:47 630603 >>>>>>>>>>>>>>>> Exim pid=630603 (daemon-accept) terminating with rc=0 >>>>>>>>>>>>>>>>
08:57:47 630521 child 630603 ended: status=0x0
08:57:47 630521   normal exit, 0
08:57:47 630521 0 SMTP accept processes now running
08:57:47 630521 Listening...
08:57:49 630607 mailman3_virtual_transport transport yielded 2
08:57:49 630607 search_tidyup called
08:57:49 630604 mailman3_virtual_transport transport returned FAIL for [email protected]
08:57:49 630604 post-process [email protected] (2)
08:57:49 630604 LOG: MAIN
08:57:49 630604   ** [email protected] <[email protected]> R=mailman3_virtual_router_suffixed T=mailman3_virtual_transport: Child process of mailman3_virtual_transport transport returned 2 from command: /usr/bin/podman
08:57:49 630604 >>>>>>>>>>>>>>>> deliveries are done >>>>>>>>>>>>>>>>

How do I see more output from the command? Currently the only error I can see is this, and I'm not sure how I'd reproduce the command to see it working or not working or give more output:

Child process of mailman3_virtual_transport transport returned 2 from command: /usr/bin/podman

If I try to run the line on it's own, it hangs. I don't see how Exim sends the message:

mailman:/opt/mailman# /usr/bin/mailman --run-as-root join -f - [email protected]
^C
Aborted!
mailman:/opt/mailman#

0

There are 0 best solutions below