xref: /titanic_41/usr/src/cmd/ssh/include/readconf.h (revision dcd4d5928c099531751fb8dcac80b772dd0e1963)
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 	char   *xauth_location;	/* Location for xauth program */
45 	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
46 	int     use_privileged_port;	/* Don't use privileged port if false. */
47 	int     rhosts_authentication;	/* Try rhosts authentication. */
48 	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
49 						 * authentication. */
50 	int     rsa_authentication;	/* Try RSA authentication. */
51 	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
52 	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
53 	int     challenge_response_authentication;
54 	int	fallback_to_rsh; /* Use rsh if cannot connect with ssh.  */
55 	int	use_rsh;	/* Always use rsh(don\'t try ssh). */
56 					/* Try S/Key or TIS, authentication. */
57 #if defined(KRB4) || defined(KRB5)
58 	int     kerberos_authentication;	/* Try Kerberos authentication. */
59 #endif
60 #if defined(AFS) || defined(KRB5)
61 	int     kerberos_tgt_passing;	/* Try Kerberos TGT passing. */
62 #endif
63 
64 #ifdef GSSAPI
65 	int 	gss_keyex;
66 	int 	gss_authentication;
67 	int	gss_deleg_creds;
68 #ifdef GSI
69 	int	gss_globus_deleg_limited_proxy;
70 #endif /* GSI */
71 #endif /* GSSAPI */
72 
73 #ifdef AFS
74 	int     afs_token_passing;	/* Try AFS token passing. */
75 #endif
76 	int     password_authentication;	/* Try password
77 						 * authentication. */
78 	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
79 	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
80 	int     batch_mode;	/* Batch mode: do not ask for passwords. */
81 	int     check_host_ip;	/* Also keep track of keys for IP address */
82 	int     strict_host_key_checking;	/* Strict host key checking. */
83 	int     compression;	/* Compress packets in both directions. */
84 	int     compression_level;	/* Compression level 1 (fast) to 9
85 					 * (best). */
86 	int     keepalives;	/* Set SO_KEEPALIVE. */
87 	LogLevel log_level;	/* Level for logging. */
88 
89 	int     port;		/* Port to connect. */
90 	int     connection_attempts;	/* Max attempts (seconds) before
91 					 * giving up */
92 	int     connection_timeout;	/* Max time (seconds) before
93 					 * aborting connection attempt */
94 	int     number_of_password_prompts;	/* Max number of password
95 						 * prompts. */
96 	int     cipher;		/* Cipher to use. */
97 	char   *ciphers;	/* SSH2 ciphers in order of preference. */
98 	char   *macs;		/* SSH2 macs in order of preference. */
99 	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
100 	int	protocol;	/* Protocol in order of preference. */
101 	char   *hostname;	/* Real host to connect. */
102 	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
103 	char   *proxy_command;	/* Proxy command for connecting the host. */
104 	char   *user;		/* User to log in as. */
105 	int     escape_char;	/* Escape character; -2 = none */
106 
107 	char   *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */
108 	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
109 	char   *system_hostfile2;
110 	char   *user_hostfile2;
111 	char   *preferred_authentications;
112 	char   *bind_address;	/* local socket address for connection to sshd */
113 	char   *smartcard_device; /* Smartcard reader device */
114 
115 	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
116 	char   *identity_files[SSH_MAX_IDENTITY_FILES];
117 	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
118 
119 	/* Local TCP/IP forward requests. */
120 	int     num_local_forwards;
121 	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
122 
123 	/* Remote TCP/IP forward requests. */
124 	int     num_remote_forwards;
125 	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
126 	int	clear_forwardings;
127 	int	no_host_authentication_for_localhost;
128 }       Options;
129 
130 
131 void     initialize_options(Options *);
132 void     fill_default_options(Options *);
133 int	 read_config_file(const char *, const char *, Options *);
134 
135 int
136 process_config_line(Options *, const char *, char *, const char *, int, int *);
137 
138 void	 add_local_forward(Options *, u_short, const char *, u_short);
139 void	 add_remote_forward(Options *, u_short, const char *, u_short);
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif /* _READCONF_H */
146