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 /* 14bdb005b5SDarren J Moffat * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. 157c478bd9Sstevel@tonic-gate */ 167c478bd9Sstevel@tonic-gate 17cd7d5fafSJan Pechanec /* $OpenBSD: servconf.h,v 1.59 2002/07/30 17:03:55 markus Exp $ */ 18cd7d5fafSJan Pechanec 197c478bd9Sstevel@tonic-gate #ifndef _SERVCONF_H 207c478bd9Sstevel@tonic-gate #define _SERVCONF_H 217c478bd9Sstevel@tonic-gate 227c478bd9Sstevel@tonic-gate #ifdef __cplusplus 237c478bd9Sstevel@tonic-gate extern "C" { 247c478bd9Sstevel@tonic-gate #endif 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate #define MAX_PORTS 256 /* Max # ports. */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #define MAX_ALLOW_USERS 256 /* Max # users on allow list. */ 297c478bd9Sstevel@tonic-gate #define MAX_DENY_USERS 256 /* Max # users on deny list. */ 307c478bd9Sstevel@tonic-gate #define MAX_ALLOW_GROUPS 256 /* Max # groups on allow list. */ 317c478bd9Sstevel@tonic-gate #define MAX_DENY_GROUPS 256 /* Max # groups on deny list. */ 327c478bd9Sstevel@tonic-gate #define MAX_SUBSYSTEMS 256 /* Max # subsystems. */ 337c478bd9Sstevel@tonic-gate #define MAX_HOSTKEYS 256 /* Max # hostkeys. */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* permit_root_login */ 367c478bd9Sstevel@tonic-gate #define PERMIT_NOT_SET -1 377c478bd9Sstevel@tonic-gate #define PERMIT_NO 0 387c478bd9Sstevel@tonic-gate #define PERMIT_FORCED_ONLY 1 397c478bd9Sstevel@tonic-gate #define PERMIT_NO_PASSWD 2 407c478bd9Sstevel@tonic-gate #define PERMIT_YES 3 417c478bd9Sstevel@tonic-gate 426f8d59d8SJan Pechanec /* Magic name for internal sftp-server */ 436f8d59d8SJan Pechanec #define INTERNAL_SFTP_NAME "internal-sftp" 44bdb005b5SDarren J Moffat #define _SSH_PAM_SERVICE_PREFIX "sshd" 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. */ 114*4a2e944dSJan Pechanec 115*4a2e944dSJan Pechanec int kbd_interactive_authentication; 1167c478bd9Sstevel@tonic-gate int challenge_response_authentication; 117*4a2e944dSJan Pechanec int pam_authentication_via_kbd_int; 118*4a2e944dSJan Pechanec 1197c478bd9Sstevel@tonic-gate int permit_empty_passwd; /* If false, do not permit empty 1207c478bd9Sstevel@tonic-gate * passwords. */ 1217c478bd9Sstevel@tonic-gate int permit_user_env; /* If true, read ~/.ssh/environment */ 1227c478bd9Sstevel@tonic-gate int use_login; /* If true, login(1) is used */ 1237c478bd9Sstevel@tonic-gate int compression; /* If true, compression is allowed */ 1247c478bd9Sstevel@tonic-gate int allow_tcp_forwarding; 1256f8d59d8SJan Pechanec 1267c478bd9Sstevel@tonic-gate u_int num_allow_users; 1277c478bd9Sstevel@tonic-gate char *allow_users[MAX_ALLOW_USERS]; 1287c478bd9Sstevel@tonic-gate u_int num_deny_users; 1297c478bd9Sstevel@tonic-gate char *deny_users[MAX_DENY_USERS]; 1307c478bd9Sstevel@tonic-gate u_int num_allow_groups; 1317c478bd9Sstevel@tonic-gate char *allow_groups[MAX_ALLOW_GROUPS]; 1327c478bd9Sstevel@tonic-gate u_int num_deny_groups; 1337c478bd9Sstevel@tonic-gate char *deny_groups[MAX_DENY_GROUPS]; 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate u_int num_subsystems; 1367c478bd9Sstevel@tonic-gate char *subsystem_name[MAX_SUBSYSTEMS]; 1377c478bd9Sstevel@tonic-gate char *subsystem_command[MAX_SUBSYSTEMS]; 1386f8d59d8SJan Pechanec char *subsystem_args[MAX_SUBSYSTEMS]; 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate int max_startups_begin; 1417c478bd9Sstevel@tonic-gate int max_startups_rate; 1427c478bd9Sstevel@tonic-gate int max_startups; 1437c478bd9Sstevel@tonic-gate char *banner; /* SSH-2 banner message */ 1447c478bd9Sstevel@tonic-gate int verify_reverse_mapping; /* cross-check ip and dns */ 1457c478bd9Sstevel@tonic-gate int client_alive_interval; /* 1467c478bd9Sstevel@tonic-gate * poke the client this often to 1477c478bd9Sstevel@tonic-gate * see if it's still there 1487c478bd9Sstevel@tonic-gate */ 1497c478bd9Sstevel@tonic-gate int client_alive_count_max; /* 1507c478bd9Sstevel@tonic-gate * If the client is unresponsive 1517c478bd9Sstevel@tonic-gate * for this many intervals above, 1527c478bd9Sstevel@tonic-gate * disconnect the session 1537c478bd9Sstevel@tonic-gate */ 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate char *authorized_keys_file; /* File containing public keys */ 1567c478bd9Sstevel@tonic-gate char *authorized_keys_file2; 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate int max_auth_tries; 1597c478bd9Sstevel@tonic-gate int max_auth_tries_log; 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate int max_init_auth_tries; /* SUNW: /etc/default/login */ 1627c478bd9Sstevel@tonic-gate int max_init_auth_tries_log; /* SUNW: /etc/default/login */ 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate int lookup_client_hostnames; 165cd7d5fafSJan Pechanec int use_openssl_engine; 1666f8d59d8SJan Pechanec char *chroot_directory; 167d8a94255SErik Trauschke char *pre_userauth_hook; 168bdb005b5SDarren J Moffat char *pam_service_prefix; 169bdb005b5SDarren J Moffat char *pam_service_name; 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate } ServerOptions; 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate void initialize_server_options(ServerOptions *); 1747c478bd9Sstevel@tonic-gate void fill_default_server_options(ServerOptions *); 175b07b2f5cSHuie-Ying Lee int process_server_config_line(ServerOptions *, char *, const char *, int, 176b07b2f5cSHuie-Ying Lee int *, const char *, const char *, const char *); 177b07b2f5cSHuie-Ying Lee void load_server_config(const char *, Buffer *); 178b07b2f5cSHuie-Ying Lee void parse_server_config(ServerOptions *, const char *, Buffer *, 179b07b2f5cSHuie-Ying Lee const char *, const char *, const char *); 180b07b2f5cSHuie-Ying Lee void parse_server_match_config(ServerOptions *, const char *, const char *, 181b07b2f5cSHuie-Ying Lee const char *); 182b07b2f5cSHuie-Ying Lee void copy_set_server_options(ServerOptions *, ServerOptions *, int); 1836f8d59d8SJan Pechanec int chroot_requested(char *chroot_directory); 1847c478bd9Sstevel@tonic-gate 1857c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1867c478bd9Sstevel@tonic-gate } 1877c478bd9Sstevel@tonic-gate #endif 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate 1907c478bd9Sstevel@tonic-gate #endif /* _SERVCONF_H */ 191