1cce7d346SDag-Erling Smørgrav /* $OpenBSD: servconf.h,v 1.87 2009/01/22 10:02:34 djm Exp $ */ 2af12a3e7SDag-Erling Smørgrav 3511b41d2SMark Murray /* 4511b41d2SMark Murray * Author: Tatu Ylonen <ylo@cs.hut.fi> 5511b41d2SMark Murray * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 6511b41d2SMark Murray * All rights reserved 7511b41d2SMark Murray * Definitions for server configuration data and for the functions reading it. 8511b41d2SMark Murray * 9c2d3a559SKris Kennaway * As far as I am concerned, the code I have written for this software 10c2d3a559SKris Kennaway * can be used freely for any purpose. Any derived versions of this 11c2d3a559SKris Kennaway * software must be clearly marked as such, and if the derived work is 12c2d3a559SKris Kennaway * incompatible with the protocol description in the RFC file, it must be 13c2d3a559SKris Kennaway * called by a name other than "ssh" or "Secure Shell". 14511b41d2SMark Murray */ 15511b41d2SMark Murray 16511b41d2SMark Murray #ifndef SERVCONF_H 17511b41d2SMark Murray #define SERVCONF_H 18511b41d2SMark Murray 19511b41d2SMark Murray #define MAX_PORTS 256 /* Max # ports. */ 20511b41d2SMark Murray 21511b41d2SMark Murray #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ 22511b41d2SMark Murray #define MAX_DENY_USERS 256 /* Max # users on deny list. */ 23511b41d2SMark Murray #define MAX_ALLOW_GROUPS 256 /* Max # groups on allow list. */ 24511b41d2SMark Murray #define MAX_DENY_GROUPS 256 /* Max # groups on deny list. */ 25c2d3a559SKris Kennaway #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ 26ca3176e7SBrian Feldman #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ 2721e764dfSDag-Erling Smørgrav #define MAX_ACCEPT_ENV 256 /* Max # of env vars. */ 28333ee039SDag-Erling Smørgrav #define MAX_MATCH_GROUPS 256 /* Max # of groups for Match. */ 29ca3176e7SBrian Feldman 30ca3176e7SBrian Feldman /* permit_root_login */ 31ca3176e7SBrian Feldman #define PERMIT_NOT_SET -1 32ca3176e7SBrian Feldman #define PERMIT_NO 0 33ca3176e7SBrian Feldman #define PERMIT_FORCED_ONLY 1 34ca3176e7SBrian Feldman #define PERMIT_NO_PASSWD 2 35ca3176e7SBrian Feldman #define PERMIT_YES 3 36ca3176e7SBrian Feldman 3721e764dfSDag-Erling Smørgrav #define DEFAULT_AUTH_FAIL_MAX 6 /* Default for MaxAuthTries */ 38d4af9e69SDag-Erling Smørgrav #define DEFAULT_SESSIONS_MAX 10 /* Default for MaxSessions */ 39d4af9e69SDag-Erling Smørgrav 40d4af9e69SDag-Erling Smørgrav /* Magic name for internal sftp-server */ 41d4af9e69SDag-Erling Smørgrav #define INTERNAL_SFTP_NAME "internal-sftp" 42511b41d2SMark Murray 43511b41d2SMark Murray typedef struct { 44ca3176e7SBrian Feldman u_int num_ports; 45ca3176e7SBrian Feldman u_int ports_from_cmdline; 46cce7d346SDag-Erling Smørgrav int ports[MAX_PORTS]; /* Port number to listen on. */ 47511b41d2SMark Murray char *listen_addr; /* Address on which the server listens. */ 48511b41d2SMark Murray struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ 49aa49c926SDag-Erling Smørgrav int address_family; /* Address family used by the server. */ 50ca3176e7SBrian Feldman char *host_key_files[MAX_HOSTKEYS]; /* Files containing host keys. */ 51ca3176e7SBrian Feldman int num_host_key_files; /* Number of files for host keys. */ 52e8aafc91SKris Kennaway char *pid_file; /* Where to put our pid */ 53511b41d2SMark Murray int server_key_bits;/* Size of the server key. */ 54511b41d2SMark Murray int login_grace_time; /* Disconnect if no auth in this time 55511b41d2SMark Murray * (sec). */ 56511b41d2SMark Murray int key_regeneration_time; /* Server key lifetime (seconds). */ 57ca3176e7SBrian Feldman int permit_root_login; /* PERMIT_*, see above */ 58511b41d2SMark Murray int ignore_rhosts; /* Ignore .rhosts and .shosts. */ 59511b41d2SMark Murray int ignore_user_known_hosts; /* Ignore ~/.ssh/known_hosts 60511b41d2SMark Murray * for RhostsRsaAuth */ 61511b41d2SMark Murray int print_motd; /* If true, print /etc/motd. */ 62ca3176e7SBrian Feldman int print_lastlog; /* If true, print lastlog */ 63511b41d2SMark Murray int x11_forwarding; /* If true, permit inet (spoofing) X11 fwd. */ 64511b41d2SMark Murray int x11_display_offset; /* What DISPLAY number to start 65511b41d2SMark Murray * searching at */ 66af12a3e7SDag-Erling Smørgrav int x11_use_localhost; /* If true, use localhost for fake X11 server. */ 67c2d3a559SKris Kennaway char *xauth_location; /* Location of xauth program */ 68511b41d2SMark Murray int strict_modes; /* If true, require string home dir modes. */ 691ec0d754SDag-Erling Smørgrav int tcp_keep_alive; /* If true, set SO_KEEPALIVE. */ 70ca3176e7SBrian Feldman char *ciphers; /* Supported SSH2 ciphers. */ 71ca3176e7SBrian Feldman char *macs; /* Supported SSH2 macs. */ 72ca3176e7SBrian Feldman int protocol; /* Supported protocol versions. */ 73e8aafc91SKris Kennaway int gateway_ports; /* If true, allow remote connects to forwarded ports. */ 74511b41d2SMark Murray SyslogFacility log_facility; /* Facility for system logging. */ 75511b41d2SMark Murray LogLevel log_level; /* Level for system logging. */ 76511b41d2SMark Murray int rhosts_rsa_authentication; /* If true, permit rhosts RSA 77511b41d2SMark Murray * authentication. */ 78ca3176e7SBrian Feldman int hostbased_authentication; /* If true, permit ssh2 hostbased auth */ 79ca3176e7SBrian Feldman int hostbased_uses_name_from_packet_only; /* experimental */ 80511b41d2SMark Murray int rsa_authentication; /* If true, permit RSA authentication. */ 81ca3176e7SBrian Feldman int pubkey_authentication; /* If true, permit ssh2 pubkey authentication. */ 82af12a3e7SDag-Erling Smørgrav int kerberos_authentication; /* If true, permit Kerberos 83af12a3e7SDag-Erling Smørgrav * authentication. */ 84af12a3e7SDag-Erling Smørgrav int kerberos_or_local_passwd; /* If true, permit kerberos 85511b41d2SMark Murray * and any other password 86511b41d2SMark Murray * authentication mechanism, 87511b41d2SMark Murray * such as SecurID or 88511b41d2SMark Murray * /etc/passwd */ 89af12a3e7SDag-Erling Smørgrav int kerberos_ticket_cleanup; /* If true, destroy ticket 90511b41d2SMark Murray * file on logout. */ 911ec0d754SDag-Erling Smørgrav int kerberos_get_afs_token; /* If true, try to get AFS token if 921ec0d754SDag-Erling Smørgrav * authenticated with Kerberos. */ 93cf2b5f3bSDag-Erling Smørgrav int gss_authentication; /* If true, permit GSSAPI authentication */ 94cf2b5f3bSDag-Erling Smørgrav int gss_cleanup_creds; /* If true, destroy cred cache on logout */ 95511b41d2SMark Murray int password_authentication; /* If true, permit password 96511b41d2SMark Murray * authentication. */ 9709958426SBrian Feldman int kbd_interactive_authentication; /* If true, permit */ 98af12a3e7SDag-Erling Smørgrav int challenge_response_authentication; 99cce7d346SDag-Erling Smørgrav int zero_knowledge_password_authentication; 100cce7d346SDag-Erling Smørgrav /* If true, permit jpake auth */ 101511b41d2SMark Murray int permit_empty_passwd; /* If false, do not permit empty 102511b41d2SMark Murray * passwords. */ 103f388f5efSDag-Erling Smørgrav int permit_user_env; /* If true, read ~/.ssh/environment */ 104511b41d2SMark Murray int use_login; /* If true, login(1) is used */ 10580628bacSDag-Erling Smørgrav int compression; /* If true, compression is allowed */ 10609958426SBrian Feldman int allow_tcp_forwarding; 107d4af9e69SDag-Erling Smørgrav int allow_agent_forwarding; 108ca3176e7SBrian Feldman u_int num_allow_users; 109511b41d2SMark Murray char *allow_users[MAX_ALLOW_USERS]; 110ca3176e7SBrian Feldman u_int num_deny_users; 111511b41d2SMark Murray char *deny_users[MAX_DENY_USERS]; 112ca3176e7SBrian Feldman u_int num_allow_groups; 113511b41d2SMark Murray char *allow_groups[MAX_ALLOW_GROUPS]; 114ca3176e7SBrian Feldman u_int num_deny_groups; 115511b41d2SMark Murray char *deny_groups[MAX_DENY_GROUPS]; 116c2d3a559SKris Kennaway 117ca3176e7SBrian Feldman u_int num_subsystems; 118c2d3a559SKris Kennaway char *subsystem_name[MAX_SUBSYSTEMS]; 119c2d3a559SKris Kennaway char *subsystem_command[MAX_SUBSYSTEMS]; 120333ee039SDag-Erling Smørgrav char *subsystem_args[MAX_SUBSYSTEMS]; 121c2d3a559SKris Kennaway 12221e764dfSDag-Erling Smørgrav u_int num_accept_env; 12321e764dfSDag-Erling Smørgrav char *accept_env[MAX_ACCEPT_ENV]; 12421e764dfSDag-Erling Smørgrav 125c2d3a559SKris Kennaway int max_startups_begin; 126c2d3a559SKris Kennaway int max_startups_rate; 127c2d3a559SKris Kennaway int max_startups; 12821e764dfSDag-Erling Smørgrav int max_authtries; 129d4af9e69SDag-Erling Smørgrav int max_sessions; 130ca3176e7SBrian Feldman char *banner; /* SSH-2 banner message */ 131cf2b5f3bSDag-Erling Smørgrav int use_dns; 132ca3176e7SBrian Feldman int client_alive_interval; /* 133ca3176e7SBrian Feldman * poke the client this often to 134ca3176e7SBrian Feldman * see if it's still there 135ca3176e7SBrian Feldman */ 136ca3176e7SBrian Feldman int client_alive_count_max; /* 137ca3176e7SBrian Feldman * If the client is unresponsive 138af12a3e7SDag-Erling Smørgrav * for this many intervals above, 139af12a3e7SDag-Erling Smørgrav * disconnect the session 140ca3176e7SBrian Feldman */ 141c2d3a559SKris Kennaway 142af12a3e7SDag-Erling Smørgrav char *authorized_keys_file; /* File containing public keys */ 143af12a3e7SDag-Erling Smørgrav char *authorized_keys_file2; 144b74df5b2SDag-Erling Smørgrav 145333ee039SDag-Erling Smørgrav char *adm_forced_command; 146333ee039SDag-Erling Smørgrav 147cf2b5f3bSDag-Erling Smørgrav int use_pam; /* Enable auth via PAM */ 148b74df5b2SDag-Erling Smørgrav 149b74df5b2SDag-Erling Smørgrav int permit_tun; 150333ee039SDag-Erling Smørgrav 151333ee039SDag-Erling Smørgrav int num_permitted_opens; 152d4af9e69SDag-Erling Smørgrav 153d4af9e69SDag-Erling Smørgrav char *chroot_directory; 154511b41d2SMark Murray } ServerOptions; 155511b41d2SMark Murray 156af12a3e7SDag-Erling Smørgrav void initialize_server_options(ServerOptions *); 157af12a3e7SDag-Erling Smørgrav void fill_default_server_options(ServerOptions *); 158333ee039SDag-Erling Smørgrav int process_server_config_line(ServerOptions *, char *, const char *, int, 159333ee039SDag-Erling Smørgrav int *, const char *, const char *, const char *); 16021e764dfSDag-Erling Smørgrav void load_server_config(const char *, Buffer *); 161333ee039SDag-Erling Smørgrav void parse_server_config(ServerOptions *, const char *, Buffer *, 162333ee039SDag-Erling Smørgrav const char *, const char *, const char *); 163333ee039SDag-Erling Smørgrav void parse_server_match_config(ServerOptions *, const char *, const char *, 164333ee039SDag-Erling Smørgrav const char *); 165d4af9e69SDag-Erling Smørgrav void copy_set_server_options(ServerOptions *, ServerOptions *, int); 166d4af9e69SDag-Erling Smørgrav void dump_config(ServerOptions *); 167511b41d2SMark Murray 168511b41d2SMark Murray #endif /* SERVCONF_H */ 169