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): 20f374ba41SEd 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. 24*535af610SEd Maste - LibreSSL (https://www.libressl.org/) 3.1.0 or greater 25*535af610SEd Maste - OpenSSL (https://www.openssl.org) 1.1.1 or greater 2619261079SEd Maste 2719261079SEd MasteLibreSSL/OpenSSL should be compiled as a position-independent library 2819261079SEd Maste(i.e. -fPIC, eg by configuring OpenSSL as "./config [options] -fPIC" 2919261079SEd Masteor LibreSSL as "CFLAGS=-fPIC ./configure") otherwise OpenSSH will not 3019261079SEd Mastebe able to link with it. If you must use a non-position-independent 3119261079SEd Mastelibcrypto, then you may need to configure OpenSSH --without-pie. 3219261079SEd Maste 3319261079SEd MasteIf you build either from source, running the OpenSSL self-test ("make 3419261079SEd Mastetests") or the LibreSSL equivalent ("make check") and ensuring that all 3519261079SEd Mastetests pass is strongly recommended. 3619261079SEd Maste 3783d2307dSDag-Erling SmørgravNB. If you operating system supports /dev/random, you should configure 38a0ee8cc6SDag-Erling Smørgravlibcrypto (LibreSSL/OpenSSL) to use it. OpenSSH relies on libcrypto's 3919261079SEd Mastedirect support of /dev/random, or failing that, either prngd or egd. 40d4af9e69SDag-Erling Smørgrav 41d4af9e69SDag-Erling SmørgravPRNGD: 42d4af9e69SDag-Erling Smørgrav 43d4af9e69SDag-Erling SmørgravIf your system lacks kernel-based random collection, the use of Lutz 4419261079SEd MasteJaenicke's PRNGd is recommended. It requires that libcrypto be configured 4519261079SEd Masteto support it. 46d4af9e69SDag-Erling Smørgrav 47d4af9e69SDag-Erling Smørgravhttp://prngd.sourceforge.net/ 48d4af9e69SDag-Erling Smørgrav 49d4af9e69SDag-Erling SmørgravEGD: 50d4af9e69SDag-Erling Smørgrav 5119261079SEd MasteThe Entropy Gathering Daemon (EGD) supports the same interface as prngd. 5219261079SEd MasteIt also supported only if libcrypto is configured to support it. 53d4af9e69SDag-Erling Smørgrav 54a0ee8cc6SDag-Erling Smørgravhttp://egd.sourceforge.net/ 5583d2307dSDag-Erling Smørgrav 5683d2307dSDag-Erling SmørgravPAM: 57d4af9e69SDag-Erling Smørgrav 58d4af9e69SDag-Erling SmørgravOpenSSH can utilise Pluggable Authentication Modules (PAM) if your 59d4af9e69SDag-Erling Smørgravsystem supports it. PAM is standard most Linux distributions, Solaris, 6019261079SEd MasteHP-UX 11, AIX >= 5.2, FreeBSD, NetBSD and Mac OS X. 61d4af9e69SDag-Erling Smørgrav 62d4af9e69SDag-Erling SmørgravInformation about the various PAM implementations are available: 63d4af9e69SDag-Erling Smørgrav 64d4af9e69SDag-Erling SmørgravSolaris PAM: http://www.sun.com/software/solaris/pam/ 65d4af9e69SDag-Erling SmørgravLinux PAM: http://www.kernel.org/pub/linux/libs/pam/ 66d4af9e69SDag-Erling SmørgravOpenPAM: http://www.openpam.org/ 6783d2307dSDag-Erling Smørgrav 6883d2307dSDag-Erling SmørgravIf you wish to build the GNOME passphrase requester, you will need the GNOME 6983d2307dSDag-Erling Smørgravlibraries and headers. 7083d2307dSDag-Erling Smørgrav 7183d2307dSDag-Erling SmørgravGNOME: 7283d2307dSDag-Erling Smørgravhttp://www.gnome.org/ 7383d2307dSDag-Erling Smørgrav 74d74d50a8SDag-Erling SmørgravAlternatively, Jim Knoble <jmknoble@pobox.com> has written an excellent X11 7583d2307dSDag-Erling Smørgravpassphrase requester. This is maintained separately at: 7683d2307dSDag-Erling Smørgrav 77d95e11bfSDag-Erling Smørgravhttp://www.jmknoble.net/software/x11-ssh-askpass/ 7883d2307dSDag-Erling Smørgrav 79d4af9e69SDag-Erling SmørgravTCP Wrappers: 8083d2307dSDag-Erling Smørgrav 81d4af9e69SDag-Erling SmørgravIf you wish to use the TCP wrappers functionality you will need at least 82d4af9e69SDag-Erling Smørgravtcpd.h and libwrap.a, either in the standard include and library paths, 83d4af9e69SDag-Erling Smørgravor in the directory specified by --with-tcp-wrappers. Version 7.6 is 84d4af9e69SDag-Erling Smørgravknown to work. 8583d2307dSDag-Erling Smørgrav 86d4af9e69SDag-Erling Smørgravhttp://ftp.porcupine.org/pub/security/index.html 8783d2307dSDag-Erling Smørgrav 885e8dbd04SDag-Erling SmørgravLibEdit: 89761efaa7SDag-Erling Smørgrav 90761efaa7SDag-Erling Smørgravsftp supports command-line editing via NetBSD's libedit. If your platform 91761efaa7SDag-Erling Smørgravhas it available natively you can use that, alternatively you might try 92761efaa7SDag-Erling Smørgravthese multi-platform ports: 934518870cSDag-Erling Smørgrav 945e8dbd04SDag-Erling Smørgravhttp://www.thrysoee.dk/editline/ 955e8dbd04SDag-Erling Smørgravhttp://sourceforge.net/projects/libedit/ 965e8dbd04SDag-Erling Smørgrav 97462c32cbSDag-Erling SmørgravLDNS: 98462c32cbSDag-Erling Smørgrav 99462c32cbSDag-Erling SmørgravLDNS is a DNS BSD-licensed resolver library which supports DNSSEC. 100462c32cbSDag-Erling Smørgrav 101462c32cbSDag-Erling Smørgravhttp://nlnetlabs.nl/projects/ldns/ 102462c32cbSDag-Erling Smørgrav 103761efaa7SDag-Erling SmørgravAutoconf: 104761efaa7SDag-Erling Smørgrav 105761efaa7SDag-Erling SmørgravIf you modify configure.ac or configure doesn't exist (eg if you checked 10619261079SEd Mastethe code out of git yourself) then you will need autoconf-2.69 and 10719261079SEd Masteautomake-1.16.1 to rebuild the automatically generated files by running 10819261079SEd Maste"autoreconf". Earlier versions may also work but this is not guaranteed. 109761efaa7SDag-Erling Smørgrav 110761efaa7SDag-Erling Smørgravhttp://www.gnu.org/software/autoconf/ 11119261079SEd Mastehttp://www.gnu.org/software/automake/ 112761efaa7SDag-Erling Smørgrav 113761efaa7SDag-Erling SmørgravBasic Security Module (BSM): 114761efaa7SDag-Erling Smørgrav 1154f52dfbbSDag-Erling SmørgravNative BSM support is known to exist in Solaris from at least 2.5.1, 116761efaa7SDag-Erling SmørgravFreeBSD 6.1 and OS X. Alternatively, you may use the OpenBSM 117761efaa7SDag-Erling Smørgravimplementation (http://www.openbsm.org). 118761efaa7SDag-Erling Smørgrav 11947dd1d1bSDag-Erling Smørgravmakedepend: 12047dd1d1bSDag-Erling Smørgrav 12147dd1d1bSDag-Erling Smørgravhttps://www.x.org/archive/individual/util/ 12247dd1d1bSDag-Erling Smørgrav 12347dd1d1bSDag-Erling SmørgravIf you are making significant changes to the code you may need to rebuild 12447dd1d1bSDag-Erling Smørgravthe dependency (.depend) file using "make depend", which requires the 12547dd1d1bSDag-Erling Smørgrav"makedepend" tool from the X11 distribution. 126761efaa7SDag-Erling Smørgrav 12719261079SEd Mastelibfido2: 12819261079SEd Maste 12919261079SEd Mastelibfido2 allows the use of hardware security keys over USB. libfido2 13019261079SEd Mastein turn depends on libcbor. libfido2 >= 1.5.0 is strongly recommended. 13119261079SEd MasteLimited functionality is possible with earlier libfido2 versions. 13219261079SEd Maste 13319261079SEd Mastehttps://github.com/Yubico/libfido2 13419261079SEd Mastehttps://github.com/pjk/libcbor 13519261079SEd Maste 13619261079SEd Maste 13783d2307dSDag-Erling Smørgrav2. Building / Installation 13883d2307dSDag-Erling Smørgrav-------------------------- 13983d2307dSDag-Erling Smørgrav 14083d2307dSDag-Erling SmørgravTo install OpenSSH with default options: 14183d2307dSDag-Erling Smørgrav 14283d2307dSDag-Erling Smørgrav./configure 14383d2307dSDag-Erling Smørgravmake 14483d2307dSDag-Erling Smørgravmake install 14583d2307dSDag-Erling Smørgrav 14683d2307dSDag-Erling SmørgravThis will install the OpenSSH binaries in /usr/local/bin, configuration files 14783d2307dSDag-Erling Smørgravin /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different 14883d2307dSDag-Erling Smørgravinstallation prefix, use the --prefix option to configure: 14983d2307dSDag-Erling Smørgrav 15083d2307dSDag-Erling Smørgrav./configure --prefix=/opt 15183d2307dSDag-Erling Smørgravmake 15283d2307dSDag-Erling Smørgravmake install 15383d2307dSDag-Erling Smørgrav 15483d2307dSDag-Erling SmørgravWill install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override 15583d2307dSDag-Erling Smørgravspecific paths, for example: 15683d2307dSDag-Erling Smørgrav 15783d2307dSDag-Erling Smørgrav./configure --prefix=/opt --sysconfdir=/etc/ssh 15883d2307dSDag-Erling Smørgravmake 15983d2307dSDag-Erling Smørgravmake install 16083d2307dSDag-Erling Smørgrav 16183d2307dSDag-Erling SmørgravThis will install the binaries in /opt/{bin,lib,sbin}, but will place the 16283d2307dSDag-Erling Smørgravconfiguration files in /etc/ssh. 16383d2307dSDag-Erling Smørgrav 16483d2307dSDag-Erling SmørgravIf you are using PAM, you may need to manually install a PAM control 16583d2307dSDag-Erling Smørgravfile as "/etc/pam.d/sshd" (or wherever your system prefers to keep 16683d2307dSDag-Erling Smørgravthem). Note that the service name used to start PAM is __progname, 16783d2307dSDag-Erling Smørgravwhich is the basename of the path of your sshd (e.g., the service name 16883d2307dSDag-Erling Smørgravfor /usr/sbin/osshd will be osshd). If you have renamed your sshd 16983d2307dSDag-Erling Smørgravexecutable, your PAM configuration may need to be modified. 17083d2307dSDag-Erling Smørgrav 17183d2307dSDag-Erling SmørgravA generic PAM configuration is included as "contrib/sshd.pam.generic", 17283d2307dSDag-Erling Smørgravyou may need to edit it before using it on your system. If you are 17383d2307dSDag-Erling Smørgravusing a recent version of Red Hat Linux, the config file in 17483d2307dSDag-Erling Smørgravcontrib/redhat/sshd.pam should be more useful. Failure to install a 17583d2307dSDag-Erling Smørgravvalid PAM file may result in an inability to use password 17683d2307dSDag-Erling Smørgravauthentication. On HP-UX 11 and Solaris, the standard /etc/pam.conf 17783d2307dSDag-Erling Smørgravconfiguration will work with sshd (sshd will match the other service 17883d2307dSDag-Erling Smørgravname). 17983d2307dSDag-Erling Smørgrav 18083d2307dSDag-Erling SmørgravThere are a few other options to the configure script: 18183d2307dSDag-Erling Smørgrav 182761efaa7SDag-Erling Smørgrav--with-audit=[module] enable additional auditing via the specified module. 183761efaa7SDag-Erling SmørgravCurrently, drivers for "debug" (additional info via syslog) and "bsm" 184761efaa7SDag-Erling Smørgrav(Sun's Basic Security Module) are supported. 185761efaa7SDag-Erling Smørgrav 186d95e11bfSDag-Erling Smørgrav--with-pam enables PAM support. If PAM support is compiled in, it must 187d95e11bfSDag-Erling Smørgravalso be enabled in sshd_config (refer to the UsePAM directive). 18883d2307dSDag-Erling Smørgrav 18983d2307dSDag-Erling Smørgrav--with-prngd-socket=/some/file allows you to enable EGD or PRNGD 19083d2307dSDag-Erling Smørgravsupport and to specify a PRNGd socket. Use this if your Unix lacks 19147dd1d1bSDag-Erling Smørgrav/dev/random. 19283d2307dSDag-Erling Smørgrav 19383d2307dSDag-Erling Smørgrav--with-prngd-port=portnum allows you to enable EGD or PRNGD support 19483d2307dSDag-Erling Smørgravand to specify a EGD localhost TCP port. Use this if your Unix lacks 19547dd1d1bSDag-Erling Smørgrav/dev/random. 19683d2307dSDag-Erling Smørgrav 19783d2307dSDag-Erling Smørgrav--with-lastlog=FILE will specify the location of the lastlog file. 19883d2307dSDag-Erling Smørgrav./configure searches a few locations for lastlog, but may not find 19983d2307dSDag-Erling Smørgravit if lastlog is installed in a different place. 20083d2307dSDag-Erling Smørgrav 20183d2307dSDag-Erling Smørgrav--without-lastlog will disable lastlog support entirely. 20283d2307dSDag-Erling Smørgrav 203d95e11bfSDag-Erling Smørgrav--with-osfsia, --without-osfsia will enable or disable OSF1's Security 20483d2307dSDag-Erling SmørgravIntegration Architecture. The default for OSF1 machines is enable. 20583d2307dSDag-Erling Smørgrav 20683d2307dSDag-Erling Smørgrav--with-tcp-wrappers will enable TCP Wrappers (/etc/hosts.allow|deny) 207d4af9e69SDag-Erling Smørgravsupport. 20883d2307dSDag-Erling Smørgrav 20983d2307dSDag-Erling Smørgrav--with-utmpx enables utmpx support. utmpx support is automatic for 21083d2307dSDag-Erling Smørgravsome platforms. 21183d2307dSDag-Erling Smørgrav 21283d2307dSDag-Erling Smørgrav--without-shadow disables shadow password support. 21383d2307dSDag-Erling Smørgrav 21483d2307dSDag-Erling Smørgrav--with-ipaddr-display forces the use of a numeric IP address in the 21583d2307dSDag-Erling Smørgrav$DISPLAY environment variable. Some broken systems need this. 21683d2307dSDag-Erling Smørgrav 21783d2307dSDag-Erling Smørgrav--with-default-path=PATH allows you to specify a default $PATH for sessions 21883d2307dSDag-Erling Smørgravstarted by sshd. This replaces the standard path entirely. 21983d2307dSDag-Erling Smørgrav 220d4af9e69SDag-Erling Smørgrav--with-pid-dir=PATH specifies the directory in which the sshd.pid file is 22183d2307dSDag-Erling Smørgravcreated. 22283d2307dSDag-Erling Smørgrav 22383d2307dSDag-Erling Smørgrav--with-xauth=PATH specifies the location of the xauth binary 22483d2307dSDag-Erling Smørgrav 225a0ee8cc6SDag-Erling Smørgrav--with-ssl-dir=DIR allows you to specify where your Libre/OpenSSL 22647dd1d1bSDag-Erling Smørgravlibraries are installed. 22783d2307dSDag-Erling Smørgrav 228a0ee8cc6SDag-Erling Smørgrav--with-ssl-engine enables Libre/OpenSSL's (hardware) ENGINE support 229761efaa7SDag-Erling Smørgrav 23019261079SEd Maste--without-openssl builds without using OpenSSL. Only a subset of ciphers 23119261079SEd Masteand algorithms are supported in this configuration. 23219261079SEd Maste 23319261079SEd Maste--without-zlib builds without zlib. This disables the Compression option. 23419261079SEd Maste 23583d2307dSDag-Erling Smørgrav--with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to 23683d2307dSDag-Erling Smørgravreal (AF_INET) IPv4 addresses. Works around some quirks on Linux. 23783d2307dSDag-Erling Smørgrav 23883d2307dSDag-Erling SmørgravIf you need to pass special options to the compiler or linker, you 23983d2307dSDag-Erling Smørgravcan specify these as environment variables before running ./configure. 24083d2307dSDag-Erling SmørgravFor example: 24183d2307dSDag-Erling Smørgrav 242190cef3dSDag-Erling SmørgravCC="/usr/foo/cc" CFLAGS="-O" LDFLAGS="-s" LIBS="-lrubbish" ./configure 24383d2307dSDag-Erling Smørgrav 24483d2307dSDag-Erling Smørgrav3. Configuration 24583d2307dSDag-Erling Smørgrav---------------- 24683d2307dSDag-Erling Smørgrav 24783d2307dSDag-Erling SmørgravThe runtime configuration files are installed by in ${prefix}/etc or 24883d2307dSDag-Erling Smørgravwhatever you specified as your --sysconfdir (/usr/local/etc by default). 24983d2307dSDag-Erling Smørgrav 25083d2307dSDag-Erling SmørgravThe default configuration should be instantly usable, though you should 25183d2307dSDag-Erling Smørgravreview it to ensure that it matches your security requirements. 25283d2307dSDag-Erling Smørgrav 25383d2307dSDag-Erling SmørgravTo generate a host key, run "make host-key". Alternately you can do so 25483d2307dSDag-Erling Smørgravmanually using the following commands: 25583d2307dSDag-Erling Smørgrav 256ca86bcf2SDag-Erling Smørgrav ssh-keygen -t [type] -f /etc/ssh/ssh_host_key -N "" 257ca86bcf2SDag-Erling Smørgrav 258d93a896eSDag-Erling Smørgravfor each of the types you wish to generate (rsa, dsa or ecdsa) or 259ca86bcf2SDag-Erling Smørgrav 260ca86bcf2SDag-Erling Smørgrav ssh-keygen -A 261ca86bcf2SDag-Erling Smørgrav 262ca86bcf2SDag-Erling Smørgravto generate keys for all supported types. 26383d2307dSDag-Erling Smørgrav 26483d2307dSDag-Erling SmørgravReplacing /etc/ssh with the correct path to the configuration directory. 26583d2307dSDag-Erling Smørgrav(${prefix}/etc or whatever you specified with --sysconfdir during 26619261079SEd Masteconfiguration). 26783d2307dSDag-Erling Smørgrav 26819261079SEd MasteIf you have configured OpenSSH with EGD/prngd support, ensure that EGD or 26919261079SEd Masteprngd is running and has collected some entropy first. 27083d2307dSDag-Erling Smørgrav 27183d2307dSDag-Erling SmørgravFor more information on configuration, please refer to the manual pages 27283d2307dSDag-Erling Smørgravfor sshd, ssh and ssh-agent. 27383d2307dSDag-Erling Smørgrav 2745e8dbd04SDag-Erling Smørgrav4. (Optional) Send survey 2755e8dbd04SDag-Erling Smørgrav------------------------- 2765e8dbd04SDag-Erling Smørgrav 2775e8dbd04SDag-Erling Smørgrav$ make survey 278761efaa7SDag-Erling Smørgrav[check the contents of the file "survey" to ensure there's no information 279761efaa7SDag-Erling Smørgravthat you consider sensitive] 2805e8dbd04SDag-Erling Smørgrav$ make send-survey 2815e8dbd04SDag-Erling Smørgrav 2825e8dbd04SDag-Erling SmørgravThis will send configuration information for the currently configured 2835e8dbd04SDag-Erling Smørgravhost to a survey address. This will help determine which configurations 2845e8dbd04SDag-Erling Smørgravare actually in use, and what valid combinations of configure options 2855e8dbd04SDag-Erling Smørgravexist. The raw data is available only to the OpenSSH developers, however 2865e8dbd04SDag-Erling Smørgravsummary data may be published. 2875e8dbd04SDag-Erling Smørgrav 2885e8dbd04SDag-Erling Smørgrav5. Problems? 28983d2307dSDag-Erling Smørgrav------------ 29083d2307dSDag-Erling Smørgrav 29119261079SEd MasteIf you experience problems compiling, installing or running OpenSSH, 29219261079SEd Masteplease refer to the "reporting bugs" section of the webpage at 293ca86bcf2SDag-Erling Smørgravhttps://www.openssh.com/ 294