NAME
Mail::Toaster::Provision
SYNOPSIS
Account provisioning methods.
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();
$vals = { action => $ARGV[0], debug => 1 };
$prov->example_method($vals, $conf);
All the public methods will expect to be passed $conf. $conf is a hashref of values pulled from sysadmin.conf. You can get it by calling $utility->parse_config as follows:
$conf = $utility->parse_config({file=>"sysadmin.conf"});
$utility is a Mail::Toaster::Utility object.
dns
dns will provision a DNS account using the programming API of a NicTool DNS server.
quota_set
Sets a user file system quota.
my $vals = {
user => "bob",
quota => 1000,
};
$prov->quota_set($vals, $conf);
quota is set in megabytes. A hard limit will be set 5 megs larger than the soft limit.
This method depends on the perl module Quota.
user
$prov->user($vals, $conf)
$vals is a hashref of values
my $vals = {
'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.
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.
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, $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_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.
what_am_i
$prov->what_am_i($debug)
Determine what the filename of this program is.
AUTHOR
Matt Simerson <matt@tnpi.biz>
BUGS
None known. Report any to author.
TODO
SEE ALSO
The following are all man/perldoc pages: Mail::Toaster Mail::Toaster::Apache Mail::Toaster::CGI Mail::Toaster::DNS Mail::Toaster::Darwin Mail::Toaster::Ezmlm Mail::Toaster::FreeBSD Mail::Toaster::Logs Mail::Toaster::Mysql Mail::Toaster::Passwd Mail::Toaster::Perl Mail::Toaster::Provision Mail::Toaster::Qmail Mail::Toaster::Setup Mail::Toaster::Utility
Mail::Toaster::Conf
toaster.conf
toaster-watcher.conf
http://matt.simerson.net/computing/mail/toaster/
http://matt.simerson.net/computing/mail/toaster/docs/
COPYRIGHT
Copyright (c) 2004-2005, 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.