default_options.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. #ifndef DROPBEAR_DEFAULT_OPTIONS_H_
  2. #define DROPBEAR_DEFAULT_OPTIONS_H_
  3. /*
  4. > > > Read This < < <
  5. default_options.h documents compile-time options, and provides default values.
  6. Local customisation should be added to localoptions.h which is
  7. used if it exists in the build directory. Options defined there will override
  8. any options in this file.
  9. Options can also be defined with -DDROPBEAR_XXX=[0,1] in Makefile CFLAGS
  10. IMPORTANT: Some options will require "make clean" after changes */
  11. #define DROPBEAR_DEFPORT "22"
  12. /* Listen on all interfaces */
  13. #define DROPBEAR_DEFADDRESS ""
  14. /* Default hostkey paths - these can be specified on the command line.
  15. * Homedir is prepended if path begins with ~/
  16. */
  17. #define DSS_PRIV_FILENAME "/etc/dropbear/dropbear_dss_host_key"
  18. #define RSA_PRIV_FILENAME "/etc/dropbear/dropbear_rsa_host_key"
  19. #define ECDSA_PRIV_FILENAME "/etc/dropbear/dropbear_ecdsa_host_key"
  20. #define ED25519_PRIV_FILENAME "/etc/dropbear/dropbear_ed25519_host_key"
  21. /* Set NON_INETD_MODE if you require daemon functionality (ie Dropbear listens
  22. * on chosen ports and keeps accepting connections. This is the default.
  23. *
  24. * Set INETD_MODE if you want to be able to run Dropbear with inetd (or
  25. * similar), where it will use stdin/stdout for connections, and each process
  26. * lasts for a single connection. Dropbear should be invoked with the -i flag
  27. * for inetd, and can only accept IPv4 connections.
  28. *
  29. * Both of these flags can be defined at once, don't compile without at least
  30. * one of them. */
  31. #define NON_INETD_MODE 1
  32. #define INETD_MODE 1
  33. /* By default Dropbear will re-execute itself for each incoming connection so
  34. that memory layout may be re-randomised (ASLR) - exploiting
  35. vulnerabilities becomes harder. Re-exec causes slightly more memory use
  36. per connection.
  37. This option is ignored on non-Linux platforms at present */
  38. #define DROPBEAR_REEXEC 1
  39. /* Include verbose debug output, enabled with -v at runtime (repeat to increase).
  40. * define which level of debug output you compile in
  41. * TRACE1 - TRACE3 = approx 4 Kb (connection, remote identity, algos, auth type info)
  42. * TRACE4 = approx 17 Kb (detailed before connection)
  43. * TRACE5 = approx 8 Kb (detailed after connection) */
  44. #define DEBUG_TRACE 0
  45. /* Set this if you want to use the DROPBEAR_SMALL_CODE option. This can save
  46. * several kB in binary size however will make the symmetrical ciphers and hashes
  47. * slower, perhaps by 50%. Recommended for small systems that aren't doing
  48. * much traffic. */
  49. #define DROPBEAR_SMALL_CODE 1
  50. /* Enable X11 Forwarding - server only */
  51. #define DROPBEAR_X11FWD 0
  52. /* Enable TCP Fowarding */
  53. /* 'Local' is "-L" style (client listening port forwarded via server)
  54. * 'Remote' is "-R" style (server listening port forwarded via client) */
  55. #define DROPBEAR_CLI_LOCALTCPFWD 1
  56. #define DROPBEAR_CLI_REMOTETCPFWD 1
  57. #define DROPBEAR_SVR_LOCALTCPFWD 1
  58. #define DROPBEAR_SVR_REMOTETCPFWD 1
  59. /* Enable Authentication Agent Forwarding */
  60. #define DROPBEAR_SVR_AGENTFWD 1
  61. #define DROPBEAR_CLI_AGENTFWD 1
  62. /* Note: Both DROPBEAR_CLI_PROXYCMD and DROPBEAR_CLI_NETCAT must be set to
  63. * allow multihop dbclient connections */
  64. /* Allow using -J <proxycommand> to run the connection through a
  65. pipe to a program, rather the normal TCP connection */
  66. #define DROPBEAR_CLI_PROXYCMD 1
  67. /* Enable "Netcat mode" option. This will forward standard input/output
  68. * to a remote TCP-forwarded connection */
  69. #define DROPBEAR_CLI_NETCAT 1
  70. /* Whether to support "-c" and "-m" flags to choose ciphers/MACs at runtime */
  71. #define DROPBEAR_USER_ALGO_LIST 1
  72. /* Encryption - at least one required.
  73. * AES128 should be enabled, some very old implementations might only
  74. * support 3DES.
  75. * Including both AES keysize variants (128 and 256) will result in
  76. * a minimal size increase */
  77. #define DROPBEAR_AES128 1
  78. #define DROPBEAR_AES256 1
  79. #define DROPBEAR_3DES 0
  80. /* Enable Chacha20-Poly1305 authenticated encryption mode. This is
  81. * generally faster than AES256 on CPU w/o dedicated AES instructions,
  82. * having the same key size. Recommended.
  83. * Compiling in will add ~5,5kB to binary size on x86-64 */
  84. #define DROPBEAR_CHACHA20POLY1305 1
  85. /* Enable "Counter Mode" for ciphers. Recommended. */
  86. #define DROPBEAR_ENABLE_CTR_MODE 1
  87. /* Enable CBC mode for ciphers. This has security issues though
  88. may be required for compatibility with old implementations */
  89. #define DROPBEAR_ENABLE_CBC_MODE 0
  90. /* Enable "Galois/Counter Mode" for ciphers. This authenticated
  91. * encryption mode is combination of CTR mode and GHASH. Recommended
  92. * for security and forwards compatibility, but slower than CTR on
  93. * CPU w/o dedicated AES/GHASH instructions.
  94. * Compiling in will add ~6kB to binary size on x86-64 */
  95. #define DROPBEAR_ENABLE_GCM_MODE 0
  96. /* Message integrity. sha2-256 is recommended as a default,
  97. sha1 for compatibility */
  98. #define DROPBEAR_SHA1_HMAC 0
  99. #define DROPBEAR_SHA2_256_HMAC 1
  100. #define DROPBEAR_SHA1_96_HMAC 0
  101. /* Hostkey/public key algorithms - at least one required, these are used
  102. * for hostkey as well as for verifying signatures with pubkey auth.
  103. * Removing either of these won't save very much space.
  104. * RSA is recommended.
  105. * DSS may be necessary to connect to some systems though
  106. * is not recommended for new keys.
  107. * See: RSA_PRIV_FILENAME and DSS_PRIV_FILENAME */
  108. #define DROPBEAR_RSA 1
  109. #define DROPBEAR_DSS 1
  110. /* ECDSA is significantly faster than RSA or DSS. Compiling in ECC
  111. * code (either ECDSA or ECDH) increases binary size - around 30kB
  112. * on x86-64.
  113. * See: ECDSA_PRIV_FILENAME */
  114. #define DROPBEAR_ECDSA 1
  115. /* Ed25519 is faster than ECDSA. Compiling in Ed25519 code increases
  116. * binary size - around 7,5kB on x86-64.
  117. * See: ED25519_PRIV_FILENAME */
  118. #define DROPBEAR_ED25519 1
  119. /* SK_ECDSA/SK_ED25519 allows u2f security keys for public key auth.
  120. * This is currently server-only. */
  121. #define DROPBEAR_SK_ECDSA 1
  122. #define DROPBEAR_SK_ED25519 1
  123. /* RSA must be >=1024 */
  124. #define DROPBEAR_DEFAULT_RSA_SIZE 2048
  125. /* DSS is always 1024 */
  126. /* ECDSA defaults to largest size configured, usually 521 */
  127. /* Ed25519 is always 256 */
  128. /* Add runtime flag "-R" to generate hostkeys as-needed when the first
  129. connection using that key type occurs.
  130. This avoids the need to otherwise run "dropbearkey" and avoids some problems
  131. with badly seeded /dev/urandom when systems first boot. */
  132. #define DROPBEAR_DELAY_HOSTKEY 1
  133. /* Key exchange algorithm.
  134. * group14_sha1 - 2048 bit, sha1
  135. * group14_sha256 - 2048 bit, sha2-256
  136. * group16 - 4096 bit, sha2-512
  137. * group1 - 1024 bit, sha1
  138. * curve25519 - elliptic curve DH
  139. * ecdh - NIST elliptic curve DH (256, 384, 521)
  140. *
  141. * group1 is too small for security though is necessary if you need
  142. compatibility with some implementations such as Dropbear versions < 0.53
  143. * group14 is supported by most implementations.
  144. * group16 provides a greater strength level but is slower and increases binary size
  145. * curve25519 and ecdh algorithms are faster than non-elliptic curve methods
  146. * curve25519 increases binary size by ~2,5kB on x86-64
  147. * including either ECDH or ECDSA increases binary size by ~30kB on x86-64
  148. * Small systems should generally include either curve25519 or ecdh for performance.
  149. * curve25519 is less widely supported but is faster
  150. */
  151. #define DROPBEAR_DH_GROUP14_SHA1 0
  152. #define DROPBEAR_DH_GROUP14_SHA256 1
  153. #define DROPBEAR_DH_GROUP16 0
  154. #define DROPBEAR_CURVE25519 1
  155. #define DROPBEAR_ECDH 1
  156. #define DROPBEAR_DH_GROUP1 0
  157. /* When group1 is enabled it will only be allowed by Dropbear client
  158. not as a server, due to concerns over its strength. Set to 0 to allow
  159. group1 in Dropbear server too */
  160. #define DROPBEAR_DH_GROUP1_CLIENTONLY 1
  161. /* Control the memory/performance/compression tradeoff for zlib.
  162. * Set windowBits=8 for least memory usage, see your system's
  163. * zlib.h for full details.
  164. * Default settings (windowBits=15) will use 256kB for compression
  165. * windowBits=8 will use 129kB for compression.
  166. * Both modes will use ~35kB for decompression (using windowBits=15 for
  167. * interoperability) */
  168. #define DROPBEAR_ZLIB_WINDOW_BITS 15
  169. /* Whether to do reverse DNS lookups. */
  170. #define DO_HOST_LOOKUP 0
  171. /* Whether to print the message of the day (MOTD). */
  172. #define DO_MOTD 1
  173. #define MOTD_FILENAME "/etc/motd"
  174. /* Authentication Types - at least one required.
  175. RFC Draft requires pubkey auth, and recommends password */
  176. #define DROPBEAR_SVR_PASSWORD_AUTH 1
  177. /* Note: PAM auth is quite simple and only works for PAM modules which just do
  178. * a simple "Login: " "Password: " (you can edit the strings in svr-authpam.c).
  179. * It's useful for systems like OS X where standard password crypts don't work
  180. * but there's an interface via a PAM module. It won't work for more complex
  181. * PAM challenge/response.
  182. * You can't enable both PASSWORD and PAM. */
  183. #define DROPBEAR_SVR_PAM_AUTH 0
  184. /* ~/.ssh/authorized_keys authentication.
  185. * You must define DROPBEAR_SVR_PUBKEY_AUTH in order to use plugins. */
  186. #define DROPBEAR_SVR_PUBKEY_AUTH 1
  187. /* Whether to take public key options in
  188. * authorized_keys file into account */
  189. #define DROPBEAR_SVR_PUBKEY_OPTIONS 1
  190. /* Set this to 0 if your system does not have multiple user support.
  191. (Linux kernel CONFIG_MULTIUSER option)
  192. The resulting binary will not run on a normal system. */
  193. #define DROPBEAR_SVR_MULTIUSER 1
  194. /* Client authentication options */
  195. #define DROPBEAR_CLI_PASSWORD_AUTH 1
  196. #define DROPBEAR_CLI_PUBKEY_AUTH 1
  197. /* A default argument for dbclient -i <privatekey>.
  198. * Homedir is prepended if path begins with ~/
  199. */
  200. #define DROPBEAR_DEFAULT_CLI_AUTHKEY "~/.ssh/id_dropbear"
  201. /* Allow specifying the password for dbclient via the DROPBEAR_PASSWORD
  202. * environment variable. */
  203. #define DROPBEAR_USE_PASSWORD_ENV 1
  204. /* Define this (as well as DROPBEAR_CLI_PASSWORD_AUTH) to allow the use of
  205. * a helper program for the ssh client. The helper program should be
  206. * specified in the SSH_ASKPASS environment variable, and dbclient
  207. * should be run with DISPLAY set and no tty. The program should
  208. * return the password on standard output */
  209. #define DROPBEAR_CLI_ASKPASS_HELPER 0
  210. /* Save a network roundtrip by sendng a real auth request immediately after
  211. * sending a query for the available methods. This is not yet enabled by default
  212. since it could cause problems with non-compliant servers */
  213. #define DROPBEAR_CLI_IMMEDIATE_AUTH 0
  214. /* Set this to use PRNGD or EGD instead of /dev/urandom */
  215. #define DROPBEAR_USE_PRNGD 0
  216. #define DROPBEAR_PRNGD_SOCKET "/var/run/dropbear-rng"
  217. /* Specify the number of clients we will allow to be connected but
  218. * not yet authenticated. After this limit, connections are rejected */
  219. /* The first setting is per-IP, to avoid denial of service */
  220. #define MAX_UNAUTH_PER_IP 5
  221. /* And then a global limit to avoid chewing memory if connections
  222. * come from many IPs */
  223. #define MAX_UNAUTH_CLIENTS 30
  224. /* Default maximum number of failed authentication tries (server option) */
  225. /* -T server option overrides */
  226. #define MAX_AUTH_TRIES 10
  227. /* Delay introduced before closing an unauthenticated session (seconds).
  228. Disabled by default, can be set to say 30 seconds to reduce the speed
  229. of password brute forcing. Note that there is a risk of denial of
  230. service by setting this */
  231. #define UNAUTH_CLOSE_DELAY 0
  232. /* The default file to store the daemon's process ID, for shutdown
  233. * scripts etc. This can be overridden with the -P flag.
  234. * Homedir is prepended if path begins with ~/
  235. */
  236. #define DROPBEAR_PIDFILE "/var/run/dropbear.pid"
  237. /* The command to invoke for xauth when using X11 forwarding.
  238. * "-q" for quiet */
  239. #define XAUTH_COMMAND "/usr/bin/xauth -q"
  240. /* If you want to enable running an sftp server (such as the one included with
  241. * OpenSSH), set the path below and set DROPBEAR_SFTPSERVER.
  242. * The sftp-server program is not provided by Dropbear itself.
  243. * Homedir is prepended if path begins with ~/
  244. */
  245. #define DROPBEAR_SFTPSERVER 1
  246. #define SFTPSERVER_PATH "/usr/libexec/sftp-server"
  247. /* This is used by the scp binary when used as a client binary. If you're
  248. * not using the Dropbear client, you'll need to change it */
  249. #define DROPBEAR_PATH_SSH_PROGRAM "/usr/bin/dbclient"
  250. /* Whether to log commands executed by a client. This only logs the
  251. * (single) command sent to the server, not what a user did in a
  252. * shell/sftp session etc. */
  253. #define LOG_COMMANDS 0
  254. /* Window size limits. These tend to be a trade-off between memory
  255. usage and network performance: */
  256. /* Size of the network receive window. This amount of memory is allocated
  257. as a per-channel receive buffer. Increasing this value can make a
  258. significant difference to network performance. 24kB was empirically
  259. chosen for a 100mbit ethernet network. The value can be altered at
  260. runtime with the -W argument. */
  261. #define DEFAULT_RECV_WINDOW 24576
  262. /* Maximum size of a received SSH data packet - this _MUST_ be >= 32768
  263. in order to interoperate with other implementations */
  264. #define RECV_MAX_PAYLOAD_LEN 32768
  265. /* Maximum size of a transmitted data packet - this can be any value,
  266. though increasing it may not make a significant difference. */
  267. #define TRANS_MAX_PAYLOAD_LEN 16384
  268. /* Ensure that data is transmitted every KEEPALIVE seconds. This can
  269. be overridden at runtime with -K. 0 disables keepalives */
  270. #define DEFAULT_KEEPALIVE 0
  271. /* If this many KEEPALIVES are sent with no packets received from the
  272. other side, exit. Not run-time configurable - if you have a need
  273. for runtime configuration please mail the Dropbear list */
  274. #define DEFAULT_KEEPALIVE_LIMIT 3
  275. /* Ensure that data is received within IDLE_TIMEOUT seconds. This can
  276. be overridden at runtime with -I. 0 disables idle timeouts */
  277. #define DEFAULT_IDLE_TIMEOUT 0
  278. /* The default path. This will often get replaced by the shell */
  279. #define DEFAULT_PATH "/usr/bin:/bin"
  280. #define DEFAULT_ROOT_PATH "/usr/sbin:/usr/bin:/sbin:/bin"
  281. #endif /* DROPBEAR_DEFAULT_OPTIONS_H_ */