| 1 |
# mod_sql.conf -- a proftpd.conf file for mod_sql/4.0 and higher |
| 2 |
# |
| 3 |
# This is a basic mod_sql-enabled ProFTPD configuration file. It is |
| 4 |
# based on the 'basic.conf' sample configuration file. |
| 5 |
# |
| 6 |
# To fully understand this sample configuration you should read the |
| 7 |
# other sample configurations and the README.mod_sql file which came |
| 8 |
# with your distribution. |
| 9 |
# |
| 10 |
# NOTE ABOUT DIRECTIVES: |
| 11 |
# |
| 12 |
# When you're looking through the ProFTPD directive list, you'll see |
| 13 |
# that every directive is marked with a 'Context'. This lists the |
| 14 |
# blocks that the directive can legally appear in. The default server |
| 15 |
# is known as the 'server config' context; the others are '<Global>', |
| 16 |
# '<VirtualHost>', and '<Anonymous>'. These are all explained below. |
| 17 |
# |
| 18 |
# NOTE ABOUT DEFAULT, GLOBAL, ANONYMOUS, AND VIRTUAL BLOCKS: |
| 19 |
# |
| 20 |
# There are four types of 'contexts' in this file; three of them are |
| 21 |
# explicitly marked and one is a catch-all. The three explicit contexts |
| 22 |
# are the <Global>...</Global> block, the <Anonymous>...</Anonymous> |
| 23 |
# block, and the <VirtualHost>...</VirtualHost> block (which isn't |
| 24 |
# included in this sample). Many people just starting with ProFTPD |
| 25 |
# seem to have trouble understanding the way these blocks nest and |
| 26 |
# what they do. |
| 27 |
# |
| 28 |
# You should understand that any directive that *isn't* inside a |
| 29 |
# <VirtualHost> block is part of the default server configuration. It |
| 30 |
# doesn't matter if it's at the end of the file, between other |
| 31 |
# <VirtualHost> blocks, or at the start of the file -- if it's not |
| 32 |
# contained by a <VirtualHost> ... </VirtualHost> pair, it's applied to |
| 33 |
# the default server. |
| 34 |
# |
| 35 |
# First of all, <Global> blocks set defaults for *every* server listed |
| 36 |
# in the proftpd.conf file, including any <VirtualHost> blocks. They do |
| 37 |
# not define an ftp server; it's just a shorthand way of specifying a set |
| 38 |
# of directives in one place instead of in multiple spots. |
| 39 |
# |
| 40 |
# Second, <Anonymous> blocks do not define a server. They define a |
| 41 |
# particular service that an FTP server provides. You can have |
| 42 |
# <Anonymous> blocks in the default server configuration, or in |
| 43 |
# <VirtualHost> blocks, but the <Anonymous> blocks are conceptually a |
| 44 |
# *part* of a server, they do not define a server in and of themselves. |
| 45 |
# |
| 46 |
# Third, <VirtualHost> blocks define servers which are in addition to |
| 47 |
# the default server, but they are *completely* separate in setup, |
| 48 |
# except that they inherit any directives in a <Global> block. |
| 49 |
# <VirtualHost> blocks can have their own <Anonymous> blocks, and must |
| 50 |
# have their own IP or Port (since the FTP protocol doesn't support |
| 51 |
# true name-based virtual hosts, like HTTP does). |
| 52 |
# |
| 53 |
# Finally, you should realize that all these explicitly-marked blocks |
| 54 |
# are optional. The simplest configuration file will have no |
| 55 |
# <VirtualHost> blocks and no <Anonymous> blocks. If you don't want |
| 56 |
# anonymous logins, simply remove the anonymous block from this sample |
| 57 |
# configuration file. If you want to configure a virtual host, simply |
| 58 |
# add a complete set of server directives inside a <VirtualHost> |
| 59 |
# block. |
| 60 |
|
| 61 |
|
| 62 |
ServerName "ProFTPD Default Installation" |
| 63 |
ServerType standalone |
| 64 |
DefaultServer on |
| 65 |
|
| 66 |
# Port 21 is the standard FTP port. |
| 67 |
Port 21 |
| 68 |
|
| 69 |
# Umask 022 is a good standard umask to prevent new dirs and files |
| 70 |
# from being group and world writable. |
| 71 |
Umask 022 |
| 72 |
|
| 73 |
# We put our mod_sql directives in a <Global> block so they'll be |
| 74 |
# inherited by the <Anonymous> block below, and any other <VirtualHost> |
| 75 |
# blocks we may want to add. For a simple server these don't need to |
| 76 |
# be in a <Global> block but it won't hurt anything. |
| 77 |
<Global> |
| 78 |
|
| 79 |
# Specify our connection information. Both mod_sql_mysql and |
| 80 |
# mod_sql_postgres use the same format, other backends may specify a |
| 81 |
# different format for the first argument to SQLConnectInfo. By not |
| 82 |
# specifying a fourth argument, we're defaulting to 'PERSESSION' |
| 83 |
# connections -- a connection is made to the database at the start of |
| 84 |
# the session and closed at the end. This should be fine for most |
| 85 |
# situations. |
| 86 |
SQLConnectInfo dbname@host:port username password |
| 87 |
|
| 88 |
# Specify our authentication schemes. Assuming we're using |
| 89 |
# mod_sql_mysql, here we're saying 'first try to authenticate using |
| 90 |
# mysql's password scheme, then try to authenticate the user's |
| 91 |
# password using crypt(3)'. |
| 92 |
SQLAuthTypes Backend Crypt |
| 93 |
|
| 94 |
# Specify the table and fields for user information. If you've |
| 95 |
# created the database as it specifies in 'README.mod_sql', you don't |
| 96 |
# need to have this directive at all UNLESS you've elected not to |
| 97 |
# create some fields. In this case we're telling mod_sql to look in |
| 98 |
# table 'users' for the fields 'username','password','uid', and |
| 99 |
# 'gid'. The 'homedir' and 'shell' fields are specified as 'NULL' -- |
| 100 |
# this will be explained below. |
| 101 |
SQLUserInfo users username password uid gid NULL NULL |
| 102 |
|
| 103 |
# Here we tell mod_sql that every user it authenticates should have |
| 104 |
# the same home directory. A much more common option would be to |
| 105 |
# specify a homedir in the database and leave this directive out. Note |
| 106 |
# that this directive is necessary in this case because we specified |
| 107 |
# the homedir field as 'NULL', above. mod_sql needs to get homedir |
| 108 |
# information from *somewhere*, otherwise it will not allow access. |
| 109 |
SQLDefaultHomedir "/tmp" |
| 110 |
|
| 111 |
# This is not a mod_sql specific directive, but it's here because of |
| 112 |
# the way we specified 'SQLUserInfo', above. By setting this to |
| 113 |
# 'off', we're telling ProFTPD to allow users to connect even if we |
| 114 |
# have no (or bad) shell information for them. Since we specified the |
| 115 |
# shell field as 'NULL', above, we need to tell ProFTPD to allow the |
| 116 |
# users in even though their shell doesn't exist. |
| 117 |
RequireValidShell off |
| 118 |
|
| 119 |
# Here we tell mod_sql how to get out group information. By leaving |
| 120 |
# this commented out, we're telling mod_sql to go ahead and use the |
| 121 |
# defaults for the tablename and all the field names. |
| 122 |
# SQLGroupInfo groups groupname gid members |
| 123 |
|
| 124 |
# For small sites, the following directive will speed up queries at |
| 125 |
# the cost of some memory. Larger sites should read the complete |
| 126 |
# description of the 'SQLAuthenticate' directive; there are options |
| 127 |
# here that control the use of potentially expensive database |
| 128 |
# queries. NOTE: these arguments to 'SQLAuthoritative' limit the way |
| 129 |
# you can structure your group table. Check the README for more |
| 130 |
# information. |
| 131 |
SQLAuthenticate users groups usersetfast groupsetfast |
| 132 |
|
| 133 |
# Finally, some example logging directives. If you have an integer |
| 134 |
# field named 'count' in your users table, these directives will |
| 135 |
# automatically update the field each time a user logs in and display |
| 136 |
# their current login count to them. |
| 137 |
# SQLNamedQuery getcount SELECT "count, userid from users where userid='%u'" |
| 138 |
# SQLNamedQuery updatecount UPDATE "count=count+1 WHERE userid='%u'" users |
| 139 |
# SQLShowInfo PASS "230" "You've logged on %{getcount} times, %u" |
| 140 |
# SQLLog PASS updatecount |
| 141 |
|
| 142 |
# close our <Global> block. |
| 143 |
</Global> |
| 144 |
|
| 145 |
# To prevent DoS attacks, set the maximum number of child processes |
| 146 |
# to 30. If you need to allow more than 30 concurrent connections |
| 147 |
# at once, simply increase this value. Note that this ONLY works |
| 148 |
# in standalone mode, in inetd mode you should use an inetd server |
| 149 |
# that allows you to limit maximum number of processes per service |
| 150 |
# (such as xinetd) |
| 151 |
MaxInstances 30 |
| 152 |
|
| 153 |
# Set the normal user and group permissions for the server. |
| 154 |
User nobody |
| 155 |
Group nogroup |
| 156 |
|
| 157 |
# Normally, we want files to be overwriteable. |
| 158 |
<Directory /> |
| 159 |
AllowOverwrite on |
| 160 |
</Directory> |
| 161 |
|
| 162 |
# A basic anonymous configuration, no upload directories. If you |
| 163 |
# don't want to support anonymous access, simply remove this |
| 164 |
# <Anonymous ..> ... </Anonymous> block. |
| 165 |
|
| 166 |
<Anonymous ~ftp> |
| 167 |
User ftp |
| 168 |
Group ftp |
| 169 |
|
| 170 |
# We want clients to be able to login with "anonymous" as well as "ftp" |
| 171 |
UserAlias anonymous ftp |
| 172 |
|
| 173 |
# Limit the maximum number of anonymous logins |
| 174 |
MaxClients 10 |
| 175 |
|
| 176 |
# We want 'welcome.msg' displayed at login, and '.message' displayed |
| 177 |
# in each newly chdired directory. |
| 178 |
DisplayLogin welcome.msg |
| 179 |
DisplayChdir .message |
| 180 |
|
| 181 |
# Limit WRITE everywhere in the anonymous chroot |
| 182 |
<Limit WRITE> |
| 183 |
DenyAll |
| 184 |
</Limit> |
| 185 |
</Anonymous> |