xref: /titanic_44/usr/src/cmd/ssh/include/readconf.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
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 2004 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     number_of_password_prompts;	/* Max number of password
93 						 * prompts. */
94 	int     cipher;		/* Cipher to use. */
95 	char   *ciphers;	/* SSH2 ciphers in order of preference. */
96 	char   *macs;		/* SSH2 macs in order of preference. */
97 	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
98 	int	protocol;	/* Protocol in order of preference. */
99 	char   *hostname;	/* Real host to connect. */
100 	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
101 	char   *proxy_command;	/* Proxy command for connecting the host. */
102 	char   *user;		/* User to log in as. */
103 	int     escape_char;	/* Escape character; -2 = none */
104 
105 	char   *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */
106 	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
107 	char   *system_hostfile2;
108 	char   *user_hostfile2;
109 	char   *preferred_authentications;
110 	char   *bind_address;	/* local socket address for connection to sshd */
111 	char   *smartcard_device; /* Smartcard reader device */
112 
113 	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
114 	char   *identity_files[SSH_MAX_IDENTITY_FILES];
115 	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
116 
117 	/* Local TCP/IP forward requests. */
118 	int     num_local_forwards;
119 	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
120 
121 	/* Remote TCP/IP forward requests. */
122 	int     num_remote_forwards;
123 	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
124 	int	clear_forwardings;
125 	int	no_host_authentication_for_localhost;
126 }       Options;
127 
128 
129 void     initialize_options(Options *);
130 void     fill_default_options(Options *);
131 int	 read_config_file(const char *, const char *, Options *);
132 
133 int
134 process_config_line(Options *, const char *, char *, const char *, int, int *);
135 
136 void	 add_local_forward(Options *, u_short, const char *, u_short);
137 void	 add_remote_forward(Options *, u_short, const char *, u_short);
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif /* _READCONF_H */
144