### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### SASL.pm - SASL configuration module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::SASL; use strict; use PSGConf::Action::GenerateFile::SASL_conf; use PSGConf::Data::Boolean; use PSGConf::Data::List; use PSGConf::Data::Hash; use PSGConf::Data::String; use PSGConf::Control::Packages qw(_add_pkgs); ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; my ($lib_dir, $app_conf); return if ($psgconf->data_obj('SASL_enable')->equals('false')); $lib_dir = $psgconf->data_obj('SASL_lib_dir')->get(); $app_conf = $psgconf->data_obj('SASL_app_config')->get(); $psgconf->register_actions( map { PSGConf::Action::GenerateFile::SASL_conf->new( name => "$lib_dir/$_.conf", description => 'SASL config for ' . $_, options => $app_conf->{$_} ) } (keys %$app_conf) ); if ($psgconf->data_obj('saslauthd_enable')->equals('true') && $psgconf->data_obj('saslauthd_mechanism')->equals('ldap')) { $psgconf->register_actions( PSGConf::Action::GenerateFile::SASL_conf->new( name => '/usr/local/etc/saslauthd.conf', description => 'saslauthd LDAP configuration', options => $psgconf->data_obj('saslauthd_ldap_options')->get() ) ); } } ############################################################################### ### policy methods ############################################################################### sub _add_rc_scripts { my ($self, $psgconf) = @_; my ($start_cmd); ### set start command $start_cmd = $psgconf->data_obj('saslauthd_path')->get() . ' -a ' . $psgconf->data_obj('saslauthd_mechanism')->get() if ( defined $psgconf->data_obj('saslauthd_path')->get() && defined $psgconf->data_obj('saslauthd_mechanism')->get() ); $start_cmd .= ' ' . $psgconf->data_obj('saslauthd_args')->get() if ( defined $psgconf->data_obj('saslauthd_args')->get() ); $start_cmd .= ' -O /usr/local/etc/saslauthd.conf' if ( defined $psgconf->data_obj('saslauthd_mechanism')->get() && $psgconf->data_obj('saslauthd_mechanism')->equals('ldap')); $psgconf->data_obj('rc_scripts')->insert( { 'saslauthd' => { 'start_cmd' => $start_cmd }} ); $psgconf->data_obj('rc_scripts')->insert( { 'saslauthd' => { 'state' => 'enable' }} ) if ( $psgconf->data_obj('SASL_enable')->equals('true') && $psgconf->data_obj('saslauthd_enable')->equals('true') ); } ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); ### So that _add_pkgs knows which directives to look at $self->{name} = 'SASL'; $self->{enable} = $self->{name} . '_enable'; $self->{packages} = $self->{name} . '_packages'; $psgconf->register_data( SASL_enable => PSGConf::Data::Boolean->new( value => 'false' ), SASL_packages => PSGConf::Data::List->new(), SASL_lib_dir => PSGConf::Data::String->new( 'value_abspath' => 1, value => '/usr/lib/sasl2' ), SASL_app_config => PSGConf::Data::Hash->new( value_type => 'HASH' ), saslauthd_path => PSGConf::Data::String->new( 'value_abspath' => 1, value => '/usr/local/sbin/saslauthd' ), saslauthd_mechanism => PSGConf::Data::String->new(), saslauthd_args => PSGConf::Data::String->new(), saslauthd_ldap_options => PSGConf::Data::Hash->new(), saslauthd_enable => PSGConf::Data::Boolean->new( value => 'false' ) ); $psgconf->register_policy($self, SASL_add_packages => '_add_pkgs', saslauthd_add_rc_scripts => '_add_rc_scripts', ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::SASL - psgconf control class for SASL configuration =head1 SYNOPSIS In F: Control PSGConf::Control::SASL =head1 DESCRIPTION The B module provides a B control object for configuring B. It supports the following methods: =over 4 =item new() The constructor. Its parameter is a reference to the B object. It registers the following data objects: =over 4 =item I A B object indicating whether B should be configured. =item I A B object listing what packages to install. =item I A B object containing the absolute path of the B library directory. The default is F. =item I A B object containing options for each SASL-aware application. The hash key is the name of the application, and the value is an anonymous hash containing the options and values for that application. =item I A B object indicating whether B should be configured. =item I A B object containing the absolute path to the B daemon. The default is F. =item I A B object containing the authentication mechanism to be used by B. This object must be set if I is set. =item I A B object containing additional arguments to be passed to B when it is started. =item I A B object containing options for the B C authentication mechanism. =back The constructor also registers the following policy methods: =over 4 =item I Adds an entry for I to the I object (provided by B), if not already present. =item I Adds an entry for I to the I object (provided by B). =back =item decide() If I is set, registers a B object to create a configuration file for each application listed in I. If I is also set and I is set to C, registers a B object to generate the F file. =back =head1 SEE ALSO L L L L L L L L L L =cut