4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

centos 7 ssh更新 (写経 and 実践) ソースビルド

Last updated at Posted at 2020-03-06

ssh version 更新

centos 7のyumでupdateしても、最新のversionのopensshにならないです。

ssh -V
#結果--
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
--#

最新に更新してみたいです。
https://adan.jp.net/blog/programing/1741
をやったけど、、、
askpass??で失敗。

以下の手順でやりました。ほぼ記載通りの写経ですが、

Step 1. OpenSSLを最新にする。

DL & INSTALL

cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1d.tar.gz
tar xvzf openssl-1.1.1d.tar.gz 
cd openssl-1.1.1d
./config -fPIC shared
make
make install

ランブラリ参照

vim /etc/ld.so.conf
#以下を追加
/usr/local/lib64 #←これを追加
include ld.so.conf.d/*.conf
#load
ldconfig

##確認

ldconfig -p | grep ssl
#結果---
libxmlsec1-openssl.so.1 (libc6,x86-64) => /lib64/libxmlsec1-openssl.so.1
libxmlsec1-openssl.so (libc6,x86-64) => /lib64/libxmlsec1-openssl.so
libssl3.so (libc6,x86-64) => /lib64/libssl3.so
libssl.so.10 (libc6,x86-64) => /lib64/libssl.so.10
libssl.so.1.1 (libc6,x86-64) => /usr/local/lib64/libssl.so.1.1
libssl.so (libc6,x86-64) => /usr/local/lib64/libssl.so
libssl.so (libc6,x86-64) => /lib64/libssl.so
libevent_openssl-2.0.so.5 (libc6,x86-64) => /lib64/libevent_openssl-2.0.so.5
---#
/usr/local/bin/openssl version
#結果---
OpenSSL 1.1.1d  10 Sep 2019
---#

Step 2. OpenSSHを最新にする。

INSTALL

#あらかじめキーファイルの権限を変更
chmod 600 /etc/ssh/ssh_host_*
cd /usr/local/src
wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-8.2p1.tar.gz
tar xvzf openssh-8.2p1.tar.gz 
cd openssh-8.2p1
./configure --with-ssl-dir=/usr/local/lib64
make
make install

##確認

sshd -V
#結果--
unknown option -- V
OpenSSH_8.2p1, OpenSSL 1.1.1d  10 Sep 2019
--#

Step 3. sshd_config設定

vim /etc/ssh/sshd_config
#sshd_configのGSSAPI設定を無効にします
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
↓
#GSSAPIAuthentication yes
#GSSAPICleanupCredentials no

#security強化,以下を追加
KexAlgorithms ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521, diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha2-256,hmac-sha2-512,hmac-sha1

#security強化,特定ユーザのみ許可
AllowUsers user1, user2
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?