New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rebase pdxcat/xinetd against new upstream #15
Changes from all commits
5ef8ed9
ae681b3
d6aa4d4
e598192
6402e3d
8831278
8578296
74d681a
5c9dd81
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
fixtures: | ||
repositories: | ||
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib" | ||
symlinks: | ||
"xinetd": "#{source_dir}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
class xinetd::params { | ||
|
||
case $::osfamily { | ||
'Debian': { | ||
$confdir = '/etc/xinetd.d' | ||
$conffile = '/etc/xinetd.conf' | ||
$package_name = 'xinetd' | ||
$service_name = 'xinetd' | ||
} | ||
'FreeBSD': { | ||
$confdir = '/usr/local/etc/xinetd.d' | ||
$conffile = '/usr/local/etc/xinetd.conf' | ||
$package_name = 'security/xinetd' | ||
$service_name = 'xinetd' | ||
} | ||
'Suse': { | ||
$confdir = '/etc/xinetd.d' | ||
$conffile = '/etc/xinetd.conf' | ||
$package_name = 'xinetd' | ||
$service_name = 'xinetd' | ||
} | ||
'RedHat': { | ||
$confdir = '/etc/xinetd.d' | ||
$conffile = '/etc/xinetd.conf' | ||
$package_name = 'xinetd' | ||
$service_name = 'xinetd' | ||
} | ||
default: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about if the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eh, the default case was the |
||
fail("xinetd: module does not support osfamily ${::osfamily}") | ||
} | ||
} | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,27 +4,32 @@ | |
# all parameters match up with xinetd.conf(5) man page | ||
# | ||
# Parameters: | ||
# $port - required - determines the service port | ||
# $server - required - determines the executable for this service | ||
# $ensure - optional - defaults to 'present' | ||
# $cps - optional | ||
# $flags - optional | ||
# $per_source - optional | ||
# $server_args - optional | ||
# $log_on_failure - optional - may contain any combination of | ||
# 'HOST', 'USERID', 'ATTEMPT' | ||
# $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 | ||
# $bind - optional - defaults to '0.0.0.0' | ||
# $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 - optional - determines the "type" of service, see xinetd.conf(5) | ||
# $no_access - optional | ||
# $access_times - optional | ||
# $log_type - optional | ||
# $bind - optional | ||
# | ||
# Actions: | ||
# setups up a xinetd service by creating a file in /etc/xinetd.d/ | ||
|
@@ -50,37 +55,71 @@ | |
$port, | ||
$server, | ||
$ensure = present, | ||
$log_on_failure = undef, | ||
$service_type = undef, | ||
$service_name = $title, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usually the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any preference on what should be done? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. Except that it does notify the xinetd service. I think |
||
$cps = undef, | ||
$disable = 'no', | ||
$flags = undef, | ||
$group = 'root', | ||
$groups = 'yes', | ||
$instances = 'UNLIMITED', | ||
$log_on_failure = undef, | ||
$per_source = undef, | ||
$protocol = 'tcp', | ||
$server_args = undef, | ||
$disable = 'no', | ||
$socket_type = 'stream', | ||
$protocol = 'tcp', | ||
$user = 'root', | ||
$group = 'root', | ||
$instances = 'UNLIMITED', | ||
$only_from = undef, | ||
$wait = undef, | ||
$bind = '0.0.0.0', | ||
$service_type = undef | ||
$xtype = undef, | ||
$no_access = undef, | ||
$access_times = undef, | ||
$log_type = undef, | ||
$bind = undef, | ||
) { | ||
|
||
include xinetd | ||
|
||
if $wait { | ||
$mywait = $wait | ||
$_wait = $wait | ||
} else { | ||
$mywait = $protocol ? { | ||
validate_re($protocol, '(tcp|udp)') | ||
$_wait = $protocol ? { | ||
tcp => 'no', | ||
udp => 'yes' | ||
} | ||
} | ||
|
||
file { "/etc/xinetd.d/${name}": | ||
# Template uses: | ||
# - $port | ||
# - $disable | ||
# - $socket_type | ||
# - $protocol | ||
# - $_wait | ||
# - $user | ||
# - $group | ||
# - $groups | ||
# - $server | ||
# - $bind | ||
# - $service_type | ||
# - $server_args | ||
# - $only_from | ||
# - $per_source | ||
# - $log_on_failure | ||
# - $cps | ||
# - $flags | ||
# - $xtype | ||
# - $no_access | ||
# - $access_types | ||
# - $log_type | ||
file { "${xinetd::confdir}/${title}": | ||
ensure => $ensure, | ||
owner => 'root', | ||
mode => '0644', | ||
content => template('xinetd/service.erb'), | ||
notify => Service['xinetd'], | ||
require => Package['xinetd'], | ||
notify => Service[$xinetd::service_name], | ||
require => File[$xinetd::confdir], | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
require 'spec_helper' | ||
|
||
describe 'xinetd' do | ||
|
||
let :facts do | ||
{ :osfamily => 'Debian' } | ||
end | ||
|
||
it { | ||
should contain_package('xinetd') | ||
should contain_file('/etc/xinetd.conf') | ||
should contain_service('xinetd').with_restart('/etc/init.d/xinetd reload') | ||
should contain_service('xinetd') | ||
} | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,51 @@ | ||
# This file is being maintained by Puppet. | ||
# DO NOT EDIT | ||
|
||
service <%= @name %> | ||
service <%= @service_name %> | ||
{ | ||
port = <%= @port %> | ||
disable = <%= @disable %> | ||
socket_type = <%= @socket_type %> | ||
protocol = <%= @protocol %> | ||
wait = <%= @mywait %> | ||
wait = <%= @_wait %> | ||
user = <%= @user %> | ||
group = <%= @group %> | ||
groups = <%= @groups %> | ||
server = <%= @server %> | ||
<% if @bind -%> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The man page is very unhelpful in determining this..... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright I put it back to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, my guess would be that no bind is the same as |
||
bind = <%= @bind %> | ||
<% if @server_args %> server_args = <%= @server_args %><% end %> | ||
<% if @per_source %> per_source = <%= @per_source %><% end %> | ||
<% if @log_on_failure %> log_on_failure += <%= @log_on_failure %><% end %> | ||
<% if @cps %> cps = <%= @cps %><% end %> | ||
<% if @flags %> flags = <%= @flags %><% end %> | ||
<% if @service_type %> type = <%= @service_type %><% end %> | ||
<% 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_failure -%> | ||
log_on_failure += <%= @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 -%> | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,5 +48,4 @@ defaults | |
# banner_success = | ||
} | ||
|
||
includedir /etc/xinetd.d | ||
|
||
includedir <%= @confdir %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this has a
template()
call I like to comment# Template uses:
and list the variables so I don't have to open the template to see what is going on.