1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
/*
* Dropbear - a SSH2 server
*
* Copyright (c) 2002,2003 Matt Johnston
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. */
#ifndef DROPBEAR_RUNOPTS_H_
#define DROPBEAR_RUNOPTS_H_
#include "includes.h"
#include "signkey.h"
#include "buffer.h"
#include "auth.h"
#include "tcpfwd.h"
typedef struct runopts {
int disable_ip_tos;
#if DROPBEAR_SVR_REMOTETCPFWD || DROPBEAR_CLI_LOCALTCPFWD \
|| DROPBEAR_CLI_REMOTETCPFWD
int listen_fwd_all;
#endif
unsigned int recv_window;
time_t keepalive_secs; /* Time between sending keepalives. 0 is off */
time_t idle_timeout_secs; /* Exit if no traffic is sent/received in this time */
int usingsyslog;
#ifndef DISABLE_ZLIB
/* TODO: add a commandline flag. Currently this is on by default if compression
* is compiled in, but disabled for a client's non-final multihop stages. (The
* intermediate stages are compressed streams, so are uncompressible. */
enum {
DROPBEAR_COMPRESS_DELAYED, /* Server only */
DROPBEAR_COMPRESS_ON,
DROPBEAR_COMPRESS_OFF,
} compress_mode;
#endif
#if DROPBEAR_USER_ALGO_LIST
char *cipher_list;
char *mac_list;
#endif
} runopts;
extern runopts opts;
int readhostkey(const char * filename, sign_key * hostkey,
enum signkey_type *type);
void load_all_hostkeys(void);
typedef struct svr_runopts {
char * bannerfile;
int forkbg;
/* ports and addresses are arrays of the portcount
listening ports. strings are malloced. */
char *ports[DROPBEAR_MAX_PORTS];
unsigned int portcount;
char *addresses[DROPBEAR_MAX_PORTS];
int inetdmode;
/* Hidden "-2 childpipe_fd" flag indicates it's re-executing itself,
stores the childpipe preauth file descriptor. Set to -1 otherwise. */
int reexec_childpipe;
/* Flags indicating whether to use ipv4 and ipv6 */
/* not used yet
int ipv4;
int ipv6;
*/
#if DO_MOTD
/* whether to print the MOTD */
int domotd;
#endif
int norootlogin;
#ifdef HAVE_GETGROUPLIST
/* restrict_group is the group name if group restriction was enabled,
NULL otherwise */
char *restrict_group;
/* restrict_group_gid is only valid if restrict_group is set */
gid_t restrict_group_gid;
#endif
int noauthpass;
int norootpass;
int allowblankpass;
int multiauthmethod;
unsigned int maxauthtries;
#if DROPBEAR_SVR_REMOTETCPFWD
int noremotetcp;
#endif
#if DROPBEAR_SVR_LOCALTCPFWD
int nolocaltcp;
#endif
sign_key *hostkey;
int delay_hostkey;
char *hostkey_files[MAX_HOSTKEYS];
int num_hostkey_files;
buffer * banner;
char * pidfile;
char * forced_command;
#if DROPBEAR_PLUGIN
/* malloced */
char *pubkey_plugin;
/* points into pubkey_plugin */
char *pubkey_plugin_options;
#endif
int pass_on_env;
} svr_runopts;
extern svr_runopts svr_opts;
void svr_getopts(int argc, char ** argv);
void loadhostkeys(void);
typedef struct cli_runopts {
char *progname;
char *remotehost;
const char *remoteport;
char *own_user;
char *username;
char *cmd;
int wantpty;
int always_accept_key;
int no_hostkey_check;
int no_cmd;
int quiet;
int backgrounded;
int is_subsystem;
#if DROPBEAR_CLI_PUBKEY_AUTH
m_list *privkeys; /* Keys to use for public-key auth */
#endif
#if DROPBEAR_CLI_ANYTCPFWD
int exit_on_fwd_failure;
#endif
int disable_trivial_auth;
#if DROPBEAR_CLI_REMOTETCPFWD
m_list * remotefwds;
#endif
#if DROPBEAR_CLI_LOCALTCPFWD
m_list * localfwds;
#endif
#if DROPBEAR_CLI_AGENTFWD
int agent_fwd;
int agent_keys_loaded; /* whether pubkeys has been populated with a
list of keys held by the agent */
int agent_fd; /* The agent fd is only set during authentication. Forwarded
agent sessions have their own file descriptors */
#endif
#if DROPBEAR_CLI_NETCAT
char *netcat_host;
unsigned int netcat_port;
#endif
#if DROPBEAR_CLI_PROXYCMD
/* A proxy command to run via the user's shell */
char *proxycmd;
#endif
#if DROPBEAR_CLI_MULTIHOP
/* Similar to proxycmd, but is arguments for execve(), not shell */
char **proxyexec;
#endif
char *bind_address;
char *bind_port;
} cli_runopts;
extern cli_runopts cli_opts;
void cli_getopts(int argc, char ** argv);
#if DROPBEAR_USER_ALGO_LIST
void parse_ciphers_macs(void);
#endif
void print_version(void);
void parse_recv_window(const char* recv_window_arg);
int split_address_port(const char* spec, char **first, char ** second);
#endif /* DROPBEAR_RUNOPTS_H_ */
|