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 * Functions for reading the configuration file. 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 /* 14*7574SJan.Pechanec@Sun.COM * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 150Sstevel@tonic-gate * Use is subject to license terms. 160Sstevel@tonic-gate */ 170Sstevel@tonic-gate 185243Sjp161948 #ifndef _READCONF_H 195243Sjp161948 #define _READCONF_H 205243Sjp161948 215243Sjp161948 /* $OpenBSD: readconf.h,v 1.43 2002/06/08 05:17:01 markus Exp $ */ 225243Sjp161948 235243Sjp161948 #ifdef __cplusplus 245243Sjp161948 extern "C" { 255243Sjp161948 #endif 265243Sjp161948 275266Sjp161948 #include "key.h" 285243Sjp161948 295266Sjp161948 /* 305266Sjp161948 * We accept only fixed amount of unknown options. Note that we must treat all 315266Sjp161948 * options in different Host sections separately since we need to remember the 325266Sjp161948 * line number. See IgnoreIfUnknown for more information. 335266Sjp161948 */ 345266Sjp161948 #define MAX_UNKNOWN_OPTIONS 64 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* Data structure for representing a forwarding request. */ 370Sstevel@tonic-gate 380Sstevel@tonic-gate typedef struct { 395334Sjp161948 char *listen_host; /* Host (address) to listen on. */ 405334Sjp161948 u_short listen_port; /* Port to forward. */ 415334Sjp161948 char *connect_host; /* Host to connect. */ 425334Sjp161948 u_short connect_port; /* Port to connect on connect_host. */ 430Sstevel@tonic-gate } Forward; 440Sstevel@tonic-gate /* Data structure for representing option data. */ 450Sstevel@tonic-gate 465266Sjp161948 /* For postponed processing of option keywords. */ 475266Sjp161948 typedef struct { 485266Sjp161948 char *keyword; /* option keyword name */ 495266Sjp161948 char *filename; /* config file it was found in */ 505266Sjp161948 int linenum; /* line number in the config file */ 515266Sjp161948 } StoredOption; 525266Sjp161948 530Sstevel@tonic-gate typedef struct { 540Sstevel@tonic-gate int forward_agent; /* Forward authentication agent. */ 550Sstevel@tonic-gate int forward_x11; /* Forward X11 display. */ 564907Sjp161948 int forward_x11_trusted; /* Trust Forward X11 display. */ 570Sstevel@tonic-gate char *xauth_location; /* Location for xauth program */ 580Sstevel@tonic-gate int gateway_ports; /* Allow remote connects to forwarded ports. */ 590Sstevel@tonic-gate int use_privileged_port; /* Don't use privileged port if false. */ 600Sstevel@tonic-gate int rhosts_authentication; /* Try rhosts authentication. */ 610Sstevel@tonic-gate int rhosts_rsa_authentication; /* Try rhosts with RSA 620Sstevel@tonic-gate * authentication. */ 630Sstevel@tonic-gate int rsa_authentication; /* Try RSA authentication. */ 640Sstevel@tonic-gate int pubkey_authentication; /* Try ssh2 pubkey authentication. */ 650Sstevel@tonic-gate int hostbased_authentication; /* ssh2's rhosts_rsa */ 660Sstevel@tonic-gate int challenge_response_authentication; 670Sstevel@tonic-gate int fallback_to_rsh; /* Use rsh if cannot connect with ssh. */ 680Sstevel@tonic-gate int use_rsh; /* Always use rsh(don\'t try ssh). */ 690Sstevel@tonic-gate /* Try S/Key or TIS, authentication. */ 700Sstevel@tonic-gate #if defined(KRB4) || defined(KRB5) 710Sstevel@tonic-gate int kerberos_authentication; /* Try Kerberos authentication. */ 720Sstevel@tonic-gate #endif 730Sstevel@tonic-gate #if defined(AFS) || defined(KRB5) 740Sstevel@tonic-gate int kerberos_tgt_passing; /* Try Kerberos TGT passing. */ 750Sstevel@tonic-gate #endif 760Sstevel@tonic-gate 770Sstevel@tonic-gate #ifdef GSSAPI 780Sstevel@tonic-gate int gss_keyex; 790Sstevel@tonic-gate int gss_authentication; 800Sstevel@tonic-gate int gss_deleg_creds; 810Sstevel@tonic-gate #ifdef GSI 820Sstevel@tonic-gate int gss_globus_deleg_limited_proxy; 830Sstevel@tonic-gate #endif /* GSI */ 840Sstevel@tonic-gate #endif /* GSSAPI */ 850Sstevel@tonic-gate 860Sstevel@tonic-gate #ifdef AFS 870Sstevel@tonic-gate int afs_token_passing; /* Try AFS token passing. */ 880Sstevel@tonic-gate #endif 890Sstevel@tonic-gate int password_authentication; /* Try password 900Sstevel@tonic-gate * authentication. */ 910Sstevel@tonic-gate int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ 920Sstevel@tonic-gate char *kbd_interactive_devices; /* Keyboard-interactive auth devices. */ 930Sstevel@tonic-gate int batch_mode; /* Batch mode: do not ask for passwords. */ 940Sstevel@tonic-gate int check_host_ip; /* Also keep track of keys for IP address */ 950Sstevel@tonic-gate int strict_host_key_checking; /* Strict host key checking. */ 960Sstevel@tonic-gate int compression; /* Compress packets in both directions. */ 970Sstevel@tonic-gate int compression_level; /* Compression level 1 (fast) to 9 980Sstevel@tonic-gate * (best). */ 990Sstevel@tonic-gate int keepalives; /* Set SO_KEEPALIVE. */ 1000Sstevel@tonic-gate LogLevel log_level; /* Level for logging. */ 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate int port; /* Port to connect. */ 1030Sstevel@tonic-gate int connection_attempts; /* Max attempts (seconds) before 1040Sstevel@tonic-gate * giving up */ 1053946Sjp161948 int connection_timeout; /* Max time (seconds) before 1063946Sjp161948 * aborting connection attempt */ 1070Sstevel@tonic-gate int number_of_password_prompts; /* Max number of password 1080Sstevel@tonic-gate * prompts. */ 1090Sstevel@tonic-gate int cipher; /* Cipher to use. */ 1100Sstevel@tonic-gate char *ciphers; /* SSH2 ciphers in order of preference. */ 1110Sstevel@tonic-gate char *macs; /* SSH2 macs in order of preference. */ 1120Sstevel@tonic-gate char *hostkeyalgorithms; /* SSH2 server key types in order of preference. */ 1130Sstevel@tonic-gate int protocol; /* Protocol in order of preference. */ 1140Sstevel@tonic-gate char *hostname; /* Real host to connect. */ 1150Sstevel@tonic-gate char *host_key_alias; /* hostname alias for .ssh/known_hosts */ 1160Sstevel@tonic-gate char *proxy_command; /* Proxy command for connecting the host. */ 1170Sstevel@tonic-gate char *user; /* User to log in as. */ 1180Sstevel@tonic-gate int escape_char; /* Escape character; -2 = none */ 1190Sstevel@tonic-gate 1200Sstevel@tonic-gate char *system_hostfile;/* Path for /etc/ssh/ssh_known_hosts. */ 1210Sstevel@tonic-gate char *user_hostfile; /* Path for $HOME/.ssh/known_hosts. */ 1220Sstevel@tonic-gate char *system_hostfile2; 1230Sstevel@tonic-gate char *user_hostfile2; 1240Sstevel@tonic-gate char *preferred_authentications; 1250Sstevel@tonic-gate char *bind_address; /* local socket address for connection to sshd */ 1260Sstevel@tonic-gate char *smartcard_device; /* Smartcard reader device */ 1274958Sjp161948 int disable_banner; /* Disable display of banner */ 1280Sstevel@tonic-gate 1295266Sjp161948 /* 1305266Sjp161948 * Unknown options listed in IgnoreIfUnknown will not cause ssh to 1315266Sjp161948 * exit. So, we must store all unknown options here and can't process 1325266Sjp161948 * them before the command line options and all config files are read 1335266Sjp161948 * and IgnoreIfUnknown is properly set. 1345266Sjp161948 */ 1355266Sjp161948 char *ignore_if_unknown; 1365266Sjp161948 int unknown_opts_num; 1375266Sjp161948 StoredOption unknown_opts[MAX_UNKNOWN_OPTIONS]; 1385266Sjp161948 1390Sstevel@tonic-gate int num_identity_files; /* Number of files for RSA/DSA identities. */ 1400Sstevel@tonic-gate char *identity_files[SSH_MAX_IDENTITY_FILES]; 1410Sstevel@tonic-gate Key *identity_keys[SSH_MAX_IDENTITY_FILES]; 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate /* Local TCP/IP forward requests. */ 1440Sstevel@tonic-gate int num_local_forwards; 1450Sstevel@tonic-gate Forward local_forwards[SSH_MAX_FORWARDS_PER_DIRECTION]; 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate /* Remote TCP/IP forward requests. */ 1480Sstevel@tonic-gate int num_remote_forwards; 1490Sstevel@tonic-gate Forward remote_forwards[SSH_MAX_FORWARDS_PER_DIRECTION]; 1500Sstevel@tonic-gate int clear_forwardings; 1515562Sjp161948 1525562Sjp161948 int64_t rekey_limit; 1530Sstevel@tonic-gate int no_host_authentication_for_localhost; 1544668Sjp161948 int server_alive_interval; 1554668Sjp161948 int server_alive_count_max; 1565243Sjp161948 1575243Sjp161948 int hash_known_hosts; 158*7574SJan.Pechanec@Sun.COM int use_openssl_engine; 1590Sstevel@tonic-gate } Options; 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate void initialize_options(Options *); 1630Sstevel@tonic-gate void fill_default_options(Options *); 1640Sstevel@tonic-gate int read_config_file(const char *, const char *, Options *); 1655334Sjp161948 int parse_forward(int, Forward *, const char *); 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate int 1680Sstevel@tonic-gate process_config_line(Options *, const char *, char *, const char *, int, int *); 1690Sstevel@tonic-gate 1705334Sjp161948 void add_local_forward(Options *, const Forward *); 1715334Sjp161948 void add_remote_forward(Options *, const Forward *); 1720Sstevel@tonic-gate 1735334Sjp161948 void process_unknown_options(Options *); 1745266Sjp161948 1750Sstevel@tonic-gate #ifdef __cplusplus 1760Sstevel@tonic-gate } 1770Sstevel@tonic-gate #endif 1780Sstevel@tonic-gate 1790Sstevel@tonic-gate #endif /* _READCONF_H */ 180