|
| 1 | +# == Define: pureftpd::config |
| 2 | +# |
| 3 | +# This module manages the pure-ftpd configuration files with LDAP authentication |
| 4 | +# |
| 5 | +# === Parameters |
| 6 | +# |
| 7 | +# [*ldap_server*] |
| 8 | +# Mandatory, is the IP or FQDN of the LDAP server |
| 9 | +# |
| 10 | +# [*ldap_basedn*] |
| 11 | +# Mandatory, is the base DN of the LDAP tree where the users are stored |
| 12 | +# (e.g.: ou=People,dc=company,dc=com) |
| 13 | +# |
| 14 | +# [*ldap_filter*] |
| 15 | +# Mandatory, specifies a filter that can be used to filter out users |
| 16 | +# (e.g.: '(&(objectClass=posixAccount)(uid=\L))') |
| 17 | +# |
| 18 | +# [*ldap_port*] |
| 19 | +# Optional, defaults to 389 |
| 20 | +# The server port where the ldap service listens |
| 21 | +# |
| 22 | +# [*ldap_authmethod*] |
| 23 | +# Mandatory, can either be BIND or password |
| 24 | +# Manages the authentication methof for the LDAP users. |
| 25 | +# |
| 26 | +# [*$ldap_binddn*] |
| 27 | +# Optional, defaults to "". |
| 28 | +# the binddn that will be used to connect to the tree; leave blank if LDAP |
| 29 | +# supports anonymous bind. |
| 30 | +# |
| 31 | +# [*ldap_bindpw*] |
| 32 | +# Optional, defaults to "". |
| 33 | +# the binddn pass that will be used to connect to the tree; leave blank if LDAP |
| 34 | +# supports anonymous bind. |
| 35 | +# |
| 36 | +# [*ldap_usetls*] |
| 37 | +# Optional, defaults to false. |
| 38 | +# Defines whether or not to use a TLS connection to the LDAP service. |
| 39 | +# |
| 40 | +# [*use_selinux*] |
| 41 | +# Optional, defaults to false. |
| 42 | +# Manages whether or not to enable selinux extensions. |
| 43 | +# |
| 44 | +# [*allow_anonymous*] |
| 45 | +# Optional, defaults to false. |
| 46 | +# Manages whether or not to allow anonymous users. |
| 47 | +# |
| 48 | +# [*allow_fxp*] |
| 49 | +# Optional, defaults to false. |
| 50 | +# Manages whether or not to allow the fxp protocol |
| 51 | +# |
| 52 | +# [*user_bandwidth*] |
| 53 | +# Optional, defaults to undef. |
| 54 | +# Defines the maximum bandwidth that the can be used, in the form |
| 55 | +# $kb_download:$kb_upload (e.g., 1800:1800). |
| 56 | +# |
| 57 | +# [*max_clients_number*] |
| 58 | +# Optional, defaults to 50. |
| 59 | +# Maximum number of simultaneous users that the server can manage. |
| 60 | +# |
| 61 | +# [*max_clients_per_ip*] |
| 62 | +# Optional, defaults to 8. |
| 63 | +# Maximum number of different clients that can come from a single IP |
| 64 | +# |
| 65 | +# [*umask*] |
| 66 | +# Optional, defaults to 133:022. |
| 67 | +# Specifies the user mask of the uploaded files/directories, in the form |
| 68 | +# $file_umask:$dir_umask (e.g., 177:077). |
| 69 | +# |
| 70 | +# [*min_uid*] |
| 71 | +# Optional, defaults to 500. |
| 72 | +# The minimum user id that can be accepted as an ftp user. |
| 73 | +# |
| 74 | +# [*allow_chmod*] |
| 75 | +# Optional, defaults to false. |
| 76 | +# Whether or not users are allowed to change ownerships of their files. |
| 77 | +# |
| 78 | +# [*use_tls*] |
| 79 | +# Optional, defaults to false. |
| 80 | +# Whether or not to accept tls connections in addition to normal ones. |
| 81 | +# TODO: Remember to place your server certificate in /etc/ssl/private/pure-ftpd.pem |
| 82 | +# |
| 83 | +# [*force_passive_ip*] |
| 84 | +# Optional, defaults to undef (not set) |
| 85 | +# Force an IP address in PASV/EPSV/SPSV replies |
| 86 | +# |
| 87 | +# [*motd_file*] |
| 88 | +# Optional, defaults to undef (use the dynamic provided file). |
| 89 | +# Manages the location of the server motd file, if any. |
| 90 | +# |
| 91 | +# === Examples |
| 92 | +# |
| 93 | +# pureftpd::config_ldap { 'ftp-server': |
| 94 | +# ldap_server => '192.168.100.10', |
| 95 | +# ldap_basedn => 'ou=Users,dc=company,dc=com', |
| 96 | +# ldap_filter => '(&(objectClass=posixAccount)(uid=\L))', |
| 97 | +# ldap_authmethod => 'BIND' |
| 98 | +# user_bandwidth => '1800:1800' |
| 99 | +# } |
| 100 | +# |
| 101 | +# === Authors |
| 102 | +# |
| 103 | +# 5Ub-Z3r0 |
| 104 | +# |
| 105 | +define pureftpd::config_ldap( |
| 106 | + $use_selinux = false, |
| 107 | + $allow_anonymous = false, |
| 108 | + $allow_fxp = false, |
| 109 | + $user_bandwidth = undef, |
| 110 | + $max_clients_number = '50', |
| 111 | + $max_clients_per_ip = '8', |
| 112 | + $umask = '133:022', |
| 113 | + $min_uid = '500', |
| 114 | + $allow_chmod = false, |
| 115 | + $use_tls = false, |
| 116 | + $force_passive_ip = undef, |
| 117 | + $motd_file = undef, |
| 118 | + $ldap_port = '389', |
| 119 | + $ldap_usetls = false, |
| 120 | + $ldap_server, |
| 121 | + $ldap_basedn, |
| 122 | + $ldap_binddn = '', |
| 123 | + $ldap_bindpw = '', |
| 124 | + $ldap_filter, |
| 125 | + $ldap_authmethod |
| 126 | +){ |
| 127 | + |
| 128 | + class { 'pureftpd': |
| 129 | + use_selinux => $use_selinux |
| 130 | + } |
| 131 | + |
| 132 | + $default_auth = 'ldap' |
| 133 | + |
| 134 | + if ($motd_file != undef) { |
| 135 | + file { '/etc/motd.pureftpd': |
| 136 | + ensure => file, |
| 137 | + source => $motd_file, |
| 138 | + owner => 'root', |
| 139 | + group => 'root', |
| 140 | + mode => '0644' |
| 141 | + } |
| 142 | + } |
| 143 | + |
| 144 | + file { "${pureftpd::params::config_dir}/pure-ftpd.conf": |
| 145 | + ensure => file, |
| 146 | + content => template("${module_name}/${::osfamily}/pure-ftpd.conf.erb"), |
| 147 | + owner => 'root', |
| 148 | + group => 'root', |
| 149 | + mode => '0644', |
| 150 | + notify => Service[$pureftpd::params::service_name] |
| 151 | + } |
| 152 | + |
| 153 | + file { "${pureftpd::params::config_dir}/pureftpd-ldap.conf": |
| 154 | + ensure => file, |
| 155 | + content => template("${module_name}/${::osfamily}/pureftpd-ldap.conf.erb"), |
| 156 | + owner => 'root', |
| 157 | + group => 'root', |
| 158 | + mode => '0644', |
| 159 | + notify => Service[$pureftpd::params::service_name] |
| 160 | + } |
| 161 | +} |
0 commit comments