readconf.h revision 262566
1/* $OpenBSD: readconf.h,v 1.99 2013/10/16 22:49:38 djm Exp $ */
2/* $FreeBSD: stable/10/crypto/openssh/readconf.h 262566 2014-02-27 17:29:02Z des $ */
3
4/*
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
7 *                    All rights reserved
8 * Functions for reading the configuration file.
9 *
10 * As far as I am concerned, the code I have written for this software
11 * can be used freely for any purpose.  Any derived versions of this
12 * software must be clearly marked as such, and if the derived work is
13 * incompatible with the protocol description in the RFC file, it must be
14 * called by a name other than "ssh" or "Secure Shell".
15 */
16
17#ifndef READCONF_H
18#define READCONF_H
19
20/* Data structure for representing a forwarding request. */
21
22typedef struct {
23	char	 *listen_host;		/* Host (address) to listen on. */
24	int	  listen_port;		/* Port to forward. */
25	char	 *connect_host;		/* Host to connect. */
26	int	  connect_port;		/* Port to connect on connect_host. */
27	int	  allocated_port;	/* Dynamically allocated listen port */
28	int	  handle;		/* Handle for dynamic listen ports */
29}       Forward;
30/* Data structure for representing option data. */
31
32#define MAX_SEND_ENV		256
33#define SSH_MAX_HOSTS_FILES	32
34#define MAX_CANON_DOMAINS	32
35
36struct allowed_cname {
37	char *source_list;
38	char *target_list;
39};
40
41typedef struct {
42	int     forward_agent;	/* Forward authentication agent. */
43	int     forward_x11;	/* Forward X11 display. */
44	int     forward_x11_timeout;	/* Expiration for Cookies */
45	int     forward_x11_trusted;	/* Trust Forward X11 display. */
46	int     exit_on_forward_failure;	/* Exit if bind(2) fails for -L/-R */
47	char   *xauth_location;	/* Location for xauth program */
48	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
49	int     use_privileged_port;	/* Don't use privileged port if false. */
50	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
51						 * authentication. */
52	int     rsa_authentication;	/* Try RSA authentication. */
53	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
54	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
55	int     challenge_response_authentication;
56					/* Try S/Key or TIS, authentication. */
57	int     gss_authentication;	/* Try GSS authentication */
58	int     gss_deleg_creds;	/* Delegate GSS credentials */
59	int     password_authentication;	/* Try password
60						 * authentication. */
61	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
62	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
63	int     zero_knowledge_password_authentication;	/* Try jpake */
64	int     batch_mode;	/* Batch mode: do not ask for passwords. */
65	int     check_host_ip;	/* Also keep track of keys for IP address */
66	int     strict_host_key_checking;	/* Strict host key checking. */
67	int     compression;	/* Compress packets in both directions. */
68	int     compression_level;	/* Compression level 1 (fast) to 9
69					 * (best). */
70	int     tcp_keep_alive;	/* Set SO_KEEPALIVE. */
71	int	ip_qos_interactive;	/* IP ToS/DSCP/class for interactive */
72	int	ip_qos_bulk;		/* IP ToS/DSCP/class for bulk traffic */
73	LogLevel log_level;	/* Level for logging. */
74
75	int     port;		/* Port to connect. */
76	int     address_family;
77	int     connection_attempts;	/* Max attempts (seconds) before
78					 * giving up */
79	int     connection_timeout;	/* Max time (seconds) before
80					 * aborting connection attempt */
81	int     number_of_password_prompts;	/* Max number of password
82						 * prompts. */
83	int     cipher;		/* Cipher to use. */
84	char   *ciphers;	/* SSH2 ciphers in order of preference. */
85	char   *macs;		/* SSH2 macs in order of preference. */
86	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
87	char   *kex_algorithms;	/* SSH2 kex methods in order of preference. */
88	int	protocol;	/* Protocol in order of preference. */
89	char   *hostname;	/* Real host to connect. */
90	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
91	char   *proxy_command;	/* Proxy command for connecting the host. */
92	char   *user;		/* User to log in as. */
93	int     escape_char;	/* Escape character; -2 = none */
94
95	u_int	num_system_hostfiles;	/* Paths for /etc/ssh/ssh_known_hosts */
96	char   *system_hostfiles[SSH_MAX_HOSTS_FILES];
97	u_int	num_user_hostfiles;	/* Path for $HOME/.ssh/known_hosts */
98	char   *user_hostfiles[SSH_MAX_HOSTS_FILES];
99	char   *preferred_authentications;
100	char   *bind_address;	/* local socket address for connection to sshd */
101	char   *pkcs11_provider; /* PKCS#11 provider */
102	int	verify_host_key_dns;	/* Verify host key using DNS */
103
104	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
105	char   *identity_files[SSH_MAX_IDENTITY_FILES];
106	int    identity_file_userprovided[SSH_MAX_IDENTITY_FILES];
107	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
108
109	/* Local TCP/IP forward requests. */
110	int     num_local_forwards;
111	Forward *local_forwards;
112
113	/* Remote TCP/IP forward requests. */
114	int     num_remote_forwards;
115	Forward *remote_forwards;
116	int	clear_forwardings;
117
118	int	enable_ssh_keysign;
119	int64_t rekey_limit;
120	int	rekey_interval;
121	int	no_host_authentication_for_localhost;
122	int	identities_only;
123	int	server_alive_interval;
124	int	server_alive_count_max;
125
126	int     num_send_env;
127	char   *send_env[MAX_SEND_ENV];
128
129	char	*control_path;
130	int	control_master;
131	int     control_persist; /* ControlPersist flag */
132	int     control_persist_timeout; /* ControlPersist timeout (seconds) */
133
134	int	hash_known_hosts;
135
136	int	tun_open;	/* tun(4) */
137	int     tun_local;	/* force tun device (optional) */
138	int     tun_remote;	/* force tun device (optional) */
139
140	char	*local_command;
141	int	permit_local_command;
142	int	visual_host_key;
143
144	int	use_roaming;
145
146	int	request_tty;
147
148	int	proxy_use_fdpass;
149
150	int	num_canonical_domains;
151	char	*canonical_domains[MAX_CANON_DOMAINS];
152	int	canonicalize_hostname;
153	int	canonicalize_max_dots;
154	int	canonicalize_fallback_local;
155	int	num_permitted_cnames;
156	struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS];
157
158	char	*ignored_unknown; /* Pattern list of unknown tokens to ignore */
159
160	char   *version_addendum;	/* Appended to SSH banner */
161
162	int	hpn_disabled;	/* Switch to disable HPN buffer management. */
163	int	hpn_buffer_size;	/* User definable size for HPN buffer
164					 * window. */
165	int	tcp_rcv_buf_poll;	/* Option to poll recv buf every window
166					 * transfer. */
167	int	tcp_rcv_buf;	/* User switch to set tcp recv buffer. */
168
169#ifdef	NONE_CIPHER_ENABLED
170	int	none_enabled;	/* Allow none to be used */
171	int	none_switch;	/* Use none cipher */
172#endif
173}       Options;
174
175#define SSH_CANONICALISE_NO	0
176#define SSH_CANONICALISE_YES	1
177#define SSH_CANONICALISE_ALWAYS	2
178
179#define SSHCTL_MASTER_NO	0
180#define SSHCTL_MASTER_YES	1
181#define SSHCTL_MASTER_AUTO	2
182#define SSHCTL_MASTER_ASK	3
183#define SSHCTL_MASTER_AUTO_ASK	4
184
185#define REQUEST_TTY_AUTO	0
186#define REQUEST_TTY_NO		1
187#define REQUEST_TTY_YES		2
188#define REQUEST_TTY_FORCE	3
189
190#define SSHCONF_CHECKPERM	1  /* check permissions on config file */
191#define SSHCONF_USERCONF	2  /* user provided config file not system */
192
193void     initialize_options(Options *);
194void     fill_default_options(Options *);
195int	 process_config_line(Options *, struct passwd *, const char *, char *,
196    const char *, int, int *, int);
197int	 read_config_file(const char *, struct passwd *, const char *,
198    Options *, int);
199int	 parse_forward(Forward *, const char *, int, int);
200int	 default_ssh_port(void);
201
202void	 add_local_forward(Options *, const Forward *);
203void	 add_remote_forward(Options *, const Forward *);
204void	 add_identity_file(Options *, const char *, const char *, int);
205
206#endif				/* READCONF_H */
207