1 /* $OpenBSD: readconf.h,v 1.101 2014/02/23 20:11:36 djm Exp $ */
5 * Author: Tatu Ylonen <ylo@cs.hut.fi>
6 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
8 * Functions for reading the configuration file.
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".
20 /* Data structure for representing a forwarding request. */
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 */
30 /* Data structure for representing option data. */
32 #define MAX_SEND_ENV 256
33 #define SSH_MAX_HOSTS_FILES 32
34 #define MAX_CANON_DOMAINS 32
36 struct allowed_cname {
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
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
61 int kbd_interactive_authentication; /* Try keyboard-interactive auth. */
62 char *kbd_interactive_devices; /* Keyboard-interactive auth devices. */
63 int batch_mode; /* Batch mode: do not ask for passwords. */
64 int check_host_ip; /* Also keep track of keys for IP address */
65 int strict_host_key_checking; /* Strict host key checking. */
66 int compression; /* Compress packets in both directions. */
67 int compression_level; /* Compression level 1 (fast) to 9
69 int tcp_keep_alive; /* Set SO_KEEPALIVE. */
70 int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */
71 int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */
72 LogLevel log_level; /* Level for logging. */
74 int port; /* Port to connect. */
76 int connection_attempts; /* Max attempts (seconds) before
78 int connection_timeout; /* Max time (seconds) before
79 * aborting connection attempt */
80 int number_of_password_prompts; /* Max number of password
82 int cipher; /* Cipher to use. */
83 char *ciphers; /* SSH2 ciphers in order of preference. */
84 char *macs; /* SSH2 macs in order of preference. */
85 char *hostkeyalgorithms; /* SSH2 server key types in order of preference. */
86 char *kex_algorithms; /* SSH2 kex methods in order of preference. */
87 int protocol; /* Protocol in order of preference. */
88 char *hostname; /* Real host to connect. */
89 char *host_key_alias; /* hostname alias for .ssh/known_hosts */
90 char *proxy_command; /* Proxy command for connecting the host. */
91 char *user; /* User to log in as. */
92 int escape_char; /* Escape character; -2 = none */
94 u_int num_system_hostfiles; /* Paths for /etc/ssh/ssh_known_hosts */
95 char *system_hostfiles[SSH_MAX_HOSTS_FILES];
96 u_int num_user_hostfiles; /* Path for $HOME/.ssh/known_hosts */
97 char *user_hostfiles[SSH_MAX_HOSTS_FILES];
98 char *preferred_authentications;
99 char *bind_address; /* local socket address for connection to sshd */
100 char *pkcs11_provider; /* PKCS#11 provider */
101 int verify_host_key_dns; /* Verify host key using DNS */
103 int num_identity_files; /* Number of files for RSA/DSA identities. */
104 char *identity_files[SSH_MAX_IDENTITY_FILES];
105 int identity_file_userprovided[SSH_MAX_IDENTITY_FILES];
106 Key *identity_keys[SSH_MAX_IDENTITY_FILES];
108 /* Local TCP/IP forward requests. */
109 int num_local_forwards;
110 Forward *local_forwards;
112 /* Remote TCP/IP forward requests. */
113 int num_remote_forwards;
114 Forward *remote_forwards;
115 int clear_forwardings;
117 int enable_ssh_keysign;
120 int no_host_authentication_for_localhost;
122 int server_alive_interval;
123 int server_alive_count_max;
126 char *send_env[MAX_SEND_ENV];
130 int control_persist; /* ControlPersist flag */
131 int control_persist_timeout; /* ControlPersist timeout (seconds) */
133 int hash_known_hosts;
135 int tun_open; /* tun(4) */
136 int tun_local; /* force tun device (optional) */
137 int tun_remote; /* force tun device (optional) */
140 int permit_local_command;
147 int proxy_use_fdpass;
149 int num_canonical_domains;
150 char *canonical_domains[MAX_CANON_DOMAINS];
151 int canonicalize_hostname;
152 int canonicalize_max_dots;
153 int canonicalize_fallback_local;
154 int num_permitted_cnames;
155 struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS];
157 char *ignored_unknown; /* Pattern list of unknown tokens to ignore */
159 char *version_addendum; /* Appended to SSH banner */
161 int hpn_disabled; /* Switch to disable HPN buffer management. */
162 int hpn_buffer_size; /* User definable size for HPN buffer
164 int tcp_rcv_buf_poll; /* Option to poll recv buf every window
166 int tcp_rcv_buf; /* User switch to set tcp recv buffer. */
168 #ifdef NONE_CIPHER_ENABLED
169 int none_enabled; /* Allow none to be used */
170 int none_switch; /* Use none cipher */
174 #define SSH_CANONICALISE_NO 0
175 #define SSH_CANONICALISE_YES 1
176 #define SSH_CANONICALISE_ALWAYS 2
178 #define SSHCTL_MASTER_NO 0
179 #define SSHCTL_MASTER_YES 1
180 #define SSHCTL_MASTER_AUTO 2
181 #define SSHCTL_MASTER_ASK 3
182 #define SSHCTL_MASTER_AUTO_ASK 4
184 #define REQUEST_TTY_AUTO 0
185 #define REQUEST_TTY_NO 1
186 #define REQUEST_TTY_YES 2
187 #define REQUEST_TTY_FORCE 3
189 #define SSHCONF_CHECKPERM 1 /* check permissions on config file */
190 #define SSHCONF_USERCONF 2 /* user provided config file not system */
192 void initialize_options(Options *);
193 void fill_default_options(Options *);
194 void fill_default_options_for_canonicalization(Options *);
195 int process_config_line(Options *, struct passwd *, const char *, char *,
196 const char *, int, int *, int);
197 int read_config_file(const char *, struct passwd *, const char *,
199 int parse_forward(Forward *, const char *, int, int);
200 int default_ssh_port(void);
201 int option_clear_or_none(const char *);
203 void add_local_forward(Options *, const Forward *);
204 void add_remote_forward(Options *, const Forward *);
205 void add_identity_file(Options *, const char *, const char *, int);
207 #endif /* READCONF_H */