1 /* $MirOS: src/usr.bin/ssh/servconf.h,v 1.14 2014/03/28 22:31:58 tg Exp $ */ 2 /* $OpenBSD: servconf.h,v 1.87 2009/01/22 10:02:34 djm Exp $ */ 3 4 /* 5 * Author: Tatu Ylonen <ylo@cs.hut.fi> 6 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 7 * All rights reserved 8 * Definitions for server configuration data and for the functions reading it. 9 * 10 * As far as I am concerned, the code I have written for this software 11 * can be used freely for any purpose. Any derived versions of this 12 * software must be clearly marked as such, and if the derived work is 13 * incompatible with the protocol description in the RFC file, it must be 14 * called by a name other than "ssh" or "Secure Shell". 15 */ 16 17 #ifndef SERVCONF_H 18 #define SERVCONF_H 19 20 #define MAX_PORTS 256 /* Max # ports. */ 21 22 #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ 23 #define MAX_DENY_USERS 256 /* Max # users on deny list. */ 24 #define MAX_ALLOW_GROUPS 256 /* Max # groups on allow list. */ 25 #define MAX_DENY_GROUPS 256 /* Max # groups on deny list. */ 26 #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ 27 #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ 28 #define MAX_ACCEPT_ENV 256 /* Max # of env vars. */ 29 #define MAX_MATCH_GROUPS 256 /* Max # of groups for Match. */ 30 31 /* permit_root_login */ 32 #define PERMIT_NOT_SET -1 33 #define PERMIT_NO 0 34 #define PERMIT_FORCED_ONLY 1 35 #define PERMIT_NO_PASSWD 2 36 #define PERMIT_YES 3 37 38 #define DEFAULT_AUTH_FAIL_MAX 6 /* Default for MaxAuthTries */ 39 #define DEFAULT_SESSIONS_MAX 10 /* Default for MaxSessions */ 40 41 /* Magic name for internal sftp-server */ 42 #define INTERNAL_SFTP_NAME "internal-sftp" 43 44 typedef struct { 45 u_int num_ports; 46 u_int ports_from_cmdline; 47 int ports[MAX_PORTS]; /* Port number to listen on. */ 48 char *listen_addr; /* Address on which the server listens. */ 49 struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ 50 int address_family; /* Address family used by the server. */ 51 char *host_key_files[MAX_HOSTKEYS]; /* Files containing host keys. */ 52 int num_host_key_files; /* Number of files for host keys. */ 53 char *pid_file; /* Where to put our pid */ 54 int server_key_bits;/* Size of the server key. */ 55 int login_grace_time; /* Disconnect if no auth in this time 56 * (sec). */ 57 int key_regeneration_time; /* Server key lifetime (seconds). */ 58 int permit_root_login; /* PERMIT_*, see above */ 59 int ignore_rhosts; /* Ignore .rhosts and .shosts. */ 60 int ignore_user_known_hosts; /* Ignore ~/.etc/ssh/known_hosts 61 * for RhostsRsaAuth */ 62 int print_motd; /* If true, print /etc/motd. */ 63 int print_lastlog; /* If true, print lastlog */ 64 int x11_forwarding; /* If true, permit inet (spoofing) X11 fwd. */ 65 int x11_display_offset; /* What DISPLAY number to start 66 * searching at */ 67 int x11_use_localhost; /* If true, use localhost for fake X11 server. */ 68 char *xauth_location; /* Location of xauth program */ 69 int strict_modes; /* If true, require string home dir modes. */ 70 int tcp_keep_alive; /* If true, set SO_KEEPALIVE. */ 71 const char *ciphers; /* Supported SSH2 ciphers. */ 72 const char *macs; /* Supported SSH2 macs. */ 73 int protocol; /* Supported protocol versions. */ 74 int gateway_ports; /* If true, allow remote connects to forwarded ports. */ 75 SyslogFacility log_facility; /* Facility for system logging. */ 76 LogLevel log_level; /* Level for system logging. */ 77 int rhosts_rsa_authentication; /* If true, permit rhosts RSA 78 * authentication. */ 79 int hostbased_authentication; /* If true, permit ssh2 hostbased auth */ 80 int hostbased_uses_name_from_packet_only; /* experimental */ 81 int rsa_authentication; /* If true, permit RSA authentication. */ 82 int pubkey_authentication; /* If true, permit ssh2 pubkey authentication. */ 83 int password_authentication; /* If true, permit password 84 * authentication. */ 85 int kbd_interactive_authentication; /* If true, permit */ 86 int challenge_response_authentication; 87 int permit_empty_passwd; /* If false, do not permit empty 88 * passwords. */ 89 int permit_user_env; /* If true, read ~/.etc/ssh/environment */ 90 int use_login; /* If true, login(1) is used */ 91 int compression; /* If true, compression is allowed */ 92 int allow_tcp_forwarding; 93 int allow_agent_forwarding; 94 u_int num_allow_users; 95 char *allow_users[MAX_ALLOW_USERS]; 96 u_int num_deny_users; 97 char *deny_users[MAX_DENY_USERS]; 98 u_int num_allow_groups; 99 char *allow_groups[MAX_ALLOW_GROUPS]; 100 u_int num_deny_groups; 101 char *deny_groups[MAX_DENY_GROUPS]; 102 103 u_int num_subsystems; 104 char *subsystem_name[MAX_SUBSYSTEMS]; 105 char *subsystem_command[MAX_SUBSYSTEMS]; 106 char *subsystem_args[MAX_SUBSYSTEMS]; 107 108 u_int num_accept_env; 109 char *accept_env[MAX_ACCEPT_ENV]; 110 111 int max_startups_begin; 112 int max_startups_rate; 113 int max_startups; 114 int max_authtries; 115 int max_sessions; 116 char *banner; /* SSH-2 banner message */ 117 int use_dns; 118 int client_alive_interval; /* 119 * poke the client this often to 120 * see if it's still there 121 */ 122 int client_alive_count_max; /* 123 * If the client is unresponsive 124 * for this many intervals above, 125 * disconnect the session 126 */ 127 128 char *authorised_keys_file1; /* File containing public keys */ 129 char *authorised_keys_file2; /* Same; note not used for root */ 130 131 char *adm_forced_command; 132 133 int permit_tun; 134 135 int num_permitted_opens; 136 137 char *chroot_directory; 138 } ServerOptions; 139 140 void initialize_server_options(ServerOptions *); 141 void fill_default_server_options(ServerOptions *); 142 int process_server_config_line(ServerOptions *, char *, const char *, int, 143 int *, const char *, const char *, const char *); 144 void load_server_config(const char *, Buffer *); 145 void parse_server_config(ServerOptions *, const char *, Buffer *, 146 const char *, const char *, const char *); 147 void parse_server_match_config(ServerOptions *, const char *, const char *, 148 const char *); 149 void copy_set_server_options(ServerOptions *, ServerOptions *, int); 150 void dump_config(ServerOptions *); 151 152 #endif /* SERVCONF_H */ 153