1323124Sdes/* $OpenBSD: readconf.h,v 1.117 2016/07/15 00:24:30 djm Exp $ */ 2224638Sbrooks/* $FreeBSD: stable/10/crypto/openssh/readconf.h 323124 2017-09-01 22:52:18Z des $ */ 392559Sdes 457429Smarkm/* 557429Smarkm * Author: Tatu Ylonen <ylo@cs.hut.fi> 657429Smarkm * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 757429Smarkm * All rights reserved 857429Smarkm * Functions for reading the configuration file. 960576Skris * 1065674Skris * As far as I am concerned, the code I have written for this software 1165674Skris * can be used freely for any purpose. Any derived versions of this 1265674Skris * software must be clearly marked as such, and if the derived work is 1365674Skris * incompatible with the protocol description in the RFC file, it must be 1465674Skris * called by a name other than "ssh" or "Secure Shell". 1557429Smarkm */ 1657429Smarkm 1757429Smarkm#ifndef READCONF_H 1857429Smarkm#define READCONF_H 1957429Smarkm 2057429Smarkm/* Data structure for representing option data. */ 2157429Smarkm 22226046Sdes#define MAX_SEND_ENV 256 23262566Sdes#define SSH_MAX_HOSTS_FILES 32 24262566Sdes#define MAX_CANON_DOMAINS 32 25295367Sdes#define PATH_MAX_SUN (sizeof((struct sockaddr_un *)0)->sun_path) 26137019Sdes 27262566Sdesstruct allowed_cname { 28262566Sdes char *source_list; 29262566Sdes char *target_list; 30262566Sdes}; 31262566Sdes 3257429Smarkmtypedef struct { 3357429Smarkm int forward_agent; /* Forward authentication agent. */ 3457429Smarkm int forward_x11; /* Forward X11 display. */ 35215116Sdes int forward_x11_timeout; /* Expiration for Cookies */ 36126277Sdes int forward_x11_trusted; /* Trust Forward X11 display. */ 37162856Sdes int exit_on_forward_failure; /* Exit if bind(2) fails for -L/-R */ 3865674Skris char *xauth_location; /* Location for xauth program */ 39295367Sdes struct ForwardOptions fwd_opts; /* forwarding options */ 4057429Smarkm int use_privileged_port; /* Don't use privileged port if false. */ 4157429Smarkm int rhosts_rsa_authentication; /* Try rhosts with RSA 4257429Smarkm * authentication. */ 4357429Smarkm int rsa_authentication; /* Try RSA authentication. */ 4476262Sgreen int pubkey_authentication; /* Try ssh2 pubkey authentication. */ 4576262Sgreen int hostbased_authentication; /* ssh2's rhosts_rsa */ 4692559Sdes int challenge_response_authentication; 4776262Sgreen /* Try S/Key or TIS, authentication. */ 48124211Sdes int gss_authentication; /* Try GSS authentication */ 49124211Sdes int gss_deleg_creds; /* Delegate GSS credentials */ 5057429Smarkm int password_authentication; /* Try password 5157429Smarkm * authentication. */ 5269591Sgreen int kbd_interactive_authentication; /* Try keyboard-interactive auth. */ 5369591Sgreen char *kbd_interactive_devices; /* Keyboard-interactive auth devices. */ 5457429Smarkm int batch_mode; /* Batch mode: do not ask for passwords. */ 5557429Smarkm int check_host_ip; /* Also keep track of keys for IP address */ 5657429Smarkm int strict_host_key_checking; /* Strict host key checking. */ 5757429Smarkm int compression; /* Compress packets in both directions. */ 5857429Smarkm int compression_level; /* Compression level 1 (fast) to 9 5957429Smarkm * (best). */ 60126277Sdes int tcp_keep_alive; /* Set SO_KEEPALIVE. */ 61221420Sdes int ip_qos_interactive; /* IP ToS/DSCP/class for interactive */ 62221420Sdes int ip_qos_bulk; /* IP ToS/DSCP/class for bulk traffic */ 6357429Smarkm LogLevel log_level; /* Level for logging. */ 6457429Smarkm 6557429Smarkm int port; /* Port to connect. */ 66124211Sdes int address_family; 6757429Smarkm int connection_attempts; /* Max attempts (seconds) before 6857429Smarkm * giving up */ 69124211Sdes int connection_timeout; /* Max time (seconds) before 70126277Sdes * aborting connection attempt */ 7157429Smarkm int number_of_password_prompts; /* Max number of password 7257429Smarkm * prompts. */ 7357429Smarkm int cipher; /* Cipher to use. */ 7460576Skris char *ciphers; /* SSH2 ciphers in order of preference. */ 7576262Sgreen char *macs; /* SSH2 macs in order of preference. */ 7676262Sgreen char *hostkeyalgorithms; /* SSH2 server key types in order of preference. */ 77221420Sdes char *kex_algorithms; /* SSH2 kex methods in order of preference. */ 7860576Skris int protocol; /* Protocol in order of preference. */ 7957429Smarkm char *hostname; /* Real host to connect. */ 8076262Sgreen char *host_key_alias; /* hostname alias for .ssh/known_hosts */ 8157429Smarkm char *proxy_command; /* Proxy command for connecting the host. */ 8257429Smarkm char *user; /* User to log in as. */ 8357429Smarkm int escape_char; /* Escape character; -2 = none */ 8457429Smarkm 85226046Sdes u_int num_system_hostfiles; /* Paths for /etc/ssh/ssh_known_hosts */ 86226046Sdes char *system_hostfiles[SSH_MAX_HOSTS_FILES]; 87226046Sdes u_int num_user_hostfiles; /* Path for $HOME/.ssh/known_hosts */ 88226046Sdes char *user_hostfiles[SSH_MAX_HOSTS_FILES]; 8976262Sgreen char *preferred_authentications; 9092559Sdes char *bind_address; /* local socket address for connection to sshd */ 91204917Sdes char *pkcs11_provider; /* PKCS#11 provider */ 92124211Sdes int verify_host_key_dns; /* Verify host key using DNS */ 9357429Smarkm 9476262Sgreen int num_identity_files; /* Number of files for RSA/DSA identities. */ 9557429Smarkm char *identity_files[SSH_MAX_IDENTITY_FILES]; 96249016Sdes int identity_file_userprovided[SSH_MAX_IDENTITY_FILES]; 97295367Sdes struct sshkey *identity_keys[SSH_MAX_IDENTITY_FILES]; 9857429Smarkm 99296781Sdes int num_certificate_files; /* Number of extra certificates for ssh. */ 100296781Sdes char *certificate_files[SSH_MAX_CERTIFICATE_FILES]; 101296781Sdes int certificate_file_userprovided[SSH_MAX_CERTIFICATE_FILES]; 102296781Sdes struct sshkey *certificates[SSH_MAX_CERTIFICATE_FILES]; 103296781Sdes 104296781Sdes int add_keys_to_agent; 105323124Sdes char *identity_agent; /* Optional path to ssh-agent socket */ 106296781Sdes 10757429Smarkm /* Local TCP/IP forward requests. */ 10857429Smarkm int num_local_forwards; 109295367Sdes struct Forward *local_forwards; 11057429Smarkm 11157429Smarkm /* Remote TCP/IP forward requests. */ 11257429Smarkm int num_remote_forwards; 113295367Sdes struct Forward *remote_forwards; 11492559Sdes int clear_forwardings; 115113911Sdes 116323124Sdes /* stdio forwarding (-W) host and port */ 117323124Sdes char *stdio_forward_host; 118323124Sdes int stdio_forward_port; 119323124Sdes 120113911Sdes int enable_ssh_keysign; 121181111Sdes int64_t rekey_limit; 122255767Sdes int rekey_interval; 12392559Sdes int no_host_authentication_for_localhost; 124128460Sdes int identities_only; 125137019Sdes int server_alive_interval; 126126277Sdes int server_alive_count_max; 127137019Sdes 128137019Sdes int num_send_env; 129137019Sdes char *send_env[MAX_SEND_ENV]; 130137019Sdes 131137019Sdes char *control_path; 132137019Sdes int control_master; 133215116Sdes int control_persist; /* ControlPersist flag */ 134215116Sdes int control_persist_timeout; /* ControlPersist timeout (seconds) */ 135147005Sdes 136147005Sdes int hash_known_hosts; 137157019Sdes 138157019Sdes int tun_open; /* tun(4) */ 139157019Sdes int tun_local; /* force tun device (optional) */ 140157019Sdes int tun_remote; /* force tun device (optional) */ 141157019Sdes 142157019Sdes char *local_command; 143157019Sdes int permit_local_command; 144181111Sdes int visual_host_key; 145157019Sdes 146226046Sdes int request_tty; 147255767Sdes 148262566Sdes int proxy_use_fdpass; 149262566Sdes 150262566Sdes int num_canonical_domains; 151262566Sdes char *canonical_domains[MAX_CANON_DOMAINS]; 152262566Sdes int canonicalize_hostname; 153262566Sdes int canonicalize_max_dots; 154262566Sdes int canonicalize_fallback_local; 155262566Sdes int num_permitted_cnames; 156262566Sdes struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS]; 157262566Sdes 158295367Sdes char *revoked_host_keys; 159197679Sdes 160295367Sdes int fingerprint_hash; 161295367Sdes 162295367Sdes int update_hostkeys; /* one of SSH_UPDATE_HOSTKEYS_* */ 163295367Sdes 164295367Sdes char *hostbased_key_types; 165295367Sdes char *pubkey_key_types; 166295367Sdes 167323124Sdes char *version_addendum; /* Appended to SSH banner */ 168295367Sdes 169323124Sdes char *jump_user; 170323124Sdes char *jump_host; 171323124Sdes int jump_port; 172323124Sdes char *jump_extra; 173323124Sdes 174294693Sdes char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ 17557429Smarkm} Options; 17657429Smarkm 177262566Sdes#define SSH_CANONICALISE_NO 0 178262566Sdes#define SSH_CANONICALISE_YES 1 179262566Sdes#define SSH_CANONICALISE_ALWAYS 2 180262566Sdes 181149753Sdes#define SSHCTL_MASTER_NO 0 182149753Sdes#define SSHCTL_MASTER_YES 1 183149753Sdes#define SSHCTL_MASTER_AUTO 2 184149753Sdes#define SSHCTL_MASTER_ASK 3 185149753Sdes#define SSHCTL_MASTER_AUTO_ASK 4 18657429Smarkm 187226046Sdes#define REQUEST_TTY_AUTO 0 188226046Sdes#define REQUEST_TTY_NO 1 189226046Sdes#define REQUEST_TTY_YES 2 190226046Sdes#define REQUEST_TTY_FORCE 3 191226046Sdes 192249839Sdes#define SSHCONF_CHECKPERM 1 /* check permissions on config file */ 193249839Sdes#define SSHCONF_USERCONF 2 /* user provided config file not system */ 194295367Sdes#define SSHCONF_POSTCANON 4 /* After hostname canonicalisation */ 195323124Sdes#define SSHCONF_NEVERMATCH 8 /* Match/Host never matches; internal only */ 196249839Sdes 197295367Sdes#define SSH_UPDATE_HOSTKEYS_NO 0 198295367Sdes#define SSH_UPDATE_HOSTKEYS_YES 1 199295367Sdes#define SSH_UPDATE_HOSTKEYS_ASK 2 200295367Sdes 20192559Sdesvoid initialize_options(Options *); 20292559Sdesvoid fill_default_options(Options *); 203264377Sdesvoid fill_default_options_for_canonicalization(Options *); 204295367Sdesint process_config_line(Options *, struct passwd *, const char *, 205295367Sdes const char *, char *, const char *, int, int *, int); 206262566Sdesint read_config_file(const char *, struct passwd *, const char *, 207295367Sdes const char *, Options *, int); 208295367Sdesint parse_forward(struct Forward *, const char *, int, int); 209323124Sdesint parse_jump(const char *, Options *, int); 210262566Sdesint default_ssh_port(void); 211264377Sdesint option_clear_or_none(const char *); 212295367Sdesvoid dump_client_config(Options *o, const char *host); 21357429Smarkm 214295367Sdesvoid add_local_forward(Options *, const struct Forward *); 215295367Sdesvoid add_remote_forward(Options *, const struct Forward *); 216249016Sdesvoid add_identity_file(Options *, const char *, const char *, int); 217296781Sdesvoid add_certificate_file(Options *, const char *, int); 21857429Smarkm 21957429Smarkm#endif /* READCONF_H */ 220