# /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 :)
The port doesn't have a maintainer, so without a patch this PR may never be fixed.
Created attachment 273742 [details] quick fix for check_mailq plugin Proposed patch, build and run with default options tested.
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!
(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.
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.
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(-)
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(-)
Thank you, I committed it.
(In reply to Matthias Fechner from comment #3) Reported to upstream https://github.com/monitoring-plugins/monitoring-plugins/issues/2328
(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.