sysoptions.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. /*******************************************************************
  2. * You shouldn't edit this file unless you know you need to.
  3. * This file is only included from options.h
  4. *******************************************************************/
  5. #ifndef DROPBEAR_VERSION
  6. #define DROPBEAR_VERSION "2017.75"
  7. #endif
  8. #define LOCAL_IDENT "SSH-2.0-dropbear_" DROPBEAR_VERSION
  9. #define PROGNAME "dropbear"
  10. /* Spec recommends after one hour or 1 gigabyte of data. One hour
  11. * is a bit too verbose, so we try 8 hours */
  12. #ifndef KEX_REKEY_TIMEOUT
  13. #define KEX_REKEY_TIMEOUT (3600 * 8)
  14. #endif
  15. #ifndef KEX_REKEY_DATA
  16. #define KEX_REKEY_DATA (1<<30) /* 2^30 == 1GB, this value must be < INT_MAX */
  17. #endif
  18. /* Close connections to clients which haven't authorised after AUTH_TIMEOUT */
  19. #ifndef AUTH_TIMEOUT
  20. #define AUTH_TIMEOUT 300 /* we choose 5 minutes */
  21. #endif
  22. /* A client should try and send an initial key exchange packet guessing
  23. * the algorithm that will match - saves a round trip connecting, has little
  24. * overhead if the guess was "wrong". */
  25. #define USE_KEX_FIRST_FOLLOWS
  26. /* Use protocol extension to allow "first follows" to succeed more frequently.
  27. * This is currently Dropbear-specific but will gracefully fallback when connecting
  28. * to other implementations. */
  29. #define USE_KEXGUESS2
  30. /* Minimum key sizes for DSS and RSA */
  31. #ifndef MIN_DSS_KEYLEN
  32. #define MIN_DSS_KEYLEN 512
  33. #endif
  34. #ifndef MIN_RSA_KEYLEN
  35. #define MIN_RSA_KEYLEN 512
  36. #endif
  37. #define MAX_BANNER_SIZE 2000 /* this is 25*80 chars, any more is foolish */
  38. #define MAX_BANNER_LINES 20 /* How many lines the client will display */
  39. /* the number of NAME=VALUE pairs to malloc for environ, if we don't have
  40. * the clearenv() function */
  41. #define ENV_SIZE 100
  42. #define MAX_CMD_LEN 9000 /* max length of a command */
  43. #define MAX_TERM_LEN 200 /* max length of TERM name */
  44. #define MAX_HOST_LEN 254 /* max hostname len for tcp fwding */
  45. #define MAX_IP_LEN 15 /* strlen("255.255.255.255") == 15 */
  46. #define DROPBEAR_MAX_PORTS 10 /* max number of ports which can be specified,
  47. ipv4 and ipv6 don't count twice */
  48. /* Each port might have at least a v4 and a v6 address */
  49. #define MAX_LISTEN_ADDR (DROPBEAR_MAX_PORTS*3)
  50. #define _PATH_TTY "/dev/tty"
  51. #define _PATH_CP "/bin/cp"
  52. #define DROPBEAR_ESCAPE_CHAR '~'
  53. /* success/failure defines */
  54. #define DROPBEAR_SUCCESS 0
  55. #define DROPBEAR_FAILURE -1
  56. /* Required for pubkey auth */
  57. #if defined(ENABLE_SVR_PUBKEY_AUTH) || defined(DROPBEAR_CLIENT)
  58. #define DROPBEAR_SIGNKEY_VERIFY
  59. #endif
  60. #define SHA1_HASH_SIZE 20
  61. #define MD5_HASH_SIZE 16
  62. #define MAX_HASH_SIZE 64 /* sha512 */
  63. #define MAX_KEY_LEN 32 /* 256 bits for aes256 etc */
  64. #define MAX_IV_LEN 20 /* must be same as max blocksize, */
  65. #if defined(DROPBEAR_SHA2_512_HMAC)
  66. #define MAX_MAC_LEN 64
  67. #elif defined(DROPBEAR_SHA2_256_HMAC)
  68. #define MAX_MAC_LEN 32
  69. #else
  70. #define MAX_MAC_LEN 20
  71. #endif
  72. #if defined(DROPBEAR_ECDH) || defined (DROPBEAR_ECDSA)
  73. #define DROPBEAR_ECC
  74. /* Debian doesn't define this in system headers */
  75. #ifndef LTM_DESC
  76. #define LTM_DESC
  77. #endif
  78. #endif
  79. #ifdef DROPBEAR_ECC
  80. #define DROPBEAR_ECC_256
  81. #define DROPBEAR_ECC_384
  82. #define DROPBEAR_ECC_521
  83. #endif
  84. #ifdef DROPBEAR_ECC
  85. #define DROPBEAR_LTC_PRNG
  86. #endif
  87. /* RSA can be vulnerable to timing attacks which use the time required for
  88. * signing to guess the private key. Blinding avoids this attack, though makes
  89. * signing operations slightly slower. */
  90. #define RSA_BLINDING
  91. /* hashes which will be linked and registered */
  92. #if defined(DROPBEAR_SHA2_256_HMAC) || defined(DROPBEAR_ECC_256) || defined(DROPBEAR_CURVE25519) || DROPBEAR_DH_GROUP14
  93. #define DROPBEAR_SHA256
  94. #endif
  95. #if defined(DROPBEAR_ECC_384)
  96. #define DROPBEAR_SHA384
  97. #endif
  98. /* LTC SHA384 depends on SHA512 */
  99. #if defined(DROPBEAR_SHA2_512_HMAC) || defined(DROPBEAR_ECC_521) || defined(DROPBEAR_ECC_384) || DROPBEAR_DH_GROUP16
  100. #define DROPBEAR_SHA512
  101. #endif
  102. #if defined(DROPBEAR_MD5_HMAC)
  103. #define DROPBEAR_MD5
  104. #endif
  105. /* These are disabled in Dropbear 2016.73 by default since the spec
  106. draft-ietf-curdle-ssh-kex-sha2-02 is under development. */
  107. #define DROPBEAR_DH_GROUP14_256 0
  108. #define DROPBEAR_DH_GROUP16 0
  109. /* roughly 2x 521 bits */
  110. #define MAX_ECC_SIZE 140
  111. #define MAX_NAME_LEN 64 /* maximum length of a protocol name, isn't
  112. explicitly specified for all protocols (just
  113. for algos) but seems valid */
  114. #define MAX_PROPOSED_ALGO 20
  115. /* size/count limits */
  116. /* From transport rfc */
  117. #define MIN_PACKET_LEN 16
  118. #define RECV_MAX_PACKET_LEN (MAX(35000, ((RECV_MAX_PAYLOAD_LEN)+100)))
  119. /* for channel code */
  120. #define TRANS_MAX_WINDOW 500000000 /* 500MB is sufficient, stopping overflow */
  121. #define TRANS_MAX_WIN_INCR 500000000 /* overflow prevention */
  122. #define RECV_WINDOWEXTEND (opts.recv_window / 3) /* We send a "window extend" every
  123. RECV_WINDOWEXTEND bytes */
  124. #define MAX_RECV_WINDOW (1024*1024) /* 1 MB should be enough */
  125. #define MAX_CHANNELS 1000 /* simple mem restriction, includes each tcp/x11
  126. connection, so can't be _too_ small */
  127. #define MAX_STRING_LEN (MAX(MAX_CMD_LEN, 2400)) /* Sun SSH needs 2400 for algos,
  128. MAX_CMD_LEN is usually longer */
  129. /* For a 4096 bit DSS key, empirically determined */
  130. #define MAX_PUBKEY_SIZE 1700
  131. /* For a 4096 bit DSS key, empirically determined */
  132. #define MAX_PRIVKEY_SIZE 1700
  133. #define MAX_HOSTKEYS 3
  134. /* The maximum size of the bignum portion of the kexhash buffer */
  135. /* Sect. 8 of the transport rfc 4253, K_S + e + f + K */
  136. #define KEXHASHBUF_MAX_INTS (1700 + 130 + 130 + 130)
  137. #define DROPBEAR_MAX_SOCKS 2 /* IPv4, IPv6 are all we'll get for now. Revisit
  138. in a few years time.... */
  139. #define DROPBEAR_MAX_CLI_PASS 1024
  140. #define DROPBEAR_MAX_CLI_INTERACT_PROMPTS 80 /* The number of prompts we'll
  141. accept for keyb-interactive
  142. auth */
  143. #if defined(DROPBEAR_AES256) || defined(DROPBEAR_AES128)
  144. #define DROPBEAR_AES
  145. #endif
  146. #if defined(DROPBEAR_TWOFISH256) || defined(DROPBEAR_TWOFISH128)
  147. #define DROPBEAR_TWOFISH
  148. #endif
  149. #ifndef ENABLE_X11FWD
  150. #define DISABLE_X11FWD
  151. #endif
  152. #if defined(ENABLE_CLI_REMOTETCPFWD) || defined(ENABLE_CLI_LOCALTCPFWD)
  153. #define ENABLE_CLI_ANYTCPFWD
  154. #endif
  155. #if defined(ENABLE_CLI_LOCALTCPFWD) || defined(ENABLE_SVR_REMOTETCPFWD)
  156. #define DROPBEAR_TCP_ACCEPT
  157. #endif
  158. #if defined(ENABLE_CLI_REMOTETCPFWD) || defined(ENABLE_CLI_LOCALTCPFWD) || \
  159. defined(ENABLE_SVR_REMOTETCPFWD) || defined(ENABLE_SVR_LOCALTCPFWD) || \
  160. defined(ENABLE_SVR_AGENTFWD) || defined(ENABLE_X11FWD)
  161. #define USING_LISTENERS
  162. #endif
  163. #if defined(ENABLE_CLI_NETCAT) && defined(ENABLE_CLI_PROXYCMD)
  164. #define ENABLE_CLI_MULTIHOP
  165. #endif
  166. #if defined(ENABLE_CLI_AGENTFWD) || defined(DROPBEAR_PRNGD_SOCKET)
  167. #define ENABLE_CONNECT_UNIX
  168. #endif
  169. #if defined(DROPBEAR_CLIENT) || defined(ENABLE_SVR_PUBKEY_AUTH)
  170. #define DROPBEAR_KEY_LINES /* ie we're using authorized_keys or known_hosts */
  171. #endif
  172. /* Changing this is inadvisable, it appears to have problems
  173. * with flushing compressed data */
  174. #define DROPBEAR_ZLIB_MEM_LEVEL 8
  175. #if defined(ENABLE_SVR_PASSWORD_AUTH) && defined(ENABLE_SVR_PAM_AUTH)
  176. #error "You can't turn on PASSWORD and PAM auth both at once. Fix it in options.h"
  177. #endif
  178. /* We use dropbear_client and dropbear_server as shortcuts to avoid redundant
  179. * code, if we're just compiling as client or server */
  180. #if defined(DROPBEAR_SERVER) && defined(DROPBEAR_CLIENT)
  181. #define IS_DROPBEAR_SERVER (ses.isserver == 1)
  182. #define IS_DROPBEAR_CLIENT (ses.isserver == 0)
  183. #elif defined(DROPBEAR_SERVER)
  184. #define IS_DROPBEAR_SERVER 1
  185. #define IS_DROPBEAR_CLIENT 0
  186. #elif defined(DROPBEAR_CLIENT)
  187. #define IS_DROPBEAR_SERVER 0
  188. #define IS_DROPBEAR_CLIENT 1
  189. #else
  190. /* Just building key utils? */
  191. #define IS_DROPBEAR_SERVER 0
  192. #define IS_DROPBEAR_CLIENT 0
  193. #endif /* neither DROPBEAR_SERVER nor DROPBEAR_CLIENT */
  194. #ifndef HAVE_FORK
  195. #define USE_VFORK
  196. #endif /* don't HAVE_FORK */
  197. #if MAX_UNAUTH_CLIENTS > MAX_CHANNELS
  198. #define DROPBEAR_LISTEN_BACKLOG MAX_UNAUTH_CLIENTS
  199. #else
  200. #define DROPBEAR_LISTEN_BACKLOG MAX_CHANNELS
  201. #endif
  202. /* free memory before exiting */
  203. #define DROPBEAR_CLEANUP
  204. /* Use this string since some implementations might special-case it */
  205. #define DROPBEAR_KEEPALIVE_STRING "keepalive@openssh.com"
  206. /* Linux will attempt TCP fast open, falling back if not supported by the kernel.
  207. * Currently server is enabled but client is disabled by default until there
  208. * is further compatibility testing */
  209. #ifdef __linux__
  210. #define DROPBEAR_SERVER_TCP_FAST_OPEN
  211. /* #define DROPBEAR_CLIENT_TCP_FAST_OPEN */
  212. #endif
  213. /* no include guard for this file */