I decided this week to write my own public commands script. Now i know there are security issues involved.
Before the script got too bulky i want to have the security done good.
A first comment, none of the commands are safe in the concept that there is no password verification of any user. If you make a slight typo or mistake when adding new hostmasks, or let people use the ident-command from shared IP-pools, this could very well grant one malicious user access to sensitive commands.
Other than that, your code looks ok at a first glance.