2004-06-01 02:46:09 +00:00
|
|
|
/*
|
|
|
|
* 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. */
|
|
|
|
|
2015-02-24 12:43:01 +00:00
|
|
|
#ifndef DROPBEAR_RUNOPTS_H_
|
|
|
|
#define DROPBEAR_RUNOPTS_H_
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
#include "includes.h"
|
|
|
|
#include "signkey.h"
|
|
|
|
#include "buffer.h"
|
2004-08-06 16:18:01 +00:00
|
|
|
#include "auth.h"
|
2004-08-12 13:48:42 +00:00
|
|
|
#include "tcpfwd.h"
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-20 12:05:00 +00:00
|
|
|
typedef struct runopts {
|
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_SVR_REMOTETCPFWD || DROPBEAR_CLI_LOCALTCPFWD \
|
|
|
|
|| DROPBEAR_CLI_REMOTETCPFWD
|
2005-12-04 16:13:11 +00:00
|
|
|
int listen_fwd_all;
|
|
|
|
#endif
|
2007-07-25 15:44:25 +00:00
|
|
|
unsigned int recv_window;
|
2014-07-08 16:15:20 +00:00
|
|
|
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 */
|
2015-12-01 18:52:38 +00:00
|
|
|
int usingsyslog;
|
2004-07-20 12:05:00 +00:00
|
|
|
|
2009-09-11 14:02:04 +00:00
|
|
|
#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. */
|
2015-01-28 13:38:27 +00:00
|
|
|
enum {
|
|
|
|
DROPBEAR_COMPRESS_DELAYED, /* Server only */
|
|
|
|
DROPBEAR_COMPRESS_ON,
|
|
|
|
DROPBEAR_COMPRESS_OFF,
|
|
|
|
} compress_mode;
|
2009-09-11 14:02:04 +00:00
|
|
|
#endif
|
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_USER_ALGO_LIST
|
2012-05-16 16:12:42 +00:00
|
|
|
char *cipher_list;
|
|
|
|
char *mac_list;
|
|
|
|
#endif
|
2009-09-11 14:02:04 +00:00
|
|
|
|
2004-07-20 12:05:00 +00:00
|
|
|
} runopts;
|
|
|
|
|
|
|
|
extern runopts opts;
|
|
|
|
|
2013-10-31 16:13:09 +00:00
|
|
|
int readhostkey(const char * filename, sign_key * hostkey,
|
|
|
|
enum signkey_type *type);
|
2016-01-01 15:30:31 +00:00
|
|
|
void load_all_hostkeys(void);
|
2004-08-06 16:18:01 +00:00
|
|
|
|
2004-07-20 12:05:00 +00:00
|
|
|
typedef struct svr_runopts {
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
char * bannerfile;
|
2004-07-20 12:05:00 +00:00
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
int forkbg;
|
|
|
|
|
2015-12-02 14:37:20 +00:00
|
|
|
/* ports and addresses are arrays of the portcount
|
|
|
|
listening ports. strings are malloced. */
|
2004-08-23 05:27:34 +00:00
|
|
|
char *ports[DROPBEAR_MAX_PORTS];
|
2004-06-01 02:46:09 +00:00
|
|
|
unsigned int portcount;
|
2007-02-22 14:52:46 +00:00
|
|
|
char *addresses[DROPBEAR_MAX_PORTS];
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-08-12 17:18:53 +00:00
|
|
|
int inetdmode;
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
/* Flags indicating whether to use ipv4 and ipv6 */
|
|
|
|
/* not used yet
|
|
|
|
int ipv4;
|
|
|
|
int ipv6;
|
|
|
|
*/
|
|
|
|
|
2017-07-20 19:38:26 +00:00
|
|
|
#if DO_MOTD
|
2004-06-01 02:46:09 +00:00
|
|
|
/* whether to print the MOTD */
|
|
|
|
int domotd;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int norootlogin;
|
2018-02-27 13:49:10 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_GETGROUPLIST
|
|
|
|
/* restrict_group is the group name if group restriction was enabled,
|
|
|
|
NULL otherwise */
|
2018-02-26 13:17:13 +00:00
|
|
|
char *restrict_group;
|
2018-02-27 13:49:10 +00:00
|
|
|
/* restrict_group_gid is only valid if restrict_group is set */
|
2018-02-26 13:17:13 +00:00
|
|
|
gid_t restrict_group_gid;
|
2018-02-27 13:49:10 +00:00
|
|
|
#endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
|
|
|
int noauthpass;
|
|
|
|
int norootpass;
|
2013-02-12 15:52:57 +00:00
|
|
|
int allowblankpass;
|
2017-05-29 09:25:09 +00:00
|
|
|
unsigned int maxauthtries;
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_SVR_REMOTETCPFWD
|
2005-12-04 16:13:11 +00:00
|
|
|
int noremotetcp;
|
|
|
|
#endif
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_SVR_LOCALTCPFWD
|
2005-12-04 16:13:11 +00:00
|
|
|
int nolocaltcp;
|
|
|
|
#endif
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
sign_key *hostkey;
|
2013-05-03 15:07:48 +00:00
|
|
|
|
2013-11-07 15:49:37 +00:00
|
|
|
int delay_hostkey;
|
|
|
|
|
2013-05-03 15:07:48 +00:00
|
|
|
char *hostkey_files[MAX_HOSTKEYS];
|
|
|
|
int num_hostkey_files;
|
|
|
|
|
2004-06-01 02:46:09 +00:00
|
|
|
buffer * banner;
|
2006-06-07 14:10:21 +00:00
|
|
|
char * pidfile;
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2016-04-12 13:01:08 +00:00
|
|
|
char * forced_command;
|
|
|
|
|
2019-05-15 13:59:45 +00:00
|
|
|
#if DROPBEAR_PLUGIN
|
2019-05-15 13:43:57 +00:00
|
|
|
char *pubkey_plugin;
|
|
|
|
char *pubkey_plugin_options;
|
|
|
|
#endif
|
|
|
|
|
2021-08-19 15:13:41 +00:00
|
|
|
int pass_on_env;
|
|
|
|
|
2004-07-20 12:05:00 +00:00
|
|
|
} svr_runopts;
|
|
|
|
|
|
|
|
extern svr_runopts svr_opts;
|
|
|
|
|
|
|
|
void svr_getopts(int argc, char ** argv);
|
2016-01-01 15:30:31 +00:00
|
|
|
void loadhostkeys(void);
|
2004-07-20 12:05:00 +00:00
|
|
|
|
|
|
|
typedef struct cli_runopts {
|
|
|
|
|
2004-08-01 08:54:01 +00:00
|
|
|
char *progname;
|
2004-07-27 16:30:46 +00:00
|
|
|
char *remotehost;
|
2019-03-20 16:21:38 +00:00
|
|
|
const char *remoteport;
|
2004-07-27 16:30:46 +00:00
|
|
|
|
2008-09-15 14:40:30 +00:00
|
|
|
char *own_user;
|
2004-07-27 16:30:46 +00:00
|
|
|
char *username;
|
2004-07-30 03:02:19 +00:00
|
|
|
|
|
|
|
char *cmd;
|
|
|
|
int wantpty;
|
2007-02-11 08:50:21 +00:00
|
|
|
int always_accept_key;
|
2013-04-14 14:49:10 +00:00
|
|
|
int no_hostkey_check;
|
2006-06-07 15:01:20 +00:00
|
|
|
int no_cmd;
|
2006-06-07 15:47:04 +00:00
|
|
|
int backgrounded;
|
2008-09-23 15:57:26 +00:00
|
|
|
int is_subsystem;
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_PUBKEY_AUTH
|
2009-07-06 12:59:13 +00:00
|
|
|
m_list *privkeys; /* Keys to use for public-key auth */
|
2004-08-12 13:48:42 +00:00
|
|
|
#endif
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_ANYTCPFWD
|
2015-11-30 17:30:58 +00:00
|
|
|
int exit_on_fwd_failure;
|
|
|
|
#endif
|
2021-08-19 15:37:14 +00:00
|
|
|
int disable_trivial_auth;
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_REMOTETCPFWD
|
2009-07-06 12:59:13 +00:00
|
|
|
m_list * remotefwds;
|
2004-08-12 13:48:42 +00:00
|
|
|
#endif
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_LOCALTCPFWD
|
2009-07-06 12:59:13 +00:00
|
|
|
m_list * localfwds;
|
2004-08-06 16:18:01 +00:00
|
|
|
#endif
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_AGENTFWD
|
2005-07-18 14:32:52 +00:00
|
|
|
int agent_fwd;
|
|
|
|
int agent_keys_loaded; /* whether pubkeys has been populated with a
|
|
|
|
list of keys held by the agent */
|
2009-07-06 14:02:45 +00:00
|
|
|
int agent_fd; /* The agent fd is only set during authentication. Forwarded
|
|
|
|
agent sessions have their own file descriptors */
|
2004-08-06 16:18:01 +00:00
|
|
|
#endif
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_NETCAT
|
2008-09-17 14:36:49 +00:00
|
|
|
char *netcat_host;
|
|
|
|
unsigned int netcat_port;
|
|
|
|
#endif
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_CLI_PROXYCMD
|
2008-09-15 12:51:50 +00:00
|
|
|
char *proxycmd;
|
|
|
|
#endif
|
2017-05-01 02:56:15 +00:00
|
|
|
char *bind_address;
|
2018-01-25 16:27:48 +00:00
|
|
|
char *bind_port;
|
2004-07-20 12:05:00 +00:00
|
|
|
} cli_runopts;
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2004-07-20 12:05:00 +00:00
|
|
|
extern cli_runopts cli_opts;
|
|
|
|
void cli_getopts(int argc, char ** argv);
|
2004-06-01 02:46:09 +00:00
|
|
|
|
2016-05-04 13:33:40 +00:00
|
|
|
#if DROPBEAR_USER_ALGO_LIST
|
2016-01-01 15:30:31 +00:00
|
|
|
void parse_ciphers_macs(void);
|
2012-05-16 16:12:42 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-27 14:55:29 +00:00
|
|
|
void print_version(void);
|
2021-10-12 15:32:10 +00:00
|
|
|
void parse_recv_window(const char* recv_window_arg);
|
2014-07-27 14:06:26 +00:00
|
|
|
|
2015-02-24 12:43:01 +00:00
|
|
|
#endif /* DROPBEAR_RUNOPTS_H_ */
|