bdraco / addon_securityadvisor

Old Security Advisor for cPanel 11.40 (upstream repo) -- Use CPANELINC/addon_securityadvisor
Other
16 stars 56 forks source link

Permissions.pm updated to check both /etc/passwd and /etc/shadow #6

Closed cPanelSSP closed 11 years ago

cPanelSSP commented 11 years ago

Permissions.pm updated to check both /etc/passwd and /etc/shadow . I don't plan on chasing the permissions rabbit hole very far, but those 2 files are historically amongst the most targeted.

bdraco commented 11 years ago

my %test_files = ('/etc/shadow' => { 'perms' => 0600, 'uid' => 0, 'gid' => 0 }, '/etc/passwd' => {'perms' => 0644, 'uid' => 0, 'gid' => 0 } );

Would be be better to do something like this?

cPanelSSP commented 11 years ago

For your review. Refactored Permissions.pm. I wanted to use just 1 stat() call to get the $mode, $uid, and $gid all at once, but wasn't clear on how to go about that. Something tells me there's a better way to get the $mode than the 2 liner I used.

bdraco commented 11 years ago

Merged. Will update the stat