CentOS 7 repolist
- 공식# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line ins..
2023.09.20
no image
OpenSSL 설치 및 업그레이드
이 문서는 기록 보관 및 자료 공유입니다. 백퍼센트 신뢰하지는 말아주세요. KISA 권고https://knvd.krcert.or.kr/detailSecNo.do?IDX=5866  보안 취약점 정보 포털닫기 검색knvd.krcert.or.kr 영향을 받는 제품 및 해결 버전제품명취약점 (CVE-ID)영향받는 버전해결 버전OpenSSLCVE-2023-0286CVE-2022-4304CVE-2023-02153.03.0.81.1.11.1.1t1.0.21.0.2zgCVE-2022-4203CVE-2023-0216CVE-2023-0217CVE-2023-04013.0.0 ~ 3.0.73.0.8CVE-2022-44503.03.0.81.1.11.1.1t출처 : KISA 기본적으로 설치되어있는 OpenSSL 패키지 버전은 1..
2023.09.20
no image
[CVE-2023-38408] OpenSSH 업그레이드
이 문서는 기록 보관 및 자료 공유입니다. 백퍼센트 신뢰하지는 말아주세요. KISA 권고문https://knvd.krcert.or.kr/detailSecNo.do?IDX=5961  보안 취약점 정보 포털닫기 검색knvd.krcert.or.kr 취약 대상 버전 : 5.5 ~ 9.3p1관련 라이브러리 종속성이 매우 많으므로 인터넷 환경에서 구성하는 것을 추천합니다. 현재 구성된 테스트 서버의 스펙과 SSH 버전은 다음과 같습니다.centos 7.9 1vCore 1GB, SSH version 7.4p1 , OpenSSL 1.0.2k-fips 첫번째로 openssh를 제거합니다. 해당 패키지를 제거할 경우 현재 붙어있는 세션 이후로, CLI 재접속이 불가하므로 신중하게 합니다.rpm -e --nodeps ope..
2023.09.19

CentOS 7 repolist

하녕
|2023. 9. 20. 17:05
반응형

- 공식

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

- 카카오

[base]
name=CentOS-$releasever - Base
baseurl= http://mirror.kakao.com/centos/$releasever/os/$basearch/ 
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#released updates
[updates]
name=CentOS-$releasever - Updates
baseurl= http://mirror.kakao.com/centos/$releasever/updates/$basearch 
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
 
[extras]
name=CentOS-$releasever - Extras
baseurl= http://mirror.kakao.com/centos/$releasever/extras/$basearch 
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
 
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl= http://mirror.kakao.com/centos/$releasever/centosplus/$basearch 
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

 

- 네이버

[base]
name=CentOS-$releasever - Base
baseurl=https://mirror.navercorp.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirror.navercorp.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirror.navercorp.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirror.navercorp.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
반응형

'Linux' 카테고리의 다른 글

[Linux] Squid 프록시 설치  (0) 2023.09.21
[Linux] IPTables 개념  (0) 2023.09.21
CentOS 6 repolist  (0) 2023.09.20
OpenSSL 설치 및 업그레이드  (0) 2023.09.20
[CVE-2023-38408] OpenSSH 업그레이드  (0) 2023.09.19
반응형

이 문서는 기록 보관 및 자료 공유입니다. 백퍼센트 신뢰하지는 말아주세요.

 

KISA 권고

https://knvd.krcert.or.kr/detailSecNo.do?IDX=5866 

 

보안 취약점 정보 포털

닫기 검색

knvd.krcert.or.kr

 

영향을 받는 제품 및 해결 버전

제품명 취약점 (CVE-ID) 영향받는 버전 해결 버전
OpenSSL CVE-2023-0286
CVE-2022-4304
CVE-2023-0215
3.0 3.0.8
1.1.1 1.1.1t
1.0.2 1.0.2zg
CVE-2022-4203
CVE-2023-0216
CVE-2023-0217
CVE-2023-0401
3.0.0 ~ 3.0.7 3.0.8
CVE-2022-4450 3.0 3.0.8
1.1.1 1.1.1t

출처 : KISA

 

기본적으로 설치되어있는 OpenSSL 패키지 버전은 1.0.2k-fips 입니다.

 

https://www.openssl.org/source

 

/source/index.html

Downloads The master sources are maintained in our git repository, which is accessible over the network and cloned on GitHub, at https://github.com/openssl/openssl. Bugs and pull patches (issues and pull requests) should be filed on the GitHub repo. Please

www.openssl.org

 

사전에 필요한 패키지를 설치합시다.

yum install -y gcc gcc-c++ perl pcre-devel zlib-devel perl-core make

 

포스팅 기준 최신 버전으로 설치를 진행하려고 합니다. 이후 버전이 필요하신 분은 상단 openssl URL을 참고하세요.

wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz

 

컴파일에 필요한 추가 옵션은 하단의 문서 혹은 압축을 푼 디렉토리 내부의 INSTALL 파일을 확인 하시면 됩니다.

https://wiki.openssl.org/index.php/Compilation_and_Installation

 

Compilation and Installation - OpenSSLWiki

The following page is a combination of the INSTALL file provided with the OpenSSL library and notes from the field. If you have questions about what you are doing or seeing, then you should consult INSTALL since it contains the commands and specifies the b

wiki.openssl.org

 

OpenSSL 1.1.0 and above

OpenSSL 1.1.0 changed the behavior of install rules. You should specify both --prefix and --openssldir to ensure make install works as expected.
The takeaway is /usr/local/ssl is used by default, and it can be overridden with both --prefix and --openssldir. The rule of thumb applies for path overrides: specify both --prefix and --openssldir.

해당 문서를 참고하였을 때, 1.1.0 이상 버전을 설치 할 때는 prefix와 openssldir을 지정하여야 작동 확인이 가능하다고 명시되어 있습니다. 따라서 되도록이면 경로 지정을 하는게 좋습니다.

prefix :
OpenSSL을 설치 할 디렉토리
openssldir : 
OpenSSL에 구성될 기본 인증서 및 키 저장소

zlib의 경우 데이터 압축으로 인해 네트워크의 전송 데이터를 줄일 수 있고, SSL/TLS 이전 버전의 호환성을 유지 할 수 있지만, CRIM 공격에 취약하므로 zlib는 사용하지 않겠습니다.

따라서 컨픽값은 다음과 같습니다.

./config --prefix=/opt/openssl --openssldir=/usr/local/ssl no-ssl2 no-ssl3

 


컨픽 설정 후 make && make test를 통해 빌드와 테스트를 진행합니다.

[root@test123 openssl-1.1.1w]# ./config --prefix=/usr/local/openssl --openssldir=/usr/local/ssl no-ssl2 no-ssl3

Operating system: x86_64-whatever-linux2
Configuring OpenSSL version 1.1.1w (0x1010117fL) for linux-x86_64
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************

[root@test123 openssl-1.1.1w]# make && make test

 

테스트가 정상적으로 끝나게 되면 다음과 같이 마지막에 표시가 됩니다.

 

빌드와 테스트가 끝났으니 설치를 하도록 합니다.

make install

 

정상적으로 설치가 되었다면, 위에서 설정한 경로 값으로 이동하여 확인해봅니다.

 

올바르게 설치가 된 것을 확인 할 수 있습니다.

 

그리고 설치된 openssl의 라이브러리와 바이너리 파일의 심볼릭 링크를 생성합니다.

ln -s /opt/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /opt/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
ln -s /opt/openssl/bin/openssl /bin/openssl

 

혹은 ldconfig을 이용하여 라이브러리 연동을 하셔도 됩니다.

echo "/opt/openssl/lib" >> /etc/ld.so.conf.d/openssl-1.1.1w.conf
ldconfig -v

 

마지막으로 정상적으로 설치되었는지 실행합시다.

 

반응형

'Linux' 카테고리의 다른 글

[Linux] Squid 프록시 설치  (0) 2023.09.21
[Linux] IPTables 개념  (0) 2023.09.21
CentOS 6 repolist  (0) 2023.09.20
CentOS 7 repolist  (0) 2023.09.20
[CVE-2023-38408] OpenSSH 업그레이드  (0) 2023.09.19
반응형

이 문서는 기록 보관 및 자료 공유입니다. 백퍼센트 신뢰하지는 말아주세요.

 

KISA 권고문

https://knvd.krcert.or.kr/detailSecNo.do?IDX=5961 

 

보안 취약점 정보 포털

닫기 검색

knvd.krcert.or.kr

 

취약 대상 버전 : 5.5 ~ 9.3p1

관련 라이브러리 종속성이 매우 많으므로 인터넷 환경에서 구성하는 것을 추천합니다.

 

현재 구성된 테스트 서버의 스펙과 SSH 버전은 다음과 같습니다.

centos 7.9 1vCore 1GB, SSH version 7.4p1 , OpenSSL 1.0.2k-fips

 

첫번째로 openssh를 제거합니다. 

해당 패키지를 제거할 경우 현재 붙어있는 세션 이후로, CLI 재접속이 불가하므로 신중하게 합니다.

rpm -e --nodeps openssh openssh-clients openssh-server

오류가 발생하여 원복이 필요할 경우에는 해당 패키지를 재설치하여, 원복 할 수 있습니다.

yum install -y openssh openssh-server openssh-client

 

패키지를 제거하게되면 ssh/sshd_config과 pam.d/sshd가 *.rpmsave으로 변경됩니다. (중요)

[root@test123 openssh-9.4p1]# rpm -e --nodeps openssh openssh-clients openssh-server
warning: /etc/ssh/sshd_config saved as /etc/ssh/sshd_config.rpmsave
warning: /etc/pam.d/sshd saved as /etc/pam.d/sshd.rpmsave

 

 

 

필요한 패키지

yum update && upgrade -y
yum install -y gcc zlib-devel openssl-devel pam-devel

gcc : 컴파일러

devel : 컴파일을 위한 라이브러리 패키지

각 패키지 확인

 

wget http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.3p2.tar.gz

wget 사용이 힘들 경우에는 Filezilla 같은 FTP 프로그램을 사용하도록 합니다.

 

tar -xvf openssh-9.3p2.tar.gz
cd openssh-9.3p2

이후 압축을 풀고 해당 디렉토리로 진입합니다.

 

컴파일을 하기에 앞서 OpenSSL 버전과 경로 확인이 필요합니다.

 

https://www.openssh.com/releasenotes.html

 

OpenSSH: Release Notes

OpenSSH 9.4 was released on 2023-08-10. It is available from the mirrors listed at https://www.openssh.com/. OpenSSH is a 100% complete SSH protocol 2.0 implementation and includes sftp client and server support. Once again, we would like to thank the Open

www.openssh.com

릴리즈 노트에 따르면, openssh 9.4 버전부터 openssl 1.1.1을 요구하므로 현재 설치되어있는 버전을 그대로 사용합니다.

 

OpenSSL 업그레이드 포스팅은 하단 링크를 참고하세요.

https://f0rest.tistory.com/entry/OpenSSL-%EC%97%85%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C

 

보노보노

이것저것

f0rest.tistory.com

 

OpenSSL의 경로는 /bin/openssl, 버전은 CentOS7 기본 배포 버전인 OpenSSL 1.0.2k-fips 입니다.

요구사항을 모두 갖추었으니, 컴파일을 진행하겠습니다.

 

 

./configure --prefix=패키지를 설치 할 경로 --with-ssl-dir=OpenSSL이 설치된 위치 --with-pam --sysconfdir=sshd 설정 경로 --with-kerberos5

./configure --prefix=/opt/openssh --with-pam --sysconfdir=/etc/ssh --with-kerberos5
make && make install

#--with-ssl-dir 옵션은 별도로 컴파일 설치를 하지 않았기에 생략하였습니다.

간혹 PAM이 작동하지 않을 경우에는 --with-md5-passwords 옵션을 추가하여 조치를 취할 수 있습니다.

 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Unable to load host key "/etc/ssh/ssh_host_rsa_key": bad permissions
Unable to load host key: /etc/ssh/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_ecdsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Unable to load host key "/etc/ssh/ssh_host_ecdsa_key": bad permissions
Unable to load host key: /etc/ssh/ssh_host_ecdsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0640 for '/etc/ssh/ssh_host_ed25519_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Unable to load host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
Unable to load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.

컴파일을 끝내고 설치까지 완료하니까 다음과 같은 오류 메시지가 출력되었습니다.

기본적으로 생성되어있는 SSH 키파일에 대한 권한 오류로 저는 별도로 수정하였습니다.

chmod 400 /etc/ssh/ssh_*

 

 

다음과 같이 버전 확인을 하였을 때, 정상적으로 설치된 것을 확인 할 수 있습니다.

/opt/openssh/bin/ssh -V
OpenSSH_9.3p2, OpenSSL 1.0.2k-fips  26 Jan 2017

 

맨 처음 openssh를 제거하였을 때, 변경되었던 기존 설정 값을 전부 원복하여 줍니다.

cp /etc/ssh/sshd_config.rpmsave /etc/ssh/sshd_config
cp /etc/pam.d/sshd.rpmsave /etc/pam.d/sshd

 

원본이 유실되었을 경우, 제가 사용하는 설정 값을 같이 공유드립니다.

 

- /etc/ssh/sshd_config

 

#       $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
#KerberosUseKuserok yes

# GSSAPI options
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no
#GSSAPIEnablek5users no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
# WARNING: 'UsePAM no' is not supported in Red Hat Enterprise Linux and may cause several
# problems.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS

# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       PermitTTY no
#       ForceCommand cvs server
Match User root
  Banner /etc/ssh/banner_centos

 

- /etc/pam.d/sshd

#%PAM-1.0
auth       required     pam_sepermit.so
auth       substack     password-auth
auth       include      postlogin
# Used with polkit to reauthorize users in remote sessions
-auth      optional     pam_reauthorize.so prepare
account    required     pam_nologin.so
account    include      password-auth
password   include      password-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open env_params
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      password-auth
session    include      postlogin
# Used with polkit to reauthorize users in remote sessions
-session   optional     pam_reauthorize.so prepare

 

다음은 sshd 서비스를 다음과 같이 등록하였습니다.

cat <<EOF > /etc/systemd/system/sshd.service
[Unit]
Description=OpenSSH server 9.3p2
Wants=sshd-keygen.service

[Service]
ExecStart=/bin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=42s

[Install]
WantedBy=multi-user.target

EOF

[root@test123 ~]# systemctl daemon-reload
[root@test123 ~]# systemctl restart sshd

[root@test123 ~]# systemctl status sshd
● sshd.service - OpenSSH server 9.3p2
   Loaded: loaded (/etc/systemd/system/sshd.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2023-09-19 15:20:03 KST; 15min ago
 Main PID: 24446 (sshd)
   CGroup: /system.slice/sshd.service
           └─24446 sshd: /bin/sshd -D [listener] 0 of 10-100 startups

 

 

마지막으로 심볼릭을 생성하여 바로 실행이 가능하도록 지정하여 줍니다.

ln -s /opt/openssh/bin/ssh /bin/ssh
ln -s /opt/openssh/sbin/sshd /bin/sshd
ln -s /opt/openssh/bin/sftp /bin/sftp
ln -s /opt/openssh/bin/ssh-keygen /bin/ssh-keygen

ssh -V
OpenSSH_9.3p2, OpenSSL 1.0.2k-fips  26 Jan 2017

 

 

모든 구성이 끝났으므로 마지막으로 원격 접속 테스트를 해보도록 하겠습니다.

패스워드 접근

 

키 접근

키와 패스워드 모두 문제 없이 PAM이 동작하면서 정상적으로 접근되는 것을 확인 할 수 있습니다.

반응형

'Linux' 카테고리의 다른 글

[Linux] Squid 프록시 설치  (0) 2023.09.21
[Linux] IPTables 개념  (0) 2023.09.21
CentOS 6 repolist  (0) 2023.09.20
CentOS 7 repolist  (0) 2023.09.20
OpenSSL 설치 및 업그레이드  (0) 2023.09.20