1 /* $OpenBSD: readconf.h,v 1.99 2013/10/16 22:49:38 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 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
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. */
75 int port; /* Port to connect. */
77 int connection_attempts; /* Max attempts (seconds) before
79 int connection_timeout; /* Max time (seconds) before
80 * aborting connection attempt */
81 int number_of_password_prompts; /* Max number of password
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 */
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 */
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];
109 /* Local TCP/IP forward requests. */
110 int num_local_forwards;
111 Forward *local_forwards;
113 /* Remote TCP/IP forward requests. */
114 int num_remote_forwards;
115 Forward *remote_forwards;
116 int clear_forwardings;
118 int enable_ssh_keysign;
121 int no_host_authentication_for_localhost;
123 int server_alive_interval;
124 int server_alive_count_max;
127 char *send_env[MAX_SEND_ENV];
131 int control_persist; /* ControlPersist flag */
132 int control_persist_timeout; /* ControlPersist timeout (seconds) */
134 int hash_known_hosts;
136 int tun_open; /* tun(4) */
137 int tun_local; /* force tun device (optional) */
138 int tun_remote; /* force tun device (optional) */
141 int permit_local_command;
148 int proxy_use_fdpass;
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];
158 char *ignored_unknown; /* Pattern list of unknown tokens to ignore */
160 char *version_addendum; /* Appended to SSH banner */
162 int hpn_disabled; /* Switch to disable HPN buffer management. */
163 int hpn_buffer_size; /* User definable size for HPN buffer
165 int tcp_rcv_buf_poll; /* Option to poll recv buf every window
167 int tcp_rcv_buf; /* User switch to set tcp recv buffer. */
169 #ifdef NONE_CIPHER_ENABLED
170 int none_enabled; /* Allow none to be used */
171 int none_switch; /* Use none cipher */
175 #define SSH_CANONICALISE_NO 0
176 #define SSH_CANONICALISE_YES 1
177 #define SSH_CANONICALISE_ALWAYS 2
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
185 #define REQUEST_TTY_AUTO 0
186 #define REQUEST_TTY_NO 1
187 #define REQUEST_TTY_YES 2
188 #define REQUEST_TTY_FORCE 3
190 #define SSHCONF_CHECKPERM 1 /* check permissions on config file */
191 #define SSHCONF_USERCONF 2 /* user provided config file not system */
193 void initialize_options(Options *);
194 void fill_default_options(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);
202 void add_local_forward(Options *, const Forward *);
203 void add_remote_forward(Options *, const Forward *);
204 void add_identity_file(Options *, const char *, const char *, int);
206 #endif /* READCONF_H */