Created
June 18, 2013 20:42
-
-
Save riywo/5809166 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub check_sudo { | |
my @commands = ( | |
'/bin/netstat', | |
); | |
my @unexecutable = grep { | |
system("sudo -l -U user $_ > /dev/null 2>&1") != 0; | |
} @commands; | |
message_for_sudo(@unexecutable); | |
} | |
sub message_for_sudo { | |
my @commands = @_; | |
return if scalar(@commands) == 0; | |
print "Please add lines below to /etc/sudoers or /etc/sudoers.d\n\n"; | |
print "======================================================\n"; | |
print "zabbix ALL=(root) NOPASSWD: $_\n" for (@commands); | |
print "======================================================\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment