xref: /titanic_41/usr/src/cmd/ssh/include/readconf.h (revision 67e96bdfbca5b789a8c03fa34eaaa6c9aec7a629)
1 /*	$OpenBSD: readconf.h,v 1.43 2002/06/08 05:17:01 markus Exp $	*/
2 
3 #ifndef	_READCONF_H
4 #define	_READCONF_H
5 
6 #pragma ident	"%Z%%M%	%I%	%E% SMI"
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 
13 /*
14  * Author: Tatu Ylonen <ylo@cs.hut.fi>
15  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
16  *                    All rights reserved
17  * Functions for reading the configuration file.
18  *
19  * As far as I am concerned, the code I have written for this software
20  * can be used freely for any purpose.  Any derived versions of this
21  * software must be clearly marked as such, and if the derived work is
22  * incompatible with the protocol description in the RFC file, it must be
23  * called by a name other than "ssh" or "Secure Shell".
24  */
25 /*
26  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 #include "key.h"
31 
32 /* Data structure for representing a forwarding request. */
33 
34 typedef struct {
35 	u_short	  port;		/* Port to forward. */
36 	char	 *host;		/* Host to connect. */
37 	u_short	  host_port;	/* Port to connect on host. */
38 }       Forward;
39 /* Data structure for representing option data. */
40 
41 typedef struct {
42 	int     forward_agent;	/* Forward authentication agent. */
43 	int     forward_x11;	/* Forward X11 display. */
44 	int     forward_x11_trusted;	/* Trust Forward X11 display. */
45 	char   *xauth_location;	/* Location for xauth program */
46 	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
47 	int     use_privileged_port;	/* Don't use privileged port if false. */
48 	int     rhosts_authentication;	/* Try rhosts authentication. */
49 	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
50 						 * authentication. */
51 	int     rsa_authentication;	/* Try RSA authentication. */
52 	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
53 	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
54 	int     challenge_response_authentication;
55 	int	fallback_to_rsh; /* Use rsh if cannot connect with ssh.  */
56 	int	use_rsh;	/* Always use rsh(don\'t try ssh). */
57 					/* Try S/Key or TIS, authentication. */
58 #if defined(KRB4) || defined(KRB5)
59 	int     kerberos_authentication;	/* Try Kerberos authentication. */
60 #endif
61 #if defined(AFS) || defined(KRB5)
62 	int     kerberos_tgt_passing;	/* Try Kerberos TGT passing. */
63 #endif
64 
65 #ifdef GSSAPI
66 	int 	gss_keyex;
67 	int 	gss_authentication;
68 	int	gss_deleg_creds;
69 #ifdef GSI
70 	int	gss_globus_deleg_limited_proxy;
71 #endif /* GSI */
72 #endif /* GSSAPI */
73 
74 #ifdef AFS
75 	int     afs_token_passing;	/* Try AFS token passing. */
76 #endif
77 	int     password_authentication;	/* Try password
78 						 * authentication. */
79 	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
80 	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
81 	int     batch_mode;	/* Batch mode: do not ask for passwords. */
82 	int     check_host_ip;	/* Also keep track of keys for IP address */
83 	int     strict_host_key_checking;	/* Strict host key checking. */
84 	int     compression;	/* Compress packets in both directions. */
85 	int     compression_level;	/* Compression level 1 (fast) to 9
86 					 * (best). */
87 	int     keepalives;	/* Set SO_KEEPALIVE. */
88 	LogLevel log_level;	/* Level for logging. */
89 
90 	int     port;		/* Port to connect. */
91 	int     connection_attempts;	/* Max attempts (seconds) before
92 					 * giving up */
93 	int     connection_timeout;	/* Max time (seconds) before
94 					 * aborting connection attempt */
95 	int     number_of_password_prompts;	/* Max number of password
96 						 * prompts. */
97 	int     cipher;		/* Cipher to use. */
98 	char   *ciphers;	/* SSH2 ciphers in order of preference. */
99 	char   *macs;		/* SSH2 macs in order of preference. */
100 	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
101 	int	protocol;	/* Protocol in order of preference. */
102 	char   *hostname;	/* Real host to connect. */
103 	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
104 	char   *proxy_command;	/* Proxy command for connecting the host. */
105 	char   *user;		/* User to log in as. */
106 	int     escape_char;	/* Escape character; -2 = none */
107 
108 	char   *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */
109 	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
110 	char   *system_hostfile2;
111 	char   *user_hostfile2;
112 	char   *preferred_authentications;
113 	char   *bind_address;	/* local socket address for connection to sshd */
114 	char   *smartcard_device; /* Smartcard reader device */
115 	int	disable_banner;	/* Disable display of banner */
116 
117 	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
118 	char   *identity_files[SSH_MAX_IDENTITY_FILES];
119 	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
120 
121 	/* Local TCP/IP forward requests. */
122 	int     num_local_forwards;
123 	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
124 
125 	/* Remote TCP/IP forward requests. */
126 	int     num_remote_forwards;
127 	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
128 	int	clear_forwardings;
129 	int	no_host_authentication_for_localhost;
130 	int	server_alive_interval;
131 	int	server_alive_count_max;
132 }       Options;
133 
134 
135 void     initialize_options(Options *);
136 void     fill_default_options(Options *);
137 int	 read_config_file(const char *, const char *, Options *);
138 
139 int
140 process_config_line(Options *, const char *, char *, const char *, int, int *);
141 
142 void	 add_local_forward(Options *, u_short, const char *, u_short);
143 void	 add_remote_forward(Options *, u_short, const char *, u_short);
144 
145 #ifdef __cplusplus
146 }
147 #endif
148 
149 #endif /* _READCONF_H */
150