| 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>ProFTPD module mod_wrap2</title> |
| 5 | </head> |
| 6 | |
| 7 | <body bgcolor=white> |
| 8 | |
| 9 | <hr> |
| 10 | <center> |
| 11 | <h2><b>ProFTPD module <code>mod_wrap2</code></b></h2> |
| 12 | </center> |
| 13 | <hr> |
| 14 | |
| 15 | <p> |
| 16 | The <code>mod_wrap2</code> package allows the <code>proftpd</code> daemon to |
| 17 | provide <code>tcpwrapper</code>-like access control rules while running |
| 18 | in standalone mode. It also allows for those access rules to be stored |
| 19 | in various formats, such as files (<i>e.g.</i> <code>/etc/hosts.allow</code> |
| 20 | and <code>/etc/hosts.deny</code>) or in SQL tables. <b>Note</b> that the |
| 21 | <code>mod_wrap2</code> module does <b>not</b> require or use the |
| 22 | standard tcpwrappers <code>libwrap</code> library, and instead implements |
| 23 | the same functionality internally (in order to support SQL-based access rules). |
| 24 | Please read the <a href="#Usage">usage</a> documentation for more details. |
| 25 | |
| 26 | <p> |
| 27 | This module is contained in <code>mod_wrap2.c</code>, |
| 28 | <code>mod_wrap2.h</code>, and in the submodules source files, for |
| 29 | ProFTPD 1.3.<i>x</i>. These modules are not enabled by default. Installation |
| 30 | <a href="#Installation">notes</a> follow the directive documentation. |
| 31 | |
| 32 | <p> |
| 33 | The most current version of <code>mod_wrap2</code>'s submodules supports |
| 34 | storage of access table information in various formats: |
| 35 | <a name="submodules"></a> |
| 36 | <ul> |
| 37 | <li><a href="mod_wrap2_file.html"><code>mod_wrap2_file</code></a> for file-based access tables<br> |
| 38 | <li><a href="mod_wrap2_redis.html"><code>mod_wrap2_redis</code></a> for Redis-based access lists/sets<br> |
| 39 | <li><a href="mod_wrap2_sql.html"><code>mod_wrap2_sql</code></a> for SQL-based access tables<br> |
| 40 | </ul> |
| 41 | |
| 42 | <p> |
| 43 | The most current version of <code>mod_wrap2</code> is distributed with the |
| 44 | ProFTPD source code. |
| 45 | |
| 46 | <h2>Author</h2> |
| 47 | <p> |
| 48 | Please contact TJ Saunders <tj <i>at</i> castaglia.org> with any |
| 49 | questions, concerns, or suggestions regarding this module. |
| 50 | |
| 51 | <h2>Thanks</h2> |
| 52 | <p> |
| 53 | Many, many thanks to Wietse Venema for writing the <code>tcpwrappers</code> |
| 54 | package and its <code>libwrap</code> library, from which this module drew |
| 55 | much of its code. |
| 56 | |
| 57 | <p> |
| 58 | <i>2002-12-12</i>: Thanks to Steve Grubb for pointing out a few cases where |
| 59 | interrupted functions were not being properly handled, and for reviewing |
| 60 | the module code. |
| 61 | |
| 62 | <h2>Directives</h2> |
| 63 | <ul> |
| 64 | <li><a href="#WrapAllowMsg">WrapAllowMsg</a> |
| 65 | <li><a href="#WrapDenyMsg">WrapDenyMsg</a> |
| 66 | <li><a href="#WrapEngine">WrapEngine</a> |
| 67 | <li><a href="#WrapGroupTables">WrapGroupTables</a> |
| 68 | <li><a href="#WrapLog">WrapLog</a> |
| 69 | <li><a href="#WrapOptions">WrapOptions</a> |
| 70 | <li><a href="#WrapServiceName">WrapServiceName</a> |
| 71 | <li><a href="#WrapTables">WrapTables</a> |
| 72 | <li><a href="#WrapUserTables">WrapUserTables</a> |
| 73 | </ul> |
| 74 | |
| 75 | <hr> |
| 76 | <h3><a name="WrapAllowMsg">WrapAllowMsg</a></h3> |
| 77 | <strong>Syntax:</strong> WrapAllowMsg <em>mesg</em><br> |
| 78 | <strong>Default:</strong> None<br> |
| 79 | <strong>Context:</strong> server config, <code><VirtualHost</code>, <code><Global></code>, <code><Anonymous></code><br> |
| 80 | <strong>Module:</strong> mod_wrap2<br> |
| 81 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 82 | |
| 83 | <p> |
| 84 | The <code>WrapAllowMsg</code> directive configures a message that will be |
| 85 | added to <code>proftpd</code>'s response to the connecting client when that |
| 86 | client is allowed by <code>mod_wrap2</code>'s access check. In the |
| 87 | <em>mesg</em> parameter, the magic cookie '%u' is replaced with the username |
| 88 | specified by the client during login. |
| 89 | |
| 90 | <p> |
| 91 | Example: |
| 92 | <pre> |
| 93 | WrapAllowMsg "User '%u' allowed by access rules" |
| 94 | </pre> |
| 95 | |
| 96 | <p> |
| 97 | <hr> |
| 98 | <h3><a name="WrapDenyMsg">WrapDenyMsg</a></h3> |
| 99 | <strong>Syntax:</strong> WrapDenyMsg <em>mesg</em><br> |
| 100 | <strong>Default:</strong> None<br> |
| 101 | <strong>Context:</strong> server config, <code><VirtualHost</code>, <code><Global></code>, <code><Anonymous></code><br> |
| 102 | <strong>Module:</strong> mod_wrap2<br> |
| 103 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 104 | |
| 105 | <p> |
| 106 | The <code>WrapDenyMsg</code> directive configures a message that will be |
| 107 | sent to the connecting client when that client is denied by |
| 108 | <code>mod_wrap2</code>'s access check, and disconnected. In the <em>mesg</em> |
| 109 | parameter, the magic cookie '%u' is replaced with the username specified by |
| 110 | the client during login. |
| 111 | |
| 112 | <p> |
| 113 | Example: |
| 114 | <pre> |
| 115 | WrapDenyMsg "User '%u' denied by access rules" |
| 116 | </pre> |
| 117 | |
| 118 | <p> |
| 119 | <hr> |
| 120 | <h3><a name="WrapEngine">WrapEngine</a></h3> |
| 121 | <strong>Syntax:</strong> WrapEngine <em>on|off</em><br> |
| 122 | <strong>Default:</strong> None<br> |
| 123 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 124 | <strong>Module:</strong> mod_wrap2<br> |
| 125 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 126 | |
| 127 | <p> |
| 128 | The <code>WrapEngine</code> directive enables or disables the module's runtime |
| 129 | access control engine. If it is set to <em>off</em> this module does no runtime |
| 130 | processing at all. Use this directive to disable the module instead of |
| 131 | commenting out all <code>mod_wrap2</code> directives. |
| 132 | |
| 133 | <p> |
| 134 | <hr> |
| 135 | <h3><a name="WrapGroupTables">WrapGroupTables</a></h3> |
| 136 | <strong>Syntax:</strong> WrapGroupTables <em>group-AND-expression source-type:allow-source-info source-type:deny-source-info [source-type:options-source-info]</em><br> |
| 137 | <strong>Default:</strong> None<br> |
| 138 | <strong>Context:</strong> server config, <code><VirtualHost</code>, <code><Global></code>, <code><Anonymous></code><br> |
| 139 | <strong>Module:</strong> mod_wrap2<br> |
| 140 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 141 | |
| 142 | <p> |
| 143 | The <code>WrapGroupTables</code> directive configures the information necessary |
| 144 | for <code>mod_wrap2</code> to locate and use the tables containing the access |
| 145 | rules for specific groups. |
| 146 | |
| 147 | <p> |
| 148 | The <em>group-AND-expression</em> parameter is a logical AND expression, which |
| 149 | means that the connecting user must be a member of <b>all</b> the groups |
| 150 | listed for this directive to apply. Group names may be negated with a |
| 151 | <code>!</code> prefix. |
| 152 | |
| 153 | <p> |
| 154 | The next two parameters specify two tables, an allow and a deny table, each of |
| 155 | which contain the IP addresses, networks or host/network masks to be allowed or |
| 156 | denied. |
| 157 | |
| 158 | <p> |
| 159 | Please consult the relevant <a href="#submodule">submodule</a> documentation |
| 160 | for details on that module's syntax for specifying tables. The service name |
| 161 | for which <code>mod_wrap2</code> will look in the indicated access tables is |
| 162 | "proftpd" by default; this can be configured via the |
| 163 | <a href="#WrapServiceName"><code>WrapServiceName</code></a> directive. |
| 164 | |
| 165 | <p> |
| 166 | See also: |
| 167 | <a href="#WrapServiceName">WrapServiceName</a>, |
| 168 | <a href="#WrapTables">WrapTables</a>, |
| 169 | <a href="#WrapUserTables">WrapUserTables</a> |
| 170 | |
| 171 | <p> |
| 172 | <hr> |
| 173 | <h3><a name="WrapLog">WrapLog</a></h3> |
| 174 | <strong>Syntax:</strong> WrapLog <em>file|"none"</em><br> |
| 175 | <strong>Default:</strong> None<br> |
| 176 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 177 | <strong>Module:</strong> mod_wrap2<br> |
| 178 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 179 | |
| 180 | <p> |
| 181 | The <code>WrapLog</code> directive is used to specify a log file for |
| 182 | <code>mod_wrap2</code> reporting, and can be done a per-server basis. |
| 183 | The <em>file</em> parameter must be the full path to the file to use for |
| 184 | logging. Note that this path must <b>not</b> be to a world-writeable |
| 185 | directory and, unless <code>AllowLogSymlinks</code> is explicitly set to |
| 186 | <em>on</em> (generally a bad idea), the path must <b>not</b> be a symbolic |
| 187 | link. |
| 188 | |
| 189 | <p> |
| 190 | If <em>file</em> is "none", no logging will be done at all; this |
| 191 | setting can be used to override a <code>WrapLog</code> setting inherited from |
| 192 | a <code><Global></code> context. |
| 193 | |
| 194 | <p> |
| 195 | <hr> |
| 196 | <h3><a name="WrapOptions">WrapOptions</a></h3> |
| 197 | <strong>Syntax:</strong> WrapOptions <em>opt1 ...</em><br> |
| 198 | <strong>Default:</strong> None<br> |
| 199 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 200 | <strong>Module:</strong> mod_wrap2<br> |
| 201 | <strong>Compatibility:</strong> 1.3.4rc1 and later |
| 202 | |
| 203 | <p> |
| 204 | The <code>WrapOptions</code> directive is used to configure various optional |
| 205 | behavior of <code>mod_wrap2</code>. <b>Note</b>: all of the configured |
| 206 | <code>WrapOptions</code> parameters <b>must</b> appear on the same line in the |
| 207 | configuration; only the first <code>WrapOptions</code> directive that appears |
| 208 | in the configuration is used. |
| 209 | |
| 210 | <p> |
| 211 | Example: |
| 212 | <pre> |
| 213 | WrapOptions CheckOnConnect |
| 214 | </pre> |
| 215 | |
| 216 | <p> |
| 217 | The currently implemented options are: |
| 218 | <ul> |
| 219 | <li><code>CheckAllNames</code><br> |
| 220 | <p> |
| 221 | This causes <code>mod_wrap2</code> to check <b>all</b> of the known |
| 222 | DNS names for the client IP address against the DNS names/patterns |
| 223 | in the access rules, rather than just checking the first DNS name |
| 224 | returned for the client IP address. |
| 225 | </li> |
| 226 | |
| 227 | <li><code>CheckOnConnect</code><br> |
| 228 | <p> |
| 229 | This causes <code>mod_wrap2</code> to check the allow/deny tables when |
| 230 | the client first connects, rather than waiting until the client has |
| 231 | authenticated before checking the access rules. This means that |
| 232 | per-user/group allow/deny tables, and the use of the tilde (~) notation |
| 233 | in table paths, is <b>not</b> supported when this option is used. |
| 234 | |
| 235 | <p> |
| 236 | In addition, <i>if <code>mod_wrap2_sql</code> is used</i>, the order in |
| 237 | which that module is loaded is very important. The <code>mod_sql</code> |
| 238 | module <b>must</b> appear <b>after</b> the <code>mod_wrap2</code> module |
| 239 | in the <code>--with-modules</code> configure option, <i>e.g.</i>: |
| 240 | <pre> |
| 241 | --with-modules=mod_wrap2:mod_wrap2_sql:mod_sql:mod_sql_mysql |
| 242 | </pre> |
| 243 | Or, if you are using shared/DSO modules, then you <b>must</b> ensure that |
| 244 | the modules are loaded in the correct order via <code>LoadModule</code>: |
| 245 | <pre> |
| 246 | ... |
| 247 | LoadModule mod_wrap2.c |
| 248 | LoadModule mod_wrap2_sql.c |
| 249 | ... |
| 250 | LoadModule mod_sql.c |
| 251 | LoadModule mod_sql_mysql.c |
| 252 | ... |
| 253 | </pre> |
| 254 | <p> |
| 255 | You will <b>also</b> need to ensure that <code>mod_sql</code> creates a |
| 256 | database connection at connect time, using the <code>PERCONNECTION</code> |
| 257 | connection policy; see |
| 258 | <a href="mod_sql.html#SQLConnectInfo"><code>SQLConnectInfo</code></a> for |
| 259 | more details: |
| 260 | <pre> |
| 261 | SQLConnectInfo <i>database</i> <i>user</i> <i>password</i> PERCONNECTION |
| 262 | </pre> |
| 263 | |
| 264 | <p> |
| 265 | Without this, the database connection will <b>not</b> be created at connect |
| 266 | time, and the <code>mod_wrap2</code> module will be unable to check |
| 267 | any allow/deny rules stored in SQL tables when the client connects. |
| 268 | </li> |
| 269 | </ul> |
| 270 | |
| 271 | <p> |
| 272 | <hr> |
| 273 | <h3><a name="WrapServiceName">WrapServiceName</a></h3> |
| 274 | <strong>Syntax:</strong> WrapServiceName <em>name</em><br> |
| 275 | <strong>Default:</strong> <code>WrapServiceName proftpd</code><br> |
| 276 | <strong>Context:</strong> server config, <code><VirtualHost></code>, <code><Global></code><br> |
| 277 | <strong>Module:</strong> mod_wrap2<br> |
| 278 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 279 | |
| 280 | <p> |
| 281 | <code>WrapServiceName</code> is used to configure the name of the service under |
| 282 | which <code>mod_wrap2</code> will check the allow/deny tables. By default, this |
| 283 | is the name of the program started, <em>i.e.</em> "proftpd". However, |
| 284 | some administrators may want to use a different, more generic service name, |
| 285 | such as "ftpd"; use this directive for such needs. The lookup |
| 286 | using the configured <em>name</em> is <b>case-sensitive</b>. |
| 287 | |
| 288 | <p> |
| 289 | <hr> |
| 290 | <h3><a name="WrapTables">WrapTables</a></h3> |
| 291 | <strong>Syntax:</strong> WrapTables <em>source-type:allow-source-info source-info:deny-source-info</em><br> |
| 292 | <strong>Default:</strong> None<br> |
| 293 | <strong>Context:</strong> server config, <code><VirtualHost</code>, <code><Global></code>, <code><Anonymous></code><br> |
| 294 | <strong>Module:</strong> mod_wrap2<br> |
| 295 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 296 | |
| 297 | <p> |
| 298 | The <code>WrapTables</code> directive configures the information necessary |
| 299 | for <code>mod_wrap2</code> to locate and use the tables containing the access |
| 300 | rules for all clients. |
| 301 | |
| 302 | <p> |
| 303 | The two parameters specify two tables, an allow and a deny table, each of which |
| 304 | contain the IP addresses, networks or host/network masks to be allowed or |
| 305 | denied. |
| 306 | |
| 307 | <p> |
| 308 | Please consult the relevant <a href="#submodule">submodule</a> documentation |
| 309 | for details on that module's syntax for specifying tables. The service name |
| 310 | for which <code>mod_wrap2</code> will look in the indicated access tables is |
| 311 | "proftpd" by default; this can be configured via the |
| 312 | <a href="#WrapServiceName"><code>WrapServiceName</code></a> directive. |
| 313 | |
| 314 | <p> |
| 315 | See also: |
| 316 | <a href="#WrapGroupTables">WrapGroupTables</a>, |
| 317 | <a href="#WrapServiceName">WrapServiceName</a>, |
| 318 | <a href="#WrapUserTables">WrapUserTables</a> |
| 319 | |
| 320 | <p> |
| 321 | <hr> |
| 322 | <h3><a name="WrapUserTables">WrapUserTables</a></h3> |
| 323 | <strong>Syntax:</strong> WrapUserTables <em>user-OR-expression source-type:allow-source-info source-type:deny-source-info [source-type:option-source-info]</em><br> |
| 324 | <strong>Default:</strong> None<br> |
| 325 | <strong>Context:</strong> server config, <code><VirtualHost</code>, <code><Global></code>, <code><Anonymous></code><br> |
| 326 | <strong>Module:</strong> mod_wrap2<br> |
| 327 | <strong>Compatibility:</strong> 1.3.1rc1 and later |
| 328 | |
| 329 | <p> |
| 330 | The <code>WrapUserTables</code> directive configures the information necessary |
| 331 | for <code>mod_wrap2</code> to locate and use the tables containing the access |
| 332 | rules for specific users. |
| 333 | |
| 334 | <p> |
| 335 | The <em>user-OR-expression</em> parameter is a logical OR expression, which |
| 336 | means that the connecting user can be <b>any</b> the users listed for this |
| 337 | directive to apply. User names may be negated with a <code>!</code> prefix. |
| 338 | |
| 339 | <p> |
| 340 | The next two parameters specify two tables, an allow and a deny table, each of |
| 341 | which contain the IP addresses, networks or host/network masks to be allowed or |
| 342 | denied. |
| 343 | |
| 344 | <p> |
| 345 | Please consult the relevant <a href="#submodule">submodule</a> documentation |
| 346 | for details on that module's syntax for specifying tables. The service name |
| 347 | for which <code>mod_wrap2</code> will look in the indicated access tables is |
| 348 | "proftpd" by default; this can be configured via the |
| 349 | <a href="#WrapServiceName"><code>WrapServiceName</code></a> directive. |
| 350 | |
| 351 | <p> |
| 352 | See also: |
| 353 | <a href="#WrapGroupTables">WrapGroupTables</a>, |
| 354 | <a href="#WrapServiceName">WrapServiceName</a>, |
| 355 | <a href="#WrapTables">WrapTables</a> |
| 356 | |
| 357 | <p> |
| 358 | <hr> |
| 359 | <h2><a name="Usage">Usage</a></h2> |
| 360 | To use <code>mod_wrap2</code>'s functionality, you must first define the tables |
| 361 | that together contain the access rules. Access rules are composed of |
| 362 | <b>daemon lists</b>, <b>client lists</b>, and optional <b>options lists</b>. |
| 363 | <b>daemon lists</b> are used so that the access rules can be configured for |
| 364 | multiple daemons; <code>mod_wrap2</code> ignores all daemons except that |
| 365 | configured for <code>proftpd</code>. <b>client lists</b> are the heart of |
| 366 | the access rules, specifying the host names, IP addresses, <i>etc</i> to |
| 367 | be allowed or denied. The handling of <b>options lists</b> is done only if |
| 368 | <code>mod_wrap2</code> is configured with the |
| 369 | <code>--enable-wrapper-options</code> option. |
| 370 | |
| 371 | <p> |
| 372 | There is a built-in precedence to the <code>WrapUserTables</code>, |
| 373 | <code>WrapGroupTables</code>, and <code>WrapTables</code> directives, if all |
| 374 | are used. <code>mod_wrap2</code> will look for applicable |
| 375 | <code>WrapUserTables</code> for the connecting user first. If no applicable |
| 376 | <code>WrapUserTables</code> are found, <code>mod_wrap2</code> will search for |
| 377 | <code>WrapGroupTables</code> which pertain to the connecting user. If not |
| 378 | found, <code>mod_wrap2</code> will then look for the server-wide |
| 379 | <code>WrapTables</code> directive. This allows for access control to be set |
| 380 | on a per-server basis, and allow for per-user or per-group access control |
| 381 | to be handled without interfering with the overall server access rules. |
| 382 | |
| 383 | <p> |
| 384 | When checking the tables, <code>mod_wrap2</code> always checks the allow |
| 385 | table first. If the client has been explicitly allowed by the rules in |
| 386 | that table, processing stops and <code>mod_wrap2</code> allows the client |
| 387 | to continue the session. If not explicitly allowed, <code>mod_wrap2</code> |
| 388 | will then check the deny table's access rules. If the client has been |
| 389 | explicitly denied by rules in that table, <code>mod_wrap2</code> will |
| 390 | disconnect the client. By default, if neither explicitly allowed or |
| 391 | explicitly denied, <code>mod_wrap2</code> will allow the client to continue. |
| 392 | |
| 393 | <p><a name="builtin"></a> |
| 394 | In addition to the various formats supported by the |
| 395 | <a href="#submodules">submodules</a>, there is a special source type: |
| 396 | "builtin". This is used in the situations where the administrator |
| 397 | wishes to configure "mostly closed" access rules, the most common |
| 398 | situation. For example, if all clients are to be denied by |
| 399 | <code>mod_wrap2</code> by default, unless that client is granted access via an |
| 400 | allow table entry, then the administrator can use: |
| 401 | <pre> |
| 402 | builtin:all |
| 403 | </pre> |
| 404 | as the deny table parameter (<i>e.g.</i> in a <code>WrapUserTables</code>, |
| 405 | <code>WrapGroupTables</code>, or <code>WrapTables</code> directive), rather |
| 406 | than configuring a static deny table that always says ALL. |
| 407 | |
| 408 | <p> |
| 409 | <h3><a name="AccessRules">Access Rules</a></h3> |
| 410 | When checking access rules, the check terminates when the first match is |
| 411 | found. A <b>client list</b> is a list of one or more host names, host |
| 412 | addresses, patterns or wildcards (see below) that will be matched against the |
| 413 | client host name or address. The more complex <i>daemon@host</i> and |
| 414 | <i>user@host</i> forms are explained in the sections on server endpoint |
| 415 | patterns and on client username lookups, respectively. With the exception of |
| 416 | NIS/YP netgroup lookups, all access control checks are case insensitive. |
| 417 | |
| 418 | <p> |
| 419 | <b>Patterns</b><br> |
| 420 | The access control language implements the following patterns: |
| 421 | <ul> |
| 422 | <li>A string that begins with a `.' character. A host name is matched if the |
| 423 | last components of its name match the specified pattern. For example, the |
| 424 | pattern <code>.castaglia.org</code> matches the host name |
| 425 | <code>golem.devlan.castaglia.org</code>. |
| 426 | |
| 427 | <p> |
| 428 | <li>A string that ends with a `.' character. A host address is matched if its |
| 429 | first numeric fields match the given string. For example, the pattern |
| 430 | <code>131.155.</code> matches the address of (almost) every host on the |
| 431 | Eindhoven University network (<code>131.155.<i>x</i>.<i>x</i></code>). |
| 432 | |
| 433 | <p> |
| 434 | <li>A string that begins with an `@' character is treated as an NIS (formerly |
| 435 | YP) netgroup name. A host name is matched if it is a host member of the |
| 436 | specified netgroup. Netgroup matches are not supported for client user |
| 437 | names. <i>Note</i> that <code>mod_wrap2</code> must be configured for NIS |
| 438 | support for netgroup lookups to occur. |
| 439 | |
| 440 | <p> |
| 441 | <li>An expression of the form <i>n.n.n.n/m.m.m.m</i> is interpreted as |
| 442 | an IPv4 <code>net/mask</code> pair. An IPv4 address is matched if the |
| 443 | <code>net</code> portion is equal to the bitwise AND of the address and the |
| 444 | <code>mask</code> portion. For example, the <code>net/mask</code> pattern |
| 445 | <code>131.155.72.0/255.255.254.0</code> matches every address in the range |
| 446 | <code>131.155.72.0</code> through <code>131.155.73.255</code>. |
| 447 | |
| 448 | <p> |
| 449 | <li>An expression of the form <i>[address]/number</i> is interpreted as |
| 450 | an IPv6 <code>net/mask</code> pair. An IPv6 address is matched if the |
| 451 | first <em>number</em> bits match the rule <em>address</em>. For example, |
| 452 | <code>[3ffe:505:2:1::]/64</code> matches every address in the range |
| 453 | <code>3ffe:505:2:1::</code> through <code>3ffe:505:2:1:ffff:ffff:ffff:ffff:</code>. |
| 454 | |
| 455 | <p> |
| 456 | <li>A string that begins with a `/' character is treated as a file name. |
| 457 | A host name or address is matched if it matches any host name or address |
| 458 | pattern listed in the named file. The file format is zero or more lines |
| 459 | with zero or more host name or address patterns separated by whitespace. |
| 460 | A file name pattern can be used anywhere a host name or address pattern |
| 461 | can be used. |
| 462 | |
| 463 | <p> |
| 464 | <li>Wildcards `*' and `?' can be used to match hostnames or IP addresses. |
| 465 | This method of matching cannot be used in conjunction with |
| 466 | <code>net/mask</code> matching, hostname matching beginning with `.' or |
| 467 | IP address matching ending with `.'. |
| 468 | </ul> |
| 469 | |
| 470 | <p> |
| 471 | <b>Wildcards</b><br> |
| 472 | The access control language supports explicit wildcards: |
| 473 | <ul> |
| 474 | <li>ALL<br> |
| 475 | The universal wildcard, always matches. |
| 476 | |
| 477 | <p> |
| 478 | <li>LOCAL<br> |
| 479 | Matches any host whose name does not contain a dot character. |
| 480 | |
| 481 | <p> |
| 482 | <li>UNKNOWN<br> |
| 483 | Matches any user whose name is unknown, and matches any host whose name or |
| 484 | address are unknown. This pattern should be used with care: host names may |
| 485 | be unavailable due to temporary name server problems. |
| 486 | |
| 487 | <p> |
| 488 | <li>KNOWN<br> |
| 489 | Matches any user whose name is known, and matches any host whose name and |
| 490 | address are known. This pattern should be used with care: host names may be |
| 491 | unavailable due to temporary name server problems. |
| 492 | |
| 493 | <p> |
| 494 | <li>PARANOID<br> |
| 495 | Matches any host whose name does not match its address, before looking |
| 496 | at the access control tables. |
| 497 | </ul> |
| 498 | |
| 499 | <p> |
| 500 | <b>Operators</b><br> |
| 501 | <ul> |
| 502 | <li>EXCEPT<br> |
| 503 | Intended use is of the form: |
| 504 | <pre> |
| 505 | <em>list1</em> EXCEPT <em>list2</em> |
| 506 | </pre> |
| 507 | This construct matches anything that matches <em>list1</em> unless it |
| 508 | matches <em>list2</em>. The EXCEPT operator can be used in <b>daemon |
| 509 | lists</b> and <b>client lists</b>. The EXCEPT operator can be nested: if |
| 510 | the control language would permit the use of parentheses: |
| 511 | <pre> |
| 512 | a EXCEPT b EXCEPT c |
| 513 | </pre> |
| 514 | would parse as |
| 515 | <pre> |
| 516 | (a EXCEPT (b EXCEPT c)) |
| 517 | </pre> |
| 518 | </ul> |
| 519 | |
| 520 | <p> |
| 521 | <b>Server Endpoint Patterns</b><br> |
| 522 | In order to distinguish clients by the network address that they connect to, |
| 523 | use patterns of the form: |
| 524 | <pre> |
| 525 | <i>process-name</i>@<i>host-pattern</i> : <i>client-list</i> ... |
| 526 | </pre> |
| 527 | Patterns like these can be used when the machine has different Internet |
| 528 | addresses with different Internet hostnames. Service providers can use this |
| 529 | facility to offer FTP, GOPHER or WWW archives with Internet names that may even |
| 530 | belong to different organizations. Some systems can have more than one |
| 531 | Internet address on one physical interface. |
| 532 | |
| 533 | <p> |
| 534 | The <i>host-pattern</i> obeys the same syntax rules as host names and addresses |
| 535 | in <b>client lists</b>. |
| 536 | |
| 537 | <p> |
| 538 | <b>Client Username Lookup</b><br> |
| 539 | When the client host supports the RFC 931 protocol, the <code>proftpd</code> |
| 540 | daemon can retrieve additional information about the owner of a connection. |
| 541 | Client username information, when available (<i>i.e.</i> when |
| 542 | <code>IdentLookups</code> are not disabled), is logged together with the client |
| 543 | host name, and can be used to match patterns like: |
| 544 | <pre> |
| 545 | <i>daemon-list</i> : ... <i>user-pattern</i>@<i>host-pattern</i> ... |
| 546 | </pre> |
| 547 | |
| 548 | <p> |
| 549 | A <i>user-pattern</i> has the same syntax as a daemon pattern, so the same |
| 550 | wildcards apply (netgroup membership is not supported). One should not get |
| 551 | carried away with username lookups, though: |
| 552 | <ul> |
| 553 | <li>The client username information cannot be trusted when it is needed |
| 554 | most, <i>i.e.</i> when the client system has been compromised. In |
| 555 | general, ALL and (UN)KNOWN are the only user name patterns that make sense. |
| 556 | |
| 557 | <p> |
| 558 | <li>Username lookups are possible only when the client host runs a suitable |
| 559 | daemon; in all other cases the result is "unknown". |
| 560 | </ul> |
| 561 | |
| 562 | <p> |
| 563 | <h3><a name="AccessOptions">Access Options</a></h3> |
| 564 | This section describes optional <b>options list</b> portion the access control |
| 565 | language described above. The <b>options list</b> syntax uses the following |
| 566 | format: |
| 567 | <pre> |
| 568 | <i>opt1</i> : <i>opt2</i> ... |
| 569 | </pre> |
| 570 | Any `:' characters within options should be protected with a backslash. |
| 571 | |
| 572 | <p> |
| 573 | An option is of the form <code>"keyword"</code> or |
| 574 | <code>"keyword value"</code>. Options are processed in the |
| 575 | specified order. For the sake of backwards compatibility with earlier |
| 576 | versions, a `=' is permitted between keyword and value. |
| 577 | <ul> |
| 578 | <li>ALLOW<br> |
| 579 | Grant service. This option must appear at the end of a rule. |
| 580 | </li> |
| 581 | |
| 582 | <p> |
| 583 | <li>DENY<br> |
| 584 | Deny service. This option must appear at the end of a rule. |
| 585 | </li> |
| 586 | </ul> |
| 587 | |
| 588 | <p> |
| 589 | The allow and deny keywords make it possible to keep all access control |
| 590 | rules within a single file, for example in the <code>hosts.allow</code> |
| 591 | file. To permit access from specific hosts only: |
| 592 | <pre> |
| 593 | ALL: .friendly.domain: ALLOW |
| 594 | ALL: ALL: DENY |
| 595 | </pre> |
| 596 | To permit access from all hosts except a few trouble makers: |
| 597 | <pre> |
| 598 | ALL: .bad.domain: DENY |
| 599 | ALL: ALL: ALLOW |
| 600 | </pre> |
| 601 | Notice the leading dot on the domain name patterns. |
| 602 | |
| 603 | <ul> |
| 604 | <p> |
| 605 | <li>nice <em>[number]</em><br> |
| 606 | Change the nice value of the process (default 10). Specify a positive |
| 607 | value to spend more CPU resources on other processes. |
| 608 | |
| 609 | <p> |
| 610 | <li>setenv <em>name=value</em><br> |
| 611 | Place a <code>name=value</code> pair into the process environment. The |
| 612 | value may contain whitespace (but leading and trailing blanks are stripped |
| 613 | off). |
| 614 | </ul> |
| 615 | |
| 616 | <p> |
| 617 | <b>Diagnostics</b><br> |
| 618 | When a syntax error is found in an options list, the error is reported in the |
| 619 | <code>WrapLog</code> and the access option will be ignored. |
| 620 | |
| 621 | <p> |
| 622 | <hr> |
| 623 | <h2><a name="Installation">Installation</a></h2> |
| 624 | Follow the usual steps for using third-party modules in ProFTPD: |
| 625 | <pre> |
| 626 | $ ./configure --with-modules=<em>wrap-modules</em> |
| 627 | $ make |
| 628 | $ make install |
| 629 | </pre> |
| 630 | where <em>wrap-modules</em> will depend on the types of access tables you wish |
| 631 | to support. |
| 632 | |
| 633 | <p> |
| 634 | For file-based access tables, include the <code>mod_wrap2_file</code> |
| 635 | submodule, <i>e.g.</i>: |
| 636 | <pre> |
| 637 | mod_wrap2:mod_wrap2_file |
| 638 | </pre> |
| 639 | For SQL-based access tables, include the <code>mod_wrap2_sql</code> |
| 640 | submodule, <i>e.g.</i>: |
| 641 | <pre> |
| 642 | mod_wrap2:mod_wrap2_sql |
| 643 | </pre> |
| 644 | And, if you wish to support both file- and SQL-based access tables, use: |
| 645 | <pre> |
| 646 | mod_wrap2:mod_wrap2_file:mod_wrap2_sql |
| 647 | </pre> |
| 648 | Note that SQL tables require that a correct installation of <code>mod_sql</code> |
| 649 | (and any of its backend modules) also be used. Consult the <code>mod_sql</code> |
| 650 | documentation for installation instructions for that module. |
| 651 | |
| 652 | <p> |
| 653 | <hr> |
| 654 | <font size=2><b><i> |
| 655 | © Copyright 2000-2021 TJ Saunders<br> |
| 656 | All Rights Reserved<br> |
| 657 | </i></b></font> |
| 658 | <hr> |
| 659 | |
| 660 | </body> |
| 661 | </html> |