NAME
Provision::Unix::User - provision unix user accounts
VERSION
version 1.08
SYNOPSIS
Handles provisioning operations (create, modify, destroy) for system users on UNIX based operating systems.
use Provision::Unix::User;
my $prov = Provision::Unix::User->new();
...
show
Show user attributes. Right now it only shows quota info.
$pass->show( {user=>"matt"} );
returns a hashref with error_code and error_desc
disable
Disable an /etc/passwd user by expiring their account.
$pass->disable( "matt" );
enable
Enable an /etc/passwd user by removing the expiration date.
$pass->enable( {user=>"matt"} );
input is a hashref
returns a hashref with error_code and error_desc
is_valid_password
Check a password for sanity.
$r = $user->is_valid_password($password, $username);
$password is the password the user is attempting to use.
$username is the username the user has selected.
Checks:
Passwords must have at least 6 characters.
Passwords must have no more than 128 characters.
Passwords must not be the same as the username
Passwords must not be purely alpha or purely numeric
Passwords must not be in reserved list
(/usr/local/etc/passwd.badpass)
$r is a hashref that gets returned.
$r->{error_code} will contain a result code of 100 (success) or (4-500) (failure)
$r->{error_desc} will contain a string with a description of which test failed.
get_crypted_password
$user->get_crypted_password($pass, [$salt] )
get the DES/MD5 digest of the plain text password that is passed in
FUNCTIONS
new
Creates and returns a new Provision::Unix::User object.
is_valid_username
$user->is_valid_username($username, $denylist);
$username is the username. Pass it along as a scalar (string).
$denylist is a optional hashref. Define all usernames you want reserved (denied) and it will check to make sure $username is not in the hashref.
Checks:
* Usernames must be between 2 and 16 characters.
* Usernames must have only lower alpha and numeric chars
* Usernames must not be defined in $denylist or reserved list
The format of $local/etc/passwd.reserved is one username per line.
archive
Create's a tarball of the users home directory. Typically done right before you rm -rf their home directory as part of a de-provisioning step.
if ( $user->archive("user") )
{
print "user archived";
};
returns a boolean.
create_group
Installs a system group.
$r = $pass->create_group($group, $gid)
$r->{error_code} == 200 ? print "success" : print $r->{error_desc};
BUGS
Please report any bugs or feature requests to bug-unix-provision-user at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Provision-Unix. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Provision::Unix::User
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
AUTHOR
Matt Simerson <msimerson@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by The Network People, Inc..
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.