Unix::Sysadmin - Object Oriented Toolkit for Unix System Administration
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
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
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.
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.
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 represent manageable objects or resources in the Unix::Sysadmin framework.
Unix::Sysadmin::Host encapsulates both generic and OS specific behavior for Unix hosts. The following four architectures are supported by the Host class:
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 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 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 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.
These classes serve support roles within the Unix::Sysadmin framework.
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.
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.
See the Unix::Sysadmin::List::Host.list manpage for file format.
See the Unix::Sysadmin::List::User.list manpage for file format.
See the Unix::Sysadmin::List::Automount.list manpage for file format.
See the Unix::Sysadmin::List::Group.list manpage for file format.
See the Unix::Sysadmin::List::Netgroup.list manpage for file format.
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:
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:
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
Howard Owen <hbo@egbok.com> =cut