dropbear 2015.71
[tomato.git] / release / src / router / dropbear / options.h
blob27e2a02705af94ff991967d0ce749bd749456e2f
1 /* Dropbear SSH
2 * Copyright (c) 2002,2003 Matt Johnston
3 * All rights reserved. See LICENSE for the license. */
5 #ifndef DROPBEAR_OPTIONS_H_
6 #define DROPBEAR_OPTIONS_H_
8 /* Define compile-time options below - the "#ifndef DROPBEAR_XXX .... #endif"
9 * parts are to allow for commandline -DDROPBEAR_XXX options etc. */
11 /* IMPORTANT: Many options will require "make clean" after changes */
13 #ifndef DROPBEAR_DEFPORT
14 #define DROPBEAR_DEFPORT "22"
15 #endif
17 #ifndef DROPBEAR_DEFADDRESS
18 /* Listen on all interfaces */
19 #define DROPBEAR_DEFADDRESS ""
20 #endif
22 /* Default hostkey paths - these can be specified on the command line */
23 #ifndef DSS_PRIV_FILENAME
24 #define DSS_PRIV_FILENAME "/etc/dropbear/dropbear_dss_host_key"
25 #endif
26 #ifndef RSA_PRIV_FILENAME
27 #define RSA_PRIV_FILENAME "/etc/dropbear/dropbear_rsa_host_key"
28 #endif
29 #ifndef ECDSA_PRIV_FILENAME
30 #define ECDSA_PRIV_FILENAME "/etc/dropbear/dropbear_ecdsa_host_key"
31 #endif
33 /* Set NON_INETD_MODE if you require daemon functionality (ie Dropbear listens
34 * on chosen ports and keeps accepting connections. This is the default.
36 * Set INETD_MODE if you want to be able to run Dropbear with inetd (or
37 * similar), where it will use stdin/stdout for connections, and each process
38 * lasts for a single connection. Dropbear should be invoked with the -i flag
39 * for inetd, and can only accept IPv4 connections.
41 * Both of these flags can be defined at once, don't compile without at least
42 * one of them. */
43 #define NON_INETD_MODE
44 #define INETD_MODE
46 /* Setting this disables the fast exptmod bignum code. It saves ~5kB, but is
47 * perhaps 20% slower for pubkey operations (it is probably worth experimenting
48 * if you want to use this) */
49 /*#define NO_FAST_EXPTMOD*/
51 /* Set this if you want to use the DROPBEAR_SMALL_CODE option. This can save
52 several kB in binary size however will make the symmetrical ciphers and hashes
53 slower, perhaps by 50%. Recommended for small systems that aren't doing
54 much traffic. */
55 #define DROPBEAR_SMALL_CODE
57 /* Enable X11 Forwarding - server only */
58 #define ENABLE_X11FWD
60 /* Enable TCP Fowarding */
61 /* 'Local' is "-L" style (client listening port forwarded via server)
62 * 'Remote' is "-R" style (server listening port forwarded via client) */
64 #define ENABLE_CLI_LOCALTCPFWD
65 #define ENABLE_CLI_REMOTETCPFWD
67 #define ENABLE_SVR_LOCALTCPFWD
68 #define ENABLE_SVR_REMOTETCPFWD
70 /* Enable Authentication Agent Forwarding */
71 #define ENABLE_SVR_AGENTFWD
72 #define ENABLE_CLI_AGENTFWD
75 /* Note: Both ENABLE_CLI_PROXYCMD and ENABLE_CLI_NETCAT must be set to
76 * allow multihop dbclient connections */
78 /* Allow using -J <proxycommand> to run the connection through a
79 pipe to a program, rather the normal TCP connection */
80 #define ENABLE_CLI_PROXYCMD
82 /* Enable "Netcat mode" option. This will forward standard input/output
83 * to a remote TCP-forwarded connection */
84 #define ENABLE_CLI_NETCAT
86 /* Whether to support "-c" and "-m" flags to choose ciphers/MACs at runtime */
87 #define ENABLE_USER_ALGO_LIST
89 /* Encryption - at least one required.
90 * Protocol RFC requires 3DES and recommends AES128 for interoperability.
91 * Including multiple keysize variants the same cipher
92 * (eg AES256 as well as AES128) will result in a minimal size increase.*/
93 #define DROPBEAR_AES128
94 #define DROPBEAR_3DES
95 #define DROPBEAR_AES256
96 /* Compiling in Blowfish will add ~6kB to runtime heap memory usage */
97 /*#define DROPBEAR_BLOWFISH*/
98 #define DROPBEAR_TWOFISH256
99 #define DROPBEAR_TWOFISH128
101 /* Enable CBC mode for ciphers. This has security issues though
102 * is the most compatible with older SSH implementations */
103 #define DROPBEAR_ENABLE_CBC_MODE
105 /* Enable "Counter Mode" for ciphers. This is more secure than normal
106 * CBC mode against certain attacks. It is recommended for security
107 * and forwards compatibility */
108 #define DROPBEAR_ENABLE_CTR_MODE
110 /* Twofish counter mode is disabled by default because it
111 has not been tested for interoperability with other SSH implementations.
112 If you test it please contact the Dropbear author */
113 /* #define DROPBEAR_TWOFISH_CTR */
115 /* You can compile with no encryption if you want. In some circumstances
116 * this could be safe security-wise, though make sure you know what
117 * you're doing. Anyone can see everything that goes over the wire, so
118 * the only safe auth method is public key. */
119 /* #define DROPBEAR_NONE_CIPHER */
121 /* Message Integrity - at least one required.
122 * Protocol RFC requires sha1 and recommends sha1-96.
123 * sha1-96 is of use for slow links as it has a smaller overhead.
125 * There's no reason to disable sha1 or sha1-96 to save space since it's
126 * used for the random number generator and public-key cryptography anyway.
127 * Disabling it here will just stop it from being used as the integrity portion
128 * of the ssh protocol.
130 * These hashes are also used for public key fingerprints in logs.
131 * If you disable MD5, Dropbear will fall back to SHA1 fingerprints,
132 * which are not the standard form. */
133 #define DROPBEAR_SHA1_HMAC
134 #define DROPBEAR_SHA1_96_HMAC
135 #define DROPBEAR_SHA2_256_HMAC
136 #define DROPBEAR_SHA2_512_HMAC
137 #define DROPBEAR_MD5_HMAC
139 /* You can also disable integrity. Don't bother disabling this if you're
140 * still using a cipher, it's relatively cheap. If you disable this it's dead
141 * simple for an attacker to run arbitrary commands on the remote host. Beware. */
142 /* #define DROPBEAR_NONE_INTEGRITY */
144 /* Hostkey/public key algorithms - at least one required, these are used
145 * for hostkey as well as for verifying signatures with pubkey auth.
146 * Removing either of these won't save very much space.
147 * SSH2 RFC Draft requires dss, recommends rsa */
148 #define DROPBEAR_RSA
149 #define DROPBEAR_DSS
150 /* ECDSA is significantly faster than RSA or DSS. Compiling in ECC
151 * code (either ECDSA or ECDH) increases binary size - around 30kB
152 * on x86-64 */
153 #define DROPBEAR_ECDSA
155 /* Generate hostkeys as-needed when the first connection using that key type occurs.
156 This avoids the need to otherwise run "dropbearkey" and avoids some problems
157 with badly seeded /dev/urandom when systems first boot.
158 This also requires a runtime flag "-R". This adds ~4kB to binary size (or hardly
159 anything if dropbearkey is linked in a "dropbearmulti" binary) */
160 #define DROPBEAR_DELAY_HOSTKEY
162 /* Enable Curve25519 for key exchange. This is another elliptic
163 * curve method with good security properties. Increases binary size
164 * by ~8kB on x86-64 */
165 #define DROPBEAR_CURVE25519
167 /* Enable elliptic curve Diffie Hellman key exchange, see note about
168 * ECDSA above */
169 #define DROPBEAR_ECDH
171 /* Control the memory/performance/compression tradeoff for zlib.
172 * Set windowBits=8 for least memory usage, see your system's
173 * zlib.h for full details.
174 * Default settings (windowBits=15) will use 256kB for compression
175 * windowBits=8 will use 129kB for compression.
176 * Both modes will use ~35kB for decompression (using windowBits=15 for
177 * interoperability) */
178 #ifndef DROPBEAR_ZLIB_WINDOW_BITS
179 #define DROPBEAR_ZLIB_WINDOW_BITS 15
180 #endif
182 /* Server won't allow zlib compression until after authentication. Prevents
183 flaws in the zlib library being unauthenticated exploitable flaws.
184 Some old ssh clients may not support the alternative zlib@openssh.com method */
185 #define DROPBEAR_SERVER_DELAY_ZLIB 1
187 /* Whether to do reverse DNS lookups. */
188 /*#define DO_HOST_LOOKUP */
190 /* Whether to print the message of the day (MOTD). This doesn't add much code
191 * size */
192 #define DO_MOTD
194 /* The MOTD file path */
195 #ifndef MOTD_FILENAME
196 #define MOTD_FILENAME "/etc/motd"
197 #endif
199 /* Authentication Types - at least one required.
200 RFC Draft requires pubkey auth, and recommends password */
202 /* Note: PAM auth is quite simple and only works for PAM modules which just do
203 * a simple "Login: " "Password: " (you can edit the strings in svr-authpam.c).
204 * It's useful for systems like OS X where standard password crypts don't work
205 * but there's an interface via a PAM module. It won't work for more complex
206 * PAM challenge/response.
207 * You can't enable both PASSWORD and PAM. */
209 /* This requires crypt() */
210 #ifdef HAVE_CRYPT
211 #define ENABLE_SVR_PASSWORD_AUTH
212 #endif
213 /* PAM requires ./configure --enable-pam */
214 /*#define ENABLE_SVR_PAM_AUTH */
215 #define ENABLE_SVR_PUBKEY_AUTH
217 /* Whether to take public key options in
218 * authorized_keys file into account */
219 #ifdef ENABLE_SVR_PUBKEY_AUTH
220 #define ENABLE_SVR_PUBKEY_OPTIONS
221 #endif
223 /* This requires getpass. */
224 #ifdef HAVE_GETPASS
225 #define ENABLE_CLI_PASSWORD_AUTH
226 #define ENABLE_CLI_INTERACT_AUTH
227 #endif
228 #define ENABLE_CLI_PUBKEY_AUTH
230 /* A default argument for dbclient -i <privatekey>.
231 Homedir is prepended unless path begins with / */
232 #define DROPBEAR_DEFAULT_CLI_AUTHKEY ".ssh/id_dropbear"
234 /* This variable can be used to set a password for client
235 * authentication on the commandline. Beware of platforms
236 * that don't protect environment variables of processes etc. Also
237 * note that it will be provided for all "hidden" client-interactive
238 * style prompts - if you want something more sophisticated, use
239 * SSH_ASKPASS instead. Comment out this var to remove this functionality.*/
240 #define DROPBEAR_PASSWORD_ENV "DROPBEAR_PASSWORD"
242 /* Define this (as well as ENABLE_CLI_PASSWORD_AUTH) to allow the use of
243 * a helper program for the ssh client. The helper program should be
244 * specified in the SSH_ASKPASS environment variable, and dbclient
245 * should be run with DISPLAY set and no tty. The program should
246 * return the password on standard output */
247 /*#define ENABLE_CLI_ASKPASS_HELPER*/
249 /* Save a network roundtrip by sendng a real auth request immediately after
250 * sending a query for the available methods. It is at the expense of < 100
251 * bytes of extra network traffic. This is not yet enabled by default since it
252 * could cause problems with non-compliant servers */
253 /* #define DROPBEAR_CLI_IMMEDIATE_AUTH */
255 /* Source for randomness. This must be able to provide hundreds of bytes per SSH
256 * connection without blocking. In addition /dev/random is used for seeding
257 * rsa/dss key generation */
258 #define DROPBEAR_URANDOM_DEV "/dev/urandom"
260 /* Set this to use PRNGD or EGD instead of /dev/urandom or /dev/random */
261 /*#define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng"*/
264 /* Specify the number of clients we will allow to be connected but
265 * not yet authenticated. After this limit, connections are rejected */
266 /* The first setting is per-IP, to avoid denial of service */
267 #ifndef MAX_UNAUTH_PER_IP
268 #define MAX_UNAUTH_PER_IP 5
269 #endif
271 /* And then a global limit to avoid chewing memory if connections
272 * come from many IPs */
273 #ifndef MAX_UNAUTH_CLIENTS
274 #define MAX_UNAUTH_CLIENTS 30
275 #endif
277 /* Maximum number of failed authentication tries (server option) */
278 #ifndef MAX_AUTH_TRIES
279 #define MAX_AUTH_TRIES 10
280 #endif
282 /* The default file to store the daemon's process ID, for shutdown
283 scripts etc. This can be overridden with the -P flag */
284 #ifndef DROPBEAR_PIDFILE
285 #define DROPBEAR_PIDFILE "/var/run/dropbear.pid"
286 #endif
288 /* The command to invoke for xauth when using X11 forwarding.
289 * "-q" for quiet */
290 #ifndef XAUTH_COMMAND
291 #define XAUTH_COMMAND "/usr/bin/xauth -q"
292 #endif
294 /* if you want to enable running an sftp server (such as the one included with
295 * OpenSSH), set the path below. If the path isn't defined, sftp will not
296 * be enabled */
297 #ifndef SFTPSERVER_PATH
298 #define SFTPSERVER_PATH "/usr/libexec/sftp-server"
299 #endif
301 /* This is used by the scp binary when used as a client binary. If you're
302 * not using the Dropbear client, you'll need to change it */
303 #define DROPBEAR_PATH_SSH_PROGRAM "/usr/bin/dbclient"
305 /* Whether to log commands executed by a client. This only logs the
306 * (single) command sent to the server, not what a user did in a
307 * shell/sftp session etc. */
308 /* #define LOG_COMMANDS */
310 /* Window size limits. These tend to be a trade-off between memory
311 usage and network performance: */
312 /* Size of the network receive window. This amount of memory is allocated
313 as a per-channel receive buffer. Increasing this value can make a
314 significant difference to network performance. 24kB was empirically
315 chosen for a 100mbit ethernet network. The value can be altered at
316 runtime with the -W argument. */
317 #ifndef DEFAULT_RECV_WINDOW
318 #define DEFAULT_RECV_WINDOW 24576
319 #endif
320 /* Maximum size of a received SSH data packet - this _MUST_ be >= 32768
321 in order to interoperate with other implementations */
322 #ifndef RECV_MAX_PAYLOAD_LEN
323 #define RECV_MAX_PAYLOAD_LEN 32768
324 #endif
325 /* Maximum size of a transmitted data packet - this can be any value,
326 though increasing it may not make a significant difference. */
327 #ifndef TRANS_MAX_PAYLOAD_LEN
328 #define TRANS_MAX_PAYLOAD_LEN 16384
329 #endif
331 /* Ensure that data is transmitted every KEEPALIVE seconds. This can
332 be overridden at runtime with -K. 0 disables keepalives */
333 #define DEFAULT_KEEPALIVE 0
335 /* If this many KEEPALIVES are sent with no packets received from the
336 other side, exit. Not run-time configurable - if you have a need
337 for runtime configuration please mail the Dropbear list */
338 #define DEFAULT_KEEPALIVE_LIMIT 3
340 /* Ensure that data is received within IDLE_TIMEOUT seconds. This can
341 be overridden at runtime with -I. 0 disables idle timeouts */
342 #define DEFAULT_IDLE_TIMEOUT 0
344 /* The default path. This will often get replaced by the shell */
345 #define DEFAULT_PATH "/usr/bin:/bin"
347 /* Some other defines (that mostly should be left alone) are defined
348 * in sysoptions.h */
349 #include "sysoptions.h"
351 #endif /* DROPBEAR_OPTIONS_H_ */