As said this is not a problem of the module but of the sysadmin. Personally I would add the NOEXEC tag for the list of sudo commands.
Some users might desire a more granular control (not full permission on an executable but on a command with arguments, eg. /bin/cat /var/lib/nethserver/secrets/mysql) but this would complicate things making the module.
For the servers I manage, the users I grant sudo access to usually need full root privileges. On occasion when someone has needed root to access certain commands or to make certain changes, the set policy is to speak to someone who has the access. But that’s just me and the setup I have chosen.
If there is a way to give more granular sudo access it would and extremely beneficial feature for those who have a large installation where some form of delegation is required for for practical reasons.
I am unsure of how easy or not it is to develop something for this and @stephdl is quite correct in that you don’t want to have this feature breaking the sudoers file as it could either give everyone too much permissions (thereby potentially causing sensitive data leakage or worse) or restrict everyone’s permissions causing a scenario where a re-installation is required.
Agree on that. I misunderstood what your question was referring to.
User input is often a problem. Sanitise it could do it, and verify the (temp)file for proper syntax (visudo -cf…) so the script can accept or revert the changes.
Not sure how easy or difficult this may be, but how easy would it be to select the users from a drop down list instead of adding them in a text box? This may reduce some of the errors with user-entry
Yes it would be a nice enhancement but I really don’t know how to test it and also validate all the bad hacks that a sudo users can do after to be granted…in this case I would prefer to let the sysadmin writes his own /etc/sudoers.d/file to delegate exactly what he wants.
for now I have sanitise the ‘/…,…,///’ you found, just with a preg_match test.
yum install http://mirror.de-labrusse.fr/NethDev/nethserver-delegation/nethserver-delegation-0.1.4-1.ns7.sdl.noarch.rpm
* Tue Aug 01 2017 stephane de Labrusse <stephdl@de-labrusse.fr> 0.1.4-1.ns7
- The path to the binary is sanitised
- New UI
One more thing @stephdl, after reading excerpts from sudoers manual, it seems files under /etc/sudoers.d/ should also be set to 0440 permission. Can you check it?