puppetlabs-xinetd-1.5.0/000755 000765 000024 00000000000 12466455125 015625 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/CHANGELOG.md000644 000765 000024 00000003246 12466455101 017435 0ustar00morganstaff000000 000000 ##2015-02-10 - Release 1.5.0 ###Summary This release adds some new parameters and also pins to rspec-puppet 1.x until migration. ####Features - New parameters in `class xinetd` - `package_ensure` - `purge_confdir` - New parameter in `xinetd::service` - `nice` ##2015-01-20 - Release 1.4.0 ###Summary This release adds support for Gentoo and improves FreeBSD support ####Features - Gentoo support added - Better defaults for group for FreeBSD - Add deprecation warning for `$xtype` parameter ##2014-07-15 - Release 1.3.1 ###Summary This release merely updates metadata.json so the module can be uninstalled and upgraded via the puppet module command. ##2014-06-18 - Release 1.3.0 ####Features - Add 'log_on_success', 'log_on_success_operator' and 'log_on_failure_operator parameters to xinetd::service - Add 'service_restart', 'service_status', 'service_hasrestart', and 'service_hasstatus' parameters to class xinetd. - Add support for Amazon Linux. - License changes to ASLv2 - Testing and documentation updates. ####Bugfixes - Remove duplicated $log_on_failure parameter ##2013-07-30 - Release 1.2.0 ####Features - Add `confdir`, `conffile`, `package_name`, and `service_name` parameters to `Class['xinetd']` - Add support for FreeBSD and Suse. - Add `log_on_failure`, `service_name`, `groups`, `no_access`, `access_times`, `log_type`, `only_from`, and `xtype` parameters to `Xinetd::Service` define ####Bugfixes - Redesign for `xinetd::params` pattern - Add validation - Add unit testing ##2012-06-07 - Release 1.1.0 - Add port and bind options to services - make services deletable ##2010-08-12 - Release 1.0.1 -added documentation ##2010-06-24 - Release 1.0.0 - initial release puppetlabs-xinetd-1.5.0/checksums.json000644 000765 000024 00000002200 12466455125 020477 0ustar00morganstaff000000 000000 { "CHANGELOG.md": "24edea8d41437fc98a8c69a6f99897cd", "Gemfile": "c361ca947adbb89734be126d254167a2", "LICENSE": "617dce6c9442191a93fe112b36271a93", "README.md": "cd2612e7f6f897a1979a62adeb4de69a", "Rakefile": "0428ea3759a4692c91604396c406a9c1", "examples/init.pp": "c31f20acadb59d84cc56ebe12a138a03", "manifests/init.pp": "ac0c9e8b6848818828ca8b8ee361b45f", "manifests/params.pp": "779a034f57c2a014d7b0483e1301642c", "manifests/service.pp": "0100ff2cd3b389e4563ecc62b6914321", "metadata.json": "d8dfe87fd19f89c3ac0758112d27999f", "spec/classes/xinetd_init_spec.rb": "22e25589ef7bfb19fa2c915eb357b110", "spec/defines/xinetd_service_spec.rb": "a5d491076278d1144f46c32979704312", "spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c", "spec/spec_helper.rb": "0db89c9a486df193c0e40095422e19dc", "spec/spec_helper_system.rb": "a8b3b2c2614853b700179d53eb5d549b", "spec/system/class_spec.rb": "b1dcb446277f3bb1916f3528acb73742", "spec/system/service_spec.rb": "70e460d61848c190501cb8d9158520e7", "templates/service.erb": "bbb4fa1e4efb77539107ca71196f2dc5", "templates/xinetd.conf.erb": "39a49b490f2bd5e0b133ce9a58a74b0b" }puppetlabs-xinetd-1.5.0/examples/000755 000765 000024 00000000000 12466455125 017443 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/Gemfile000644 000765 000024 00000001161 12466455101 017111 0ustar00morganstaff000000 000000 source 'https://rubygems.org' group :development, :test do gem 'rake', :require => false gem 'rspec-puppet', '~> 1.0', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'puppet-lint', :require => false gem 'serverspec', :require => false gem 'rspec-system', :require => false gem 'rspec-system-puppet', :require => false gem 'rspec-system-serverspec', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] gem 'puppet', puppetversion, :require => false else gem 'puppet', :require => false end # vim:ft=ruby puppetlabs-xinetd-1.5.0/LICENSE000644 000765 000024 00000001223 12466455101 016622 0ustar00morganstaff000000 000000 Xinetd Puppet Module. Copyright (C) 2010-2014 Garrett Honeycutt Garrett Honeycutt can be contacted at: contact@garretthoneycutt.com. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. puppetlabs-xinetd-1.5.0/manifests/000755 000765 000024 00000000000 12466455125 017616 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/metadata.json000644 000765 000024 00000001061 12466455125 020276 0ustar00morganstaff000000 000000 { "name": "puppetlabs-xinetd", "version": "1.5.0", "author": "puppetlabs", "summary": "Configures xinetd and exposes the xinetd::service definition for adding new services.", "license": "Apache-2.0", "source": "https://github.com/puppetlabs/puppetlabs-xinetd", "project_page": "https://github.com/puppetlabs/puppetlabs-xinetd", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "description": "Puppet module to configure xinetd services", "dependencies": [ {"name":"puppetlabs/stdlib","version_requirement":">=2.2.1"} ] } puppetlabs-xinetd-1.5.0/Rakefile000644 000765 000024 00000000115 12466455101 017261 0ustar00morganstaff000000 000000 require 'puppetlabs_spec_helper/rake_tasks' require 'rspec-system/rake_task' puppetlabs-xinetd-1.5.0/README.md000644 000765 000024 00000003377 12466455101 017110 0ustar00morganstaff000000 000000 # xinetd [![Build Status](https://travis-ci.org/puppetlabs/puppetlabs-xinetd.png)](https://travis-ci.org/puppetlabs/puppetlabs-xinetd) This is the xinetd module. ## Overview This module configures xinetd, and exposes the xinetd::service definition for adding new services. ## Class: xinetd Sets up the xinetd daemon. Has options for you in case you have specific package names and service needs. ### Parameters * `confdir` * `conffile` * `package_name` * `service_name` * `service_restart` * `service_status` * `service_hasrestart` * `service_hasstatus` ## Definition: xinetd::service Sets up a xinetd service. All parameters match up with xinetd.conf(5) man page. ### Parameters: * `server` - required - determines the program to execute for this service * `port` - required - determines the service port * `cps` - optional * `flags` - optional * `per_source` - optional * `server_args` - optional * `disable` - optional - defaults to "no" * `socket_type` - optional - defaults to "stream" * `protocol` - optional - defaults to "tcp" * `user` - optional - defaults to "root" * `group` - optional - defaults to "root" * `instances` - optional - defaults to "UNLIMITED" * `wait` - optional - based on $protocol will default to "yes" for udp and "no" for tcp * `service_type` - optional - type setting in xinetd ### Sample Usage ```puppet xinetd::service { 'tftp': port => '69', server => '/usr/sbin/in.tftpd', server_args => '-s /var/lib/tftp/', socket_type => 'dgram', protocol => 'udp', cps => '100 2', flags => 'IPv4', per_source => '11', } ``` ## Supported OSes Supports Debian, FreeBSD, Suse, RedHat, and Amazon Linux OS Families. puppetlabs-xinetd-1.5.0/spec/000755 000765 000024 00000000000 12466455125 016557 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/templates/000755 000765 000024 00000000000 12466455125 017623 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/templates/service.erb000644 000765 000024 00000003044 12466455101 021750 0ustar00morganstaff000000 000000 # This file is being maintained by Puppet. # DO NOT EDIT service <%= @service_name %> { port = <%= @port %> disable = <%= @disable %> socket_type = <%= @socket_type %> protocol = <%= @protocol %> wait = <%= @_wait %> user = <%= @user %> group = <%= @group %> groups = <%= @groups %> server = <%= @server %> <% if @bind -%> bind = <%= @bind %> <% end -%> <% if @service_type -%> type = <%= @service_type %> <% end -%> <% if @server_args -%> server_args = <%= @server_args %> <% end -%> <% if @only_from -%> only_from = <%= @only_from %> <% end -%> <% if @per_source -%> per_source = <%= @per_source %> <% end -%> <% if @log_on_success -%> log_on_success <%= @log_on_success_operator %> <%= @log_on_success %> <% end -%> <% if @log_on_failure -%> log_on_failure <%= @log_on_failure_operator %> <%= @log_on_failure %> <% end -%> <% if @cps -%> cps = <%= @cps %> <% end -%> <% if @flags -%> flags = <%= @flags %> <% end -%> <% if @xtype -%> type = <%= @xtype %> <% end -%> <% if @no_access -%> no_access = <%= @no_access %> <% end -%> <% if @access_times -%> access_times = <%= @access_times %> <% end -%> <% if @log_type -%> log_type = <%= @log_type %> <% end -%> <% if @nice -%> nice = <%= @nice %> <% end -%> } puppetlabs-xinetd-1.5.0/templates/xinetd.conf.erb000644 000765 000024 00000002443 12466455101 022531 0ustar00morganstaff000000 000000 # This file is being maintained by Puppet. # DO NOT EDIT # # This is the master xinetd configuration file. Settings in the # default section will be inherited by all service configurations # unless explicitly overridden in the service configuration. See # xinetd.conf in the man pages for a more detailed explanation of # these attributes. defaults { # The next two items are intended to be a quick access place to # temporarily enable or disable services. # # enabled = # disabled = # Define general logging characteristics. log_type = SYSLOG daemon info log_on_failure = HOST log_on_success = PID HOST DURATION EXIT # Define access restriction defaults # # no_access = # only_from = # max_load = 0 cps = 50 10 instances = 50 per_source = 10 # Address and networking defaults # # bind = # mdns = yes v6only = no # setup environmental attributes # # passenv = groups = yes umask = 002 # Generally, banners are not used. This sets up their global defaults # # banner = # banner_fail = # banner_success = } includedir <%= @confdir %> puppetlabs-xinetd-1.5.0/spec/classes/000755 000765 000024 00000000000 12466455125 020214 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/spec/defines/000755 000765 000024 00000000000 12466455125 020174 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/spec/spec.opts000644 000765 000024 00000000057 12466455101 020414 0ustar00morganstaff000000 000000 --format s --colour --loadby mtime --backtrace puppetlabs-xinetd-1.5.0/spec/spec_helper.rb000644 000765 000024 00000000064 12466455101 021367 0ustar00morganstaff000000 000000 require 'puppetlabs_spec_helper/module_spec_helper' puppetlabs-xinetd-1.5.0/spec/spec_helper_system.rb000644 000765 000024 00000001316 12466455101 022774 0ustar00morganstaff000000 000000 require 'rspec-system/spec_helper' require 'rspec-system-puppet/helpers' require 'rspec-system-serverspec/helpers' include Serverspec::Helper::RSpecSystem include Serverspec::Helper::DetectOS include RSpecSystemPuppet::Helpers RSpec.configure do |c| # Project root proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) # Enable colour c.tty = true c.include RSpecSystemPuppet::Helpers # This is where we 'setup' the nodes before running our tests c.before :suite do # Install puppet puppet_install # Install modules and dependencies puppet_module_install(:source => proj_root, :module_name => 'xinetd') shell('puppet module install puppetlabs-stdlib') end end puppetlabs-xinetd-1.5.0/spec/system/000755 000765 000024 00000000000 12466455125 020103 5ustar00morganstaff000000 000000 puppetlabs-xinetd-1.5.0/spec/system/class_spec.rb000644 000765 000024 00000000545 12466455101 022545 0ustar00morganstaff000000 000000 require 'spec_helper_system' describe 'xinetd class' do describe puppet_apply(<<-EOS class { 'xinetd': } EOS ) do its(:exit_code) { should_not eq(1) } its(:refresh) { should be_nil } its(:exit_code) { should be_zero } end describe service('xinetd') do it { should be_running } it { should be_enabled } end end puppetlabs-xinetd-1.5.0/spec/system/service_spec.rb000644 000765 000024 00000001223 12466455101 023072 0ustar00morganstaff000000 000000 require 'spec_helper_system' describe 'adding a service' do describe puppet_apply(<<-EOS class { 'xinetd': } xinetd::service { 'tftp': port => '69', server => '/usr/sbin/in.tftpd', server_args => '-s $base', socket_type => 'dgram', protocol => 'udp', cps => '100 2', flags => 'IPv4', per_source => '11', } EOS ) do its(:exit_code) { should_not eq(1) } its(:refresh) { should be_nil } its(:exit_code) { should be_zero } end describe service('xinetd') do it { should be_running } it { should be_enabled } end end puppetlabs-xinetd-1.5.0/spec/defines/xinetd_service_spec.rb000644 000765 000024 00000005132 12466455101 024541 0ustar00morganstaff000000 000000 require 'spec_helper' describe 'xinetd::service' do let :facts do { :osfamily => 'Debian' } end let :default_params do { 'port' => '80', 'server' => 'httpd' } end let :title do "httpd" end describe 'with default ensure' do let :params do default_params end it { should contain_file('/etc/xinetd.d/httpd').with_ensure('present') } end describe 'with ensure=present' do let :params do default_params.merge({'ensure' => 'present'}) end it { should contain_file('/etc/xinetd.d/httpd').with_ensure('present') } end describe 'with ensure=absent' do let :params do default_params.merge({'ensure' => 'absent'}) end it { should contain_file('/etc/xinetd.d/httpd').with_ensure('absent') } end describe 'without log_on_' do let :params do default_params end it { should contain_file('/etc/xinetd.d/httpd').without_content(/log_on_success/) should contain_file('/etc/xinetd.d/httpd').without_content(/log_on_failure/) } end describe 'with log_on_ w/default operator' do let :params do default_params.merge({ :log_on_success => 'SUCCESS_TEST', :log_on_failure => 'FAILURE_TEST', }) end it { should contain_file('/etc/xinetd.d/httpd').with_content( /log_on_success\s*\+=\s*SUCCESS_TEST/) should contain_file('/etc/xinetd.d/httpd').with_content( /log_on_failure\s*\+=\s*FAILURE_TEST/) } end describe 'with log_on_ with equal operator' do let :params do default_params.merge({ :log_on_success => 'SUCCESS_TEST', :log_on_failure => 'FAILURE_TEST', :log_on_success_operator => '=', :log_on_failure_operator => '=', }) end it { should contain_file('/etc/xinetd.d/httpd').with_content( /log_on_success\s*\=\s*SUCCESS_TEST/) should contain_file('/etc/xinetd.d/httpd').with_content( /log_on_failure\s*\=\s*FAILURE_TEST/) } end # nice values, good ['-19','9','19'].each do |i| describe "with nice #{i}" do let :params do default_params.merge({ :nice => i }) end it { should contain_file('/etc/xinetd.d/httpd').with_content( /nice\s*=\s*#{i}/) } end end # nice values, bad ['-20','90','foo'].each do |i| describe "with nice #{i}" do let :params do default_params.merge({ :nice => i }) end it { expect { should compile }.to raise_error(Puppet::Error) } end end end puppetlabs-xinetd-1.5.0/spec/classes/xinetd_init_spec.rb000644 000765 000024 00000001607 12466455101 024067 0ustar00morganstaff000000 000000 require 'spec_helper' describe 'xinetd' do let :facts do { :osfamily => 'Debian' } end describe 'with defaults' do it { should contain_package('xinetd') should contain_file('/etc/xinetd.conf') should contain_file('/etc/xinetd.d').with_ensure('directory') should contain_file('/etc/xinetd.d').with_recurse(false) should contain_file('/etc/xinetd.d').with_purge(false) should contain_service('xinetd') } end describe 'with managed confdir' do let :params do { :purge_confdir => true } end it { should contain_package('xinetd') should contain_file('/etc/xinetd.conf') should contain_file('/etc/xinetd.d').with_ensure('directory') should contain_file('/etc/xinetd.d').with_recurse(true) should contain_file('/etc/xinetd.d').with_purge(true) should contain_service('xinetd') } end end puppetlabs-xinetd-1.5.0/manifests/init.pp000644 000765 000024 00000003077 12466455101 021123 0ustar00morganstaff000000 000000 # Class: xinetd # # This module manages xinetd # # Sample Usage: # xinetd::service { 'rsync': # port => '873', # server => '/usr/bin/rsync', # server_args => '--daemon --config /etc/rsync.conf', # } # class xinetd ( $confdir = $xinetd::params::confdir, $conffile = $xinetd::params::conffile, $package_name = $xinetd::params::package_name, $package_ensure = $xinetd::params::package_ensure, $service_name = $xinetd::params::service_name, $service_restart = $xinetd::params::service_restart, $service_status = $xinetd::params::service_status, $service_hasrestart = $xinetd::params::service_hasrestart, $service_hasstatus = $xinetd::params::service_hasstatus, $purge_confdir = false, ) inherits xinetd::params { File { owner => 'root', group => '0', notify => Service[$service_name], require => Package[$package_name], } file { $confdir: ensure => directory, mode => '0755', recurse => $purge_confdir, purge => $purge_confdir, } # Template uses: # $confdir file { $conffile: ensure => file, mode => '0644', content => template('xinetd/xinetd.conf.erb'), } package { $package_name: ensure => $package_ensure, before => Service[$service_name], } service { $service_name: ensure => running, enable => true, hasrestart => $service_hasrestart, hasstatus => $service_hasstatus, restart => $service_restart, status => $service_status, require => File[$conffile], } } puppetlabs-xinetd-1.5.0/manifests/params.pp000644 000765 000024 00000004431 12466455101 021436 0ustar00morganstaff000000 000000 class xinetd::params { $default_default_user = 'root' $default_default_group = 'root' $package_ensure = 'installed' case $::osfamily { 'Debian': { $confdir = '/etc/xinetd.d' $conffile = '/etc/xinetd.conf' $package_name = 'xinetd' $service_hasrestart = true $service_hasstatus = false $service_name = 'xinetd' $service_restart = "/usr/sbin/service ${service_name} reload" } 'FreeBSD': { $confdir = '/usr/local/etc/xinetd.d' $conffile = '/usr/local/etc/xinetd.conf' $default_group = 'wheel' $package_name = 'security/xinetd' $service_hasrestart = false $service_hasstatus = true $service_name = 'xinetd' } 'Suse': { $confdir = '/etc/xinetd.d' $conffile = '/etc/xinetd.conf' $package_name = 'xinetd' $service_hasrestart = true $service_hasstatus = false $service_name = 'xinetd' $service_restart = "/sbin/service ${service_name} reload" } 'RedHat': { $confdir = '/etc/xinetd.d' $conffile = '/etc/xinetd.conf' $package_name = 'xinetd' $service_hasrestart = true $service_hasstatus = true $service_name = 'xinetd' $service_restart = "/sbin/service ${service_name} reload" } 'Gentoo': { $confdir = '/etc/xinetd.d' $conffile = '/etc/xinetd.conf' $package_name = 'sys-apps/xinetd' $service_hasrestart = true $service_hasstatus = true $service_name = 'xinetd' } 'Linux': { case $::operatingsystem { 'Amazon': { $confdir = '/etc/xinetd.d' $conffile = '/etc/xinetd.conf' $package_name = 'xinetd' $service_name = 'xinetd' } default: { fail("xinetd: module does not support Linux operatingsystem ${::operatingsystem}") } } } default: { fail("xinetd: module does not support osfamily ${::osfamily}") } } if $default_user == undef { $default_user = $default_default_user } if $default_group == undef { $default_group = $default_default_group } } puppetlabs-xinetd-1.5.0/manifests/service.pp000644 000765 000024 00000011227 12466455101 021614 0ustar00morganstaff000000 000000 # Definition: xinetd::service # # sets up a xinetd service # all parameters match up with xinetd.conf(5) man page # # Parameters: # $ensure - optional - defaults to 'present' # $log_on_success - optional - may contain any combination of # 'PID', 'HOST', 'USERID', 'EXIT', 'DURATION', 'TRAFFIC' # $log_on_success_operator - optional - defaults to '+='. This is whether or # not values specified will be add, set or remove # from the default. # $log_on_failure - optional - may contain any combination of # 'HOST', 'USERID', 'ATTEMPT' # $log_on_failure_operator - optional - defaults to '+='. This is whether or # not values specified will be add, set or remove # from the default. # $service_type - optional - type setting in xinetd # may contain any combinarion of 'RPC', 'INTERNAL', # 'TCPMUX/TCPMUXPLUS', 'UNLISTED' # $cps - optional # $flags - optional # $per_source - optional # $port - required - determines the service port # $server - required - determines the program to execute for this service # $server_args - optional # $disable - optional - defaults to "no" # $socket_type - optional - defaults to "stream" # $protocol - optional - defaults to "tcp" # $user - optional - defaults to "root" # $group - optional - defaults to "root" # $groups - optional - defaults to "yes" # $instances - optional - defaults to "UNLIMITED" # $only_from - optional # $wait - optional - based on $protocol will default to "yes" for udp and "no" for tcp # $xtype - deprecated - use $service_type instead # $no_access - optional # $access_times - optional # $log_type - optional # $bind - optional # $nice - optional # # Actions: # setups up a xinetd service by creating a file in /etc/xinetd.d/ # # Requires: # $server must be set # $port must be set # # Sample Usage: # # setup tftp service # xinetd::service { 'tftp': # port => '69', # server => '/usr/sbin/in.tftpd', # server_args => '-s $base', # socket_type => 'dgram', # protocol => 'udp', # cps => '100 2', # flags => 'IPv4', # per_source => '11', # nice => '19', # } # xinetd::service # define xinetd::service ( $port, $server, $ensure = present, $log_on_success = undef, $log_on_success_operator = '+=', $log_on_failure = undef, $log_on_failure_operator = '+=', $service_type = undef, $service_name = $title, $cps = undef, $disable = 'no', $flags = undef, $group = $xinetd::params::default_group, $groups = 'yes', $instances = 'UNLIMITED', $per_source = undef, $protocol = 'tcp', $server_args = undef, $socket_type = 'stream', $user = $xinetd::params::default_user, $only_from = undef, $wait = undef, $xtype = undef, $no_access = undef, $access_times = undef, $log_type = undef, $bind = undef, $nice = undef ) { include xinetd if $wait { $_wait = $wait } else { validate_re($protocol, '(tcp|udp)') $_wait = $protocol ? { tcp => 'no', udp => 'yes' } } if $xtype { warning ('The $xtype parameter to xinetd::service is deprecated. Use the service_type parameter instead.') } if $nice { validate_re($nice,'^-?[0-9]+$') if !is_numeric($nice) or $nice < -19 or $nice > 19 { fail("Invalid value for nice, ${nice}") } } # Template uses: # - $port # - $disable # - $socket_type # - $protocol # - $_wait # - $user # - $group # - $groups # - $server # - $bind # - $service_type # - $server_args # - $only_from # - $per_source # - $log_on_success # - $log_on_success_operator # - $log_on_failure # - $log_on_failure_operator # - $cps # - $flags # - $xtype (deprecated) # - $no_access # - $access_types # - $log_type # - $nice file { "${xinetd::confdir}/${title}": ensure => $ensure, owner => 'root', mode => '0644', content => template('xinetd/service.erb'), notify => Service[$xinetd::service_name], require => File[$xinetd::confdir], } } puppetlabs-xinetd-1.5.0/examples/init.pp000644 000765 000024 00000000017 12466455101 020737 0ustar00morganstaff000000 000000 include xinetd