From 3d4c0fa98a661d0bda25635b025c679f4560ea9f Mon Sep 17 00:00:00 2001 From: thomashaw Date: Wed, 19 Apr 2017 13:17:48 +0100 Subject: [PATCH] Parameterised port - service/proftpd --- modules/services/unix/ftp/proftpd/manifests/configure.pp | 4 +++- modules/services/unix/ftp/proftpd/manifests/init.pp | 6 +++--- modules/services/unix/ftp/proftpd/manifests/service.pp | 2 ++ modules/services/unix/ftp/proftpd/secgen_metadata.xml | 6 ++++++ modules/services/unix/ftp/proftpd/templates/proftpd.erb | 6 +++++- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/modules/services/unix/ftp/proftpd/manifests/configure.pp b/modules/services/unix/ftp/proftpd/manifests/configure.pp index e20341a8a..86dbab06e 100644 --- a/modules/services/unix/ftp/proftpd/manifests/configure.pp +++ b/modules/services/unix/ftp/proftpd/manifests/configure.pp @@ -1,9 +1,11 @@ class proftpd::configure { + $json_inputs = base64('decode', $::base64_inputs) file { '/etc/proftpd/proftpd.conf': + notify => Service['proftpd'], ensure => present, owner => 'root', group => 'root', mode => '0644', - content => template('proftpd/proftpd.erb') + content => template('proftpd/proftpd.erb'), } } \ No newline at end of file diff --git a/modules/services/unix/ftp/proftpd/manifests/init.pp b/modules/services/unix/ftp/proftpd/manifests/init.pp index 3d74a37f1..d9bcb2727 100644 --- a/modules/services/unix/ftp/proftpd/manifests/init.pp +++ b/modules/services/unix/ftp/proftpd/manifests/init.pp @@ -1,5 +1,5 @@ class proftpd { - require proftpd::install - require proftpd::configure - require proftpd::service + class { 'proftpd::install': } + class { 'proftpd::configure': } ~> + class { 'proftpd::service': } } diff --git a/modules/services/unix/ftp/proftpd/manifests/service.pp b/modules/services/unix/ftp/proftpd/manifests/service.pp index 9215ef51a..a838143cc 100644 --- a/modules/services/unix/ftp/proftpd/manifests/service.pp +++ b/modules/services/unix/ftp/proftpd/manifests/service.pp @@ -2,6 +2,8 @@ class proftpd::service { service { 'proftpd': ensure => running, enable => true, + hasrestart => true, require => File['/etc/proftpd/proftpd.conf'], + subscribe => File['/etc/proftpd/proftpd.conf'], } } \ No newline at end of file diff --git a/modules/services/unix/ftp/proftpd/secgen_metadata.xml b/modules/services/unix/ftp/proftpd/secgen_metadata.xml index 1f3feba39..f2ed9372f 100644 --- a/modules/services/unix/ftp/proftpd/secgen_metadata.xml +++ b/modules/services/unix/ftp/proftpd/secgen_metadata.xml @@ -12,6 +12,12 @@ ftp linux + port + + + 201 + + https://security.appspot.com/vsftpd.html https://forge.puppet.com/adamjlow/proftpd diff --git a/modules/services/unix/ftp/proftpd/templates/proftpd.erb b/modules/services/unix/ftp/proftpd/templates/proftpd.erb index ffc87637c..eae1df013 100644 --- a/modules/services/unix/ftp/proftpd/templates/proftpd.erb +++ b/modules/services/unix/ftp/proftpd/templates/proftpd.erb @@ -1,3 +1,7 @@ +<% require 'json' + $secgen_parameters = JSON.parse(@json_inputs) + $port = $secgen_parameters['port'].first +%> # # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file. # To really apply changes, reload proftpd after modifications, if @@ -38,7 +42,7 @@ DenyFilter \*.*/ # RequireValidShell off # Port 21 is the standard FTP port. -Port 21 +Port <%=$port%> # In some cases you have to specify passive ports range to by-pass # firewall limitations. Ephemeral ports can be used for that, but