readconf.h revision 181111
113547Sjulian/* $OpenBSD: readconf.h,v 1.74 2008/06/26 11:46:31 grunk Exp $ */
213547Sjulian
335025Sjb/*
413547Sjulian * Author: Tatu Ylonen <ylo@cs.hut.fi>
513547Sjulian * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
613547Sjulian *                    All rights reserved
713547Sjulian * Functions for reading the configuration file.
813547Sjulian *
913547Sjulian * As far as I am concerned, the code I have written for this software
1013547Sjulian * can be used freely for any purpose.  Any derived versions of this
1113547Sjulian * software must be clearly marked as such, and if the derived work is
1213547Sjulian * incompatible with the protocol description in the RFC file, it must be
1313547Sjulian * called by a name other than "ssh" or "Secure Shell".
1413547Sjulian */
1513547Sjulian
1613547Sjulian#ifndef READCONF_H
1713547Sjulian#define READCONF_H
1813547Sjulian
1913547Sjulian/* Data structure for representing a forwarding request. */
2013547Sjulian
2113547Sjuliantypedef struct {
2213547Sjulian	char	 *listen_host;		/* Host (address) to listen on. */
2313547Sjulian	u_short	  listen_port;		/* Port to forward. */
2413547Sjulian	char	 *connect_host;		/* Host to connect. */
2513547Sjulian	u_short	  connect_port;		/* Port to connect on connect_host. */
2613547Sjulian}       Forward;
2713547Sjulian/* Data structure for representing option data. */
2813547Sjulian
2913547Sjulian#define MAX_SEND_ENV	256
3013547Sjulian
3113547Sjuliantypedef struct {
3213547Sjulian	int     forward_agent;	/* Forward authentication agent. */
3350473Speter	int     forward_x11;	/* Forward X11 display. */
3413547Sjulian	int     forward_x11_trusted;	/* Trust Forward X11 display. */
3513547Sjulian	int     exit_on_forward_failure;	/* Exit if bind(2) fails for -L/-R */
3613547Sjulian	char   *xauth_location;	/* Location for xauth program */
3713547Sjulian	int     gateway_ports;	/* Allow remote connects to forwarded ports. */
3813547Sjulian	int     use_privileged_port;	/* Don't use privileged port if false. */
3913547Sjulian	int     rhosts_rsa_authentication;	/* Try rhosts with RSA
4013547Sjulian						 * authentication. */
4113547Sjulian	int     rsa_authentication;	/* Try RSA authentication. */
4213547Sjulian	int     pubkey_authentication;	/* Try ssh2 pubkey authentication. */
4313547Sjulian	int     hostbased_authentication;	/* ssh2's rhosts_rsa */
4417706Sjulian	int     challenge_response_authentication;
4517706Sjulian					/* Try S/Key or TIS, authentication. */
4644965Sjb	int     gss_authentication;	/* Try GSS authentication */
4713547Sjulian	int     gss_deleg_creds;	/* Delegate GSS credentials */
4813547Sjulian	int     password_authentication;	/* Try password
4917706Sjulian						 * authentication. */
5013547Sjulian	int     kbd_interactive_authentication; /* Try keyboard-interactive auth. */
5117706Sjulian	char	*kbd_interactive_devices; /* Keyboard-interactive auth devices. */
5217706Sjulian	int     batch_mode;	/* Batch mode: do not ask for passwords. */
5317706Sjulian	int     check_host_ip;	/* Also keep track of keys for IP address */
5417706Sjulian	int     strict_host_key_checking;	/* Strict host key checking. */
5513547Sjulian	int     compression;	/* Compress packets in both directions. */
5613547Sjulian	int     compression_level;	/* Compression level 1 (fast) to 9
5722315Sjulian					 * (best). */
5822315Sjulian	int     tcp_keep_alive;	/* Set SO_KEEPALIVE. */
5922315Sjulian	LogLevel log_level;	/* Level for logging. */
6022315Sjulian
6122315Sjulian	int     port;		/* Port to connect. */
6222315Sjulian	int     address_family;
6322315Sjulian	int     connection_attempts;	/* Max attempts (seconds) before
6422315Sjulian					 * giving up */
6522315Sjulian	int     connection_timeout;	/* Max time (seconds) before
6622315Sjulian					 * aborting connection attempt */
6722315Sjulian	int     number_of_password_prompts;	/* Max number of password
6822315Sjulian						 * prompts. */
6922315Sjulian	int     cipher;		/* Cipher to use. */
7038919Salex	char   *ciphers;	/* SSH2 ciphers in order of preference. */
7138919Salex	char   *macs;		/* SSH2 macs in order of preference. */
7238919Salex	char   *hostkeyalgorithms;	/* SSH2 server key types in order of preference. */
7338919Salex	int	protocol;	/* Protocol in order of preference. */
7438919Salex	char   *hostname;	/* Real host to connect. */
7538919Salex	char   *host_key_alias;	/* hostname alias for .ssh/known_hosts */
7653812Salfred	char   *proxy_command;	/* Proxy command for connecting the host. */
7753812Salfred	char   *user;		/* User to log in as. */
7853812Salfred	int     escape_char;	/* Escape character; -2 = none */
7953812Salfred
8053812Salfred	char   *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */
8153812Salfred	char   *user_hostfile;	/* Path for $HOME/.ssh/known_hosts. */
8253812Salfred	char   *system_hostfile2;
8353812Salfred	char   *user_hostfile2;
8453812Salfred	char   *preferred_authentications;
8517706Sjulian	char   *bind_address;	/* local socket address for connection to sshd */
8617706Sjulian	char   *smartcard_device; /* Smartcard reader device */
8717706Sjulian	int	verify_host_key_dns;	/* Verify host key using DNS */
8813547Sjulian
8917706Sjulian	int     num_identity_files;	/* Number of files for RSA/DSA identities. */
9017706Sjulian	char   *identity_files[SSH_MAX_IDENTITY_FILES];
9117706Sjulian	Key    *identity_keys[SSH_MAX_IDENTITY_FILES];
9217706Sjulian
9317706Sjulian	/* Local TCP/IP forward requests. */
9417706Sjulian	int     num_local_forwards;
9517706Sjulian	Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
9638919Salex
9738919Salex	/* Remote TCP/IP forward requests. */
9813547Sjulian	int     num_remote_forwards;
9913547Sjulian	Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION];
10017706Sjulian	int	clear_forwardings;
10117706Sjulian
10217706Sjulian	int	enable_ssh_keysign;
10317706Sjulian	int64_t rekey_limit;
10417706Sjulian	int	no_host_authentication_for_localhost;
10513547Sjulian	int	identities_only;
10617706Sjulian	int	server_alive_interval;
10717706Sjulian	int	server_alive_count_max;
10817706Sjulian
10917706Sjulian	int     num_send_env;
11017706Sjulian	char   *send_env[MAX_SEND_ENV];
11117706Sjulian
11217706Sjulian	char	*control_path;
11317706Sjulian	int	control_master;
11438919Salex
11538919Salex	int	hash_known_hosts;
11613547Sjulian
11713547Sjulian	int	tun_open;	/* tun(4) */
11817706Sjulian	int     tun_local;	/* force tun device (optional) */
11917706Sjulian	int     tun_remote;	/* force tun device (optional) */
12017706Sjulian
12117706Sjulian	char	*local_command;
12213547Sjulian	int	permit_local_command;
12317706Sjulian	int	visual_host_key;
12493032Simp
12513547Sjulian}       Options;
12613547Sjulian
12713547Sjulian#define SSHCTL_MASTER_NO	0
12813547Sjulian#define SSHCTL_MASTER_YES	1
12913547Sjulian#define SSHCTL_MASTER_AUTO	2
13017706Sjulian#define SSHCTL_MASTER_ASK	3
13117706Sjulian#define SSHCTL_MASTER_AUTO_ASK	4
13213547Sjulian
13313547Sjulianvoid     initialize_options(Options *);
13413547Sjulianvoid     fill_default_options(Options *);
13513547Sjulianint	 read_config_file(const char *, const char *, Options *, int);
13613547Sjulianint	 parse_forward(Forward *, const char *);
13713547Sjulian
13813547Sjulianint
13913547Sjulianprocess_config_line(Options *, const char *, char *, const char *, int, int *);
14013547Sjulian
14113547Sjulianvoid	 add_local_forward(Options *, const Forward *);
14213547Sjulianvoid	 add_remote_forward(Options *, const Forward *);
14317706Sjulian
14413547Sjulian#endif				/* READCONF_H */
14513547Sjulian