Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

v0.2.0 Updates #11

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
51c7c84
adding puppet lint config
mrjoshuap Feb 8, 2015
70668ac
puppet-lint updates
mrjoshuap Feb 8, 2015
1324d19
adding rhel and aix support
mrjoshuap Feb 8, 2015
40f1a8c
using different dependency style
mrjoshuap Feb 8, 2015
69f7892
adding example and fixing whitespace
mrjoshuap Feb 8, 2015
74801d1
documentation update
mrjoshuap Feb 8, 2015
5c19478
adding options and using output_real
mrjoshuap Feb 8, 2015
49b4e87
format cleanup
mrjoshuap Feb 8, 2015
fb1f3bd
changing dep type
mrjoshuap Feb 8, 2015
b754e8a
fixing aix inittab requires
mrjoshuap Feb 8, 2015
a5e8453
fixing naming
mrjoshuap Feb 9, 2015
958ab5a
adding module build to ignore list
mrjoshuap Feb 9, 2015
73c9bef
updating authors
mrjoshuap Feb 9, 2015
22fecf8
adding operating system support
mrjoshuap Feb 9, 2015
df1a0be
updated notes
mrjoshuap Feb 9, 2015
fa026ea
updated to show AIX support
mrjoshuap Feb 9, 2015
76b4b06
now supports accept and connect with and without colon
mrjoshuap Feb 9, 2015
f54fadc
removing parameter order check
mrjoshuap Feb 9, 2015
16f3270
reordering params for linting
mrjoshuap Feb 9, 2015
4f16d44
email removal
mrjoshuap Feb 9, 2015
4dc6ceb
adding defaults
mrjoshuap Feb 14, 2015
45823e7
making sure options is an array
mrjoshuap Feb 16, 2015
f298363
adding missing default for service
mrjoshuap Feb 16, 2015
725e118
adding notify
mrjoshuap Feb 16, 2015
7a24959
tunnel template update
mrjoshuap Feb 16, 2015
e8f692f
setting values to undef
mrjoshuap Feb 16, 2015
6e77e03
altering default compression to zlib
mrjoshuap Feb 16, 2015
8c81877
adding in checks
mrjoshuap Feb 16, 2015
0b9c193
fixing sockets
mrjoshuap Feb 16, 2015
e02893f
adding check and fail, updating socket to sock
mrjoshuap Feb 16, 2015
5a6942a
changing default verify level
mrjoshuap Feb 16, 2015
aa7b4d4
changing name of verify
mrjoshuap Feb 16, 2015
7b810e3
updating init script to work properly
mrjoshuap Feb 16, 2015
9de5231
adding verbiage to status and stop
mrjoshuap Feb 16, 2015
a3714a5
adding rhel4 support
mrjoshuap Feb 17, 2015
d14c96c
removing verify level
mrjoshuap Feb 17, 2015
a0133db
commenting out verify
mrjoshuap Feb 17, 2015
0da5a83
commenting out verify
mrjoshuap Feb 17, 2015
e573cd5
commenting out verify
mrjoshuap Feb 17, 2015
f9c8dba
working on stunnel templates
mrjoshuap Feb 17, 2015
fa911c4
working on stunnel templates
mrjoshuap Feb 17, 2015
b98d1a9
fixing rhel4 template
mrjoshuap Feb 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ tags

# Ruby
Gemfile.lock
pkg
3 changes: 3 additions & 0 deletions .puppet-lint.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--no-autoloader_layout-check
--no-class_inherits_from_params_class-check
--no-80chars-check
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Summary
Provides a defined resource type for managing stunnel on Debian and Red Hat systems.
Provides a defined resource type for managing stunnel on AIX, Debian and Red Hat systems.

## Usage
```
Expand All @@ -8,20 +8,30 @@ Provides a defined resource type for managing stunnel on Debian and Red Hat syst
private_key => "/etc/puppet/ssl/private_keys/${::clientcert}.pem",
ca_file => '/etc/puppet/ssl/certs/ca.pem',
crl_file => '/etc/puppet/ssl/crl.pem',
chroot => '/var/lib/stunnel4/rsyncd',
chroot => '/var/lib/stunnel4/rsyncd',
user => 'pe-puppet',
group => 'pe-puppet',
client => false,
accept => '1873',
connect => '873',
}

stunnel::tun { 'ldap':
ca_file => '/etc/puppet/ssl/certs/ca.pem',
crl_file => '/etc/puppet/ssl/crl.pem',
client => true,
accept => 'localhost:1389',
connect => 'ldap.server.local:636',
}

```

## Notes
* There is no sysvinit script installed as part of the `stunnel` package on Red Hat systems.
* This includes an sysvinit script because the `stunnel` package on Red Hat systems does not provide one.
* Use of SSLv2 is highly discouraged because it's known to be vulnerable.
* The chroot defined in `stunnel::tun` needs to be manually created.
* AIX support does not include package installation

## Authors
* Cody Herriages <[email protected]>
* Sam Kottler <[email protected]>
* Josh Preston
103 changes: 80 additions & 23 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
#
# [*package*]
# The package name that represents the stunnel application on your
# distribution. By default we look this value up in a stunnel::data class,
# distribution. By default we look this value up in a stunnel::params class,
# which has a list of common answers.
#
# [*service*]
# The service name that represents the stunnel application on your
# distribution. By default we look this value up in a stunnel::data class,
# distribution. By default we look this value up in a stunnel::params class,
# which has a list of common answers.
#
# [*conf_dir*]
# The default base configuration directory for your version on stunnel.
# By default we look this value up in a stunnel::data class, which has a
# By default we look this value up in a stunnel::params class, which has a
# list of common answers.
#
# === Examples
Expand All @@ -27,44 +27,101 @@
# === Authors
#
# Cody Herriges <[email protected]>
# Josh Preston
#
# === Copyright
#
# Copyright 2012 Puppet Labs, LLC
#
class stunnel(
$package = $stunnel::params::package,
$service = $stunnel::params::service,
$conf_dir = $stunnel::params::conf_dir
# These are OS dependent...
$package = $stunnel::params::package,
$service = $stunnel::params::service,
$conf_dir = $stunnel::params::conf_dir,
$log_dir = $stunnel::params::log_dir,
$pid_dir = $stunnel::params::pid_dir,
$chroot_dir = $stunnel::params::chroot_dir,

# These are stunnel global options
$chroot = $stunnel::params::chroot,
$compression = $stunnel::params::compression,
$debug_level = $stunnel::params::debug_level,
$fips = $stunnel::params::fips,
$foreground = $stunnel::params::foreground,
$group = $stunnel::params::group,
$output = $stunnel::params::output,
$pid_file = $stunnel::params::pid_file,
$sockets = $stunnel::params::sockets,
$syslog = $stunnel::params::syslog,
$user = $stunnel::params::user,
) inherits stunnel::params {

package { $package:
ensure => present,
if $package {
# Make sure the package is installed
package { $package:
ensure => present,
before => File[$conf_dir],
}
}

# Make sure our config directory exists
file { $conf_dir:
ensure => directory,
require => Package[$package],
purge => true,
recurse => true,
}

if $osfamily == "Debian" {
exec { 'enable stunnel':
command => 'sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/stunnel4',
path => [ '/bin', '/usr/bin' ],
unless => 'grep "ENABLED=1" /etc/default/stunnel4',
require => Package[$package],
before => Service[$service],
# Make sure the pid directory exists if needed
if ($pid_dir and !$chroot and !$chroot_dir) {
file { $pid_dir:
ensure => directory,
}
} else {
notify { 'Specifying chroot and pid_dir is not recommended': }
}

# Make sure the log directory exists if needed
if $log_dir {
file { $log_dir:
ensure => directory,
}
}

# Make sure the chroot directory exists if needed
if $chroot_dir {
file { $chroot_dir:
ensure => directory,
}
}

# There isn't a sysvinit script installed by the "stunnel" package on
# Red Hat systems.
service { $service:
ensure => running,
enable => true,
hasrestart => true,
hasstatus => false,
# Debian must handle stunnel differently and AIX needs telinit -q
case $::osfamily {

'AIX': {
exec { 'telinit -q':
command => 'telinit -q',
path => '/usr/bin:/usr/sbin:/bin:/sbin',
refreshonly => true,
}
}

'Debian': {
exec { 'enable stunnel':
command => 'sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/stunnel4',
path => [ '/bin', '/usr/bin' ],
unless => 'grep "ENABLED=1" /etc/default/stunnel4',
require => Package[$package],
before => Service[$service],
}
service { $service:
ensure => running,
enable => true,
hasrestart => true,
hasstatus => false,
}
}

default: { }
}

}
76 changes: 70 additions & 6 deletions manifests/params.pp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# == Class: stunnel::data
# == Class: stunnel::params
#
# This module sets up SSL encrypted and authenticated tunnels using the
# common application stunnel.
# This class sets up the default values for the OS and global options.
#
# === Variables
#
# ==== OS Variables
#
# [*package*]
# The package name that represents the stunnel application on your
# distribution.
Expand All @@ -16,26 +17,89 @@
# [*conf_dir*]
# The default base configuration directory for your version on stunnel.
#
# [*pid_dir*]
# The default base pid file directory for stunnel services.
#
# [*log_dir*]
# The default base log file directory for stunnel services.
#
# [*lock_dir*]
# The default base lock file directory for stunnel services.
#
# ==== Global Variables
#
# [*compression*]
# The default compression for stunnel services.
#
# [*debug_level*]
# The default debug level for stunnel services.
#
# [*fips*]
# The default fips flag for stunnel services.
#
# [*foreground*]
# The default foreground flag for stunnel services.
#
# [*log*]
# The default logging type for stunnel services.
#
# [*output*]
# The default log file for stunnel services.
#
# [*sockets*]
# The default socket options for stunnel services.
#
# [*syslog*]
# The default syslog flag for stunnel services.
#
# === Authors
#
# Cody Herriges <[email protected]>
# Sam Kottler <[email protected]>
# Josh Preston
#
# === Copyright
#
# Copyright 2012 Puppet Labs, LLC
#
class stunnel::params {
case $osfamily {

case $::osfamily {

AIX: {
$conf_dir = '/etc/stunnel'
$pid_dir = '/var/run'
$log_dir = '/var/log/stunnel'
}

Debian: {
$conf_dir = '/etc/stunnel'
$log_dir = '/var/log/stunnel'
$package = 'stunnel4'
$pid_file = '/var/run/stunnel.pid'
$service = 'stunnel4'
}

RedHat: {
$conf_dir = '/etc/stunnel'
$package = 'stunnel'
$service = 'stunnel'
$lock_dir = '/var/lock/subsys'
$log_dir = '/var/log/stunnel'
$package = 'stunnel'
$pid_dir = '/var/run'
}

default: {
notify { "${::osfamily} is not supported.": }
}

}

$compression = 'zlib'
$debug_level = '4'
$fips = 'no'
$foreground = 'no'
$service = 'stunnel'
$log = 'append'
$output = '/var/log/stunnel.log'
$syslog = 'yes'
}
Loading