servconf.h revision 204917
186659Sjoe/* $OpenBSD: servconf.h,v 1.92 2010/03/04 10:36:03 djm Exp $ */
286659Sjoe
386659Sjoe/*
486659Sjoe * Author: Tatu Ylonen <ylo@cs.hut.fi>
586659Sjoe * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
686659Sjoe *                    All rights reserved
786659Sjoe * Definitions for server configuration data and for the functions reading it.
886659Sjoe *
986659Sjoe * As far as I am concerned, the code I have written for this software
1086659Sjoe * can be used freely for any purpose.  Any derived versions of this
1186659Sjoe * software must be clearly marked as such, and if the derived work is
1286659Sjoe * incompatible with the protocol description in the RFC file, it must be
1386659Sjoe * called by a name other than "ssh" or "Secure Shell".
1486659Sjoe */
1586659Sjoe
1686659Sjoe#ifndef SERVCONF_H
1786659Sjoe#define SERVCONF_H
1886659Sjoe
1986659Sjoe#define MAX_PORTS		256	/* Max # ports. */
2086659Sjoe
2186659Sjoe#define MAX_ALLOW_USERS		256	/* Max # users on allow list. */
2286659Sjoe#define MAX_DENY_USERS		256	/* Max # users on deny list. */
2386659Sjoe#define MAX_ALLOW_GROUPS	256	/* Max # groups on allow list. */
2486659Sjoe#define MAX_DENY_GROUPS		256	/* Max # groups on deny list. */
2586659Sjoe#define MAX_SUBSYSTEMS		256	/* Max # subsystems. */
2686659Sjoe#define MAX_HOSTKEYS		256	/* Max # hostkeys. */
2786659Sjoe#define MAX_HOSTCERTS		256	/* Max # host certificates. */
2886659Sjoe#define MAX_ACCEPT_ENV		256	/* Max # of env vars. */
2986659Sjoe#define MAX_MATCH_GROUPS	256	/* Max # of groups for Match. */
3086659Sjoe
3186659Sjoe/* permit_root_login */
32266559Sgavin#define	PERMIT_NOT_SET		-1
3386659Sjoe#define	PERMIT_NO		0
3486659Sjoe#define	PERMIT_FORCED_ONLY	1
3586659Sjoe#define	PERMIT_NO_PASSWD	2
3686659Sjoe#define	PERMIT_YES		3
3786659Sjoe
3886659Sjoe#define DEFAULT_AUTH_FAIL_MAX	6	/* Default for MaxAuthTries */
39238705Swblock#define DEFAULT_SESSIONS_MAX	10	/* Default for MaxSessions */
40238705Swblock
41238705Swblock/* Magic name for internal sftp-server */
42238705Swblock#define INTERNAL_SFTP_NAME	"internal-sftp"
4386659Sjoe
4486659Sjoetypedef struct {
4586659Sjoe	u_int	num_ports;
4686659Sjoe	u_int	ports_from_cmdline;
4786775Sru	int	ports[MAX_PORTS];	/* Port number to listen on. */
4886775Sru	char   *listen_addr;		/* Address on which the server listens. */
4986659Sjoe	struct addrinfo *listen_addrs;	/* Addresses on which the server listens. */
5086659Sjoe	int     address_family;		/* Address family used by the server. */
5186659Sjoe	char   *host_key_files[MAX_HOSTKEYS];	/* Files containing host keys. */
5286775Sru	int     num_host_key_files;     /* Number of files for host keys. */
5386775Sru	char   *host_cert_files[MAX_HOSTCERTS];	/* Files containing host certs. */
5486659Sjoe	int     num_host_cert_files;     /* Number of files for host certs. */
5586775Sru	char   *pid_file;	/* Where to put our pid */
5686775Sru	int     server_key_bits;/* Size of the server key. */
5786775Sru	int     login_grace_time;	/* Disconnect if no auth in this time
5886775Sru					 * (sec). */
59238705Swblock	int     key_regeneration_time;	/* Server key lifetime (seconds). */
60238705Swblock	int     permit_root_login;	/* PERMIT_*, see above */
6186659Sjoe	int     ignore_rhosts;	/* Ignore .rhosts and .shosts. */
62238705Swblock	int     ignore_user_known_hosts;	/* Ignore ~/.ssh/known_hosts
6386659Sjoe						 * for RhostsRsaAuth */
6486659Sjoe	int     print_motd;	/* If true, print /etc/motd. */
65238705Swblock	int	print_lastlog;	/* If true, print lastlog */
6686659Sjoe	int     x11_forwarding;	/* If true, permit inet (spoofing) X11 fwd. */
67238705Swblock	int     x11_display_offset;	/* What DISPLAY number to start
6886659Sjoe					 * searching at */
6986659Sjoe	int     x11_use_localhost;	/* If true, use localhost for fake X11 server. */
7086659Sjoe	char   *xauth_location;	/* Location of xauth program */
7186775Sru	int     strict_modes;	/* If true, require string home dir modes. */
72238705Swblock	int     tcp_keep_alive;	/* If true, set SO_KEEPALIVE. */
73238705Swblock	char   *ciphers;	/* Supported SSH2 ciphers. */
74238705Swblock	char   *macs;		/* Supported SSH2 macs. */
7586659Sjoe	int	protocol;	/* Supported protocol versions. */
7686659Sjoe	int     gateway_ports;	/* If true, allow remote connects to forwarded ports. */
7786659Sjoe	SyslogFacility log_facility;	/* Facility for system logging. */
7886659Sjoe	LogLevel log_level;	/* Level for system logging. */
7986659Sjoe	int     rhosts_rsa_authentication;	/* If true, permit rhosts RSA
8086775Sru						 * authentication. */
8186775Sru	int     hostbased_authentication;	/* If true, permit ssh2 hostbased auth */
8286659Sjoe	int     hostbased_uses_name_from_packet_only; /* experimental */
8386659Sjoe	int     rsa_authentication;	/* If true, permit RSA authentication. */
8486659Sjoe	int     pubkey_authentication;	/* If true, permit ssh2 pubkey authentication. */
8586659Sjoe	int     kerberos_authentication;	/* If true, permit Kerberos
8686775Sru						 * authentication. */
8786775Sru	int     kerberos_or_local_passwd;	/* If true, permit kerberos
8886775Sru						 * and any other password
8986659Sjoe						 * authentication mechanism,
9086659Sjoe						 * such as SecurID or
9186659Sjoe						 * /etc/passwd */
9286659Sjoe	int     kerberos_ticket_cleanup;	/* If true, destroy ticket
9386659Sjoe						 * file on logout. */
9486659Sjoe	int     kerberos_get_afs_token;		/* If true, try to get AFS token if
9586775Sru						 * authenticated with Kerberos. */
9686775Sru	int     gss_authentication;	/* If true, permit GSSAPI authentication */
9786659Sjoe	int     gss_cleanup_creds;	/* If true, destroy cred cache on logout */
9886659Sjoe	int     password_authentication;	/* If true, permit password
9986659Sjoe						 * authentication. */
10086659Sjoe	int     kbd_interactive_authentication;	/* If true, permit */
10186775Sru	int     challenge_response_authentication;
10286659Sjoe	int     zero_knowledge_password_authentication;
103111680Sjhay					/* If true, permit jpake auth */
104111680Sjhay	int     permit_empty_passwd;	/* If false, do not permit empty
105111680Sjhay					 * passwords. */
10686659Sjoe	int     permit_user_env;	/* If true, read ~/.ssh/environment */
107111680Sjhay	int     use_login;	/* If true, login(1) is used */
108111680Sjhay	int     compression;	/* If true, compression is allowed */
10986775Sru	int	allow_tcp_forwarding;
11086775Sru	int	allow_agent_forwarding;
11186659Sjoe	u_int num_allow_users;
11286659Sjoe	char   *allow_users[MAX_ALLOW_USERS];
11386659Sjoe	u_int num_deny_users;
11486659Sjoe	char   *deny_users[MAX_DENY_USERS];
11586659Sjoe	u_int num_allow_groups;
11686775Sru	char   *allow_groups[MAX_ALLOW_GROUPS];
11786775Sru	u_int num_deny_groups;
11886775Sru	char   *deny_groups[MAX_DENY_GROUPS];
11986775Sru
12086659Sjoe	u_int num_subsystems;
12186659Sjoe	char   *subsystem_name[MAX_SUBSYSTEMS];
12286775Sru	char   *subsystem_command[MAX_SUBSYSTEMS];
123238705Swblock	char   *subsystem_args[MAX_SUBSYSTEMS];
124238705Swblock
12586775Sru	u_int num_accept_env;
12686659Sjoe	char   *accept_env[MAX_ACCEPT_ENV];
12786659Sjoe
12886659Sjoe	int	max_startups_begin;
12986659Sjoe	int	max_startups_rate;
13086659Sjoe	int	max_startups;
13186659Sjoe	int	max_authtries;
13286775Sru	int	max_sessions;
13386775Sru	char   *banner;			/* SSH-2 banner message */
13486659Sjoe	int	use_dns;
13586775Sru	int	client_alive_interval;	/*
13686659Sjoe					 * poke the client this often to
13786775Sru					 * see if it's still there
13886659Sjoe					 */
13986659Sjoe	int	client_alive_count_max;	/*
14086775Sru					 * If the client is unresponsive
14186659Sjoe					 * for this many intervals above,
14286659Sjoe					 * disconnect the session
14386659Sjoe					 */
144120402Sjb
14586659Sjoe	char   *authorized_keys_file;	/* File containing public keys */
14686659Sjoe	char   *authorized_keys_file2;
14786659Sjoe
148120398Sjb	char   *adm_forced_command;
149120398Sjb
150120398Sjb	int	use_pam;		/* Enable auth via PAM */
15186659Sjoe
15286659Sjoe	int	permit_tun;
15386775Sru
15486659Sjoe	int	num_permitted_opens;
15586659Sjoe
15686659Sjoe	char   *chroot_directory;
157120402Sjb	char   *revoked_keys_file;
15886659Sjoe	char   *trusted_user_ca_keys;
15986775Sru}       ServerOptions;
16086659Sjoe
16186659Sjoevoid	 initialize_server_options(ServerOptions *);
16286775Sruvoid	 fill_default_server_options(ServerOptions *);
16386659Sjoeint	 process_server_config_line(ServerOptions *, char *, const char *, int,
164120402Sjb	     int *, const char *, const char *, const char *);
16586659Sjoevoid	 load_server_config(const char *, Buffer *);
16686775Sruvoid	 parse_server_config(ServerOptions *, const char *, Buffer *,
16786659Sjoe	     const char *, const char *, const char *);
16886775Sruvoid	 parse_server_match_config(ServerOptions *, const char *, const char *,
16986659Sjoe	     const char *);
170238705Swblockvoid	 copy_set_server_options(ServerOptions *, ServerOptions *, int);
17186659Sjoevoid	 dump_config(ServerOptions *);
17286659Sjoechar	*derelativise_path(const char *);
17386659Sjoe
174120398Sjb#endif				/* SERVCONF_H */
175120398Sjb