Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x
- Puppet >= 6.0.0 < 8.0.0
Start using this module
Add this module to your Puppetfile:
mod 'bkuebler-pureftpd', '1.0.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-pureftpd
Table of Contents
- Module Description - What the module does and why it is useful
- Setup - The basics of getting started with pureftpd
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Module Description
The pureftpd module installs, configures, and manages the Pure-FTPd service.
This module manages both the installation and configuration of Pure-FTPd. It manages also different Pure-FTPd versions with compiled backends like MySQL, PostgreSQL and LDAP.
Setup
Beginning with pureftpd
To install a server with the default options:
include '::pureftpd'
.
To install a server with MySQL, PostgreSQL or LDAP backend you need to set the "server_type":
class { '::pureftpd':
server_type => 'mysql',
mysql_config => { }
}
See Config Options below for examples of the hash structure for $config
, $ldap_config
, $mysql_config
and $pgsql_config
.
Usage
All interaction is done via pureftpd
. There is no additional public class available.
Hiera
This module is fully configureable with hiera. Only include the module with
include '::pureftpd'
and setup your configuration in hiera here with yaml backend:
---
pureftpd::config:
'TLS': 1
pureftpd::manage_ssl: true
pureftpd::server_mode: standalone
pureftpd::server_type: mysql
pureftpd::ssl_config:
'country': 'US'
'organization': 'example.org Inc.'
'commonname': 'ftp.example.org'
pureftpd::virtualchroot: true
Config Options
To define server options, structure a hash structure of config key
=> value
pairs. This hash create for each key
a file with content of value
:
$config = {
'AltLog' => 'clf:/var/log/pure-ftpd/transfer.log',
'FSCharset' => 'UTF-8',
'MinUID' => '1000',
'NoAnonymous' => 'yes'
}
This will create for example the following files:
root@localhost:~# tail /etc/pure-ftpd/conf/*
==> /etc/pure-ftpd/conf/AltLog <==
clf:/var/log/pure-ftpd/transfer.log
==> /etc/pure-ftpd/conf/FSCharset <==
UTF-8
==> /etc/pure-ftpd/conf/MinUID <==
1000
==> /etc/pure-ftpd/conf/NoAnonymous <==
yes
Known Options (Debian)
This following options will be parsed by the pure-ftpd-wrapper. This List is maybe not completely and just for reference.
'AnonymousCantUpload' => ['-i'],
'AnonymousOnly', => ['-e'],
'AnonymousRatio' => ['-q %d:%d', \&parse_number_2],
'AntiWarez' => ['-s'],
'AutoRename' => ['-r'],
'Bind' => ['-S %s', \&parse_string],
'BrokenClientsCompatibility' => ['-b'],
'CallUploadScript' => ['-o'],
'ChrootEveryone' => ['-A'],
'CreateHomeDir' => ['-j'],
'CustomerProof' => ['-Z'],
'Daemonize' => ['-B'],
'DisplayDotFiles' => ['-D'],
'DontResolve' => ['-H'],
'ForcePassiveIP' => ['-P %s', \&parse_string],
'FortunesFile' => ['-F %s', \&parse_filename],
'FSCharset' => ['-8 %s', \&parse_string],
'ClientCharset' => ['-9 %s', \&parse_string],
'IPV4Only' => ['-4'],
'IPV6Only' => ['-6'],
'KeepAllFiles' => ['-K'],
'LimitRecursion' => ['-L %d:%d', \&parse_number_2_unlimited],
'LogPID' => ['-1'],
'MaxClientsNumber' => ['-c %d', \&parse_number_1],
'MaxClientsPerIP' => ['-C %d', \&parse_number_1],
'MaxDiskUsage' => ['-k %d', \&parse_number_1],
'MaxIdleTime' => ['-I %d', \&parse_number_1],
'MaxLoad' => ['-m %d', \&parse_number_1],
'MinUID' => ['-u %d', \&parse_number_1],
'NATmode' => ['-N'],
'NoAnonymous' => ['-E'],
'NoChmod' => ['-R'],
'NoRename' => ['-G'],
'NoTruncate' => ['-0'],
'PassivePortRange' => ['-p %d:%d', \&parse_number_2],
'PerUserLimits' => ['-y %d:%d', \&parse_number_2],
'ProhibitDotFilesRead' => ['-X'],
'ProhibitDotFilesWrite' => ['-x'],
'Quota' => ['-n %d:%d', \&parse_number_2],
'SyslogFacility' => ['-f %s', \&parse_word, 99],
'TLS' => ['-Y %d', \&parse_number_1],
'TLSCipherSuite' => ['-J %s', \&parse_string],
'TrustedGID' => ['-a %d', \&parse_number_1],
'TrustedIP' => ['-V %s', \&parse_ip],
'Umask' => ['-U %s:%s', \&parse_umask],
'UserBandwidth' => ['-T %s', \&parse_number_1_2],
'UserRatio' => ['-Q %d:%d', \&parse_number_2],
'VerboseLog' => ['-d'],
Reference
Classes
Public classes
pureftpd
: Installs and configures the complete Pure-FTPd.
Private classes
pureftpd::install
: Installs and manage packages.pureftpd::config
: Configures the Pure-FTPd server.pureftpd::service
: Manages the service.
Parameters
pureftpd
config
Specifies options which parsed by pure-ftpd-wrapper. This must be a hash.
$config = {
'AltLog' => 'clf:/var/log/pure-ftpd/transfer.log',
'FSCharset' => 'UTF-8',
'MinUID' => '1000',
'NoAnonymous' => 'yes'
}
See Customize Options and Known Options (Debian) above for usage details.
config_db_dir
Absolute path to directory for backend configuration files. Value must be a string.
Default: /etc/pure-ftpd/db
config_dir
Absolute path to directory for configuration files. Value must be a string.
Default: /etc/pure-ftpd/conf
config_manage
Whether the Pure-FTPd configuration files should be managed. Valid values are true, false. Defaults to true.
dir_aliases
Specifies options to pass pureftpd-dir-aliases file. Structured like a hash, same as config
:
$dir_aliases = {
'public' => '/srv/public',
'uploads' => '/tmp/uploads'
}
dir_aliases_file
Absolute path to directory for configuration files. Value must be a string.
Default: /etc/pure-ftpd/pureftpd-dir-aliases
install_options
Passes install_options array to managed package resources. You must pass the appropriate options for the specified package manager. Defaults to undefined.
ldap_config
Configures the ldap.conf
options in the config_db_dir
. Structured like a hash, same as config
:
$ldap_config = {
'public' => '/srv/public',
'uploads' => '/tmp/uploads'
}
Available Options List
- LDAPServer
- LDAPPort
- LDAPBaseDN
- LDAPBindDN
- LDAPBindPW
- LDAPDefaultUID
- LDAPDefaultGID
- LDAPFilter
- LDAPHomeDir
- LDAPVersion
- LDAPUseTLS
- LDAPAuthMethod
- LDAPDefaultHomeDirectory
For more information see the file itself. All comments available.
ldap_config_file
Absolute path to file for ldap configuration. Value must be a string.
Default: /etc/pure-ftpd/db/ldap.conf
manage_ssl
This options needs the openssl module from camptocamp it provides an self-signed certificate, which is needed if you will use SSL/TLS. For more configuration see ssl_config
and ssl_pemfile
. Defaults to false.
mysql_config
Configures the mysql.conf
options in the config_db_dir
. Structured like a hash, same as config
:
$mysql_config = {
'public' => '/srv/public',
'uploads' => '/tmp/uploads'
}
Available Options List
- MYSQLServer
- MYSQLPort
- MYSQLSocket
- MYSQLUser
- MYSQLPassword
- MYSQLDatabase
- MYSQLCrypt
- MYSQLGetPW
- MYSQLGetUID
- MYSQLDefaultUID
- MYSQLGetGID
- MYSQLDefaultGID
- MYSQLGetDir
- MySQLGetQTAFS
- MySQLGetQTASZ
- MySQLGetRatioUL
- MySQLGetRatioDL
- MySQLGetBandwidthUL
- MySQLGetBandwidthDL
- MySQLForceTildeExpansion
- MySQLTransactions
For more information see the file itself. All comments available.
mysql_config_file
Absolute path to file for ldap configuration. Value must be a string.
Default: /etc/pure-ftpd/db/mysql.conf
package_ensure
Whether the package exists or should be a specific version. Valid values are 'present', 'absent', or 'x.y.z'. Defaults to 'present'.
package_manage
Whether to manage the Pure-FTPd server package. Defaults to true.
package_name
The name of the Pure-FTPd server package to install. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'default'.
package_name_ldap
The name of the Pure-FTPd server package to install. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'ldap'.
package_name_mysql
The name of the Pure-FTPd server package to install. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'mysql'.
package_name_pgsql
The name of the Pure-FTPd server package to install. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'postgres'.
pgsql_config
Configures the postgresql.conf
options in the config_db_dir
. Structured like a hash, same as config
:
$mysql_config = {
'public' => '/srv/public',
'uploads' => '/tmp/uploads'
}
Available Options List
- PGSQLServer
- PGSQLPort
- PGSQLUser
- PGSQLPassword
- PGSQLDatabase
- PGSQLCrypt
- PGSQLGetPW
- PGSQLGetUID
- PGSQLDefaultUID
- PGSQLGetGID
- PGSQLDefaultGID
- PGSQLGetDir
- PGSQLGetQTAFS
- PGSQLGetQTASZ
- PGSQLGetRatioUL
- PGSQLGetRatioDL
- PGSQLGetBandwidthUL
- PGSQLGetBandwidthDL
For more information see the file itself. All comments available.
pgsql_config_file
Absolute path to file for postgresql configuration. Value must be a string.
Default: /etc/pure-ftpd/db/postgresql.conf
purge_conf_dir
Whether the config_db_dir
and config_dir
directory should be purged. Valid values are true, false. Defaults to true.
restart
Whether the service should be restarted when things change. Valid values are true, false. Defaults to true.
server_mode
Whether the service should start in 'standalone' or 'inetd' mode. Defaults to standalone.
server_type
Defines which server type for Pure-FTPd should be used. Valid options are 'default', 'postgres', 'ldap', 'mysql'. Defaults to default.
Note After a server type is installed an managed and if you would like to switch to another type. Remove / Purge first and then switch server_type.
service_enabled
Specifies whether the service should be enabled. Valid values are true, false. Defaults to true.
service_manage
Specifies whether the service should be managed. Valid values are true, false. Defaults to true.
service_name
The name of the Pure-FTPd server service. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'default'.
service_name_ldap
The name of the Pure-FTPd server service. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'ldap'.
service_name_mysql
The name of the Pure-FTPd server service. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'mysql'.
service_name_pgsql
The name of the Pure-FTPd server service. Defaults are OS dependent, defined in params.pp. Used if server_type
is set to 'postgres'.
service_provider
The provider to use to manage the service. Defaults to 'systemd'.
ssl_config
Optional hash of values to create the self-signed certificate with openssl. This is only used if manage_ssl
is set to true.
$ssl_config => {
'public' => '/srv/public',
'uploads' => '/tmp/uploads'
}
Available Options List
- country (2 digit country code)
- organization (String)
- commonname (fqdn)
- days
ssl_pemfile
Absolute path to file where the self-signed certificate and private key will be placed. Value must be a string. Used only if manage_ssl
is enabled.
Default: /etc/ssl/private/pure-ftpd.pem
uploadgid
If set, pure-uploadscript will spawn running as the given gid. Defaults to undefined.
uploaduid
If set, pure-uploadscript will spawn running as the given uid. Defaults to undefined.
uploadscript
If this is set and the daemon is run in standalone mode, pure-uploadscript will also be run to spawn the program given below for handling uploads. Defaults to undefined.
virtualchroot
Whether to use binary with virtualchroot support valid values are "true" or "false". Defaults to false.
Defines
Defines not used in this module.
Types
This module currently uses no puppet Types.
Facts
Currently the module does not provide any facts. If some facts are required open an issue.
Limitations
This module has been tested on:
- Debian 9
- Debian 10
- Debian 11
My main distribution is Debian and to support other platforms please let me note the differences, that we can append this platform.
Testing on other platforms has been minimal and cannot be guaranteed.
Development
This puppet module is published under Apache-2.0 license and full opensource. Do not hesitate to contact the main developer on GitHub and open bugs, merge requests or anything else.
Authors
This module is initial written by Benjamin Kübler. The following contributors have contributed to this module:
- Benjamin Kübler
Reference
Table of Contents
Classes
pureftpd
: Class: pureftpd: See README.md for documentation.pureftpd::config
: See README.md for options.pureftpd::install
: See README.md for options.pureftpd::params
: Private class: See README.md.pureftpd::service
: See README.md for options.
Classes
pureftpd
Class: pureftpd: See README.md for documentation.
Parameters
The following parameters are available in the pureftpd
class:
config
config_db_dir
config_dir
config_manage
defaults_file
dir_aliases
dir_aliases_file
install_options
ldap_config
ldap_config_file
manage_ssl
mysql_config
mysql_config_file
package_ensure
package_manage
package_name
package_name_ldap
package_name_mysql
package_name_pgsql
pgsql_config
pgsql_config_file
purge_conf_dir
restart
server_mode
server_type
service_enabled
service_manage
service_name
service_name_ldap
service_name_mysql
service_name_pgsql
service_provider
ssl_config
ssl_pemfile
uploadgid
uploaduid
uploadscript
virtualchroot
config
Data type: Hash
Default value: {}
config_db_dir
Data type: String
Default value: $pureftpd::params::config_db_dir
config_dir
Data type: String
Default value: $pureftpd::params::config_dir
config_manage
Data type: Boolean
Default value: $pureftpd::params::config_manage
defaults_file
Data type: String
Default value: $pureftpd::params::defaults_file
dir_aliases
Data type: Hash
Default value: {}
dir_aliases_file
Data type: String
Default value: $pureftpd::params::dir_aliases_file
install_options
Data type: Optional[Array]
Default value: undef
ldap_config
Data type: Hash
Default value: {}
ldap_config_file
Data type: String
Default value: $pureftpd::params::ldap_config_file
manage_ssl
Data type: Boolean
Default value: $pureftpd::params::manage_ssl
mysql_config
Data type: Hash
Default value: {}
mysql_config_file
Data type: String
Default value: $pureftpd::params::mysql_config_file
package_ensure
Data type: String
Default value: $pureftpd::params::package_ensure
package_manage
Data type: Boolean
Default value: $pureftpd::params::package_manage
package_name
Data type: String
Default value: $pureftpd::params::package_name
package_name_ldap
Data type: String
Default value: $pureftpd::params::package_name_ldap
package_name_mysql
Data type: String
Default value: $pureftpd::params::package_name_mysql
package_name_pgsql
Data type: String
Default value: $pureftpd::params::package_name_pgsql
pgsql_config
Data type: Hash
Default value: {}
pgsql_config_file
Data type: String
Default value: $pureftpd::params::pgsql_config_file
purge_conf_dir
Data type: Boolean
Default value: $pureftpd::params::purge_conf_dir
restart
Data type: Boolean
Default value: $pureftpd::params::restart
server_mode
Data type: String
Default value: $pureftpd::params::server_mode
server_type
Data type: String
Default value: $pureftpd::params::server_type
service_enabled
Data type: Boolean
Default value: $pureftpd::params::service_enabled
service_manage
Data type: Boolean
Default value: $pureftpd::params::service_manage
service_name
Data type: String
Default value: $pureftpd::params::service_name
service_name_ldap
Data type: String
Default value: $pureftpd::params::service_name_ldap
service_name_mysql
Data type: String
Default value: $pureftpd::params::service_name_mysql
service_name_pgsql
Data type: String
Default value: $pureftpd::params::service_name_pgsql
service_provider
Data type: String
Default value: $pureftpd::params::service_provider
ssl_config
Data type: Hash
Default value: {}
ssl_pemfile
Data type: String
Default value: $pureftpd::params::ssl_pemfile
uploadgid
Data type: String
Default value: $pureftpd::params::uploadgid
uploaduid
Data type: String
Default value: $pureftpd::params::uploaduid
uploadscript
Data type: String
Default value: $pureftpd::params::uploadscript
virtualchroot
Data type: Boolean
Default value: $pureftpd::params::virtualchroot
pureftpd::config
See README.md for options.
pureftpd::install
See README.md for options.
pureftpd::params
Private class: See README.md.
pureftpd::service
See README.md for options.
2021-09-30 - 1.0.0
- Update to new Debian Versions (9,10,11)
- Add Unit Test
2016-11-19 - 0.0.3
- Hotfix Release of wrong variables
2016-11-19 - 0.0.2
- Add enhanced documentation on README.md
2016-11-19 - 0.0.1
- Initial Release.
- Support for Debian Jessie.
- Support all PureFTPd Backends
- SSL Manage Support (Self-Signed)
Dependencies
- puppetlabs/stdlib (>= 6.0.0 < 8.0.0)
- camptocamp/openssl (>= 1.8.0 < 8.0.0)
- puppetlabs/concat (>= 1.1.1 < 8.0.0)
Copyright 2016 Benjamin Kübler <b.kuebler@kuebler-it.de> 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.