1 /* 2 * ProFTPD - FTP server daemon 3 * Copyright (c) 1997, 1998 Public Flood Software 4 * Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net> 5 * Copyright (c) 2001-2019 The ProFTPD Project team 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 20 * 21 * As a special exemption, Public Flood Software/MacGyver aka Habeeb J. Dihu 22 * and other respective copyright holders give permission to link this program 23 * with OpenSSL, and distribute the resulting executable, without including 24 * the source code for OpenSSL in the source distribution. 25 */ 26 27 /* User configurable defaults and tunable parameters. */ 28 29 #ifndef PR_OPTIONS_H 30 #define PR_OPTIONS_H 31 32 /* Tunable parameters */ 33 34 /* This defines the timeout for the main select() loop, defines the number 35 * of seconds to wait for a session request before checking for things such 36 * as shutdown requests, perform signal dispatching, etc before waitinng 37 * for requests again. 38 */ 39 40 #define PR_TUNABLE_SELECT_TIMEOUT 30 41 42 /* Hash table size is the number of items in the module hash tables. 43 */ 44 45 #define PR_TUNABLE_HASH_TABLE_SIZE 40 46 47 /* "Backlog" is the number of connections that can be received at one 48 * burst before the kernel rejects. This can be configured by the 49 * "tcpBackLog" configuration directive, this value is just the default. 50 */ 51 #ifndef PR_TUNABLE_DEFAULT_BACKLOG 52 # define PR_TUNABLE_DEFAULT_BACKLOG 128 53 #endif /* PR_TUNABLE_DEFAULT_BACKLOG */ 54 55 /* The default TCP send/receive buffer sizes, should explicit sizes not 56 * be defined at compile time, or should the runtime determination process 57 * fail. 58 * 59 * Note that these default buffer sizes are only used if the service cannot 60 * determine the platform's favored network buffer sizes using getsockopt(2). 61 * If you wish to override the use of getsockopt(2) to determine the network 62 * buffer sizes to use, you can use the PR_TUNABLE_RCVBUFSZ and 63 * PR_TUNABLE_SNDBUFSZ macros to define, at compile-time, the network buffer 64 * sizes to use. 65 */ 66 67 #ifndef PR_TUNABLE_DEFAULT_RCVBUFSZ 68 # define PR_TUNABLE_DEFAULT_RCVBUFSZ 8192 69 #endif /* PR_TUNABLE_DEFAULT_RCVBUFSZ */ 70 71 #ifndef PR_TUNABLE_DEFAULT_SNDBUFSZ 72 # define PR_TUNABLE_DEFAULT_SNDBUFSZ 8192 73 #endif /* PR_TUNABLE_DEFAULT_SNDBUFSZ */ 74 75 /* Default internal buffer size used for data transfers and other 76 * miscellaneous tasks. 77 */ 78 #ifndef PR_TUNABLE_BUFFER_SIZE 79 # define PR_TUNABLE_BUFFER_SIZE 1024 80 #endif 81 82 /* There is also a definable buffer size used specifically for parsing 83 * lines of text from the config file: PR_TUNABLE_PARSER_BUFFER_SIZE. 84 * 85 * You should manually set the PR_TUNABLE_PARSER_BUFFER_SIZE only if you 86 * have exceptionally long configuration lines. 87 */ 88 #ifndef PR_TUNABLE_PARSER_BUFFER_SIZE 89 # define PR_TUNABLE_PARSER_BUFFER_SIZE 4096 90 #endif 91 92 /* There is also a definable buffer size used specifically for data 93 * transfers: PR_TUNABLE_XFER_BUFFER_SIZE. By default, this buffer 94 * size is automatically determined, at runtime, as the smaller of the 95 * TCP receive and send buffer sizes. 96 * 97 * You should manually set the PR_TUNABLE_XFER_BUFFER_SIZE only in 98 * special circumstances, when you need to explicitly control that 99 * buffer size. 100 */ 101 #ifndef PR_TUNABLE_XFER_BUFFER_SIZE 102 # define PR_TUNABLE_XFER_BUFFER_SIZE PR_TUNABLE_BUFFER_SIZE 103 #endif 104 105 /* Maximum FTP command size. For details on this size of 512KB, see 106 * the Bug#4014 discussion. 107 */ 108 #ifndef PR_TUNABLE_CMD_BUFFER_SIZE 109 # define PR_TUNABLE_CMD_BUFFER_SIZE (512 * 1024) 110 #endif 111 112 /* Maximum path length. GNU HURD (and some others) do not define 113 * MAXPATHLEN. POSIX' PATH_MAX is mandated to be at least 256 114 * (according to some), so 1K, in the absence of MAXPATHLEN, should be 115 * a reasonable default. 116 */ 117 118 #ifndef PR_TUNABLE_PATH_MAX 119 # ifdef MAXPATHLEN 120 # define PR_TUNABLE_PATH_MAX MAXPATHLEN 121 # else 122 # define PR_TUNABLE_PATH_MAX 1024 123 # endif 124 #endif 125 126 /* Default timeouts, if not explicitly configured via 127 * the TimeoutLogin, TimeoutIdle, etc directives. 128 */ 129 130 #ifndef PR_TUNABLE_TIMEOUTIDENT 131 # define PR_TUNABLE_TIMEOUTIDENT 10 132 #endif 133 134 #ifndef PR_TUNABLE_TIMEOUTIDLE 135 # define PR_TUNABLE_TIMEOUTIDLE 600 136 #endif 137 138 /* The default command timeout in many command-line FTP clients (e.g. 139 * lukemftp, used on BSDs and maybe Linux?) is 60 seconds. To avoid having 140 * those clients close the control connection because proftpd takes too 141 * long, while performing lingering closes, to send a response, keep the 142 * default linger timeout under 60 seconds. 143 */ 144 #ifndef PR_TUNABLE_TIMEOUTLINGER 145 # define PR_TUNABLE_TIMEOUTLINGER 10 146 #endif 147 148 #ifndef PR_TUNABLE_TIMEOUTLOGIN 149 # define PR_TUNABLE_TIMEOUTLOGIN 300 150 #endif 151 152 #ifndef PR_TUNABLE_TIMEOUTNOXFER 153 # define PR_TUNABLE_TIMEOUTNOXFER 300 154 #endif 155 156 #ifndef PR_TUNABLE_TIMEOUTSTALLED 157 # define PR_TUNABLE_TIMEOUTSTALLED 3600 158 #endif 159 160 /* Number of bytes in a new memory pool. During file transfers, 161 * quite a few pools can be created, which eat up a lot of memory. 162 * Tune this if ProFTPD seems too memory hungry (warning! too low 163 * can negatively impact performance) 164 */ 165 166 #ifndef PR_TUNABLE_NEW_POOL_SIZE 167 # define PR_TUNABLE_NEW_POOL_SIZE 512 168 #endif 169 170 /* Number of bytes in certain scoreboard fields, usually for reporting 171 * the full command received from the connected client, or the current 172 * working directory for the session. 173 */ 174 175 #ifndef PR_TUNABLE_SCOREBOARD_BUFFER_SIZE 176 # define PR_TUNABLE_SCOREBOARD_BUFFER_SIZE 80 177 #endif 178 179 /* Number of seconds between scoreboard scrubs, where the scoreboard is 180 * scanned for slots containing invalid PIDs. Defaults to 30 seconds. 181 */ 182 183 #ifndef PR_TUNABLE_SCOREBOARD_SCRUB_TIMER 184 # define PR_TUNABLE_SCOREBOARD_SCRUB_TIMER 30 185 #endif 186 187 /* Maximum number of attempted updates to the scoreboard during a 188 * file transfer before an actual write is done. This is to allow 189 * an optimization where the scoreboard is not updated on every loop 190 * through the transfer buffer. 191 */ 192 193 #ifndef PR_TUNABLE_XFER_SCOREBOARD_UPDATES 194 # define PR_TUNABLE_XFER_SCOREBOARD_UPDATES 10 195 #endif 196 197 #ifndef PR_TUNABLE_CALLER_DEPTH 198 /* Max depth of call stack if stacktrace support is enabled. */ 199 # define PR_TUNABLE_CALLER_DEPTH 32 200 #endif 201 202 #ifndef PR_TUNABLE_ENV_MAX 203 /* Max length of environment variable values allowed by proftpd. */ 204 # define PR_TUNABLE_ENV_MAX 2048 205 #endif 206 207 #ifndef PR_TUNABLE_GLOBBING_MAX_RECURSION 208 /* Max number of recursion/directory levels to support when globbing. 209 */ 210 # define PR_TUNABLE_GLOBBING_MAX_RECURSION 8 211 #endif 212 213 #ifndef PR_TUNABLE_GLOBBING_MAX_MATCHES 214 /* Max number of matches to support when globbing. 215 */ 216 # define PR_TUNABLE_GLOBBING_MAX_MATCHES 100000UL 217 #endif 218 219 #ifndef PR_TUNABLE_LOGIN_MAX 220 /* Maximum length of login name. 221 * 222 * Ideally, we'd use _POSIX_LOGIN_NAME_MAX here, if it was defined. However, 223 * doing so would cause trouble for those sites that use databases for 224 * storing user information; such sites often use email addresses as 225 * login names. Given that, let's use 256 as a login name size. 226 */ 227 # define PR_TUNABLE_LOGIN_MAX 256 228 #endif 229 230 #ifndef PR_TUNABLE_PASSWORD_MAX 231 /* Maximum length of a password. */ 232 # define PR_TUNABLE_PASSWORD_MAX 1024 233 #endif 234 235 #ifndef PR_TUNABLE_EINTR_RETRY_INTERVAL 236 /* Define the time to delay, in seconds, after a system call has been 237 * interrupted (errno is EINTR) before retrying that call. 238 * 239 * The default behavior is delay 0.2 secs between retries. 240 */ 241 # define PR_TUNABLE_EINTR_RETRY_INTERVAL 0.2 242 #endif 243 244 #ifndef PR_TUNABLE_XFER_LOG_MODE 245 # define PR_TUNABLE_XFER_LOG_MODE 0644 246 #endif 247 248 /* FS Statcache tuning. */ 249 #ifndef PR_TUNABLE_FS_STATCACHE_SIZE 250 # define PR_TUNABLE_FS_STATCACHE_SIZE 30000 251 #endif 252 253 #ifndef PR_TUNABLE_FS_STATCACHE_MAX_AGE 254 # define PR_TUNABLE_FS_STATCACHE_MAX_AGE 3 255 #endif 256 257 #endif /* PR_OPTIONS_H */ 258