Puppet Class: stunnel::config

Inherits:
stunnel
Defined in:
manifests/config.pp

Overview

Global stunnel options

Parameters:

  • chroot (Stdlib::Absolutepath) (defaults to: '/var/stunnel')

    The location of the chroot jail

    • Do NOT make this anything under /var/run

  • pki (Variant[Enum['simp'],Boolean]) (defaults to: $::stunnel::pki)
    • If simp, include SIMP's pki module and use pki::copy to manage application certs in /etc/pki/simp_apps/stunnel/x509

    • If true, do not include SIMP's pki module, but still use pki::copy to manage certs in /etc/pki/simp_apps/stunnel/x509

    • If false, do not include SIMP's pki module and do not use pki::copy to manage certs. You will need to appropriately assign a subset of:

      • app_pki_dir

      • app_pki_key

      • app_pki_cert

      • app_pki_ca_dir

  • app_pki_external_source (Stdlib::Absolutepath) (defaults to: $::stunnel::app_pki_external_source)
    • If pki = simp or true, this is the directory from which certs will be copied, via pki::copy

    • If pki = false, this variable has no effect

  • app_pki_dir (Stdlib::Absolutepath) (defaults to: $::stunnel::app_pki_dir)

    The source of certs in the chroot, and the basepath of $app_pki_key, $app_pki_cert, $app_pki_ca, $app_pki_ca_dir, and $app_pki_crl

    • NOTE: Even when using a chroot, stunnel needs the certs to reside outside of the chroot path

  • app_pki_key (Stdlib::Absolutepath) (defaults to: $::stunnel::app_pki_key)

    Path and name of the private SSL key file

  • app_pki_cert (Stdlib::Absolutepath) (defaults to: $::stunnel::app_pki_cert)

    Path and name of the public SSL certificate

  • app_pki_ca_dir (Stdlib::Absolutepath) (defaults to: $::stunnel::app_pki_ca_dir)

    Since stunnel runs in a chroot, you need to copy the appropriate CA certificates in from an external source

    • This should be the full path to a directory containing hashed versions of the CA certificates

  • app_pki_crl (Stdlib::Absolutepath) (defaults to: $::stunnel::app_pki_crl)

    Since stunnel runs in a chroot, you need to copy the appropriate CRL in from an external source

  • pid (Stdlib::Absolutepath) (defaults to: '/var/run/stunnel/stunnel.pid')

    The PID file

    • Relative to the chroot jail!

    • Let the startup script handle it by default

  • setuid (String) (defaults to: $::stunnel::setuid)

    The user stunnel should run as

  • setgid (String) (defaults to: $::stunnel::setgid)

    The group stunnel should run as

  • stunnel_debug (String) (defaults to: 'err')

    The debug level for logging

  • syslog (Boolean) (defaults to: $::stunnel::syslog)

    Enable logging to syslog

  • compression (Optional[Enum['zlib','rle']]) (defaults to: undef)

    The compression type to use for this service

  • egd (Optional[String]) (defaults to: undef)

    The path to the Entropy Gathering Daemon socket used to feed the OpenSSL Random Number Generator

  • engine (String) (defaults to: 'auto')

    If $egd is set, sets the Hardware Engine to be used

  • engine_ctrl (Optional[String]) (defaults to: undef)

    If $egd is set, sets the Hardware Engine Control parameters

  • fips (Boolean) (defaults to: $::stunnel::fips)

    Set the fips global option

    • We don't enable FIPS mode by default since we want to be able to use TLS1.2

    • NOTE: This has no effect on EL < 7 due to stunnel not accepting the fips option in that version of stunnel

  • output (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    The path to a log output file to use

  • rnd_bytes (Optional[Integer]) (defaults to: undef)

    The number of bytes to read from the random seed file

  • rnd_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    The path to the random seed data file

  • rnd_overwrite (Boolean) (defaults to: false)

    Overwrite the random seed file with new random data

  • socket_options (Array[String]) (defaults to: [])

Author:



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'manifests/config.pp', line 109

class stunnel::config (
  Variant[Enum['simp'],Boolean]  $pki                     = $::stunnel::pki,
  Stdlib::Absolutepath           $app_pki_dir             = $::stunnel::app_pki_dir,
  Stdlib::Absolutepath           $app_pki_external_source = $::stunnel::app_pki_external_source,
  Stdlib::Absolutepath           $app_pki_key             = $::stunnel::app_pki_key,
  Stdlib::Absolutepath           $app_pki_cert            = $::stunnel::app_pki_cert,
  Stdlib::Absolutepath           $app_pki_ca_dir          = $::stunnel::app_pki_ca_dir,
  Stdlib::Absolutepath           $app_pki_crl             = $::stunnel::app_pki_crl,
  Stdlib::Absolutepath           $chroot                  = '/var/stunnel',
  Stdlib::Absolutepath           $pid                     = '/var/run/stunnel/stunnel.pid',
  String                         $setuid                  = $::stunnel::setuid,
  String                         $setgid                  = $::stunnel::setgid,
  String                         $stunnel_debug           = 'err',
  Optional[Enum['zlib','rle']]   $compression             = undef,
  Optional[String]               $egd                     = undef,
  String                         $engine                  = 'auto',
  Optional[String]               $engine_ctrl             = undef,
  Optional[Stdlib::Absolutepath] $output                  = undef,
  Optional[Integer]              $rnd_bytes               = undef,
  Optional[Stdlib::Absolutepath] $rnd_file                = undef,
  Boolean                        $rnd_overwrite           = false,
  Array[String]                  $socket_options          = [],
  Boolean                        $syslog                  = $::stunnel::syslog,
  Boolean                        $fips                    = $::stunnel::fips
) inherits stunnel {

  if $facts['selinux_current_mode'] and $facts['selinux_current_mode'] != 'disabled' {
    $_chroot = undef
  }
  else {
    $_chroot = $chroot
  }

  if $pki {
    pki::copy { 'stunnel':
      source => $app_pki_external_source,
      pki    => $pki
    }
  }

  concat { '/etc/stunnel/stunnel.conf':
    owner          => 'root',
    group          => 'root',
    mode           => '0600',
    ensure_newline => true,
    warn           => true
  }

  concat::fragment { '0_stunnel_global':
    order   => 1,
    target  => '/etc/stunnel/stunnel.conf',
    content => template('stunnel/stunnel.erb')
  }

  if $_chroot {
    # The _chroot directory
    file { $_chroot:
      ensure => 'directory',
      owner  => 'root',
      group  => $setgid,
      mode   => '0770'
    }

    # The following two entries are required to be able to properly resolve
    # hosts using the _chroot directory.
    file { "${_chroot}/etc":
      ensure => 'directory',
      owner  => 'root',
      group  => 'root',
      mode   => '0755'
    }

    file { "${_chroot}/etc/resolv.conf":
      ensure => 'file',
      owner  => 'root',
      group  => 'root',
      mode   => '0644',
      source => 'file:///etc/resolv.conf'
    }

    file { "${_chroot}/etc/nsswitch.conf":
      ensure => 'file',
      owner  => 'root',
      group  => 'root',
      mode   => '0644',
      source => 'file:///etc/nsswitch.conf'
    }

    file { "${_chroot}/etc/hosts":
      ensure => 'file',
      owner  => 'root',
      group  => 'root',
      mode   => '0644',
      source => 'file:///etc/hosts'
    }

    file { "${_chroot}/var":
      ensure => 'directory',
      owner  => 'root',
      group  => 'root',
      mode   => '0644'
    }

    file { "${_chroot}/var/run":
      ensure => 'directory',
      owner  => $setuid,
      group  => $setgid,
      mode   => '0644'
    }

    file { "${_chroot}/var/run/stunnel":
      ensure => 'directory',
      owner  => $setuid,
      group  => $setgid,
      mode   => '0644'
    }

    file { "${_chroot}/etc/pki":
      ensure => 'directory',
      owner  => 'root',
      group  => $setgid,
      mode   => '0640'
    }

    file { "${_chroot}/etc/pki/cacerts":
      source  => "file://${app_pki_dir}/cacerts",
      group   => $setgid,
      mode    => '0640',
      recurse => true,
    }
  }

}