Stephen Quinney > BuzzSaw-0.12.0 > BuzzSaw::UserClassifier

Download:
BuzzSaw-0.12.0.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.12.0   Source  

NAME ^

BuzzSaw::UserClassifier - Classifies the type of a username

VERSION ^

This documentation refers to BuzzSaw::UserClassifier version 0.12.0

SYNOPSIS ^

   my $classifier = BuzzSaw::UserClassifier->new();

   my $user = "R00t";
   my $cleaned_username = $classifier->mangle_username($user);

   my $user_type = $classifier->classify($cleaned_username);

   print "Type for $user is $user_type\n";

DESCRIPTION ^

The BuzzSaw project provides a suite of tools for processing log file entries. Entries in files are parsed and filtered into a set of events of interest which are stored in a database. A report generation framework is also available which makes it easy to generate regular reports regarding the events discovered.

ATTRIBUTES ^

people

This is the GID of the group in which your "real" users are all members.

nonpersonal_users

This is a reference to a hash of usernames which are considered to be "non-personal". That is normally a list of users for running daemons, and other system tools. It might also include names of teams, units and other generic usernames.

This can be specified via a string in which case it is assumed to be the name of a file which contains one username per line. This is very useful when you have a long list of usernames.

Note that existence in this list is not the only criteria for a username to be considered as "non-personal", see below for full details.

SUBROUTINES/METHODS ^

This class has the following methods:

is_user($username)

This method returns a boolean which states whether (or not) the specified username exists in the local passwd database.

is_person($username)

This method returns a boolean which states whether (or not) the specified username is a user (see is_user) AND is a member of the group specified in the people attribute.

looks_like_person($username)

This method returns a boolean which states whether (or not) the username looks like a username. Currently this just does simplistic regular expression matching to spot usernames which look like University of Edinburgh student or visitor accounts. The intention being that this method is used to spot usernames which are most likely spelling mistakes (or user mistakes of some type).

is_root($username)

This method returns a boolean which states whether (or not) the username looks like root. This is done using a case-insensitive match on the string root and allows either or both of the o characters to be replaced with a 0 (zero).

is_nonpersonal($username)

This method returns a boolean which states whether (or not) the username is a non-personal account. If the username matches the is_person or looks_like_person methods then this method returns false. Otherwise, if the username exists in the local passwd database then it will return true. As a final check when nothing else matches the hash of non-personal account names will be checked. This hash lookup is particularly useful for known daemon and team names which are not in the passwd DB for the machine on which the checks are being run.

mangle_username($username)

This method is used to clean and canonicalise the username. It will lowercase the whole string and strip some undesirable characters. It also makes an attempt to canonicalise certain common forms of usernames. For example, any string starting with admin will result in admin being returned (admin1 becomes admin, administrator becomes admin, etc).

classify($username)

This uses the previously described methods to classify the specified username. If it matches the is_root method then the string root will be returned. If it matches either of the is_person or looks_like_person methods then the string real will be returned. If it matches the is_nonpersonal method then the string nonperson will be returned. Finally, if nothing matches then the string others will be returned.

in_nonpersonal_users($username)

This method returns a boolean which states whether (or not) the specified username exists in the non-personal users hash.

DEPENDENCIES ^

This module is powered by Moose. You will also need MooseX::Types and MooseX::Log::Log4perl.

SEE ALSO ^

BuzzSaw

PLATFORMS ^

This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.

ScientificLinux6

BUGS AND LIMITATIONS ^

Please report any bugs or problems (or praise!) to bugs@lcfg.org, feedback and patches are also always very welcome.

AUTHOR ^

    Stephen Quinney <squinney@inf.ed.ac.uk>

LICENSE AND COPYRIGHT ^

    Copyright (C) 2013 University of Edinburgh. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.

syntax highlighting: