options.h 13 KB

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