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