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 /* 1412317SDarren.Moffat@oracle.com * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 150Sstevel@tonic-gate */ 160Sstevel@tonic-gate 177574SJan.Pechanec@Sun.COM /* $OpenBSD: servconf.h,v 1.59 2002/07/30 17:03:55 markus Exp $ */ 187574SJan.Pechanec@Sun.COM 190Sstevel@tonic-gate #ifndef _SERVCONF_H 200Sstevel@tonic-gate #define _SERVCONF_H 210Sstevel@tonic-gate 220Sstevel@tonic-gate #ifdef __cplusplus 230Sstevel@tonic-gate extern "C" { 240Sstevel@tonic-gate #endif 250Sstevel@tonic-gate 260Sstevel@tonic-gate #define MAX_PORTS 256 /* Max # ports. */ 270Sstevel@tonic-gate 280Sstevel@tonic-gate #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ 290Sstevel@tonic-gate #define MAX_DENY_USERS 256 /* Max # users on deny list. */ 300Sstevel@tonic-gate #define MAX_ALLOW_GROUPS 256 /* Max # groups on allow list. */ 310Sstevel@tonic-gate #define MAX_DENY_GROUPS 256 /* Max # groups on deny list. */ 320Sstevel@tonic-gate #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ 330Sstevel@tonic-gate #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* permit_root_login */ 360Sstevel@tonic-gate #define PERMIT_NOT_SET -1 370Sstevel@tonic-gate #define PERMIT_NO 0 380Sstevel@tonic-gate #define PERMIT_FORCED_ONLY 1 390Sstevel@tonic-gate #define PERMIT_NO_PASSWD 2 400Sstevel@tonic-gate #define PERMIT_YES 3 410Sstevel@tonic-gate 429139SJan.Pechanec@Sun.COM /* Magic name for internal sftp-server */ 439139SJan.Pechanec@Sun.COM #define INTERNAL_SFTP_NAME "internal-sftp" 4412317SDarren.Moffat@oracle.com #define _SSH_PAM_SERVICE_PREFIX "sshd" 459139SJan.Pechanec@Sun.COM 460Sstevel@tonic-gate typedef struct { 479139SJan.Pechanec@Sun.COM u_int num_ports; 489139SJan.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. */ 114*12597SJan.Pechanec@Sun.COM 115*12597SJan.Pechanec@Sun.COM int kbd_interactive_authentication; 116*12597SJan.Pechanec@Sun.COM int challenge_response_authentication; 117*12597SJan.Pechanec@Sun.COM int pam_authentication_via_kbd_int; 118*12597SJan.Pechanec@Sun.COM 1190Sstevel@tonic-gate int permit_empty_passwd; /* If false, do not permit empty 1200Sstevel@tonic-gate * passwords. */ 1210Sstevel@tonic-gate int permit_user_env; /* If true, read ~/.ssh/environment */ 1220Sstevel@tonic-gate int use_login; /* If true, login(1) is used */ 1230Sstevel@tonic-gate int compression; /* If true, compression is allowed */ 1240Sstevel@tonic-gate int allow_tcp_forwarding; 1259139SJan.Pechanec@Sun.COM 1269139SJan.Pechanec@Sun.COM u_int num_allow_users; 1270Sstevel@tonic-gate char *allow_users[MAX_ALLOW_USERS]; 1289139SJan.Pechanec@Sun.COM u_int num_deny_users; 1290Sstevel@tonic-gate char *deny_users[MAX_DENY_USERS]; 1309139SJan.Pechanec@Sun.COM u_int num_allow_groups; 1310Sstevel@tonic-gate char *allow_groups[MAX_ALLOW_GROUPS]; 1329139SJan.Pechanec@Sun.COM u_int num_deny_groups; 1330Sstevel@tonic-gate char *deny_groups[MAX_DENY_GROUPS]; 1340Sstevel@tonic-gate 1359139SJan.Pechanec@Sun.COM u_int num_subsystems; 1360Sstevel@tonic-gate char *subsystem_name[MAX_SUBSYSTEMS]; 1370Sstevel@tonic-gate char *subsystem_command[MAX_SUBSYSTEMS]; 1389139SJan.Pechanec@Sun.COM char *subsystem_args[MAX_SUBSYSTEMS]; 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate int max_startups_begin; 1410Sstevel@tonic-gate int max_startups_rate; 1420Sstevel@tonic-gate int max_startups; 1430Sstevel@tonic-gate char *banner; /* SSH-2 banner message */ 1440Sstevel@tonic-gate int verify_reverse_mapping; /* cross-check ip and dns */ 1450Sstevel@tonic-gate int client_alive_interval; /* 1460Sstevel@tonic-gate * poke the client this often to 1470Sstevel@tonic-gate * see if it's still there 1480Sstevel@tonic-gate */ 1490Sstevel@tonic-gate int client_alive_count_max; /* 1500Sstevel@tonic-gate * If the client is unresponsive 1510Sstevel@tonic-gate * for this many intervals above, 1520Sstevel@tonic-gate * disconnect the session 1530Sstevel@tonic-gate */ 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate char *authorized_keys_file; /* File containing public keys */ 1560Sstevel@tonic-gate char *authorized_keys_file2; 1570Sstevel@tonic-gate 1580Sstevel@tonic-gate int max_auth_tries; 1590Sstevel@tonic-gate int max_auth_tries_log; 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate int max_init_auth_tries; /* SUNW: /etc/default/login */ 1620Sstevel@tonic-gate int max_init_auth_tries_log; /* SUNW: /etc/default/login */ 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate int lookup_client_hostnames; 1657574SJan.Pechanec@Sun.COM int use_openssl_engine; 1669139SJan.Pechanec@Sun.COM char *chroot_directory; 16711251SErik.Trauschke@Sun.COM char *pre_userauth_hook; 16812317SDarren.Moffat@oracle.com char *pam_service_prefix; 16912317SDarren.Moffat@oracle.com char *pam_service_name; 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate } ServerOptions; 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate void initialize_server_options(ServerOptions *); 1740Sstevel@tonic-gate void fill_default_server_options(ServerOptions *); 17511044SHuie-Ying.Lee@Sun.COM int process_server_config_line(ServerOptions *, char *, const char *, int, 17611044SHuie-Ying.Lee@Sun.COM int *, const char *, const char *, const char *); 17711044SHuie-Ying.Lee@Sun.COM void load_server_config(const char *, Buffer *); 17811044SHuie-Ying.Lee@Sun.COM void parse_server_config(ServerOptions *, const char *, Buffer *, 17911044SHuie-Ying.Lee@Sun.COM const char *, const char *, const char *); 18011044SHuie-Ying.Lee@Sun.COM void parse_server_match_config(ServerOptions *, const char *, const char *, 18111044SHuie-Ying.Lee@Sun.COM const char *); 18211044SHuie-Ying.Lee@Sun.COM void copy_set_server_options(ServerOptions *, ServerOptions *, int); 1839139SJan.Pechanec@Sun.COM int chroot_requested(char *chroot_directory); 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate #ifdef __cplusplus 1860Sstevel@tonic-gate } 1870Sstevel@tonic-gate #endif 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate 1900Sstevel@tonic-gate #endif /* _SERVCONF_H */ 191