We need a script that will run nightly (using Perl preferred, please post in PMB in what language will this be accomplished)
The script will do the following:
1. Get all the files in "/var/cpanel/users" -- Which should be a list of files, this should be stored in an array.
2. Run the following code for each user (or any code that gets all world writable files/directories): find ~USER \( -perm -a+w \) ! -type l -- The USER should be replaced the user currently being processed
3. If we get output (they have world-writable files):
3.1 Run the following for each file: chmod -R 755 FILE -- where FILE is whatever is the current file
3.2 Get the email from the file "/var/cpanel/users/THEUSER" -- The line is like this in the file : CONTACTEMAIL=THECLIENTSEMAILHERE
3.3 Send an email to the client with the list of files that were world-writable
4. If we don't get any output, do nothing, skip to next user
At the end, it should generate a report of all the users that required modifications and send it to a specified email.