### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### qpopper.pm - qpopper configuration module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::qpopper; use strict; use PSGConf::Action::GenerateFile::qpopper_conf; use PSGConf::Data::Boolean; use PSGConf::Data::Hash; use PSGConf::Data::List; use PSGConf::Data::String; use PSGConf::Control::Packages qw(_add_pkgs); use PSGConf::Control::syslog qw(_add_syslog); ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; $psgconf->register_actions( PSGConf::Action::GenerateFile::qpopper_conf->new( name => '/etc/qpopper.conf', description => 'qpopper configuration file (pop3)', options => $psgconf->data_obj('qpopper_options')->get() ) ) if ($psgconf->data_obj('qpopper_enable')->equals('true')); $psgconf->register_actions( PSGConf::Action::GenerateFile::qpopper_conf->new( name => '/etc/qpopper_ssl.conf', description => 'qpopper configuration file (pop3s)', options => $psgconf->data_obj('qpopper_ssl_options')->get() ) ) if ($psgconf->data_obj('qpopper_ssl_enable')->equals('true')); } ############################################################################### ### policy methods ############################################################################### sub _policy_add_packages { my ($self, $psgconf) = @_; $self->_add_pkgs($psgconf); ### Add if we are just using SSL also. $self->{enable} = 'qpopper_ssl_enable'; $self->_add_pkgs($psgconf); } sub _policy_add_syslog { my ($self, $psgconf) = @_; $self->{facility} = $psgconf->data_obj('qpopper_syslog')->get(); return $self->_add_syslog($psgconf); } sub _add_inetd { my ($self, $psgconf) = @_; my ($inetd); $inetd = $psgconf->data_obj('inetd')->get(); if ($psgconf->data_obj('qpopper_enable')->equals('true') && !exists($inetd->{'pop3/tcp'})) { $inetd->{'pop3/tcp'} = { server => $psgconf->data_obj('qpopper_path')->get(), server_args => '-f /etc/qpopper.conf ' . $psgconf->data_obj('qpopper_args')->get() }; } if ($psgconf->data_obj('qpopper_ssl_enable')->equals('true') && !exists($inetd->{'pop3s/tcp'})) { $inetd->{'pop3s/tcp'} = { server => $psgconf->data_obj('qpopper_path')->get(), server_args => '-f /etc/qpopper_ssl.conf ' . $psgconf->data_obj('qpopper_ssl_args')->get() }; } } sub _add_tcp_wrappers { my ($self, $psgconf) = @_; return if ( $psgconf->data_obj('qpopper_enable')->equals('false') || $psgconf->data_obj('qpopper_ssl_enable')->equals('false')); $psgconf->data_obj('tcp_wrappers')->insert_row( { 1 => 'all' }, [ 'popper', 'all', 'allow' ] ) if (! $psgconf->data_obj('tcp_wrappers')->find_row( { 0 => qr/\bpopper\b/ } )); } ############################################################################### ### constructor ############################################################################### sub new { my ($class, $psgconf) = @_; my ($self); $self = {}; bless($self, $class); $self->{name} = 'qpopper'; $self->{enable} = $self->{name} . '_enable'; $self->{packages} = $self->{name} . '_packages'; $self->{syslog} = $self->{name}; $psgconf->register_data( qpopper_path => PSGConf::Data::String->new( 'value_abspath' => 1, value => '/usr/local/sbin/popper' ), qpopper_enable => PSGConf::Data::Boolean->new( 'value' => 'false' ), qpopper_packages => PSGConf::Data::List->new(), qpopper_args => PSGConf::Data::String->new(), qpopper_syslog => PSGConf::Data::String->new( 'value' => 'local0.info' ), qpopper_options => PSGConf::Data::Hash->new(), qpopper_ssl_enable => PSGConf::Data::Boolean->new( 'value' => 'false' ), qpopper_ssl_args => PSGConf::Data::String->new(), qpopper_ssl_options => PSGConf::Data::Hash->new() ); $psgconf->register_policy($self, qpopper_add_packages => '_policy_add_packages', qpopper_add_inetd => '_add_inetd', qpopper_add_syslog => '_policy_add_syslog', qpopper_add_tcpwrapper_entry => '_add_tcp_wrappers' ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::qpopper - psgconf control class for qpopper configuration =head1 SYNOPSIS In F: Control PSGConf::Control::qpopper =head1 DESCRIPTION The B module provides a B control object for configuring B, the Qualcomm POP server. 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 containing the absolute path of the B binary. The default is F. =item I A B object indicating whether B should be configured on the standard I service port. =item I A B object listing all packages that need to be installed. =item I A B object containing additional arguments to be passed to B when it is invoked by B on the I port. =item I A B object containing the default syslog facility the application logs to. Default is C. =item I A B object containing configuration options to be set in the configuration file used by B when it is invoked on the I port. =item I A B object indicating whether B should be configured on the I service port (i.e., for SSL-encrypted POP). =item I A B object containing additional arguments to be passed to B when it is invoked by B on the I port. =item I A B object containing configuration options to be set in the configuration file used by B when it is invoked on the I port. =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 C to the I data object (which is supplied by the B module). =item I Adds entries for I to the I object (provided by B). =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 the F file. If I is set, registers a B object to create the F file. =back =head1 SEE ALSO L popper(8) L L L L L L L L L L L L =cut