runopts.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * Dropbear - a SSH2 server
  3. *
  4. * Copyright (c) 2002,2003 Matt Johnston
  5. * All rights reserved.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in
  15. * all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  20. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  21. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  22. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. * SOFTWARE. */
  24. #ifndef DROPBEAR_RUNOPTS_H_
  25. #define DROPBEAR_RUNOPTS_H_
  26. #include "includes.h"
  27. #include "signkey.h"
  28. #include "buffer.h"
  29. #include "auth.h"
  30. #include "tcpfwd.h"
  31. typedef struct runopts {
  32. #if defined(ENABLE_SVR_REMOTETCPFWD) || defined(ENABLE_CLI_LOCALTCPFWD) \
  33. || defined(ENABLE_CLI_REMOTETCPFWD)
  34. int listen_fwd_all;
  35. #endif
  36. unsigned int recv_window;
  37. time_t keepalive_secs; /* Time between sending keepalives. 0 is off */
  38. time_t idle_timeout_secs; /* Exit if no traffic is sent/received in this time */
  39. int usingsyslog;
  40. #ifndef DISABLE_ZLIB
  41. /* TODO: add a commandline flag. Currently this is on by default if compression
  42. * is compiled in, but disabled for a client's non-final multihop stages. (The
  43. * intermediate stages are compressed streams, so are uncompressible. */
  44. enum {
  45. DROPBEAR_COMPRESS_DELAYED, /* Server only */
  46. DROPBEAR_COMPRESS_ON,
  47. DROPBEAR_COMPRESS_OFF,
  48. } compress_mode;
  49. #endif
  50. #ifdef ENABLE_USER_ALGO_LIST
  51. char *cipher_list;
  52. char *mac_list;
  53. #endif
  54. } runopts;
  55. extern runopts opts;
  56. int readhostkey(const char * filename, sign_key * hostkey,
  57. enum signkey_type *type);
  58. void load_all_hostkeys(void);
  59. typedef struct svr_runopts {
  60. char * bannerfile;
  61. int forkbg;
  62. /* ports and addresses are arrays of the portcount
  63. listening ports. strings are malloced. */
  64. char *ports[DROPBEAR_MAX_PORTS];
  65. unsigned int portcount;
  66. char *addresses[DROPBEAR_MAX_PORTS];
  67. int inetdmode;
  68. /* Flags indicating whether to use ipv4 and ipv6 */
  69. /* not used yet
  70. int ipv4;
  71. int ipv6;
  72. */
  73. #ifdef DO_MOTD
  74. /* whether to print the MOTD */
  75. int domotd;
  76. #endif
  77. int norootlogin;
  78. int noauthpass;
  79. int norootpass;
  80. int allowblankpass;
  81. #ifdef ENABLE_SVR_REMOTETCPFWD
  82. int noremotetcp;
  83. #endif
  84. #ifdef ENABLE_SVR_LOCALTCPFWD
  85. int nolocaltcp;
  86. #endif
  87. sign_key *hostkey;
  88. int delay_hostkey;
  89. char *hostkey_files[MAX_HOSTKEYS];
  90. int num_hostkey_files;
  91. buffer * banner;
  92. char * pidfile;
  93. } svr_runopts;
  94. extern svr_runopts svr_opts;
  95. void svr_getopts(int argc, char ** argv);
  96. void loadhostkeys(void);
  97. typedef struct cli_runopts {
  98. char *progname;
  99. char *remotehost;
  100. char *remoteport;
  101. char *own_user;
  102. char *username;
  103. char *cmd;
  104. int wantpty;
  105. int always_accept_key;
  106. int no_hostkey_check;
  107. int no_cmd;
  108. int backgrounded;
  109. int is_subsystem;
  110. #ifdef ENABLE_CLI_PUBKEY_AUTH
  111. m_list *privkeys; /* Keys to use for public-key auth */
  112. #endif
  113. #ifdef ENABLE_CLI_ANYTCPFWD
  114. int exit_on_fwd_failure;
  115. #endif
  116. #ifdef ENABLE_CLI_REMOTETCPFWD
  117. m_list * remotefwds;
  118. #endif
  119. #ifdef ENABLE_CLI_LOCALTCPFWD
  120. m_list * localfwds;
  121. #endif
  122. #ifdef ENABLE_CLI_AGENTFWD
  123. int agent_fwd;
  124. int agent_keys_loaded; /* whether pubkeys has been populated with a
  125. list of keys held by the agent */
  126. int agent_fd; /* The agent fd is only set during authentication. Forwarded
  127. agent sessions have their own file descriptors */
  128. #endif
  129. #ifdef ENABLE_CLI_NETCAT
  130. char *netcat_host;
  131. unsigned int netcat_port;
  132. #endif
  133. #ifdef ENABLE_CLI_PROXYCMD
  134. char *proxycmd;
  135. #endif
  136. } cli_runopts;
  137. extern cli_runopts cli_opts;
  138. void cli_getopts(int argc, char ** argv);
  139. #ifdef ENABLE_USER_ALGO_LIST
  140. void parse_ciphers_macs(void);
  141. #endif
  142. void print_version(void);
  143. #endif /* DROPBEAR_RUNOPTS_H_ */