Write a Perl script for a set of custom administration tasks on a FreeBSD 5.4 or 6.0 server.
This script will be used to automate assigning developers to a project. In the case of a new developer, a new account and database login need to be created. If the project is new, then a project directory and database table need to be created. If an existing project is being reassigned, then the permissions on the project directory and its database table need to be changed.
Given a username, project directory, and MySQL database table, perform the following tasks:
1. Skip this step if the developer's username already exists. Create an account (using /usr/sbin/pw or equivalent) and private group for the username if one does not already exist. Include username 'projects' in the new group. Create a MySQL user with the same name and same password. The new password shall be cryptographically strong.
2. Create the project directory if it does not already exist. chown and chgrp the project directory and any contents to the username/group from task 1. chmod the project and its contents to be ug+rw and o-rwx.
3. Using DBI::mysql, grant full permissions on the specified database table to the user. If the table does not already exist, provide a mechanism for either a template table or table creation script to be specified.
4. Output a summary of actions taken, including any new passwords.
1) Complete and fully-functional working script as well as complete source code for all test scripts or other ancillary programs developed.
2) Deliverable must be in ready-to-run condition. Any module dependencies that are not core modules shall be clearly identified in source code.
3) All deliverables will be considered "work made for hire" under U.S. Copyright low. Buyer will receive exclusive and complete copyright to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement.)
4) The script shall have dual-mode operation, defaulting to command-line arguments that are obtained via Getopt::Long. If there are no command-line arguments, the script shall assume it is operating in a CGI environment, using [url removed, login to view] to obtain parameters and output the summary.
5) The script may have a brief configuration section either near the beginning of the script or in the __DATA__ section. Configuration sections shall be fully documented as described in the next paragraph.
6) The script shall be accompanied by documentation (approximately 1 page) describing any configuration, installation, or command-line argument descriptions needed to run the script.
7) The script shall not require any version of Perl greater than 5.8.0 and shall not require any core module version greater than that installed by Perl 5.8.0. Exception: any generally-released version of DBI or DBI::mysql may be specified. It is preferred that no explicit module version requirements are stated.
8) The script shall have warning and strict enabled. Uses of 'no warnings' are discouraged but may be accepted at Buyer's discretion.
FreeBSD 5.4 or 6.0, at Seller's preference.
MySQL 4.1 or compatible