OpenSSH是用於安全遠程登錄、命令執行和文件傳輸的SSH協議(版本2)的完整實現。它包括一個客戶機ssh和服務器sshd、文件傳輸工具scp和sftp,以及用於密鑰生成(ssh-keygen)、運行時密鑰存儲(ssh-agent)和一些支持程序的工具。
獲取源碼:
https://github.com/openssh/openssh-portable
Github文檔上描述openssh編譯時,是使用autoconf和make構建的。它需要一個工作的C編譯器、標準庫和標頭以及zlib。也可以使用LibreSSL或OpenSSL中的libcrypto,但是在構建OpenSSH時可能不支持加密算法的子集。
所以需要先下載並編譯zlib和openssl.
編譯zlib
./configure --prefix=/usr/local/zlib &&make&&make install
編譯openssl
./config --prefix=/usr/local/openssl && make && make install
編譯openssh
# cd openssh-portable
# autoreconf
# ./configure --with-zlib=/usr/local/zlib --with-ssl-dir=/root/code/openssh/openssl-1.1.1a --with-md5-passwords --with-ssl-engine
注意:
1.如果沒有autoconf,需要先安裝autoconf,然後運行autoconf纔會生成configure文件
# sudo apt-get install autoconf
# autoconf
2. --with-ssl-dir要求使用 openssl 源碼包解壓的路徑,而不是安裝的路徑,configure命令結果如下圖所示
編譯
# make && make tests