### ### Copyright 2000-2007 University of Illinois Board of Trustees ### All rights reserved. ### ### RPC.pm - RPC configuration module for psgconf ### ### Campus Information Technologies and Educational Services ### University of Illinois at Urbana-Champaign ### package PSGConf::Control::RPC; use PSGConf::Action::svcs::setprop; use PSGConf::Action::GenerateFile::etc_rpc; use PSGConf::Data::Boolean; use PSGConf::Data::Table; use PSGConf::Data::List; use PSGConf::Control::Packages qw(_add_pkgs); use strict; ############################################################################### ### decide() method ############################################################################### sub decide { my ($self, $psgconf) = @_; return if ($psgconf->data_obj('rpc_enable')->equals('false')); $psgconf->register_actions( PSGConf::Action::GenerateFile::etc_rpc->new( 'name' => '/etc/rpc', 'description' => 'RPC configuration file', entries => $psgconf->data_obj('rpc')->get() ) ); if ( $psgconf->data_obj('platform')->match('solaris10') ) { $psgconf->register_actions( PSGConf::Action::svcs::setprop->new( name => 'enable TCP Wrappers for rpcbind', FMRI => 'svc:/network/rpc/bind', property => 'config/enable_tcpwrappers', value => 'true' ) ); } } ############################################################################### ### policy methods ############################################################################### ### add TCP wrappers entry sub _policy_add_tcpwrapper_entry { my ($self, $psgconf) = @_; my ($hosts); return if ( $psgconf->data_obj('rpc_enable')->equals('false') ); ### FIXME #$psgconf->data_obj('tcp_wrappers')->insert_row( # { 1 => 'all' }, # [ 'rpcbind', $hosts, 'allow' ] #) # if (! $psgconf->data_obj('tcp_wrappers')->find_row( # { 0 => qr/\brpcbind\b/ })); } sub _enable_rc_scripts { my ($self, $psgconf) = @_; my ($cmd); ### ### Why can AIX and Linux be consistant and call the program ### the same thing it is in the TCP Wrappers stanza :( ### $cmd = ($psgconf->data_obj('platform')->match('aix|linux')) ? 'portmap' : 'rpcbind'; $psgconf->data_obj('rc_scripts')->insert( { $cmd => { 'state' => 'enable' }} ) if ( $psgconf->data_obj('rpc_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} = 'rpc'; $self->{enable} = $self->{name} . '_enable'; $self->{packages} = $self->{name} . '_packages'; $psgconf->register_data( rpc_enable => PSGConf::Data::Boolean->new( value => 'false' ), rpc => PSGConf::Data::Table->new(), rpc_packages => PSGConf::Data::List->new() ); $psgconf->register_policy($self, rpc_add_packages => '_add_pkgs', rpc_enable_rc_scripts => '_enable_rc_scripts' ); return $self; } ############################################################################### ### documentation ############################################################################### 1; __END__ =head1 NAME PSGConf::Control::RPC - psgconf control class for RPC configuration =head1 SYNOPSIS In F: Control PSGConf::Control::RPC =head1 DESCRIPTION The B module provides a B control object for configuring RPC services. 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 enabling the RPC module. =item I A B object containing the packages to install. =item I A B object containing the list of rpcs to put into the F file. =back The constructor also registers the following policy method: =over 4 =item I Adds the packges listed in the C directive to the C list to be installed by the C Control module. =back =item decide() =back =head1 SEE ALSO L L L L L L L L L =cut