1d93a896eSDag-Erling Smørgrav1. Prerequisites 283d2307dSDag-Erling Smørgrav---------------- 383d2307dSDag-Erling Smørgrav 438a52bd3SEd MasteA C compiler. Any C89 or better compiler that supports variadic macros 538a52bd3SEd Masteshould work. Where supported, configure will attempt to enable the 638a52bd3SEd Mastecompiler's run-time integrity checking options. Some notes about 738a52bd3SEd Mastespecific compilers: 8ca86bcf2SDag-Erling Smørgrav - clang: -ftrapv and -sanitize=integer require the compiler-rt runtime 9ca86bcf2SDag-Erling Smørgrav (CC=clang LDFLAGS=--rtlib=compiler-rt ./configure) 10ca86bcf2SDag-Erling Smørgrav 1119261079SEd MasteTo support Privilege Separation (which is now required) you will need 1219261079SEd Masteto create the user, group and directory used by sshd for privilege 1319261079SEd Masteseparation. See README.privsep for details. 1483d2307dSDag-Erling Smørgrav 1583d2307dSDag-Erling Smørgrav 16761efaa7SDag-Erling SmørgravThe remaining items are optional. 17761efaa7SDag-Erling Smørgrav 1819261079SEd MasteA working installation of zlib: 1919261079SEd MasteZlib 1.1.4 or 1.2.1.2 or greater (earlier 1.2.x versions have problems): 20*f374ba41SEd Mastehttps://zlib.net/ 2119261079SEd Maste 2219261079SEd Mastelibcrypto from either of LibreSSL or OpenSSL. Building without libcrypto 2319261079SEd Masteis supported but severely restricts the available ciphers and algorithms. 2419261079SEd Maste - LibreSSL (https://www.libressl.org/) 2519261079SEd Maste - OpenSSL (https://www.openssl.org) with any of the following versions: 2619261079SEd Maste - 1.0.x >= 1.0.1 or 1.1.0 >= 1.1.0g or any 1.1.1 2719261079SEd Maste 2819261079SEd MasteNote that due to a bug in EVP_CipherInit OpenSSL 1.1 versions prior to 2919261079SEd Maste1.1.0g can't be used. 3019261079SEd Maste 3119261079SEd MasteLibreSSL/OpenSSL should be compiled as a position-independent library 3219261079SEd Maste(i.e. -fPIC, eg by configuring OpenSSL as "./config [options] -fPIC" 3319261079SEd Masteor LibreSSL as "CFLAGS=-fPIC ./configure") otherwise OpenSSH will not 3419261079SEd Mastebe able to link with it. If you must use a non-position-independent 3519261079SEd Mastelibcrypto, then you may need to configure OpenSSH --without-pie. 3619261079SEd Maste 3719261079SEd MasteIf you build either from source, running the OpenSSL self-test ("make 3819261079SEd Mastetests") or the LibreSSL equivalent ("make check") and ensuring that all 3919261079SEd Mastetests pass is strongly recommended. 4019261079SEd Maste 4183d2307dSDag-Erling SmørgravNB. If you operating system supports /dev/random, you should configure 42a0ee8cc6SDag-Erling Smørgravlibcrypto (LibreSSL/OpenSSL) to use it. OpenSSH relies on libcrypto's 4319261079SEd Mastedirect support of /dev/random, or failing that, either prngd or egd. 44d4af9e69SDag-Erling Smørgrav 45d4af9e69SDag-Erling SmørgravPRNGD: 46d4af9e69SDag-Erling Smørgrav 47d4af9e69SDag-Erling SmørgravIf your system lacks kernel-based random collection, the use of Lutz 4819261079SEd MasteJaenicke's PRNGd is recommended. It requires that libcrypto be configured 4919261079SEd Masteto support it. 50d4af9e69SDag-Erling Smørgrav 51d4af9e69SDag-Erling Smørgravhttp://prngd.sourceforge.net/ 52d4af9e69SDag-Erling Smørgrav 53d4af9e69SDag-Erling SmørgravEGD: 54d4af9e69SDag-Erling Smørgrav 5519261079SEd MasteThe Entropy Gathering Daemon (EGD) supports the same interface as prngd. 5619261079SEd MasteIt also supported only if libcrypto is configured to support it. 57d4af9e69SDag-Erling Smørgrav 58a0ee8cc6SDag-Erling Smørgravhttp://egd.sourceforge.net/ 5983d2307dSDag-Erling Smørgrav 6083d2307dSDag-Erling SmørgravPAM: 61d4af9e69SDag-Erling Smørgrav 62d4af9e69SDag-Erling SmørgravOpenSSH can utilise Pluggable Authentication Modules (PAM) if your 63d4af9e69SDag-Erling Smørgravsystem supports it. PAM is standard most Linux distributions, Solaris, 6419261079SEd MasteHP-UX 11, AIX >= 5.2, FreeBSD, NetBSD and Mac OS X. 65d4af9e69SDag-Erling Smørgrav 66d4af9e69SDag-Erling SmørgravInformation about the various PAM implementations are available: 67d4af9e69SDag-Erling Smørgrav 68d4af9e69SDag-Erling SmørgravSolaris PAM: http://www.sun.com/software/solaris/pam/ 69d4af9e69SDag-Erling SmørgravLinux PAM: http://www.kernel.org/pub/linux/libs/pam/ 70d4af9e69SDag-Erling SmørgravOpenPAM: http://www.openpam.org/ 7183d2307dSDag-Erling Smørgrav 7283d2307dSDag-Erling SmørgravIf you wish to build the GNOME passphrase requester, you will need the GNOME 7383d2307dSDag-Erling Smørgravlibraries and headers. 7483d2307dSDag-Erling Smørgrav 7583d2307dSDag-Erling SmørgravGNOME: 7683d2307dSDag-Erling Smørgravhttp://www.gnome.org/ 7783d2307dSDag-Erling Smørgrav 78d74d50a8SDag-Erling SmørgravAlternatively, Jim Knoble <jmknoble@pobox.com> has written an excellent X11 7983d2307dSDag-Erling Smørgravpassphrase requester. This is maintained separately at: 8083d2307dSDag-Erling Smørgrav 81d95e11bfSDag-Erling Smørgravhttp://www.jmknoble.net/software/x11-ssh-askpass/ 8283d2307dSDag-Erling Smørgrav 83d4af9e69SDag-Erling SmørgravTCP Wrappers: 8483d2307dSDag-Erling Smørgrav 85d4af9e69SDag-Erling SmørgravIf you wish to use the TCP wrappers functionality you will need at least 86d4af9e69SDag-Erling Smørgravtcpd.h and libwrap.a, either in the standard include and library paths, 87d4af9e69SDag-Erling Smørgravor in the directory specified by --with-tcp-wrappers. Version 7.6 is 88d4af9e69SDag-Erling Smørgravknown to work. 8983d2307dSDag-Erling Smørgrav 90d4af9e69SDag-Erling Smørgravhttp://ftp.porcupine.org/pub/security/index.html 9183d2307dSDag-Erling Smørgrav 925e8dbd04SDag-Erling SmørgravLibEdit: 93761efaa7SDag-Erling Smørgrav 94761efaa7SDag-Erling Smørgravsftp supports command-line editing via NetBSD's libedit. If your platform 95761efaa7SDag-Erling Smørgravhas it available natively you can use that, alternatively you might try 96761efaa7SDag-Erling Smørgravthese multi-platform ports: 974518870cSDag-Erling Smørgrav 985e8dbd04SDag-Erling Smørgravhttp://www.thrysoee.dk/editline/ 995e8dbd04SDag-Erling Smørgravhttp://sourceforge.net/projects/libedit/ 1005e8dbd04SDag-Erling Smørgrav 101462c32cbSDag-Erling SmørgravLDNS: 102462c32cbSDag-Erling Smørgrav 103462c32cbSDag-Erling SmørgravLDNS is a DNS BSD-licensed resolver library which supports DNSSEC. 104462c32cbSDag-Erling Smørgrav 105462c32cbSDag-Erling Smørgravhttp://nlnetlabs.nl/projects/ldns/ 106462c32cbSDag-Erling Smørgrav 107761efaa7SDag-Erling SmørgravAutoconf: 108761efaa7SDag-Erling Smørgrav 109761efaa7SDag-Erling SmørgravIf you modify configure.ac or configure doesn't exist (eg if you checked 11019261079SEd Mastethe code out of git yourself) then you will need autoconf-2.69 and 11119261079SEd Masteautomake-1.16.1 to rebuild the automatically generated files by running 11219261079SEd Maste"autoreconf". Earlier versions may also work but this is not guaranteed. 113761efaa7SDag-Erling Smørgrav 114761efaa7SDag-Erling Smørgravhttp://www.gnu.org/software/autoconf/ 11519261079SEd Mastehttp://www.gnu.org/software/automake/ 116761efaa7SDag-Erling Smørgrav 117761efaa7SDag-Erling SmørgravBasic Security Module (BSM): 118761efaa7SDag-Erling Smørgrav 1194f52dfbbSDag-Erling SmørgravNative BSM support is known to exist in Solaris from at least 2.5.1, 120761efaa7SDag-Erling SmørgravFreeBSD 6.1 and OS X. Alternatively, you may use the OpenBSM 121761efaa7SDag-Erling Smørgravimplementation (http://www.openbsm.org). 122761efaa7SDag-Erling Smørgrav 12347dd1d1bSDag-Erling Smørgravmakedepend: 12447dd1d1bSDag-Erling Smørgrav 12547dd1d1bSDag-Erling Smørgravhttps://www.x.org/archive/individual/util/ 12647dd1d1bSDag-Erling Smørgrav 12747dd1d1bSDag-Erling SmørgravIf you are making significant changes to the code you may need to rebuild 12847dd1d1bSDag-Erling Smørgravthe dependency (.depend) file using "make depend", which requires the 12947dd1d1bSDag-Erling Smørgrav"makedepend" tool from the X11 distribution. 130761efaa7SDag-Erling Smørgrav 13119261079SEd Mastelibfido2: 13219261079SEd Maste 13319261079SEd Mastelibfido2 allows the use of hardware security keys over USB. libfido2 13419261079SEd Mastein turn depends on libcbor. libfido2 >= 1.5.0 is strongly recommended. 13519261079SEd MasteLimited functionality is possible with earlier libfido2 versions. 13619261079SEd Maste 13719261079SEd Mastehttps://github.com/Yubico/libfido2 13819261079SEd Mastehttps://github.com/pjk/libcbor 13919261079SEd Maste 14019261079SEd Maste 14183d2307dSDag-Erling Smørgrav2. Building / Installation 14283d2307dSDag-Erling Smørgrav-------------------------- 14383d2307dSDag-Erling Smørgrav 14483d2307dSDag-Erling SmørgravTo install OpenSSH with default options: 14583d2307dSDag-Erling Smørgrav 14683d2307dSDag-Erling Smørgrav./configure 14783d2307dSDag-Erling Smørgravmake 14883d2307dSDag-Erling Smørgravmake install 14983d2307dSDag-Erling Smørgrav 15083d2307dSDag-Erling SmørgravThis will install the OpenSSH binaries in /usr/local/bin, configuration files 15183d2307dSDag-Erling Smørgravin /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different 15283d2307dSDag-Erling Smørgravinstallation prefix, use the --prefix option to configure: 15383d2307dSDag-Erling Smørgrav 15483d2307dSDag-Erling Smørgrav./configure --prefix=/opt 15583d2307dSDag-Erling Smørgravmake 15683d2307dSDag-Erling Smørgravmake install 15783d2307dSDag-Erling Smørgrav 15883d2307dSDag-Erling SmørgravWill install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override 15983d2307dSDag-Erling Smørgravspecific paths, for example: 16083d2307dSDag-Erling Smørgrav 16183d2307dSDag-Erling Smørgrav./configure --prefix=/opt --sysconfdir=/etc/ssh 16283d2307dSDag-Erling Smørgravmake 16383d2307dSDag-Erling Smørgravmake install 16483d2307dSDag-Erling Smørgrav 16583d2307dSDag-Erling SmørgravThis will install the binaries in /opt/{bin,lib,sbin}, but will place the 16683d2307dSDag-Erling Smørgravconfiguration files in /etc/ssh. 16783d2307dSDag-Erling Smørgrav 16883d2307dSDag-Erling SmørgravIf you are using PAM, you may need to manually install a PAM control 16983d2307dSDag-Erling Smørgravfile as "/etc/pam.d/sshd" (or wherever your system prefers to keep 17083d2307dSDag-Erling Smørgravthem). Note that the service name used to start PAM is __progname, 17183d2307dSDag-Erling Smørgravwhich is the basename of the path of your sshd (e.g., the service name 17283d2307dSDag-Erling Smørgravfor /usr/sbin/osshd will be osshd). If you have renamed your sshd 17383d2307dSDag-Erling Smørgravexecutable, your PAM configuration may need to be modified. 17483d2307dSDag-Erling Smørgrav 17583d2307dSDag-Erling SmørgravA generic PAM configuration is included as "contrib/sshd.pam.generic", 17683d2307dSDag-Erling Smørgravyou may need to edit it before using it on your system. If you are 17783d2307dSDag-Erling Smørgravusing a recent version of Red Hat Linux, the config file in 17883d2307dSDag-Erling Smørgravcontrib/redhat/sshd.pam should be more useful. Failure to install a 17983d2307dSDag-Erling Smørgravvalid PAM file may result in an inability to use password 18083d2307dSDag-Erling Smørgravauthentication. On HP-UX 11 and Solaris, the standard /etc/pam.conf 18183d2307dSDag-Erling Smørgravconfiguration will work with sshd (sshd will match the other service 18283d2307dSDag-Erling Smørgravname). 18383d2307dSDag-Erling Smørgrav 18483d2307dSDag-Erling SmørgravThere are a few other options to the configure script: 18583d2307dSDag-Erling Smørgrav 186761efaa7SDag-Erling Smørgrav--with-audit=[module] enable additional auditing via the specified module. 187761efaa7SDag-Erling SmørgravCurrently, drivers for "debug" (additional info via syslog) and "bsm" 188761efaa7SDag-Erling Smørgrav(Sun's Basic Security Module) are supported. 189761efaa7SDag-Erling Smørgrav 190d95e11bfSDag-Erling Smørgrav--with-pam enables PAM support. If PAM support is compiled in, it must 191d95e11bfSDag-Erling Smørgravalso be enabled in sshd_config (refer to the UsePAM directive). 19283d2307dSDag-Erling Smørgrav 19383d2307dSDag-Erling Smørgrav--with-prngd-socket=/some/file allows you to enable EGD or PRNGD 19483d2307dSDag-Erling Smørgravsupport and to specify a PRNGd socket. Use this if your Unix lacks 19547dd1d1bSDag-Erling Smørgrav/dev/random. 19683d2307dSDag-Erling Smørgrav 19783d2307dSDag-Erling Smørgrav--with-prngd-port=portnum allows you to enable EGD or PRNGD support 19883d2307dSDag-Erling Smørgravand to specify a EGD localhost TCP port. Use this if your Unix lacks 19947dd1d1bSDag-Erling Smørgrav/dev/random. 20083d2307dSDag-Erling Smørgrav 20183d2307dSDag-Erling Smørgrav--with-lastlog=FILE will specify the location of the lastlog file. 20283d2307dSDag-Erling Smørgrav./configure searches a few locations for lastlog, but may not find 20383d2307dSDag-Erling Smørgravit if lastlog is installed in a different place. 20483d2307dSDag-Erling Smørgrav 20583d2307dSDag-Erling Smørgrav--without-lastlog will disable lastlog support entirely. 20683d2307dSDag-Erling Smørgrav 207d95e11bfSDag-Erling Smørgrav--with-osfsia, --without-osfsia will enable or disable OSF1's Security 20883d2307dSDag-Erling SmørgravIntegration Architecture. The default for OSF1 machines is enable. 20983d2307dSDag-Erling Smørgrav 21083d2307dSDag-Erling Smørgrav--with-tcp-wrappers will enable TCP Wrappers (/etc/hosts.allow|deny) 211d4af9e69SDag-Erling Smørgravsupport. 21283d2307dSDag-Erling Smørgrav 21383d2307dSDag-Erling Smørgrav--with-utmpx enables utmpx support. utmpx support is automatic for 21483d2307dSDag-Erling Smørgravsome platforms. 21583d2307dSDag-Erling Smørgrav 21683d2307dSDag-Erling Smørgrav--without-shadow disables shadow password support. 21783d2307dSDag-Erling Smørgrav 21883d2307dSDag-Erling Smørgrav--with-ipaddr-display forces the use of a numeric IP address in the 21983d2307dSDag-Erling Smørgrav$DISPLAY environment variable. Some broken systems need this. 22083d2307dSDag-Erling Smørgrav 22183d2307dSDag-Erling Smørgrav--with-default-path=PATH allows you to specify a default $PATH for sessions 22283d2307dSDag-Erling Smørgravstarted by sshd. This replaces the standard path entirely. 22383d2307dSDag-Erling Smørgrav 224d4af9e69SDag-Erling Smørgrav--with-pid-dir=PATH specifies the directory in which the sshd.pid file is 22583d2307dSDag-Erling Smørgravcreated. 22683d2307dSDag-Erling Smørgrav 22783d2307dSDag-Erling Smørgrav--with-xauth=PATH specifies the location of the xauth binary 22883d2307dSDag-Erling Smørgrav 229a0ee8cc6SDag-Erling Smørgrav--with-ssl-dir=DIR allows you to specify where your Libre/OpenSSL 23047dd1d1bSDag-Erling Smørgravlibraries are installed. 23183d2307dSDag-Erling Smørgrav 232a0ee8cc6SDag-Erling Smørgrav--with-ssl-engine enables Libre/OpenSSL's (hardware) ENGINE support 233761efaa7SDag-Erling Smørgrav 23419261079SEd Maste--without-openssl builds without using OpenSSL. Only a subset of ciphers 23519261079SEd Masteand algorithms are supported in this configuration. 23619261079SEd Maste 23719261079SEd Maste--without-zlib builds without zlib. This disables the Compression option. 23819261079SEd Maste 23983d2307dSDag-Erling Smørgrav--with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to 24083d2307dSDag-Erling Smørgravreal (AF_INET) IPv4 addresses. Works around some quirks on Linux. 24183d2307dSDag-Erling Smørgrav 24283d2307dSDag-Erling SmørgravIf you need to pass special options to the compiler or linker, you 24383d2307dSDag-Erling Smørgravcan specify these as environment variables before running ./configure. 24483d2307dSDag-Erling SmørgravFor example: 24583d2307dSDag-Erling Smørgrav 246190cef3dSDag-Erling SmørgravCC="/usr/foo/cc" CFLAGS="-O" LDFLAGS="-s" LIBS="-lrubbish" ./configure 24783d2307dSDag-Erling Smørgrav 24883d2307dSDag-Erling Smørgrav3. Configuration 24983d2307dSDag-Erling Smørgrav---------------- 25083d2307dSDag-Erling Smørgrav 25183d2307dSDag-Erling SmørgravThe runtime configuration files are installed by in ${prefix}/etc or 25283d2307dSDag-Erling Smørgravwhatever you specified as your --sysconfdir (/usr/local/etc by default). 25383d2307dSDag-Erling Smørgrav 25483d2307dSDag-Erling SmørgravThe default configuration should be instantly usable, though you should 25583d2307dSDag-Erling Smørgravreview it to ensure that it matches your security requirements. 25683d2307dSDag-Erling Smørgrav 25783d2307dSDag-Erling SmørgravTo generate a host key, run "make host-key". Alternately you can do so 25883d2307dSDag-Erling Smørgravmanually using the following commands: 25983d2307dSDag-Erling Smørgrav 260ca86bcf2SDag-Erling Smørgrav ssh-keygen -t [type] -f /etc/ssh/ssh_host_key -N "" 261ca86bcf2SDag-Erling Smørgrav 262d93a896eSDag-Erling Smørgravfor each of the types you wish to generate (rsa, dsa or ecdsa) or 263ca86bcf2SDag-Erling Smørgrav 264ca86bcf2SDag-Erling Smørgrav ssh-keygen -A 265ca86bcf2SDag-Erling Smørgrav 266ca86bcf2SDag-Erling Smørgravto generate keys for all supported types. 26783d2307dSDag-Erling Smørgrav 26883d2307dSDag-Erling SmørgravReplacing /etc/ssh with the correct path to the configuration directory. 26983d2307dSDag-Erling Smørgrav(${prefix}/etc or whatever you specified with --sysconfdir during 27019261079SEd Masteconfiguration). 27183d2307dSDag-Erling Smørgrav 27219261079SEd MasteIf you have configured OpenSSH with EGD/prngd support, ensure that EGD or 27319261079SEd Masteprngd is running and has collected some entropy first. 27483d2307dSDag-Erling Smørgrav 27583d2307dSDag-Erling SmørgravFor more information on configuration, please refer to the manual pages 27683d2307dSDag-Erling Smørgravfor sshd, ssh and ssh-agent. 27783d2307dSDag-Erling Smørgrav 2785e8dbd04SDag-Erling Smørgrav4. (Optional) Send survey 2795e8dbd04SDag-Erling Smørgrav------------------------- 2805e8dbd04SDag-Erling Smørgrav 2815e8dbd04SDag-Erling Smørgrav$ make survey 282761efaa7SDag-Erling Smørgrav[check the contents of the file "survey" to ensure there's no information 283761efaa7SDag-Erling Smørgravthat you consider sensitive] 2845e8dbd04SDag-Erling Smørgrav$ make send-survey 2855e8dbd04SDag-Erling Smørgrav 2865e8dbd04SDag-Erling SmørgravThis will send configuration information for the currently configured 2875e8dbd04SDag-Erling Smørgravhost to a survey address. This will help determine which configurations 2885e8dbd04SDag-Erling Smørgravare actually in use, and what valid combinations of configure options 2895e8dbd04SDag-Erling Smørgravexist. The raw data is available only to the OpenSSH developers, however 2905e8dbd04SDag-Erling Smørgravsummary data may be published. 2915e8dbd04SDag-Erling Smørgrav 2925e8dbd04SDag-Erling Smørgrav5. Problems? 29383d2307dSDag-Erling Smørgrav------------ 29483d2307dSDag-Erling Smørgrav 29519261079SEd MasteIf you experience problems compiling, installing or running OpenSSH, 29619261079SEd Masteplease refer to the "reporting bugs" section of the webpage at 297ca86bcf2SDag-Erling Smørgravhttps://www.openssh.com/ 298