readconf.h revision 76262
155682Smarkm/*
2178825Sdfr * Author: Tatu Ylonen <ylo@cs.hut.fi>
3178825Sdfr * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4178825Sdfr *                    All rights reserved
555682Smarkm * Functions for reading the configuration file.
6178825Sdfr *
7178825Sdfr * As far as I am concerned, the code I have written for this software
8178825Sdfr * can be used freely for any purpose.  Any derived versions of this
955682Smarkm * software must be clearly marked as such, and if the derived work is
10178825Sdfr * incompatible with the protocol description in the RFC file, it must be
11178825Sdfr * called by a name other than "ssh" or "Secure Shell".
1255682Smarkm */
13178825Sdfr
14178825Sdfr/* RCSID("$OpenBSD: readconf.h,v 1.30 2001/04/17 10:53:25 markus Exp $"); */
15178825Sdfr/* RCSID("$FreeBSD: head/crypto/openssh/readconf.h 76262 2001-05-04 04:14:23Z green $"); */
1655682Smarkm
17178825Sdfr#ifndef READCONF_H
18178825Sdfr#define READCONF_H
19178825Sdfr
2055682Smarkm#include "key.h"
21178825Sdfr
22178825Sdfr/* Data structure for representing a forwarding request. */
23178825Sdfr
24178825Sdfrtypedef struct {
25178825Sdfr	u_short	  port;		/* Port to forward. */
26178825Sdfr	char	 *host;		/* Host to connect. */
27178825Sdfr	u_short	  host_port;	/* Port to connect on host. */
28178825Sdfr}       Forward;
29178825Sdfr/* Data structure for representing option data. */
30178825Sdfr
31178825Sdfrtypedef struct {
3255682Smarkm	int     forward_agent;	/* Forward authentication agent. */
3355682Smarkm	int     forward_x11;	/* Forward X11 display. */
3455682Smarkm	char   *xauth_location;	/* Location for xauth program */
35102644Snectar	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
3655682Smarkm	int     use_privileged_port;	/* Don't use privileged port if false. */
37178825Sdfr	int     rhosts_authentication;	/* Try rhosts authentication. */
3855682Smarkm	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
39178825Sdfr						 * authentication. */
4055682Smarkm	int     rsa_authentication;	/* Try RSA authentication. */
41178825Sdfr	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
4255682Smarkm	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
4355682Smarkm	int     challenge_reponse_authentication;
4455682Smarkm					/* Try S/Key or TIS, authentication. */
4555682Smarkm#if defined(KRB4) || defined(KRB5)
46178825Sdfr	int     kerberos_authentication;	/* Try Kerberos
4755682Smarkm						 * authentication. */
4872445Sassar#endif
4955682Smarkm
5055682Smarkm#ifdef KRB5
5155682Smarkm	int	krb5_tgt_passing;
52178825Sdfr#endif /* KRB5 */
5355682Smarkm
5472445Sassar#ifdef AFS
5555682Smarkm	int     krb4_tgt_passing;	/* Try Kerberos v4 tgt passing. */
5655682Smarkm	int     afs_token_passing;	/* Try AFS token passing. */
5755682Smarkm#endif
58178825Sdfr	int     password_authentication;	/* Try password
5955682Smarkm						 * authentication. */
6055682Smarkm	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
6155682Smarkm	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
6255682Smarkm	int     fallback_to_rsh;/* Use rsh if cannot connect with ssh. */
63178825Sdfr	int     use_rsh;	/* Always use rsh (don\'t try ssh). */
64178825Sdfr	int     batch_mode;	/* Batch mode: do not ask for passwords. */
65178825Sdfr	int     check_host_ip;	/* Also keep track of keys for IP address */
66178825Sdfr	int     strict_host_key_checking;	/* Strict host key checking. */
67178825Sdfr	int     compression;	/* Compress packets in both directions. */
68178825Sdfr	int     compression_level;	/* Compression level 1 (fast) to 9
69178825Sdfr					 * (best). */
7055682Smarkm	int     keepalives;	/* Set SO_KEEPALIVE. */
7155682Smarkm	LogLevel log_level;	/* Level for logging. */
72178825Sdfr
7390926Snectar	int     port;		/* Port to connect. */
74178825Sdfr	int     connection_attempts;	/* Max attempts (seconds) before
75178825Sdfr					 * giving up */
7690926Snectar	int     number_of_password_prompts;	/* Max number of password
7790926Snectar						 * prompts. */
78178825Sdfr	int     cipher;		/* Cipher to use. */
79178825Sdfr	char   *ciphers;	/* SSH2 ciphers in order of preference. */
80178825Sdfr	char   *macs;		/* SSH2 macs in order of preference. */
81178825Sdfr	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
82178825Sdfr	int	protocol;	/* Protocol in order of preference. */
83178825Sdfr	char   *hostname;	/* Real host to connect. */
8455682Smarkm	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
8590926Snectar	char   *proxy_command;	/* Proxy command for connecting the host. */
86178825Sdfr	char   *user;		/* User to log in as. */
8790926Snectar	int     escape_char;	/* Escape character; -2 = none */
8890926Snectar
8990926Snectar	char   *system_hostfile;/* Path for /etc/ssh_known_hosts. */
9055682Smarkm	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
91102644Snectar	char   *system_hostfile2;
9255682Smarkm	char   *user_hostfile2;
9355682Smarkm	char   *preferred_authentications;
9455682Smarkm
9555682Smarkm	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
96178825Sdfr	char   *identity_files[SSH_MAX_IDENTITY_FILES];
9755682Smarkm	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
9855682Smarkm
99	/* Local TCP/IP forward requests. */
100	int     num_local_forwards;
101	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
102
103	/* Remote TCP/IP forward requests. */
104	int     num_remote_forwards;
105	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
106}       Options;
107
108
109/*
110 * Initializes options to special values that indicate that they have not yet
111 * been set.  Read_config_file will only set options with this value. Options
112 * are processed in the following order: command line, user config file,
113 * system config file.  Last, fill_default_options is called.
114 */
115void    initialize_options(Options * options);
116
117/*
118 * Called after processing other sources of option data, this fills those
119 * options for which no value has been specified with their default values.
120 */
121void    fill_default_options(Options * options);
122
123/*
124 * Processes a single option line as used in the configuration files. This
125 * only sets those values that have not already been set. Returns 0 for legal
126 * options
127 */
128int
129process_config_line(Options * options, const char *host,
130    char *line, const char *filename, int linenum,
131    int *activep);
132
133/*
134 * Reads the config file and modifies the options accordingly.  Options
135 * should already be initialized before this call.  This never returns if
136 * there is an error.  If the file does not exist, this returns immediately.
137 */
138void
139read_config_file(const char *filename, const char *host,
140    Options * options);
141
142/*
143 * Adds a local TCP/IP port forward to options.  Never returns if there is an
144 * error.
145 */
146void
147add_local_forward(Options * options, u_short port, const char *host,
148    u_short host_port);
149
150/*
151 * Adds a remote TCP/IP port forward to options.  Never returns if there is
152 * an error.
153 */
154void
155add_remote_forward(Options * options, u_short port, const char *host,
156    u_short host_port);
157
158#endif				/* READCONF_H */
159