xref: /onnv-gate/usr/src/cmd/ssh/include/servconf.h (revision 9139:84e06a454b4b)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * Author: Tatu Ylonen <ylo@cs.hut.fi>
30Sstevel@tonic-gate  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
40Sstevel@tonic-gate  *                    All rights reserved
50Sstevel@tonic-gate  * Definitions for server configuration data and for the functions reading it.
60Sstevel@tonic-gate  *
70Sstevel@tonic-gate  * As far as I am concerned, the code I have written for this software
80Sstevel@tonic-gate  * can be used freely for any purpose.  Any derived versions of this
90Sstevel@tonic-gate  * software must be clearly marked as such, and if the derived work is
100Sstevel@tonic-gate  * incompatible with the protocol description in the RFC file, it must be
110Sstevel@tonic-gate  * called by a name other than "ssh" or "Secure Shell".
120Sstevel@tonic-gate  */
130Sstevel@tonic-gate /*
14*9139SJan.Pechanec@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
150Sstevel@tonic-gate  * Use is subject to license terms.
160Sstevel@tonic-gate  */
170Sstevel@tonic-gate 
187574SJan.Pechanec@Sun.COM /*	$OpenBSD: servconf.h,v 1.59 2002/07/30 17:03:55 markus Exp $	*/
197574SJan.Pechanec@Sun.COM 
200Sstevel@tonic-gate #ifndef	_SERVCONF_H
210Sstevel@tonic-gate #define	_SERVCONF_H
220Sstevel@tonic-gate 
230Sstevel@tonic-gate #ifdef __cplusplus
240Sstevel@tonic-gate extern "C" {
250Sstevel@tonic-gate #endif
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #define MAX_PORTS		256	/* Max # ports. */
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #define MAX_ALLOW_USERS		256	/* Max # users on allow list. */
300Sstevel@tonic-gate #define MAX_DENY_USERS		256	/* Max # users on deny list. */
310Sstevel@tonic-gate #define MAX_ALLOW_GROUPS	256	/* Max # groups on allow list. */
320Sstevel@tonic-gate #define MAX_DENY_GROUPS		256	/* Max # groups on deny list. */
330Sstevel@tonic-gate #define MAX_SUBSYSTEMS		256	/* Max # subsystems. */
340Sstevel@tonic-gate #define MAX_HOSTKEYS		256	/* Max # hostkeys. */
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /* permit_root_login */
370Sstevel@tonic-gate #define	PERMIT_NOT_SET		-1
380Sstevel@tonic-gate #define	PERMIT_NO		0
390Sstevel@tonic-gate #define	PERMIT_FORCED_ONLY	1
400Sstevel@tonic-gate #define	PERMIT_NO_PASSWD	2
410Sstevel@tonic-gate #define	PERMIT_YES		3
420Sstevel@tonic-gate 
43*9139SJan.Pechanec@Sun.COM /* Magic name for internal sftp-server */
44*9139SJan.Pechanec@Sun.COM #define	INTERNAL_SFTP_NAME	"internal-sftp"
45*9139SJan.Pechanec@Sun.COM 
460Sstevel@tonic-gate typedef struct {
47*9139SJan.Pechanec@Sun.COM 	u_int	num_ports;
48*9139SJan.Pechanec@Sun.COM 	u_int	ports_from_cmdline;
490Sstevel@tonic-gate 	u_short ports[MAX_PORTS];	/* Port number to listen on. */
500Sstevel@tonic-gate 	char   *listen_addr;		/* Address on which the server listens. */
510Sstevel@tonic-gate 	struct addrinfo *listen_addrs;	/* Addresses on which the server listens. */
520Sstevel@tonic-gate 	char   *host_key_files[MAX_HOSTKEYS];	/* Files containing host keys. */
530Sstevel@tonic-gate 	int     num_host_key_files;     /* Number of files for host keys. */
540Sstevel@tonic-gate 	char   *pid_file;	/* Where to put our pid */
550Sstevel@tonic-gate 	int     server_key_bits;/* Size of the server key. */
560Sstevel@tonic-gate 	int     login_grace_time;	/* Disconnect if no auth in this time
570Sstevel@tonic-gate 					 * (sec). */
580Sstevel@tonic-gate 	int     key_regeneration_time;	/* Server key lifetime (seconds). */
590Sstevel@tonic-gate 	int     permit_root_login;	/* PERMIT_*, see above */
600Sstevel@tonic-gate 	int     ignore_rhosts;	/* Ignore .rhosts and .shosts. */
610Sstevel@tonic-gate 	int     ignore_user_known_hosts;	/* Ignore ~/.ssh/known_hosts
620Sstevel@tonic-gate 						 * for RhostsRsaAuth */
630Sstevel@tonic-gate 	int     print_motd;	/* If true, print /etc/motd. */
640Sstevel@tonic-gate 	int	print_lastlog;	/* If true, print lastlog */
650Sstevel@tonic-gate 	int     x11_forwarding;	/* If true, permit inet (spoofing) X11 fwd. */
660Sstevel@tonic-gate 	int     x11_display_offset;	/* What DISPLAY number to start
670Sstevel@tonic-gate 					 * searching at */
680Sstevel@tonic-gate 	int     x11_use_localhost;	/* If true, use localhost for fake X11 server. */
690Sstevel@tonic-gate 	char   *xauth_location;	/* Location of xauth program */
700Sstevel@tonic-gate 	int     strict_modes;	/* If true, require string home dir modes. */
710Sstevel@tonic-gate 	int     keepalives;	/* If true, set SO_KEEPALIVE. */
720Sstevel@tonic-gate 	char   *ciphers;	/* Supported SSH2 ciphers. */
730Sstevel@tonic-gate 	char   *macs;		/* Supported SSH2 macs. */
740Sstevel@tonic-gate 	int	protocol;	/* Supported protocol versions. */
750Sstevel@tonic-gate 	int     gateway_ports;	/* If true, allow remote connects to forwarded ports. */
760Sstevel@tonic-gate 	SyslogFacility log_facility;	/* Facility for system logging. */
770Sstevel@tonic-gate 	LogLevel log_level;	/* Level for system logging. */
780Sstevel@tonic-gate 	int     rhosts_authentication;	/* If true, permit rhosts
790Sstevel@tonic-gate 					 * authentication. */
800Sstevel@tonic-gate 	int     rhosts_rsa_authentication;	/* If true, permit rhosts RSA
810Sstevel@tonic-gate 						 * authentication. */
820Sstevel@tonic-gate 	int     hostbased_authentication;	/* If true, permit ssh2 hostbased auth */
830Sstevel@tonic-gate 	int     hostbased_uses_name_from_packet_only; /* experimental */
840Sstevel@tonic-gate 	int     rsa_authentication;	/* If true, permit RSA authentication. */
850Sstevel@tonic-gate 	int     pubkey_authentication;	/* If true, permit ssh2 pubkey authentication. */
860Sstevel@tonic-gate #ifdef GSSAPI
870Sstevel@tonic-gate 	int     gss_authentication;
880Sstevel@tonic-gate 	int     gss_keyex;
890Sstevel@tonic-gate 	int     gss_store_creds;
900Sstevel@tonic-gate 	int     gss_use_session_ccache;        /* If true, delegated credentials are
910Sstevel@tonic-gate 	                                        * stored in a session specific cache */
920Sstevel@tonic-gate 	int 	gss_cleanup_creds;	       /* If true, destroy cred cache on logout */
930Sstevel@tonic-gate #endif /* GSSAPI */
940Sstevel@tonic-gate #if defined(KRB4) || defined(KRB5)
950Sstevel@tonic-gate 	int     kerberos_authentication;	/* If true, permit Kerberos
960Sstevel@tonic-gate 						 * authentication. */
970Sstevel@tonic-gate 	int     kerberos_or_local_passwd;	/* If true, permit kerberos
980Sstevel@tonic-gate 						 * and any other password
990Sstevel@tonic-gate 						 * authentication mechanism,
1000Sstevel@tonic-gate 						 * such as SecurID or
1010Sstevel@tonic-gate 						 * /etc/passwd */
1020Sstevel@tonic-gate 	int     kerberos_ticket_cleanup;	/* If true, destroy ticket
1030Sstevel@tonic-gate 						 * file on logout. */
1040Sstevel@tonic-gate #endif
1050Sstevel@tonic-gate #if defined(AFS) || defined(KRB5)
1060Sstevel@tonic-gate 	int     kerberos_tgt_passing;	/* If true, permit Kerberos TGT
1070Sstevel@tonic-gate 					 * passing. */
1080Sstevel@tonic-gate #endif
1090Sstevel@tonic-gate #ifdef AFS
1100Sstevel@tonic-gate 	int     afs_token_passing;	/* If true, permit AFS token passing. */
1110Sstevel@tonic-gate #endif
1120Sstevel@tonic-gate 	int     password_authentication;	/* If true, permit password
1130Sstevel@tonic-gate 						 * authentication. */
1140Sstevel@tonic-gate 	int     kbd_interactive_authentication;	/* If true, permit */
1150Sstevel@tonic-gate 	int     challenge_response_authentication;
1160Sstevel@tonic-gate 	int     permit_empty_passwd;	/* If false, do not permit empty
1170Sstevel@tonic-gate 					 * passwords. */
1180Sstevel@tonic-gate 	int     permit_user_env;	/* If true, read ~/.ssh/environment */
1190Sstevel@tonic-gate 	int     use_login;	/* If true, login(1) is used */
1200Sstevel@tonic-gate 	int     compression;	/* If true, compression is allowed */
1210Sstevel@tonic-gate 	int	allow_tcp_forwarding;
122*9139SJan.Pechanec@Sun.COM 
123*9139SJan.Pechanec@Sun.COM 	u_int	num_allow_users;
1240Sstevel@tonic-gate 	char   *allow_users[MAX_ALLOW_USERS];
125*9139SJan.Pechanec@Sun.COM 	u_int	num_deny_users;
1260Sstevel@tonic-gate 	char   *deny_users[MAX_DENY_USERS];
127*9139SJan.Pechanec@Sun.COM 	u_int	num_allow_groups;
1280Sstevel@tonic-gate 	char   *allow_groups[MAX_ALLOW_GROUPS];
129*9139SJan.Pechanec@Sun.COM 	u_int	num_deny_groups;
1300Sstevel@tonic-gate 	char   *deny_groups[MAX_DENY_GROUPS];
1310Sstevel@tonic-gate 
132*9139SJan.Pechanec@Sun.COM 	u_int	num_subsystems;
1330Sstevel@tonic-gate 	char   *subsystem_name[MAX_SUBSYSTEMS];
1340Sstevel@tonic-gate 	char   *subsystem_command[MAX_SUBSYSTEMS];
135*9139SJan.Pechanec@Sun.COM 	char   *subsystem_args[MAX_SUBSYSTEMS];
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate 	int	max_startups_begin;
1380Sstevel@tonic-gate 	int	max_startups_rate;
1390Sstevel@tonic-gate 	int	max_startups;
1400Sstevel@tonic-gate 	char   *banner;			/* SSH-2 banner message */
1410Sstevel@tonic-gate 	int	verify_reverse_mapping;	/* cross-check ip and dns */
1420Sstevel@tonic-gate 	int	client_alive_interval;	/*
1430Sstevel@tonic-gate 					 * poke the client this often to
1440Sstevel@tonic-gate 					 * see if it's still there
1450Sstevel@tonic-gate 					 */
1460Sstevel@tonic-gate 	int	client_alive_count_max;	/*
1470Sstevel@tonic-gate 					 * If the client is unresponsive
1480Sstevel@tonic-gate 					 * for this many intervals above,
1490Sstevel@tonic-gate 					 * disconnect the session
1500Sstevel@tonic-gate 					 */
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate 	char   *authorized_keys_file;	/* File containing public keys */
1530Sstevel@tonic-gate 	char   *authorized_keys_file2;
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate 	int	pam_authentication_via_kbd_int;
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate 	int	max_auth_tries;
1580Sstevel@tonic-gate 	int	max_auth_tries_log;
1590Sstevel@tonic-gate 
1600Sstevel@tonic-gate 	int	max_init_auth_tries;	    /* SUNW: /etc/default/login */
1610Sstevel@tonic-gate 	int	max_init_auth_tries_log;    /* SUNW: /etc/default/login */
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate 	int	lookup_client_hostnames;
1647574SJan.Pechanec@Sun.COM 	int	use_openssl_engine;
165*9139SJan.Pechanec@Sun.COM 	char   *chroot_directory;
1660Sstevel@tonic-gate 
1670Sstevel@tonic-gate }       ServerOptions;
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate void	 initialize_server_options(ServerOptions *);
1700Sstevel@tonic-gate void	 read_server_config(ServerOptions *, const char *);
1710Sstevel@tonic-gate void	 fill_default_server_options(ServerOptions *);
1720Sstevel@tonic-gate int	 process_server_config_line(ServerOptions *, char *, const char *, int);
173*9139SJan.Pechanec@Sun.COM int	 chroot_requested(char *chroot_directory);
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate #ifdef __cplusplus
1760Sstevel@tonic-gate }
1770Sstevel@tonic-gate #endif
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate 
1800Sstevel@tonic-gate #endif	/* _SERVCONF_H */
181