xref: /titanic_44/usr/src/cmd/ssh/include/readconf.h (revision 442d23f49355a5d0694c758975be57af39f91a61)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Author: Tatu Ylonen <ylo@cs.hut.fi>
37c478bd9Sstevel@tonic-gate  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
47c478bd9Sstevel@tonic-gate  *                    All rights reserved
57c478bd9Sstevel@tonic-gate  * Functions for reading the configuration file.
67c478bd9Sstevel@tonic-gate  *
77c478bd9Sstevel@tonic-gate  * As far as I am concerned, the code I have written for this software
87c478bd9Sstevel@tonic-gate  * can be used freely for any purpose.  Any derived versions of this
97c478bd9Sstevel@tonic-gate  * software must be clearly marked as such, and if the derived work is
107c478bd9Sstevel@tonic-gate  * incompatible with the protocol description in the RFC file, it must be
117c478bd9Sstevel@tonic-gate  * called by a name other than "ssh" or "Secure Shell".
127c478bd9Sstevel@tonic-gate  */
137c478bd9Sstevel@tonic-gate /*
1447b374ffSjp161948  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
157c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
167c478bd9Sstevel@tonic-gate  */
177c478bd9Sstevel@tonic-gate 
18*442d23f4Sjp161948 #ifndef	_READCONF_H
19*442d23f4Sjp161948 #define	_READCONF_H
20*442d23f4Sjp161948 
21*442d23f4Sjp161948 /*	$OpenBSD: readconf.h,v 1.43 2002/06/08 05:17:01 markus Exp $	*/
22*442d23f4Sjp161948 
23*442d23f4Sjp161948 #pragma ident	"%Z%%M%	%I%	%E% SMI"
24*442d23f4Sjp161948 
25*442d23f4Sjp161948 #ifdef __cplusplus
26*442d23f4Sjp161948 extern "C" {
27*442d23f4Sjp161948 #endif
28*442d23f4Sjp161948 
29*442d23f4Sjp161948 
307c478bd9Sstevel@tonic-gate #include "key.h"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate /* Data structure for representing a forwarding request. */
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate typedef struct {
357c478bd9Sstevel@tonic-gate 	u_short	  port;		/* Port to forward. */
367c478bd9Sstevel@tonic-gate 	char	 *host;		/* Host to connect. */
377c478bd9Sstevel@tonic-gate 	u_short	  host_port;	/* Port to connect on host. */
387c478bd9Sstevel@tonic-gate }       Forward;
397c478bd9Sstevel@tonic-gate /* Data structure for representing option data. */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate typedef struct {
427c478bd9Sstevel@tonic-gate 	int     forward_agent;	/* Forward authentication agent. */
437c478bd9Sstevel@tonic-gate 	int     forward_x11;	/* Forward X11 display. */
44383a1232Sjp161948 	int     forward_x11_trusted;	/* Trust Forward X11 display. */
457c478bd9Sstevel@tonic-gate 	char   *xauth_location;	/* Location for xauth program */
467c478bd9Sstevel@tonic-gate 	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
477c478bd9Sstevel@tonic-gate 	int     use_privileged_port;	/* Don't use privileged port if false. */
487c478bd9Sstevel@tonic-gate 	int     rhosts_authentication;	/* Try rhosts authentication. */
497c478bd9Sstevel@tonic-gate 	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
507c478bd9Sstevel@tonic-gate 						 * authentication. */
517c478bd9Sstevel@tonic-gate 	int     rsa_authentication;	/* Try RSA authentication. */
527c478bd9Sstevel@tonic-gate 	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
537c478bd9Sstevel@tonic-gate 	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
547c478bd9Sstevel@tonic-gate 	int     challenge_response_authentication;
557c478bd9Sstevel@tonic-gate 	int	fallback_to_rsh; /* Use rsh if cannot connect with ssh.  */
567c478bd9Sstevel@tonic-gate 	int	use_rsh;	/* Always use rsh(don\'t try ssh). */
577c478bd9Sstevel@tonic-gate 					/* Try S/Key or TIS, authentication. */
587c478bd9Sstevel@tonic-gate #if defined(KRB4) || defined(KRB5)
597c478bd9Sstevel@tonic-gate 	int     kerberos_authentication;	/* Try Kerberos authentication. */
607c478bd9Sstevel@tonic-gate #endif
617c478bd9Sstevel@tonic-gate #if defined(AFS) || defined(KRB5)
627c478bd9Sstevel@tonic-gate 	int     kerberos_tgt_passing;	/* Try Kerberos TGT passing. */
637c478bd9Sstevel@tonic-gate #endif
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate #ifdef GSSAPI
667c478bd9Sstevel@tonic-gate 	int 	gss_keyex;
677c478bd9Sstevel@tonic-gate 	int 	gss_authentication;
687c478bd9Sstevel@tonic-gate 	int	gss_deleg_creds;
697c478bd9Sstevel@tonic-gate #ifdef GSI
707c478bd9Sstevel@tonic-gate 	int	gss_globus_deleg_limited_proxy;
717c478bd9Sstevel@tonic-gate #endif /* GSI */
727c478bd9Sstevel@tonic-gate #endif /* GSSAPI */
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate #ifdef AFS
757c478bd9Sstevel@tonic-gate 	int     afs_token_passing;	/* Try AFS token passing. */
767c478bd9Sstevel@tonic-gate #endif
777c478bd9Sstevel@tonic-gate 	int     password_authentication;	/* Try password
787c478bd9Sstevel@tonic-gate 						 * authentication. */
797c478bd9Sstevel@tonic-gate 	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
807c478bd9Sstevel@tonic-gate 	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
817c478bd9Sstevel@tonic-gate 	int     batch_mode;	/* Batch mode: do not ask for passwords. */
827c478bd9Sstevel@tonic-gate 	int     check_host_ip;	/* Also keep track of keys for IP address */
837c478bd9Sstevel@tonic-gate 	int     strict_host_key_checking;	/* Strict host key checking. */
847c478bd9Sstevel@tonic-gate 	int     compression;	/* Compress packets in both directions. */
857c478bd9Sstevel@tonic-gate 	int     compression_level;	/* Compression level 1 (fast) to 9
867c478bd9Sstevel@tonic-gate 					 * (best). */
877c478bd9Sstevel@tonic-gate 	int     keepalives;	/* Set SO_KEEPALIVE. */
887c478bd9Sstevel@tonic-gate 	LogLevel log_level;	/* Level for logging. */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate 	int     port;		/* Port to connect. */
917c478bd9Sstevel@tonic-gate 	int     connection_attempts;	/* Max attempts (seconds) before
927c478bd9Sstevel@tonic-gate 					 * giving up */
9347b374ffSjp161948 	int     connection_timeout;	/* Max time (seconds) before
9447b374ffSjp161948 					 * aborting connection attempt */
957c478bd9Sstevel@tonic-gate 	int     number_of_password_prompts;	/* Max number of password
967c478bd9Sstevel@tonic-gate 						 * prompts. */
977c478bd9Sstevel@tonic-gate 	int     cipher;		/* Cipher to use. */
987c478bd9Sstevel@tonic-gate 	char   *ciphers;	/* SSH2 ciphers in order of preference. */
997c478bd9Sstevel@tonic-gate 	char   *macs;		/* SSH2 macs in order of preference. */
1007c478bd9Sstevel@tonic-gate 	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
1017c478bd9Sstevel@tonic-gate 	int	protocol;	/* Protocol in order of preference. */
1027c478bd9Sstevel@tonic-gate 	char   *hostname;	/* Real host to connect. */
1037c478bd9Sstevel@tonic-gate 	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
1047c478bd9Sstevel@tonic-gate 	char   *proxy_command;	/* Proxy command for connecting the host. */
1057c478bd9Sstevel@tonic-gate 	char   *user;		/* User to log in as. */
1067c478bd9Sstevel@tonic-gate 	int     escape_char;	/* Escape character; -2 = none */
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate 	char   *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */
1097c478bd9Sstevel@tonic-gate 	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
1107c478bd9Sstevel@tonic-gate 	char   *system_hostfile2;
1117c478bd9Sstevel@tonic-gate 	char   *user_hostfile2;
1127c478bd9Sstevel@tonic-gate 	char   *preferred_authentications;
1137c478bd9Sstevel@tonic-gate 	char   *bind_address;	/* local socket address for connection to sshd */
1147c478bd9Sstevel@tonic-gate 	char   *smartcard_device; /* Smartcard reader device */
115e5e9dedaSjp161948 	int	disable_banner;	/* Disable display of banner */
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate 	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
1187c478bd9Sstevel@tonic-gate 	char   *identity_files[SSH_MAX_IDENTITY_FILES];
1197c478bd9Sstevel@tonic-gate 	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate 	/* Local TCP/IP forward requests. */
1227c478bd9Sstevel@tonic-gate 	int     num_local_forwards;
1237c478bd9Sstevel@tonic-gate 	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate 	/* Remote TCP/IP forward requests. */
1267c478bd9Sstevel@tonic-gate 	int     num_remote_forwards;
1277c478bd9Sstevel@tonic-gate 	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
1287c478bd9Sstevel@tonic-gate 	int	clear_forwardings;
1297c478bd9Sstevel@tonic-gate 	int	no_host_authentication_for_localhost;
1301434cf01Sjp161948 	int	server_alive_interval;
1311434cf01Sjp161948 	int	server_alive_count_max;
132*442d23f4Sjp161948 
133*442d23f4Sjp161948 	int	hash_known_hosts;
1347c478bd9Sstevel@tonic-gate }       Options;
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate 
1377c478bd9Sstevel@tonic-gate void     initialize_options(Options *);
1387c478bd9Sstevel@tonic-gate void     fill_default_options(Options *);
1397c478bd9Sstevel@tonic-gate int	 read_config_file(const char *, const char *, Options *);
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate int
1427c478bd9Sstevel@tonic-gate process_config_line(Options *, const char *, char *, const char *, int, int *);
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate void	 add_local_forward(Options *, u_short, const char *, u_short);
1457c478bd9Sstevel@tonic-gate void	 add_remote_forward(Options *, u_short, const char *, u_short);
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1487c478bd9Sstevel@tonic-gate }
1497c478bd9Sstevel@tonic-gate #endif
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate #endif /* _READCONF_H */
152