1d93a896eSDag-Erling Smørgrav1. Prerequisites 283d2307dSDag-Erling Smørgrav---------------- 383d2307dSDag-Erling Smørgrav 4ca86bcf2SDag-Erling SmørgravA C compiler. Any C89 or better compiler should work. Where supported, 5ca86bcf2SDag-Erling Smørgravconfigure will attempt to enable the compiler's run-time integrity checking 6ca86bcf2SDag-Erling Smørgravoptions. Some notes about specific compilers: 7ca86bcf2SDag-Erling Smørgrav - clang: -ftrapv and -sanitize=integer require the compiler-rt runtime 8ca86bcf2SDag-Erling Smørgrav (CC=clang LDFLAGS=--rtlib=compiler-rt ./configure) 9ca86bcf2SDag-Erling Smørgrav 10*19261079SEd MasteTo support Privilege Separation (which is now required) you will need 11*19261079SEd Masteto create the user, group and directory used by sshd for privilege 12*19261079SEd Masteseparation. See README.privsep for details. 1383d2307dSDag-Erling Smørgrav 1483d2307dSDag-Erling Smørgrav 15761efaa7SDag-Erling SmørgravThe remaining items are optional. 16761efaa7SDag-Erling Smørgrav 17*19261079SEd MasteA working installation of zlib: 18*19261079SEd MasteZlib 1.1.4 or 1.2.1.2 or greater (earlier 1.2.x versions have problems): 19*19261079SEd Mastehttp://www.gzip.org/zlib/ 20*19261079SEd Maste 21*19261079SEd Mastelibcrypto from either of LibreSSL or OpenSSL. Building without libcrypto 22*19261079SEd Masteis supported but severely restricts the available ciphers and algorithms. 23*19261079SEd Maste - LibreSSL (https://www.libressl.org/) 24*19261079SEd Maste - OpenSSL (https://www.openssl.org) with any of the following versions: 25*19261079SEd Maste - 1.0.x >= 1.0.1 or 1.1.0 >= 1.1.0g or any 1.1.1 26*19261079SEd Maste 27*19261079SEd MasteNote that due to a bug in EVP_CipherInit OpenSSL 1.1 versions prior to 28*19261079SEd Maste1.1.0g can't be used. 29*19261079SEd Maste 30*19261079SEd MasteLibreSSL/OpenSSL should be compiled as a position-independent library 31*19261079SEd Maste(i.e. -fPIC, eg by configuring OpenSSL as "./config [options] -fPIC" 32*19261079SEd Masteor LibreSSL as "CFLAGS=-fPIC ./configure") otherwise OpenSSH will not 33*19261079SEd Mastebe able to link with it. If you must use a non-position-independent 34*19261079SEd Mastelibcrypto, then you may need to configure OpenSSH --without-pie. 35*19261079SEd Maste 36*19261079SEd MasteIf you build either from source, running the OpenSSL self-test ("make 37*19261079SEd Mastetests") or the LibreSSL equivalent ("make check") and ensuring that all 38*19261079SEd Mastetests pass is strongly recommended. 39*19261079SEd Maste 4083d2307dSDag-Erling SmørgravNB. If you operating system supports /dev/random, you should configure 41a0ee8cc6SDag-Erling Smørgravlibcrypto (LibreSSL/OpenSSL) to use it. OpenSSH relies on libcrypto's 42*19261079SEd Mastedirect support of /dev/random, or failing that, either prngd or egd. 43d4af9e69SDag-Erling Smørgrav 44d4af9e69SDag-Erling SmørgravPRNGD: 45d4af9e69SDag-Erling Smørgrav 46d4af9e69SDag-Erling SmørgravIf your system lacks kernel-based random collection, the use of Lutz 47*19261079SEd MasteJaenicke's PRNGd is recommended. It requires that libcrypto be configured 48*19261079SEd Masteto support it. 49d4af9e69SDag-Erling Smørgrav 50d4af9e69SDag-Erling Smørgravhttp://prngd.sourceforge.net/ 51d4af9e69SDag-Erling Smørgrav 52d4af9e69SDag-Erling SmørgravEGD: 53d4af9e69SDag-Erling Smørgrav 54*19261079SEd MasteThe Entropy Gathering Daemon (EGD) supports the same interface as prngd. 55*19261079SEd MasteIt also supported only if libcrypto is configured to support it. 56d4af9e69SDag-Erling Smørgrav 57a0ee8cc6SDag-Erling Smørgravhttp://egd.sourceforge.net/ 5883d2307dSDag-Erling Smørgrav 5983d2307dSDag-Erling SmørgravPAM: 60d4af9e69SDag-Erling Smørgrav 61d4af9e69SDag-Erling SmørgravOpenSSH can utilise Pluggable Authentication Modules (PAM) if your 62d4af9e69SDag-Erling Smørgravsystem supports it. PAM is standard most Linux distributions, Solaris, 63*19261079SEd MasteHP-UX 11, AIX >= 5.2, FreeBSD, NetBSD and Mac OS X. 64d4af9e69SDag-Erling Smørgrav 65d4af9e69SDag-Erling SmørgravInformation about the various PAM implementations are available: 66d4af9e69SDag-Erling Smørgrav 67d4af9e69SDag-Erling SmørgravSolaris PAM: http://www.sun.com/software/solaris/pam/ 68d4af9e69SDag-Erling SmørgravLinux PAM: http://www.kernel.org/pub/linux/libs/pam/ 69d4af9e69SDag-Erling SmørgravOpenPAM: http://www.openpam.org/ 7083d2307dSDag-Erling Smørgrav 7183d2307dSDag-Erling SmørgravIf you wish to build the GNOME passphrase requester, you will need the GNOME 7283d2307dSDag-Erling Smørgravlibraries and headers. 7383d2307dSDag-Erling Smørgrav 7483d2307dSDag-Erling SmørgravGNOME: 7583d2307dSDag-Erling Smørgravhttp://www.gnome.org/ 7683d2307dSDag-Erling Smørgrav 77d74d50a8SDag-Erling SmørgravAlternatively, Jim Knoble <jmknoble@pobox.com> has written an excellent X11 7883d2307dSDag-Erling Smørgravpassphrase requester. This is maintained separately at: 7983d2307dSDag-Erling Smørgrav 80d95e11bfSDag-Erling Smørgravhttp://www.jmknoble.net/software/x11-ssh-askpass/ 8183d2307dSDag-Erling Smørgrav 82d4af9e69SDag-Erling SmørgravTCP Wrappers: 8383d2307dSDag-Erling Smørgrav 84d4af9e69SDag-Erling SmørgravIf you wish to use the TCP wrappers functionality you will need at least 85d4af9e69SDag-Erling Smørgravtcpd.h and libwrap.a, either in the standard include and library paths, 86d4af9e69SDag-Erling Smørgravor in the directory specified by --with-tcp-wrappers. Version 7.6 is 87d4af9e69SDag-Erling Smørgravknown to work. 8883d2307dSDag-Erling Smørgrav 89d4af9e69SDag-Erling Smørgravhttp://ftp.porcupine.org/pub/security/index.html 9083d2307dSDag-Erling Smørgrav 915e8dbd04SDag-Erling SmørgravLibEdit: 92761efaa7SDag-Erling Smørgrav 93761efaa7SDag-Erling Smørgravsftp supports command-line editing via NetBSD's libedit. If your platform 94761efaa7SDag-Erling Smørgravhas it available natively you can use that, alternatively you might try 95761efaa7SDag-Erling Smørgravthese multi-platform ports: 964518870cSDag-Erling Smørgrav 975e8dbd04SDag-Erling Smørgravhttp://www.thrysoee.dk/editline/ 985e8dbd04SDag-Erling Smørgravhttp://sourceforge.net/projects/libedit/ 995e8dbd04SDag-Erling Smørgrav 100462c32cbSDag-Erling SmørgravLDNS: 101462c32cbSDag-Erling Smørgrav 102462c32cbSDag-Erling SmørgravLDNS is a DNS BSD-licensed resolver library which supports DNSSEC. 103462c32cbSDag-Erling Smørgrav 104462c32cbSDag-Erling Smørgravhttp://nlnetlabs.nl/projects/ldns/ 105462c32cbSDag-Erling Smørgrav 106761efaa7SDag-Erling SmørgravAutoconf: 107761efaa7SDag-Erling Smørgrav 108761efaa7SDag-Erling SmørgravIf you modify configure.ac or configure doesn't exist (eg if you checked 109*19261079SEd Mastethe code out of git yourself) then you will need autoconf-2.69 and 110*19261079SEd Masteautomake-1.16.1 to rebuild the automatically generated files by running 111*19261079SEd Maste"autoreconf". Earlier versions may also work but this is not guaranteed. 112761efaa7SDag-Erling Smørgrav 113761efaa7SDag-Erling Smørgravhttp://www.gnu.org/software/autoconf/ 114*19261079SEd Mastehttp://www.gnu.org/software/automake/ 115761efaa7SDag-Erling Smørgrav 116761efaa7SDag-Erling SmørgravBasic Security Module (BSM): 117761efaa7SDag-Erling Smørgrav 1184f52dfbbSDag-Erling SmørgravNative BSM support is known to exist in Solaris from at least 2.5.1, 119761efaa7SDag-Erling SmørgravFreeBSD 6.1 and OS X. Alternatively, you may use the OpenBSM 120761efaa7SDag-Erling Smørgravimplementation (http://www.openbsm.org). 121761efaa7SDag-Erling Smørgrav 12247dd1d1bSDag-Erling Smørgravmakedepend: 12347dd1d1bSDag-Erling Smørgrav 12447dd1d1bSDag-Erling Smørgravhttps://www.x.org/archive/individual/util/ 12547dd1d1bSDag-Erling Smørgrav 12647dd1d1bSDag-Erling SmørgravIf you are making significant changes to the code you may need to rebuild 12747dd1d1bSDag-Erling Smørgravthe dependency (.depend) file using "make depend", which requires the 12847dd1d1bSDag-Erling Smørgrav"makedepend" tool from the X11 distribution. 129761efaa7SDag-Erling Smørgrav 130*19261079SEd Mastelibfido2: 131*19261079SEd Maste 132*19261079SEd Mastelibfido2 allows the use of hardware security keys over USB. libfido2 133*19261079SEd Mastein turn depends on libcbor. libfido2 >= 1.5.0 is strongly recommended. 134*19261079SEd MasteLimited functionality is possible with earlier libfido2 versions. 135*19261079SEd Maste 136*19261079SEd Mastehttps://github.com/Yubico/libfido2 137*19261079SEd Mastehttps://github.com/pjk/libcbor 138*19261079SEd Maste 139*19261079SEd Maste 14083d2307dSDag-Erling Smørgrav2. Building / Installation 14183d2307dSDag-Erling Smørgrav-------------------------- 14283d2307dSDag-Erling Smørgrav 14383d2307dSDag-Erling SmørgravTo install OpenSSH with default options: 14483d2307dSDag-Erling Smørgrav 14583d2307dSDag-Erling Smørgrav./configure 14683d2307dSDag-Erling Smørgravmake 14783d2307dSDag-Erling Smørgravmake install 14883d2307dSDag-Erling Smørgrav 14983d2307dSDag-Erling SmørgravThis will install the OpenSSH binaries in /usr/local/bin, configuration files 15083d2307dSDag-Erling Smørgravin /usr/local/etc, the server in /usr/local/sbin, etc. To specify a different 15183d2307dSDag-Erling Smørgravinstallation prefix, use the --prefix option to configure: 15283d2307dSDag-Erling Smørgrav 15383d2307dSDag-Erling Smørgrav./configure --prefix=/opt 15483d2307dSDag-Erling Smørgravmake 15583d2307dSDag-Erling Smørgravmake install 15683d2307dSDag-Erling Smørgrav 15783d2307dSDag-Erling SmørgravWill install OpenSSH in /opt/{bin,etc,lib,sbin}. You can also override 15883d2307dSDag-Erling Smørgravspecific paths, for example: 15983d2307dSDag-Erling Smørgrav 16083d2307dSDag-Erling Smørgrav./configure --prefix=/opt --sysconfdir=/etc/ssh 16183d2307dSDag-Erling Smørgravmake 16283d2307dSDag-Erling Smørgravmake install 16383d2307dSDag-Erling Smørgrav 16483d2307dSDag-Erling SmørgravThis will install the binaries in /opt/{bin,lib,sbin}, but will place the 16583d2307dSDag-Erling Smørgravconfiguration files in /etc/ssh. 16683d2307dSDag-Erling Smørgrav 16783d2307dSDag-Erling SmørgravIf you are using PAM, you may need to manually install a PAM control 16883d2307dSDag-Erling Smørgravfile as "/etc/pam.d/sshd" (or wherever your system prefers to keep 16983d2307dSDag-Erling Smørgravthem). Note that the service name used to start PAM is __progname, 17083d2307dSDag-Erling Smørgravwhich is the basename of the path of your sshd (e.g., the service name 17183d2307dSDag-Erling Smørgravfor /usr/sbin/osshd will be osshd). If you have renamed your sshd 17283d2307dSDag-Erling Smørgravexecutable, your PAM configuration may need to be modified. 17383d2307dSDag-Erling Smørgrav 17483d2307dSDag-Erling SmørgravA generic PAM configuration is included as "contrib/sshd.pam.generic", 17583d2307dSDag-Erling Smørgravyou may need to edit it before using it on your system. If you are 17683d2307dSDag-Erling Smørgravusing a recent version of Red Hat Linux, the config file in 17783d2307dSDag-Erling Smørgravcontrib/redhat/sshd.pam should be more useful. Failure to install a 17883d2307dSDag-Erling Smørgravvalid PAM file may result in an inability to use password 17983d2307dSDag-Erling Smørgravauthentication. On HP-UX 11 and Solaris, the standard /etc/pam.conf 18083d2307dSDag-Erling Smørgravconfiguration will work with sshd (sshd will match the other service 18183d2307dSDag-Erling Smørgravname). 18283d2307dSDag-Erling Smørgrav 18383d2307dSDag-Erling SmørgravThere are a few other options to the configure script: 18483d2307dSDag-Erling Smørgrav 185761efaa7SDag-Erling Smørgrav--with-audit=[module] enable additional auditing via the specified module. 186761efaa7SDag-Erling SmørgravCurrently, drivers for "debug" (additional info via syslog) and "bsm" 187761efaa7SDag-Erling Smørgrav(Sun's Basic Security Module) are supported. 188761efaa7SDag-Erling Smørgrav 189d95e11bfSDag-Erling Smørgrav--with-pam enables PAM support. If PAM support is compiled in, it must 190d95e11bfSDag-Erling Smørgravalso be enabled in sshd_config (refer to the UsePAM directive). 19183d2307dSDag-Erling Smørgrav 19283d2307dSDag-Erling Smørgrav--with-prngd-socket=/some/file allows you to enable EGD or PRNGD 19383d2307dSDag-Erling Smørgravsupport and to specify a PRNGd socket. Use this if your Unix lacks 19447dd1d1bSDag-Erling Smørgrav/dev/random. 19583d2307dSDag-Erling Smørgrav 19683d2307dSDag-Erling Smørgrav--with-prngd-port=portnum allows you to enable EGD or PRNGD support 19783d2307dSDag-Erling Smørgravand to specify a EGD localhost TCP port. Use this if your Unix lacks 19847dd1d1bSDag-Erling Smørgrav/dev/random. 19983d2307dSDag-Erling Smørgrav 20083d2307dSDag-Erling Smørgrav--with-lastlog=FILE will specify the location of the lastlog file. 20183d2307dSDag-Erling Smørgrav./configure searches a few locations for lastlog, but may not find 20283d2307dSDag-Erling Smørgravit if lastlog is installed in a different place. 20383d2307dSDag-Erling Smørgrav 20483d2307dSDag-Erling Smørgrav--without-lastlog will disable lastlog support entirely. 20583d2307dSDag-Erling Smørgrav 206d95e11bfSDag-Erling Smørgrav--with-osfsia, --without-osfsia will enable or disable OSF1's Security 20783d2307dSDag-Erling SmørgravIntegration Architecture. The default for OSF1 machines is enable. 20883d2307dSDag-Erling Smørgrav 20983d2307dSDag-Erling Smørgrav--with-tcp-wrappers will enable TCP Wrappers (/etc/hosts.allow|deny) 210d4af9e69SDag-Erling Smørgravsupport. 21183d2307dSDag-Erling Smørgrav 21283d2307dSDag-Erling Smørgrav--with-md5-passwords will enable the use of MD5 passwords. Enable this 213efcad6b7SDag-Erling Smørgravif your operating system uses MD5 passwords and the system crypt() does 214efcad6b7SDag-Erling Smørgravnot support them directly (see the crypt(3/3c) man page). If enabled, the 215efcad6b7SDag-Erling Smørgravresulting binary will support both MD5 and traditional crypt passwords. 21683d2307dSDag-Erling Smørgrav 21783d2307dSDag-Erling Smørgrav--with-utmpx enables utmpx support. utmpx support is automatic for 21883d2307dSDag-Erling Smørgravsome platforms. 21983d2307dSDag-Erling Smørgrav 22083d2307dSDag-Erling Smørgrav--without-shadow disables shadow password support. 22183d2307dSDag-Erling Smørgrav 22283d2307dSDag-Erling Smørgrav--with-ipaddr-display forces the use of a numeric IP address in the 22383d2307dSDag-Erling Smørgrav$DISPLAY environment variable. Some broken systems need this. 22483d2307dSDag-Erling Smørgrav 22583d2307dSDag-Erling Smørgrav--with-default-path=PATH allows you to specify a default $PATH for sessions 22683d2307dSDag-Erling Smørgravstarted by sshd. This replaces the standard path entirely. 22783d2307dSDag-Erling Smørgrav 228d4af9e69SDag-Erling Smørgrav--with-pid-dir=PATH specifies the directory in which the sshd.pid file is 22983d2307dSDag-Erling Smørgravcreated. 23083d2307dSDag-Erling Smørgrav 23183d2307dSDag-Erling Smørgrav--with-xauth=PATH specifies the location of the xauth binary 23283d2307dSDag-Erling Smørgrav 233a0ee8cc6SDag-Erling Smørgrav--with-ssl-dir=DIR allows you to specify where your Libre/OpenSSL 23447dd1d1bSDag-Erling Smørgravlibraries are installed. 23583d2307dSDag-Erling Smørgrav 236a0ee8cc6SDag-Erling Smørgrav--with-ssl-engine enables Libre/OpenSSL's (hardware) ENGINE support 237761efaa7SDag-Erling Smørgrav 238*19261079SEd Maste--without-openssl builds without using OpenSSL. Only a subset of ciphers 239*19261079SEd Masteand algorithms are supported in this configuration. 240*19261079SEd Maste 241*19261079SEd Maste--without-zlib builds without zlib. This disables the Compression option. 242*19261079SEd Maste 24383d2307dSDag-Erling Smørgrav--with-4in6 Check for IPv4 in IPv6 mapped addresses and convert them to 24483d2307dSDag-Erling Smørgravreal (AF_INET) IPv4 addresses. Works around some quirks on Linux. 24583d2307dSDag-Erling Smørgrav 24683d2307dSDag-Erling SmørgravIf you need to pass special options to the compiler or linker, you 24783d2307dSDag-Erling Smørgravcan specify these as environment variables before running ./configure. 24883d2307dSDag-Erling SmørgravFor example: 24983d2307dSDag-Erling Smørgrav 250190cef3dSDag-Erling SmørgravCC="/usr/foo/cc" CFLAGS="-O" LDFLAGS="-s" LIBS="-lrubbish" ./configure 25183d2307dSDag-Erling Smørgrav 25283d2307dSDag-Erling Smørgrav3. Configuration 25383d2307dSDag-Erling Smørgrav---------------- 25483d2307dSDag-Erling Smørgrav 25583d2307dSDag-Erling SmørgravThe runtime configuration files are installed by in ${prefix}/etc or 25683d2307dSDag-Erling Smørgravwhatever you specified as your --sysconfdir (/usr/local/etc by default). 25783d2307dSDag-Erling Smørgrav 25883d2307dSDag-Erling SmørgravThe default configuration should be instantly usable, though you should 25983d2307dSDag-Erling Smørgravreview it to ensure that it matches your security requirements. 26083d2307dSDag-Erling Smørgrav 26183d2307dSDag-Erling SmørgravTo generate a host key, run "make host-key". Alternately you can do so 26283d2307dSDag-Erling Smørgravmanually using the following commands: 26383d2307dSDag-Erling Smørgrav 264ca86bcf2SDag-Erling Smørgrav ssh-keygen -t [type] -f /etc/ssh/ssh_host_key -N "" 265ca86bcf2SDag-Erling Smørgrav 266d93a896eSDag-Erling Smørgravfor each of the types you wish to generate (rsa, dsa or ecdsa) or 267ca86bcf2SDag-Erling Smørgrav 268ca86bcf2SDag-Erling Smørgrav ssh-keygen -A 269ca86bcf2SDag-Erling Smørgrav 270ca86bcf2SDag-Erling Smørgravto generate keys for all supported types. 27183d2307dSDag-Erling Smørgrav 27283d2307dSDag-Erling SmørgravReplacing /etc/ssh with the correct path to the configuration directory. 27383d2307dSDag-Erling Smørgrav(${prefix}/etc or whatever you specified with --sysconfdir during 274*19261079SEd Masteconfiguration). 27583d2307dSDag-Erling Smørgrav 276*19261079SEd MasteIf you have configured OpenSSH with EGD/prngd support, ensure that EGD or 277*19261079SEd Masteprngd is running and has collected some entropy first. 27883d2307dSDag-Erling Smørgrav 27983d2307dSDag-Erling SmørgravFor more information on configuration, please refer to the manual pages 28083d2307dSDag-Erling Smørgravfor sshd, ssh and ssh-agent. 28183d2307dSDag-Erling Smørgrav 2825e8dbd04SDag-Erling Smørgrav4. (Optional) Send survey 2835e8dbd04SDag-Erling Smørgrav------------------------- 2845e8dbd04SDag-Erling Smørgrav 2855e8dbd04SDag-Erling Smørgrav$ make survey 286761efaa7SDag-Erling Smørgrav[check the contents of the file "survey" to ensure there's no information 287761efaa7SDag-Erling Smørgravthat you consider sensitive] 2885e8dbd04SDag-Erling Smørgrav$ make send-survey 2895e8dbd04SDag-Erling Smørgrav 2905e8dbd04SDag-Erling SmørgravThis will send configuration information for the currently configured 2915e8dbd04SDag-Erling Smørgravhost to a survey address. This will help determine which configurations 2925e8dbd04SDag-Erling Smørgravare actually in use, and what valid combinations of configure options 2935e8dbd04SDag-Erling Smørgravexist. The raw data is available only to the OpenSSH developers, however 2945e8dbd04SDag-Erling Smørgravsummary data may be published. 2955e8dbd04SDag-Erling Smørgrav 2965e8dbd04SDag-Erling Smørgrav5. Problems? 29783d2307dSDag-Erling Smørgrav------------ 29883d2307dSDag-Erling Smørgrav 299*19261079SEd MasteIf you experience problems compiling, installing or running OpenSSH, 300*19261079SEd Masteplease refer to the "reporting bugs" section of the webpage at 301ca86bcf2SDag-Erling Smørgravhttps://www.openssh.com/ 302