17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * Author: Tatu Ylonen <ylo@cs.hut.fi> 37c478bd9Sstevel@tonic-gate * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 47c478bd9Sstevel@tonic-gate * All rights reserved 57c478bd9Sstevel@tonic-gate * Definitions for server configuration data and for the functions reading it. 67c478bd9Sstevel@tonic-gate * 77c478bd9Sstevel@tonic-gate * As far as I am concerned, the code I have written for this software 87c478bd9Sstevel@tonic-gate * can be used freely for any purpose. Any derived versions of this 97c478bd9Sstevel@tonic-gate * software must be clearly marked as such, and if the derived work is 107c478bd9Sstevel@tonic-gate * incompatible with the protocol description in the RFC file, it must be 117c478bd9Sstevel@tonic-gate * called by a name other than "ssh" or "Secure Shell". 127c478bd9Sstevel@tonic-gate */ 137c478bd9Sstevel@tonic-gate /* 146f8d59d8SJan Pechanec * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 157c478bd9Sstevel@tonic-gate * Use is subject to license terms. 167c478bd9Sstevel@tonic-gate */ 177c478bd9Sstevel@tonic-gate 18cd7d5fafSJan Pechanec /* $OpenBSD: servconf.h,v 1.59 2002/07/30 17:03:55 markus Exp $ */ 19cd7d5fafSJan Pechanec 207c478bd9Sstevel@tonic-gate #ifndef _SERVCONF_H 217c478bd9Sstevel@tonic-gate #define _SERVCONF_H 227c478bd9Sstevel@tonic-gate 237c478bd9Sstevel@tonic-gate #ifdef __cplusplus 247c478bd9Sstevel@tonic-gate extern "C" { 257c478bd9Sstevel@tonic-gate #endif 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #define MAX_PORTS 256 /* Max # ports. */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ 307c478bd9Sstevel@tonic-gate #define MAX_DENY_USERS 256 /* Max # users on deny list. */ 317c478bd9Sstevel@tonic-gate #define MAX_ALLOW_GROUPS 256 /* Max # groups on allow list. */ 327c478bd9Sstevel@tonic-gate #define MAX_DENY_GROUPS 256 /* Max # groups on deny list. */ 337c478bd9Sstevel@tonic-gate #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ 347c478bd9Sstevel@tonic-gate #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate /* permit_root_login */ 377c478bd9Sstevel@tonic-gate #define PERMIT_NOT_SET -1 387c478bd9Sstevel@tonic-gate #define PERMIT_NO 0 397c478bd9Sstevel@tonic-gate #define PERMIT_FORCED_ONLY 1 407c478bd9Sstevel@tonic-gate #define PERMIT_NO_PASSWD 2 417c478bd9Sstevel@tonic-gate #define PERMIT_YES 3 427c478bd9Sstevel@tonic-gate 436f8d59d8SJan Pechanec /* Magic name for internal sftp-server */ 446f8d59d8SJan Pechanec #define INTERNAL_SFTP_NAME "internal-sftp" 456f8d59d8SJan Pechanec 467c478bd9Sstevel@tonic-gate typedef struct { 477c478bd9Sstevel@tonic-gate u_int num_ports; 487c478bd9Sstevel@tonic-gate u_int ports_from_cmdline; 497c478bd9Sstevel@tonic-gate u_short ports[MAX_PORTS]; /* Port number to listen on. */ 507c478bd9Sstevel@tonic-gate char *listen_addr; /* Address on which the server listens. */ 517c478bd9Sstevel@tonic-gate struct addrinfo *listen_addrs; /* Addresses on which the server listens. */ 527c478bd9Sstevel@tonic-gate char *host_key_files[MAX_HOSTKEYS]; /* Files containing host keys. */ 537c478bd9Sstevel@tonic-gate int num_host_key_files; /* Number of files for host keys. */ 547c478bd9Sstevel@tonic-gate char *pid_file; /* Where to put our pid */ 557c478bd9Sstevel@tonic-gate int server_key_bits;/* Size of the server key. */ 567c478bd9Sstevel@tonic-gate int login_grace_time; /* Disconnect if no auth in this time 577c478bd9Sstevel@tonic-gate * (sec). */ 587c478bd9Sstevel@tonic-gate int key_regeneration_time; /* Server key lifetime (seconds). */ 597c478bd9Sstevel@tonic-gate int permit_root_login; /* PERMIT_*, see above */ 607c478bd9Sstevel@tonic-gate int ignore_rhosts; /* Ignore .rhosts and .shosts. */ 617c478bd9Sstevel@tonic-gate int ignore_user_known_hosts; /* Ignore ~/.ssh/known_hosts 627c478bd9Sstevel@tonic-gate * for RhostsRsaAuth */ 637c478bd9Sstevel@tonic-gate int print_motd; /* If true, print /etc/motd. */ 647c478bd9Sstevel@tonic-gate int print_lastlog; /* If true, print lastlog */ 657c478bd9Sstevel@tonic-gate int x11_forwarding; /* If true, permit inet (spoofing) X11 fwd. */ 667c478bd9Sstevel@tonic-gate int x11_display_offset; /* What DISPLAY number to start 677c478bd9Sstevel@tonic-gate * searching at */ 687c478bd9Sstevel@tonic-gate int x11_use_localhost; /* If true, use localhost for fake X11 server. */ 697c478bd9Sstevel@tonic-gate char *xauth_location; /* Location of xauth program */ 707c478bd9Sstevel@tonic-gate int strict_modes; /* If true, require string home dir modes. */ 717c478bd9Sstevel@tonic-gate int keepalives; /* If true, set SO_KEEPALIVE. */ 727c478bd9Sstevel@tonic-gate char *ciphers; /* Supported SSH2 ciphers. */ 737c478bd9Sstevel@tonic-gate char *macs; /* Supported SSH2 macs. */ 747c478bd9Sstevel@tonic-gate int protocol; /* Supported protocol versions. */ 757c478bd9Sstevel@tonic-gate int gateway_ports; /* If true, allow remote connects to forwarded ports. */ 767c478bd9Sstevel@tonic-gate SyslogFacility log_facility; /* Facility for system logging. */ 777c478bd9Sstevel@tonic-gate LogLevel log_level; /* Level for system logging. */ 787c478bd9Sstevel@tonic-gate int rhosts_authentication; /* If true, permit rhosts 797c478bd9Sstevel@tonic-gate * authentication. */ 807c478bd9Sstevel@tonic-gate int rhosts_rsa_authentication; /* If true, permit rhosts RSA 817c478bd9Sstevel@tonic-gate * authentication. */ 827c478bd9Sstevel@tonic-gate int hostbased_authentication; /* If true, permit ssh2 hostbased auth */ 837c478bd9Sstevel@tonic-gate int hostbased_uses_name_from_packet_only; /* experimental */ 847c478bd9Sstevel@tonic-gate int rsa_authentication; /* If true, permit RSA authentication. */ 857c478bd9Sstevel@tonic-gate int pubkey_authentication; /* If true, permit ssh2 pubkey authentication. */ 867c478bd9Sstevel@tonic-gate #ifdef GSSAPI 877c478bd9Sstevel@tonic-gate int gss_authentication; 887c478bd9Sstevel@tonic-gate int gss_keyex; 897c478bd9Sstevel@tonic-gate int gss_store_creds; 907c478bd9Sstevel@tonic-gate int gss_use_session_ccache; /* If true, delegated credentials are 917c478bd9Sstevel@tonic-gate * stored in a session specific cache */ 927c478bd9Sstevel@tonic-gate int gss_cleanup_creds; /* If true, destroy cred cache on logout */ 937c478bd9Sstevel@tonic-gate #endif /* GSSAPI */ 947c478bd9Sstevel@tonic-gate #if defined(KRB4) || defined(KRB5) 957c478bd9Sstevel@tonic-gate int kerberos_authentication; /* If true, permit Kerberos 967c478bd9Sstevel@tonic-gate * authentication. */ 977c478bd9Sstevel@tonic-gate int kerberos_or_local_passwd; /* If true, permit kerberos 987c478bd9Sstevel@tonic-gate * and any other password 997c478bd9Sstevel@tonic-gate * authentication mechanism, 1007c478bd9Sstevel@tonic-gate * such as SecurID or 1017c478bd9Sstevel@tonic-gate * /etc/passwd */ 1027c478bd9Sstevel@tonic-gate int kerberos_ticket_cleanup; /* If true, destroy ticket 1037c478bd9Sstevel@tonic-gate * file on logout. */ 1047c478bd9Sstevel@tonic-gate #endif 1057c478bd9Sstevel@tonic-gate #if defined(AFS) || defined(KRB5) 1067c478bd9Sstevel@tonic-gate int kerberos_tgt_passing; /* If true, permit Kerberos TGT 1077c478bd9Sstevel@tonic-gate * passing. */ 1087c478bd9Sstevel@tonic-gate #endif 1097c478bd9Sstevel@tonic-gate #ifdef AFS 1107c478bd9Sstevel@tonic-gate int afs_token_passing; /* If true, permit AFS token passing. */ 1117c478bd9Sstevel@tonic-gate #endif 1127c478bd9Sstevel@tonic-gate int password_authentication; /* If true, permit password 1137c478bd9Sstevel@tonic-gate * authentication. */ 1147c478bd9Sstevel@tonic-gate int kbd_interactive_authentication; /* If true, permit */ 1157c478bd9Sstevel@tonic-gate int challenge_response_authentication; 1167c478bd9Sstevel@tonic-gate int permit_empty_passwd; /* If false, do not permit empty 1177c478bd9Sstevel@tonic-gate * passwords. */ 1187c478bd9Sstevel@tonic-gate int permit_user_env; /* If true, read ~/.ssh/environment */ 1197c478bd9Sstevel@tonic-gate int use_login; /* If true, login(1) is used */ 1207c478bd9Sstevel@tonic-gate int compression; /* If true, compression is allowed */ 1217c478bd9Sstevel@tonic-gate int allow_tcp_forwarding; 1226f8d59d8SJan Pechanec 1237c478bd9Sstevel@tonic-gate u_int num_allow_users; 1247c478bd9Sstevel@tonic-gate char *allow_users[MAX_ALLOW_USERS]; 1257c478bd9Sstevel@tonic-gate u_int num_deny_users; 1267c478bd9Sstevel@tonic-gate char *deny_users[MAX_DENY_USERS]; 1277c478bd9Sstevel@tonic-gate u_int num_allow_groups; 1287c478bd9Sstevel@tonic-gate char *allow_groups[MAX_ALLOW_GROUPS]; 1297c478bd9Sstevel@tonic-gate u_int num_deny_groups; 1307c478bd9Sstevel@tonic-gate char *deny_groups[MAX_DENY_GROUPS]; 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate u_int num_subsystems; 1337c478bd9Sstevel@tonic-gate char *subsystem_name[MAX_SUBSYSTEMS]; 1347c478bd9Sstevel@tonic-gate char *subsystem_command[MAX_SUBSYSTEMS]; 1356f8d59d8SJan Pechanec char *subsystem_args[MAX_SUBSYSTEMS]; 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate int max_startups_begin; 1387c478bd9Sstevel@tonic-gate int max_startups_rate; 1397c478bd9Sstevel@tonic-gate int max_startups; 1407c478bd9Sstevel@tonic-gate char *banner; /* SSH-2 banner message */ 1417c478bd9Sstevel@tonic-gate int verify_reverse_mapping; /* cross-check ip and dns */ 1427c478bd9Sstevel@tonic-gate int client_alive_interval; /* 1437c478bd9Sstevel@tonic-gate * poke the client this often to 1447c478bd9Sstevel@tonic-gate * see if it's still there 1457c478bd9Sstevel@tonic-gate */ 1467c478bd9Sstevel@tonic-gate int client_alive_count_max; /* 1477c478bd9Sstevel@tonic-gate * If the client is unresponsive 1487c478bd9Sstevel@tonic-gate * for this many intervals above, 1497c478bd9Sstevel@tonic-gate * disconnect the session 1507c478bd9Sstevel@tonic-gate */ 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate char *authorized_keys_file; /* File containing public keys */ 1537c478bd9Sstevel@tonic-gate char *authorized_keys_file2; 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate int pam_authentication_via_kbd_int; 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate int max_auth_tries; 1587c478bd9Sstevel@tonic-gate int max_auth_tries_log; 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate int max_init_auth_tries; /* SUNW: /etc/default/login */ 1617c478bd9Sstevel@tonic-gate int max_init_auth_tries_log; /* SUNW: /etc/default/login */ 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate int lookup_client_hostnames; 164cd7d5fafSJan Pechanec int use_openssl_engine; 1656f8d59d8SJan Pechanec char *chroot_directory; 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate } ServerOptions; 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate void initialize_server_options(ServerOptions *); 1707c478bd9Sstevel@tonic-gate void fill_default_server_options(ServerOptions *); 171*b07b2f5cSHuie-Ying Lee int process_server_config_line(ServerOptions *, char *, const char *, int, 172*b07b2f5cSHuie-Ying Lee int *, const char *, const char *, const char *); 173*b07b2f5cSHuie-Ying Lee void load_server_config(const char *, Buffer *); 174*b07b2f5cSHuie-Ying Lee void parse_server_config(ServerOptions *, const char *, Buffer *, 175*b07b2f5cSHuie-Ying Lee const char *, const char *, const char *); 176*b07b2f5cSHuie-Ying Lee void parse_server_match_config(ServerOptions *, const char *, const char *, 177*b07b2f5cSHuie-Ying Lee const char *); 178*b07b2f5cSHuie-Ying Lee void copy_set_server_options(ServerOptions *, ServerOptions *, int); 1796f8d59d8SJan Pechanec int chroot_requested(char *chroot_directory); 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1827c478bd9Sstevel@tonic-gate } 1837c478bd9Sstevel@tonic-gate #endif 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate #endif /* _SERVCONF_H */ 187