123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361 |
- #ifndef DROPBEAR_VERSION
- #define DROPBEAR_VERSION "2022.82"
- #endif
- #define LOCAL_IDENT "SSH-2.0-dropbear_" DROPBEAR_VERSION
- #define PROGNAME "dropbear"
- #ifndef KEX_REKEY_TIMEOUT
- #define KEX_REKEY_TIMEOUT (3600 * 8)
- #endif
- #ifndef KEX_REKEY_DATA
- #define KEX_REKEY_DATA (1<<30)
- #endif
- #ifndef AUTH_TIMEOUT
- #define AUTH_TIMEOUT 300
- #endif
- #define DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT ((DROPBEAR_SVR_PUBKEY_AUTH) && (DROPBEAR_SVR_PUBKEY_OPTIONS))
- #if !(NON_INETD_MODE || INETD_MODE)
- #error "NON_INETD_MODE or INETD_MODE (or both) must be enabled."
- #endif
- #if defined(HAVE_FEXECVE) && DROPBEAR_REEXEC && defined(__linux__)
- #define DROPBEAR_DO_REEXEC 1
- #else
- #define DROPBEAR_DO_REEXEC 0
- #endif
- #ifndef DROPBEAR_KEX_FIRST_FOLLOWS
- #define DROPBEAR_KEX_FIRST_FOLLOWS 1
- #endif
- #ifndef DROPBEAR_KEXGUESS2
- #define DROPBEAR_KEXGUESS2 1
- #endif
- #ifndef MIN_DSS_KEYLEN
- #define MIN_DSS_KEYLEN 1024
- #endif
- #ifndef MIN_RSA_KEYLEN
- #define MIN_RSA_KEYLEN 1024
- #endif
- #define MAX_BANNER_SIZE 2050
- #define MAX_BANNER_LINES 20
- #define ENV_SIZE 100
- #define MAX_CMD_LEN 9000
- #define MAX_TERM_LEN 200
- #define MAX_HOST_LEN 254
- #define MAX_IP_LEN 15
- #define DROPBEAR_MAX_PORTS 10
- #define MAX_LISTEN_ADDR (DROPBEAR_MAX_PORTS*3)
- #define _PATH_TTY "/dev/tty"
- #define _PATH_CP "/bin/cp"
- #define DROPBEAR_ESCAPE_CHAR '~'
- #define DROPBEAR_SUCCESS 0
- #define DROPBEAR_FAILURE -1
-
- #define DROPBEAR_PASSWORD_ENV "DROPBEAR_PASSWORD"
- #define DROPBEAR_NGROUP_MAX 1024
- #define DROPBEAR_SIGNKEY_VERIFY ((DROPBEAR_SVR_PUBKEY_AUTH) || (DROPBEAR_CLIENT))
- #define DROPBEAR_MAX_PASSWORD_LEN 100
- #define SHA1_HASH_SIZE 20
- #define SHA256_HASH_SIZE 32
- #define MD5_HASH_SIZE 16
- #define MAX_HASH_SIZE 64
- #if DROPBEAR_CHACHA20POLY1305
- #define MAX_KEY_LEN 64
- #else
- #define MAX_KEY_LEN 32
- #endif
- #define MAX_IV_LEN 20
- #if DROPBEAR_SHA2_512_HMAC
- #define MAX_MAC_LEN 64
- #elif DROPBEAR_SHA2_256_HMAC
- #define MAX_MAC_LEN 32
- #else
- #define MAX_MAC_LEN 20
- #endif
- #ifndef DROPBEAR_SHA2_512_HMAC
- #define DROPBEAR_SHA2_512_HMAC 0
- #endif
- #ifndef DROPBEAR_MD5_HMAC
- #define DROPBEAR_MD5_HMAC 0
- #endif
- #define DROPBEAR_ECC ((DROPBEAR_ECDH) || (DROPBEAR_ECDSA))
- #if !defined(LTM_DESC) && (DROPBEAR_ECC)
- #define LTM_DESC
- #endif
- #define DROPBEAR_ECC_256 (DROPBEAR_ECC)
- #define DROPBEAR_ECC_384 (DROPBEAR_ECC)
- #define DROPBEAR_ECC_521 (DROPBEAR_ECC)
- #define DROPBEAR_LTC_PRNG (DROPBEAR_ECC)
- #define DROPBEAR_RSA_BLINDING 1
- #ifndef DROPBEAR_RSA_SHA1
- #define DROPBEAR_RSA_SHA1 DROPBEAR_RSA
- #endif
- #ifndef DROPBEAR_RSA_SHA256
- #define DROPBEAR_RSA_SHA256 DROPBEAR_RSA
- #endif
- #define DROPBEAR_SHA1 (DROPBEAR_RSA_SHA1 || DROPBEAR_DSS \
- || DROPBEAR_SHA1_HMAC || DROPBEAR_SHA1_96_HMAC \
- || DROPBEAR_DH_GROUP1 || DROPBEAR_DH_GROUP14_SHA1 )
- #define DROPBEAR_SHA256 1
- #define DROPBEAR_SHA384 (DROPBEAR_ECC_384)
- #define DROPBEAR_SHA512 ((DROPBEAR_SHA2_512_HMAC) || (DROPBEAR_ECC_521) \
- || (DROPBEAR_SHA384) || (DROPBEAR_DH_GROUP16) \
- || (DROPBEAR_ED25519))
- #define DROPBEAR_MD5 (DROPBEAR_MD5_HMAC)
- #define DROPBEAR_DH_GROUP14 ((DROPBEAR_DH_GROUP14_SHA256) || (DROPBEAR_DH_GROUP14_SHA1))
- #define DROPBEAR_NORMAL_DH ((DROPBEAR_DH_GROUP1) || (DROPBEAR_DH_GROUP14) || (DROPBEAR_DH_GROUP16))
- #define DROPBEAR_EXT_INFO ((DROPBEAR_RSA_SHA256) \
- && ((DROPBEAR_CLI_PUBKEY_AUTH) || (DROPBEAR_SVR_PUBKEY_AUTH)))
- #define MAX_ECC_SIZE 140
- #define MAX_NAME_LEN 64
- #define MAX_PROPOSED_ALGO 50
- #define MIN_PACKET_LEN 16
- #define RECV_MAX_PACKET_LEN (MAX(35000, ((RECV_MAX_PAYLOAD_LEN)+100)))
- #define TRANS_MAX_WINDOW 500000000
- #define TRANS_MAX_WIN_INCR 500000000
- #define RECV_WINDOWEXTEND (opts.recv_window / 3)
- #define MAX_RECV_WINDOW (10*1024*1024)
- #define MAX_CHANNELS 1000
- #define MAX_STRING_LEN (MAX(MAX_CMD_LEN, 2400))
- #define MAX_PUBKEY_SIZE 1700
- #define MAX_PRIVKEY_SIZE 1700
- #define MAX_HOSTKEYS 4
- #define KEXHASHBUF_MAX_INTS (1700 + 130 + 130 + 130)
- #define DROPBEAR_MAX_SOCKS 2
- #define DROPBEAR_MAX_CLI_PASS 1024
- #define DROPBEAR_MAX_CLI_INTERACT_PROMPTS 80
- #define DROPBEAR_AES ((DROPBEAR_AES256) || (DROPBEAR_AES128))
- #define DROPBEAR_AEAD_MODE ((DROPBEAR_CHACHA20POLY1305) || (DROPBEAR_ENABLE_GCM_MODE))
- #define DROPBEAR_CLI_ANYTCPFWD ((DROPBEAR_CLI_REMOTETCPFWD) || (DROPBEAR_CLI_LOCALTCPFWD))
- #define DROPBEAR_TCP_ACCEPT ((DROPBEAR_CLI_LOCALTCPFWD) || (DROPBEAR_SVR_REMOTETCPFWD))
- #define DROPBEAR_LISTENERS \
- ((DROPBEAR_CLI_REMOTETCPFWD) || (DROPBEAR_CLI_LOCALTCPFWD) || \
- (DROPBEAR_SVR_REMOTETCPFWD) || (DROPBEAR_SVR_LOCALTCPFWD) || \
- (DROPBEAR_SVR_AGENTFWD) || (DROPBEAR_X11FWD))
- #define DROPBEAR_CLI_MULTIHOP ((DROPBEAR_CLI_NETCAT) && (DROPBEAR_CLI_PROXYCMD))
- #define ENABLE_CONNECT_UNIX ((DROPBEAR_CLI_AGENTFWD) || (DROPBEAR_USE_PRNGD))
-
- #define DROPBEAR_KEY_LINES ((DROPBEAR_CLIENT) || (DROPBEAR_SVR_PUBKEY_AUTH))
- #define DROPBEAR_ZLIB_MEM_LEVEL 8
- #if (DROPBEAR_SVR_PASSWORD_AUTH) && (DROPBEAR_SVR_PAM_AUTH)
- #error "You can't turn on PASSWORD and PAM auth both at once. Fix it in localoptions.h"
- #endif
- #if !defined(HAVE_LIBPAM) && DROPBEAR_SVR_PAM_AUTH
- #error "DROPBEAR_SVR_PATM_AUTH requires PAM headers. Perhaps ./configure --enable-pam ?"
- #endif
- #if DROPBEAR_SVR_PASSWORD_AUTH && !HAVE_CRYPT
- #error "DROPBEAR_SVR_PASSWORD_AUTH requires `crypt()'."
- #endif
- #if !(DROPBEAR_SVR_PASSWORD_AUTH || DROPBEAR_SVR_PAM_AUTH || DROPBEAR_SVR_PUBKEY_AUTH)
- #error "At least one server authentication type must be enabled. DROPBEAR_SVR_PUBKEY_AUTH and DROPBEAR_SVR_PASSWORD_AUTH are recommended."
- #endif
- #if (DROPBEAR_PLUGIN && !DROPBEAR_SVR_PUBKEY_AUTH)
- #error "You must define DROPBEAR_SVR_PUBKEY_AUTH in order to use plugins"
- #endif
- #if !(DROPBEAR_AES128 || DROPBEAR_3DES || DROPBEAR_AES256 || DROPBEAR_CHACHA20POLY1305)
- #error "At least one encryption algorithm must be enabled. AES128 is recommended."
- #endif
- #if !(DROPBEAR_RSA || DROPBEAR_DSS || DROPBEAR_ECDSA || DROPBEAR_ED25519)
- #error "At least one hostkey or public-key algorithm must be enabled; RSA is recommended."
- #endif
- #ifndef DROPBEAR_URANDOM_DEV
- #define DROPBEAR_URANDOM_DEV "/dev/urandom"
- #endif
- #define DROPBEAR_CLI_INTERACT_AUTH (DROPBEAR_CLI_PASSWORD_AUTH)
- #if (DROPBEAR_SERVER) && (DROPBEAR_CLIENT)
- #define IS_DROPBEAR_SERVER (ses.isserver == 1)
- #define IS_DROPBEAR_CLIENT (ses.isserver == 0)
- #elif DROPBEAR_SERVER
- #define IS_DROPBEAR_SERVER 1
- #define IS_DROPBEAR_CLIENT 0
- #elif DROPBEAR_CLIENT
- #define IS_DROPBEAR_SERVER 0
- #define IS_DROPBEAR_CLIENT 1
- #else
- #define IS_DROPBEAR_SERVER 0
- #define IS_DROPBEAR_CLIENT 0
- #endif
- #ifdef HAVE_FORK
- #define DROPBEAR_VFORK 0
- #else
- #define DROPBEAR_VFORK 1
- #endif
- #ifndef DROPBEAR_LISTEN_BACKLOG
- #if MAX_UNAUTH_CLIENTS > MAX_CHANNELS
- #define DROPBEAR_LISTEN_BACKLOG MAX_UNAUTH_CLIENTS
- #else
- #define DROPBEAR_LISTEN_BACKLOG MAX_CHANNELS
- #endif
- #endif
- #define DROPBEAR_CLEANUP 1
- #define DROPBEAR_KEEPALIVE_STRING "keepalive@openssh.com"
- #ifdef __linux__
- #define DROPBEAR_SERVER_TCP_FAST_OPEN 1
- #define DROPBEAR_CLIENT_TCP_FAST_OPEN 0
- #else
- #define DROPBEAR_SERVER_TCP_FAST_OPEN 0
- #define DROPBEAR_CLIENT_TCP_FAST_OPEN 0
- #endif
- #define DROPBEAR_TRACKING_MALLOC (DROPBEAR_FUZZ)
- #if defined(__has_feature)
- # if __has_feature(memory_sanitizer)
- # define DROPBEAR_MSAN 1
- # endif
- #endif
- #ifndef DROPBEAR_MSAN
- #define DROPBEAR_MSAN 0
- #endif
|