None of the command hooks using sudo work. The issue is that the scripts seem to be executed by gosa without sudo as www-data. The problem seem to be that plugin::callHook() method erroneously strips off the sudo command (see https://github.com/gosa-project/gosa-core/blob/2b22a5550089bab108177a41254f3f9de07eb20c/include/class_plugin.inc#L1612). However I don't see any changes in git blame since 2016, not sure why this used to work in bullseye.
-- Guido Berhoerster