NAME

Unix::Sysadmin - Object Oriented Toolkit for Unix System Administration


SYNOPSIS

 use Unix::Sysadmin::Automount;  # Automount maps class
 use Unix::Sysadmin::Group;  # Unix groups class
 use Unix::Sysadmin::Host;  # Unix hosts class
 use Unix::Sysadmin::Netgroup; # Netgroup class
 use Unix::Sysadmin::User;  # Unix user class
 use Unix::Sysadmin::List::<admin object>  # Lists of the above objects
 use Unix::Sysadmin::Cmds::<OS>  # Platform specific commands classes
 use Unix::Sysadmin::Files::<OS> # Platform specific files classes
 use Unix::Sysadmin::Config   # Framework-wide configuration class 
 use Unix::Sysadmin::Utility  # Framework-wide utility class


DESCRIPTION

Introduction

Unix::Sysadmin is an object oriented Perl framework for Unix system administration. It's main features are platform independence (at least among (Free|Open)BSD, Linux and Solaris), secure transport via ssh and a peer-to-peer management model that is in tune with many Unix networks we've seen.

This software is aimed at the Unix Systems Administrator who is also a Perl hacker. The framework provides an object oriented toolkit, with classes representing Hosts, Users, Groups, Netgroups and Automount entities. An example application of the framework is provided that does much of what NIS does, but useing the secure transport and platform independant features of the toolkit, This may or may not be what you need in your environment, (it happens that I need it in mine), but you can use the provided code as examples of what you can do with this beast. Note well: the provided example code works well in my environment. There's no telling how it will work in yours. I do not recommend you use the sample code in production unless you

A
are willing to get into the guts of the framework to understand how it works from a programmer's perspective, and

B
carefully read the disclaimers regarding liability in the license you choose, either Artistic or GPL.

The script that sets up the sample application, usasetup, will force you to read and agree to the license you choose, including the liability limitations.

The framework uses a secure transport based on ssh. The trust model is therefore closely patterned on ssh1. It's cross platform (across (Open|Free)BSD, Linux and SunOS) and hides architectural differences from the user. Thus you can write scripts that execute remote commands without worrying (too much) about where commands and files are located. The framework also contains an abstraction of the Unix management databases for users, groups and automount maps, so you can update these files to a heterogeneous groups of hosts without regard to their OSen, or your own for that matter. Any host on the network can manage any number of other hosts as root provided that the managing host has the ssh key that enables root access on the managed hosts and also has access to the database of managed hosts. Updating users, groups and automount maps requires access to these databases as well. If you setup and use these databases, users may be granted access to one, some or all hosts on the network. Automount maps work transparently with amd or autofs, and particular map entries may be distributed in the same way as users. Groups work similarly. Though managed users, hosts, groups and amd maps may be distributed selectively, the framework provides a place to keep these objects globally unique.

The rest of this document gives a high-level overview of the Unix::Sysadmin framework from a programmer's perspective.

Entity Classes

Unix::Sysadmin provides several classes that represent entities that are frequently the target of Unix system administration activity. Of particular interest are the Host and User classes. These are treated in detail in The Host Classes and The User Class below. Other classes that represent manageable entities are the Automount class for automount maps (either amd or autofs), the Group class for Unix groups and the Netgroup class for ``netgroups'', an idea stolen from NIS, but implemented differently.

Support Classes

In addition to entity classes, Unix::Sysadmin includes several classes that augment manageable entities. The List class is a base class for lists of the basic entity classes. This class provides storage, iteration, sorting, addition, and deletion of lists of the basic entities. The various subclasses of List provide methods to update their corresponding Unix administrative files. The Cmds and Files classes provide architecture dependant information about their respective subject matter. Host objects grab appropriate instances of these two classes when they are instansiated. The Config and Utility classes contain the sort of information you'd expect.

The following sections provide a somewhat lower-level treatment of each of these classes in turn Each class also has one or more manpages which are referred to in the appropriate section below.


Entity Classes

Entity classes represent manageable objects or resources in the Unix::Sysadmin framework.

The Host Classes

Unix::Sysadmin::Host encapsulates both generic and OS specific behavior for Unix hosts. The following four architectures are supported by the Host class:

FreeBSD
Tested on FreeBSD versions from 2.2.5 to 4.0

OpenBSD
Tested on OpenBSD version 2.6

Linux
Tested on Redhat 6.1 and 6.2

SunOS (Solaris)
Tested on SPARC Solaris 2.6 through Solaris 8.

A Host object knows what its hardware and software architectures are, what sorts of commands it can perform and where its configuration files are. It can therefore take actions (methods) on itself such as updating administrative files (with the help of List:: objects). Host is one of two primary coder interfaces to the Unix::Sysadmin framework. (The other is the List:: class and its derivatives) One obtains an Host object from a list or other means. One then invokes methods of the Host object to do things to the Unix host represented.

For a detailed look at the properties and methods of the Host class, see the Unix::Sysadmin::Host manpage.

The User Class

The User class describes users in a Unix network. User objects contain traditional Unix passwd information, as well as data suitable for export to an LDAP or other directory format. The class also keeps track of access permissions assigned to the user represented. A user can be graned or denied access to all, some or one host in the network. Though users may access different sets of hosts, the Unix::Sysadmin framework provides a central place to store UIDs and usernames so that these can be made unique across a set of managed hosts.

For a detailed look at the properties and methods of the User class, see the Unix::Sysadmin::User manpage.

The Automount Class

The Automount class represents automount map entries (keys). Automount keys may be applied to sets of hosts so that access to a particular exported filesystem can be distributed to one, some or all hosts in a network.

For a detailed look at the properties and methods of the Automount class, see the Unix::Sysadmin::Automount manpage.

The Group Class

The Group class represents Unix group entries. As with the other entity classes, a Group object may be applied to one, some or all hosts in a network. Like User objects, Group objects can be made globally unique with regard to group name and GID.

For a detailed look at the properties and methods of the Group class, see the Unix::Sysadmin::Group manpage.


Support Classes

These classes serve support roles within the Unix::Sysadmin framework.

The Netgroup Class

The Netgroup class represents netgroups. This object allows entity objects to refer to sets of hosts with a single symbolic name. The idea is stolen from NIS, of course. I don't run NIS or NIS+ so I don't attempt to update its configuration. This class is therefore a support class rather than an entity class.

For a detailed look at the properties and methods of the Netgroup class, see the Unix::Sysadmin::Netgroup manpage.

The List Classes

These classes are the other major interface to the framework. Unix::Sysadmin::List is a base class that provides storage, iteration, sorting, addition, and deletion of its underlying entity class in a list. The various subclasses of List provide methods to produce the Unix administrative file(s) corresponding to the entity class being listed. Generic and class specifoc proprties and methods of these classes are documented in the Unix::Sysadmin::List manpage.

Unix::Sysadmin::List::Host
This class is a store of all the hosts under management by a particular instance of the Unix::Sysadmin framework. It's in the plans that this class will produce host files and/or DNS zones, but that's not implemented yet.

See the Unix::Sysadmin::List::Host.list manpage for file format.

Unix::Sysadmin::List::User
If invoked with a reference to an object that belongs to a subclasse of Host, objects of this class will produce password databases in whatever format required by the Host object. They may also enforce access policies which means they may produce different passwd entries depending on the rights assigned to a particular user and on which particular Host object is involved,

See the Unix::Sysadmin::List::User.list manpage for file format.

Unix::Sysadmin::List::Automount
If invoked with a reference to an object that belongs to a subclasse of Host, objects of this class will produce automount maps in either amd or autofs format depending on the requirements of the Host object. In a manner similar to List::User, objects of this class may produce differing amd maps depending on the particular Host object involved.

See the Unix::Sysadmin::List::Automount.list manpage for file format.

Unix::Sysadmin::List::Group
This class produces /etc/group files. In a manner similar to List::User, objects of this class may produce differing group files depending on the particular Host object.

See the Unix::Sysadmin::List::Group.list manpage for file format.

Unix::Sysadmin::List::Netgroup
This class produces no corresponding Unix file. It could produce an /etc/netgroup, but if you are running NIS, what do you need this stuff for? (I think you need a secure, cross-platform transport and an expanding feature set, but what do I know? 8)

See the Unix::Sysadmin::List::Netgroup.list manpage for file format.

The Cmds Classes

The Unix::Sysadmin::Cmds class is a base class for OS specific Unix commands. These classes are used by the Unix::Sysadmin::Host class to provide OS specific behavior. The base class provides ``lowest common denominator'' definitions which the following classes may override or supplement:

Unix::Sysadmin::Cmds::OpenBSD
OpenBSD specific commands. See the Unix::Sysadmin::Cmds::OpenBSD manpage.

Unix::Sysadmin::Cmds::FreeBSD
FreeBSD specific commands. See the Unix::Sysadmin::Cmds::FreeBSD manpage.

Unix::Sysadmin::Cmds::Linux
Linux specific commands. See the Unix::Sysadmin::Cmds::Linux manpage.

Unix::Sysadmin::Cmds::SunOS
SunOS specific commands. See the Unix::Sysadmin::Cmds::SunOS manpage.

The Files Classes

The Unix::Sysadmin::Files class is a base class for OS specific Unix file paths. These classes are used by the Unix::Sysadmin::Host class to provide OS specific properties. The base class provides ``lowest common denominator'' definitions which the following classes may override or supplement:

Unix::Sysadmin::Files::OpenBSD
OpenBSD specific files. See the Unix::Sysadmin::Files::OpenBSD manpage.

Unix::Sysadmin::Files::FreeBSD
FreeBSD specific files. See the Unix::Sysadmin::Files::FreeBSD manpage.

Unix::Sysadmin::Files::Linux
FreeBSD specific files. See the Unix::Sysadmin::Files::Linux manpage.

Unix::Sysadmin::Files::SunOS
FreeBSD specific files. See the Unix::Sysadmin::Files::SunOS manpage.


SEE ALSO

Man(3) pages (programmer's docs):

the Unix::Sysadmin::Host manpage, the Unix::Sysadmin::User manpage, the Unix::Sysadmin::Automount manpage, the Unix::Sysadmin::Group manpage, the Unix::Sysadmin::Netgroup manpage, the Unix::Sysadmin::List manpage, the Unix::Sysadmin::Cmds manpage, the Unix::Sysadmin::Files manpage the Unix::Sysadmin::Utility manpage the Unix::Sysadmin::Config manpage, the Unix::Sysadmin::Scoped manpage

Man(4) pages (file formats):

the Unix::Sysadmin::Host.list manpage, the Unix::Sysadmin::User.list manpage, the Unix::Sysadmin::Automount.list manpage, the Unix::Sysadmin::Group.list manpage, the Unix::Sysadmin::Netgroup.list manpage

Man(1m) pages (manager's docs):

the Unix::Sysadmin manpage, the Unix::Sysadmin::Setup manpage the usasetup manpage

the usatest manpage

the usabackup manpage

the usaupdate manpage

the usapush manpage


AUTHOR

Howard Owen <hbo@egbok.com> =cut