readconf.h revision 226046
1344884Scy/* $OpenBSD: readconf.h,v 1.90 2011/05/24 07:15:47 djm Exp $ */
2275970Scy/* $FreeBSD: head/crypto/openssh/readconf.h 226046 2011-10-05 22:08:17Z des $ */
3275970Scy
4344884Scy/*
5285169Scy * Author: Tatu Ylonen <ylo@cs.hut.fi>
6275970Scy * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
7275970Scy *                    All rights reserved
8275970Scy * Functions for reading the configuration file.
9275970Scy *
10275970Scy * As far as I am concerned, the code I have written for this software
11275970Scy * can be used freely for any purpose.  Any derived versions of this
12275970Scy * software must be clearly marked as such, and if the derived work is
13275970Scy * incompatible with the protocol description in the RFC file, it must be
14275970Scy * called by a name other than "ssh" or "Secure Shell".
15275970Scy */
16275970Scy
17275970Scy#ifndef READCONF_H
18275970Scy#define READCONF_H
19285169Scy
20285169Scy/* Data structure for representing a forwarding request. */
21285169Scy
22285169Scytypedef struct {
23285169Scy	char	 *listen_host;		/* Host (address) to listen on. */
24285169Scy	int	  listen_port;		/* Port to forward. */
25285169Scy	char	 *connect_host;		/* Host to connect. */
26285169Scy	int	  connect_port;		/* Port to connect on connect_host. */
27285169Scy	int	  allocated_port;	/* Dynamically allocated listen port */
28285169Scy}       Forward;
29285169Scy/* Data structure for representing option data. */
30285169Scy
31285169Scy#define MAX_SEND_ENV		256
32285169Scy#define SSH_MAX_HOSTS_FILES	256
33285169Scy
34285169Scytypedef struct {
35285169Scy	int     forward_agent;	/* Forward authentication agent. */
36285169Scy	int     forward_x11;	/* Forward X11 display. */
37285169Scy	int     forward_x11_timeout;	/* Expiration for Cookies */
38285169Scy	int     forward_x11_trusted;	/* Trust Forward X11 display. */
39285169Scy	int     exit_on_forward_failure;	/* Exit if bind(2) fails for -L/-R */
40285169Scy	char   *xauth_location;	/* Location for xauth program */
41285169Scy	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
42285169Scy	int     use_privileged_port;	/* Don't use privileged port if false. */
43285169Scy	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
44285169Scy						 * authentication. */
45285169Scy	int     rsa_authentication;	/* Try RSA authentication. */
46285169Scy	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
47285169Scy	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
48285169Scy	int     challenge_response_authentication;
49285169Scy					/* Try S/Key or TIS, authentication. */
50285169Scy	int     gss_authentication;	/* Try GSS authentication */
51285169Scy	int     gss_deleg_creds;	/* Delegate GSS credentials */
52285169Scy	int     password_authentication;	/* Try password
53285169Scy						 * authentication. */
54285169Scy	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
55285169Scy	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
56285169Scy	int     zero_knowledge_password_authentication;	/* Try jpake */
57285169Scy	int     batch_mode;	/* Batch mode: do not ask for passwords. */
58285169Scy	int     check_host_ip;	/* Also keep track of keys for IP address */
59285169Scy	int     strict_host_key_checking;	/* Strict host key checking. */
60285169Scy	int     compression;	/* Compress packets in both directions. */
61285169Scy	int     compression_level;	/* Compression level 1 (fast) to 9
62285169Scy					 * (best). */
63285169Scy	int     tcp_keep_alive;	/* Set SO_KEEPALIVE. */
64285169Scy	int	ip_qos_interactive;	/* IP ToS/DSCP/class for interactive */
65285169Scy	int	ip_qos_bulk;		/* IP ToS/DSCP/class for bulk traffic */
66285169Scy	LogLevel log_level;	/* Level for logging. */
67285169Scy
68285169Scy	int     port;		/* Port to connect. */
69285169Scy	int     address_family;
70285169Scy	int     connection_attempts;	/* Max attempts (seconds) before
71285169Scy					 * giving up */
72285169Scy	int     connection_timeout;	/* Max time (seconds) before
73285169Scy					 * aborting connection attempt */
74275970Scy	int     number_of_password_prompts;	/* Max number of password
75275970Scy						 * prompts. */
76275970Scy	int     cipher;		/* Cipher to use. */
77275970Scy	char   *ciphers;	/* SSH2 ciphers in order of preference. */
78275970Scy	char   *macs;		/* SSH2 macs in order of preference. */
79275970Scy	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
80275970Scy	char   *kex_algorithms;	/* SSH2 kex methods in order of preference. */
81275970Scy	int	protocol;	/* Protocol in order of preference. */
82275970Scy	char   *hostname;	/* Real host to connect. */
83275970Scy	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
84275970Scy	char   *proxy_command;	/* Proxy command for connecting the host. */
85275970Scy	char   *user;		/* User to log in as. */
86275970Scy	int     escape_char;	/* Escape character; -2 = none */
87275970Scy
88275970Scy	u_int	num_system_hostfiles;	/* Paths for /etc/ssh/ssh_known_hosts */
89275970Scy	char   *system_hostfiles[SSH_MAX_HOSTS_FILES];
90275970Scy	u_int	num_user_hostfiles;	/* Path for $HOME/.ssh/known_hosts */
91275970Scy	char   *user_hostfiles[SSH_MAX_HOSTS_FILES];
92275970Scy	char   *preferred_authentications;
93275970Scy	char   *bind_address;	/* local socket address for connection to sshd */
94275970Scy	char   *pkcs11_provider; /* PKCS#11 provider */
95275970Scy	int	verify_host_key_dns;	/* Verify host key using DNS */
96282408Scy
97275970Scy	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
98275970Scy	char   *identity_files[SSH_MAX_IDENTITY_FILES];
99275970Scy	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
100275970Scy
101275970Scy	/* Local TCP/IP forward requests. */
102275970Scy	int     num_local_forwards;
103275970Scy	Forward *local_forwards;
104330106Sdelphij
105275970Scy	/* Remote TCP/IP forward requests. */
106275970Scy	int     num_remote_forwards;
107275970Scy	Forward *remote_forwards;
108275970Scy	int	clear_forwardings;
109275970Scy
110275970Scy	int	enable_ssh_keysign;
111275970Scy	int64_t rekey_limit;
112275970Scy	int	no_host_authentication_for_localhost;
113316068Sdelphij	int	identities_only;
114275970Scy	int	server_alive_interval;
115275970Scy	int	server_alive_count_max;
116275970Scy
117275970Scy	int     num_send_env;
118275970Scy	char   *send_env[MAX_SEND_ENV];
119275970Scy
120275970Scy	char	*control_path;
121275970Scy	int	control_master;
122289764Sglebius	int     control_persist; /* ControlPersist flag */
123275970Scy	int     control_persist_timeout; /* ControlPersist timeout (seconds) */
124275970Scy
125275970Scy	int	hash_known_hosts;
126285169Scy
127275970Scy	int	tun_open;	/* tun(4) */
128275970Scy	int     tun_local;	/* force tun device (optional) */
129282408Scy	int     tun_remote;	/* force tun device (optional) */
130282408Scy
131275970Scy	char	*local_command;
132275970Scy	int	permit_local_command;
133275970Scy	int	visual_host_key;
134275970Scy
135275970Scy	int	use_roaming;
136285169Scy	int	request_tty;
137275970Scy
138275970Scy	int	hpn_disabled;	/* Switch to disable HPN buffer management. */
139275970Scy	int	hpn_buffer_size;	/* User definable size for HPN buffer
140275970Scy					 * window. */
141275970Scy	int	tcp_rcv_buf_poll;	/* Option to poll recv buf every window
142275970Scy					 * transfer. */
143275970Scy	int	tcp_rcv_buf;	/* User switch to set tcp recv buffer. */
144275970Scy
145275970Scy#ifdef	NONE_CIPHER_ENABLED
146275970Scy	int	none_enabled;	/* Allow none to be used */
147275970Scy	int	none_switch;	/* Use none cipher */
148275970Scy#endif
149275970Scy}       Options;
150275970Scy
151275970Scy#define SSHCTL_MASTER_NO	0
152275970Scy#define SSHCTL_MASTER_YES	1
153275970Scy#define SSHCTL_MASTER_AUTO	2
154275970Scy#define SSHCTL_MASTER_ASK	3
155275970Scy#define SSHCTL_MASTER_AUTO_ASK	4
156275970Scy
157275970Scy#define REQUEST_TTY_AUTO	0
158275970Scy#define REQUEST_TTY_NO		1
159275970Scy#define REQUEST_TTY_YES		2
160275970Scy#define REQUEST_TTY_FORCE	3
161275970Scy
162285169Scyvoid     initialize_options(Options *);
163285169Scyvoid     fill_default_options(Options *);
164285169Scyint	 read_config_file(const char *, const char *, Options *, int);
165285169Scyint	 parse_forward(Forward *, const char *, int, int);
166285169Scy
167285169Scyint
168275970Scyprocess_config_line(Options *, const char *, char *, const char *, int, int *);
169275970Scy
170275970Scyvoid	 add_local_forward(Options *, const Forward *);
171275970Scyvoid	 add_remote_forward(Options *, const Forward *);
172275970Scy
173285169Scy#endif				/* READCONF_H */
174285169Scy