NAME
Mail::Toaster::Provision - a rudimentary provisioning agent
SYNOPSIS
Account provisioning methods. Not terribly complete, only the ones I use regularly have been coded.
DESCRIPTION
A suite of methods for provisioning various account types on unix like systems (Mac OS X, *BSD, Linux). Builds system accounts (/etc/passwd), web hosting accounts, mail hosting accounts, and DNS hosting accounts.
DEPENDENCIES
Quota (/usr/ports/sysutils/p5-Quota)
METHODS
- new
-
To use the following methods, you must first create a provision object. Then invoke any of the methods that follow using your provision object.
use Mail::Toaster::Provision; my $prov = Mail::Toaster::Provision->new(); use Mail::Toaster::Utility; my $utility = Mail::Toaster::Utility->new(); my $conf = $utility->parse_config( file=>"sysadmin.conf" ); $prov->example_method( val=>$vals, conf=>$conf ); arguments required: conf - a hashref of values pulled from sysadmin.conf.
- dns
-
dns will provision a DNS account using the programming API of a NicTool DNS server.
it is not completed.
- quota_set
-
Sets a user file system quota.
$prov->quota_set( conf=>$conf, user=>"bob", quota=>200 );
quota is set in megabytes. A hard limit will be set 5 megs larger than the soft limit.
Dependencies: Quota (the perl module) arguments required: user - the system username to modify arguments optional: quota - (int) - the quota value in megabytes (100)
- user
-
$prov->user( action=>'add', conf=>$conf ) 'action' => $ARGV[0], 'debug' => $opt_v,
user will call several private methods, beginning with user_get_options which collects the details for the new account from the command line (via GetOpts) or via a HTTP form method. Once the options are gathered, it will perform the requested action (create, destroy, disable, enable, show, repair, or test) on the account.
Due to ancient bugs corrupting FreeBSD's passwd files, user is very fault tolerant. It makes backup copies of the master.passwd files before altering them and tests to make sure the alterations it made are sane. If something is screwy, it saves a date stamped backup of the file.
It also sets user quotas if quota is passed.
arguments required: user - arguments optional: conf - result:
- user_usage
-
returns the following message if improper or missing arguments are passed:
useradmin action username required values: -username optional values: -password -shell -homedir -comment -quota -uid -gid -expire date -domain
If domain is set, then tit's assumed that you're setting up a web hosted account and you want the home directory to be /home/domain.com instead of /home/user. This integrates quite nicely with Apache's mass virtual hosting.
- user_options
-
Collects the options required for setting up a user account from the command line (GetOpts) or from a HTTP form submission.
- usage_action
-
return the following message:
usage $0 action [params] action is one of: create - adding users, domains, etc destroy - permanently removing objects disable - temporarily disable enable - restore disabled objects show - show current objects and settings repair - misc repair options test - test settings
- web
-
$prov->web (vals=>$vals, conf=>$conf)
$vals is a hashref of values
my $vals = { 'action' => $ARGV[0], 'debug' => $opt_v, };
web will call several private methods, beginning with web_get_options which collects the details for the new account from the command line (via GetOpts) or via a HTTP form method. Once the options are gathered, it will perform the requested action (create, destroy, disable, enable, show, repair, or test) on the account.
- web_check_setup
-
Performs various tests on the apache config settings:
make sure apache conf dir exists make sure vhost config is set up
- web_usage
-
returns the following message if improper or missing arguments are passed:
webadmin action -vhost [vhost name] required values: -vhost optional values: -ip - IP address to listen on (default *) -serveralias - comma separated list of aliases -serveradmin - email of server admin -documentroot - path to html files -redirect - url to redirect site to -options - server options ex. FollowSymLinks MultiViews Indexes ExecCGI Includes -ssl - ssl enabled ? -sslcert - path to ssl certificate -sslkey - path to ssl key -cgi - basic | advanced | custom -customlog - custom logging directive -customerror - custom error logging directive -awstats - include alias for awstats -phpmyadmin - include alias for php
- web_get_options
-
Collects web account settings from the command line arguments or a HTML form.
- what_am_i
-
$prov->what_am_i()
Determine what the filename of this program is.
- what_am_i_check
-
To simplify usage and increase the ability to secure access to various features, the program determines how it's being called. Currently, there are 4 options:
dnsadmin mailadmin useradmin webadmin
This simply checks to make sure a valid one has been invoked.
AUTHOR
Matt Simerson <matt@tnpi.net>
BUGS
None known. Report any to author.
TODO
SEE ALSO
The following are all man/perldoc pages:
Mail::Toaster
Mail::Toaster::Conf
toaster.conf
toaster-watcher.conf
http://mail-toaster.org/
COPYRIGHT
Copyright (c) 2004-2006, The Network People, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the The Network People, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.