Hi list and Giovanni,

I *think* I might have figured out what was wrong ...

I Googled for the expression: "mimedefang undefined subroutine &main::do_main_loop", which was showing up in: /var/log/maillog.

This brought me to a mailing list archive message[1], that is admittedly old (reply in question at the bottom of webpage is from 19 years ago), and targets Linux, but had a suggestion to try the following when receiving this error:

    $ mimedefang.pl -test

This results in the following output:

Can't locate Net/DNS.pm in @INC (you may need to install the Net::DNS module) (@INC contains: /usr/local/bin/modules/lib /usr/local/libdata/perl5/site_perl/amd64-openbsd /usr/local/libdata/perl5/site_perl /usr/libdata/perl5/amd64-openbsd /usr/libdata/perl5) at /usr/local/libdata/perl5/site_perl/Mail/MIMEDefang/Net.pm line 27. BEGIN failed--compilation aborted at /usr/local/libdata/perl5/site_perl/Mail/MIMEDefang/Net.pm line 27.
Compilation failed in require at /usr/local/bin/mimedefang.pl line 36.
BEGIN failed--compilation aborted at /usr/local/bin/mimedefang.pl line 36.

I then pulled down the Perl package: Net::DNS from packages and re-ran: mimedefang.pl -test, which now results in:

Filter /etc/mail/mimedefang-filter seems syntactically correct.

Now when I restarted mimedefang_multiplexor and mimedefang and submit a test message with a fake: .exe attachment I see in: /var/log/maillog:

Jun 23 19:03:03 server mimedefang.pl[22055]: checking message 8eada11c61e2efdc Jun 23 19:03:03 server mimedefang.pl[87731]: 8eada11c61e2efdc: MDLOG,8eada11c61e2efdc,bad_filename,attachment.exe,application/octet-stream,<r...@server.home.arpa>,develo...@server.home.arpa, Test #3 - ATTACHMENT Jun 23 19:03:03 server mimedefang.pl[87731]: 8eada11c61e2efdc: MDLOG,8eada11c61e2efdc,mail_in,,,<r...@server.home.arpa>,develo...@server.home.arpa, Test #3 - ATTACHMENT

So it appears that the following steps should be taken when installing the mimedefang filter for OpenSMTPD:

        $ doas pkg_add filter-mimedefang
        $ doas pkg_add p5-Net-DNS-1.37

        $ doas rcctl enable mimedefang_multiplexor mimedefang
        $ doas rcctl order  mimedefang_multiplexor mimedefang
        $ doas rcctl start  mimedefang_multiplexor
        $ doas rcctl start  mimedefang

This suggests to me that the root cause of the problem is a missing dependency for the Perl pacakage: Net::DNS ... am I correct ?

- J


Links

[1] See: https://mimedefang.roaringpenguin.narkive.com/UP7dOGIf/sire-2-44-undefined-subroutine-main-do-main-loop

Reply via email to