Bug 297472 - net-mgmt/monitoring-plugins: check_mailq broken in 3.0.3
Summary: net-mgmt/monitoring-plugins: check_mailq broken in 3.0.3
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Fechner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-08-12 08:22 UTC by linus.sundqvist
Modified: 2026-08-21 04:19 UTC (History)
5 users (show)

See Also:


Attachments
quick fix for check_mailq plugin (1.26 KB, patch)
2026-08-14 05:55 UTC, Oleksandr Kryvulia
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description linus.sundqvist 2026-08-12 08:22:01 UTC
# /usr/local/libexec/nagios/check_mailq
Global symbol "$sudo" requires explicit package name (did you forget to declare "my $sudo"?) at /usr/local/libexec/nagios/check_mailq line 580.
Execution of /usr/local/libexec/nagios/check_mailq aborted due to compilation errors.


Version 3.0.3 deprecated the usage of sudo in check_mailq - https://github.com/monitoring-plugins/monitoring-plugins/releases

check_mailq could be used with the sudo option (-s/--sudo) and would execute
sudo then with mailq as an argument AND additional arbitrary arguments given by the user.
A simple sudo rule to allow the monitoring user to execute this, could lead to arbitrary command execution with root privileges.

The patch with this release disables the whole sudo option of check_mailq.
Allowing the monitoring user to view the mail queue is now a problem of the MTA and most (hopefully all) MTAs should support this in one way or another.

In FreeBSD we have a patch files/patch-plugins-scripts_check__mailq.pl which adds a new command to the check, which currently contains "$sudo" which must be removed for the plugin to work again with version 3.0.3. Since this also made it into quarterly, I would recommend also updating quarterly + main :)
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2026-08-13 11:17:06 UTC
The port doesn't have a maintainer, so without a patch this PR may never be fixed.
Comment 2 Oleksandr Kryvulia 2026-08-14 05:55:45 UTC
Created attachment 273742 [details]
quick fix for check_mailq plugin

Proposed patch, build and run with default options tested.
Comment 3 Matthias Fechner freebsd_committer freebsd_triage 2026-08-14 07:52:45 UTC
I can take care of this.
But I really would prefer if these fixes are done upstream.

Can you please request that change upstream?

I have the feeling that version 3 changed a lot and there are some regressions left upstream is not aware yet.

Please also link the upstream requested change here into the ticket.

Thank you very much!
Comment 4 Oleksandr Kryvulia 2026-08-14 13:27:47 UTC
(In reply to Matthias Fechner from comment #3)
IMHO, this pr is not related to upstream project. The "sudo" verb in our local patch causes to a compilation error. Upstream does not have this problem. But I agree, opensmtp mailer which this patch introduces must be reported to the upstream project.
Comment 5 Florian Smeets freebsd_committer freebsd_triage 2026-08-14 14:18:32 UTC
I had to downgrade to the last version before the 3.0.0 upgrade. Disk checks on zfs are broken (permission issue), mailq checks are broken. I didn't have time to debug this yet. It might be that we just need an UPDATING entry because major stuff changed, and we need to adapt, but I haven't seen anything in that regard in the port.
Comment 6 commit-hook freebsd_committer freebsd_triage 2026-08-18 08:07:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=584c15e5a78c722e7aa3ebcb02f6c92d16513166

commit 584c15e5a78c722e7aa3ebcb02f6c92d16513166
Author:     Linus Sundqvist <linus.sundqvist@loopia.se>
AuthorDate: 2026-08-18 08:04:24 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2026-08-18 08:04:24 +0000

    net-mgmt/monitoring-plugins: Remove sudo from check_mailq

    Fixes error:
    /usr/local/libexec/nagios/check_mailq
    Global symbol "$sudo" requires explicit package name (did you forget to declare "my $sudo"?) at /usr/local/libexec/nagios/check_mailq line 580.
    Execution of /usr/local/libexec/nagios/check_mailq aborted due to compilation errors.

    Upstream removed sudo for check_mailq completely in version 3.0.3.

    Changes:        https://github.com/monitoring-plugins/monitoring-plugins/releases/tag/v3.0.3
    PR:             297472

 net-mgmt/monitoring-plugins/Makefile                                    | 1 +
 net-mgmt/monitoring-plugins/files/patch-plugins-scripts_check__mailq.pl | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2026-08-18 08:09:34 UTC
A commit in branch 2026Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=c7edee4fe7b8744be7cec601207e11c8c4ed7e58

commit c7edee4fe7b8744be7cec601207e11c8c4ed7e58
Author:     Linus Sundqvist <linus.sundqvist@loopia.se>
AuthorDate: 2026-08-18 08:04:24 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2026-08-18 08:07:20 +0000

    net-mgmt/monitoring-plugins: Remove sudo from check_mailq

    Fixes error:
    /usr/local/libexec/nagios/check_mailq
    Global symbol "$sudo" requires explicit package name (did you forget to declare "my $sudo"?) at /usr/local/libexec/nagios/check_mailq line 580.
    Execution of /usr/local/libexec/nagios/check_mailq aborted due to compilation errors.

    Upstream removed sudo for check_mailq completely in version 3.0.3.

    Changes:        https://github.com/monitoring-plugins/monitoring-plugins/releases/tag/v3.0.3
    PR:             297472
    (cherry picked from commit 584c15e5a78c722e7aa3ebcb02f6c92d16513166)

 net-mgmt/monitoring-plugins/Makefile                                    | 1 +
 net-mgmt/monitoring-plugins/files/patch-plugins-scripts_check__mailq.pl | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
Comment 8 Matthias Fechner freebsd_committer freebsd_triage 2026-08-18 08:10:17 UTC
Thank you, I committed it.
Comment 9 Oleksandr Kryvulia 2026-08-19 05:38:37 UTC
(In reply to Matthias Fechner from comment #3)
Reported to upstream
https://github.com/monitoring-plugins/monitoring-plugins/issues/2328
Comment 10 Matthias Fechner freebsd_committer freebsd_triage 2026-08-21 04:19:08 UTC
(In reply to Oleksandr Kryvulia from comment #9)
Thank you very much!

I think it is better to report this as a pull request and link it to the issue.
That will use a maybe define workflow upstream.