Avamar: "SSH 서버 공개 키가 너무 작음" 및 "사용되지 않는 SSH 암호화 설정"이 보안 검사 보고서에 보고됨
Summary: 보안 검사 보고서에서 "SSH Server Public Key Too Small" 및 "Deprecated SSH Cryptographic Settings" 취약성이 보고됩니다.
Symptoms
보안 검사 보고서에서 다음과 같은 보안 취약점이 보고되었습니다.
Title: SSH Server Public Key Too Small
Results: Algorithm Length ssh-rsa 1024 bit
Threat: The SSH protocol (Secure Shell) is a method for secure remote login from one computer to another. The SSH Server is using a small Public Key.
Best practices require that RSA digital signatures be 2048 or more bits long to provide adequate security. Key lengths of 1024 are acceptable through 2013, but since 2011 they are considered deprecated.
For more information, please refer to NIST Special Publication 800-131A (http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar1.pdf).
Only server keys that are not part of a certificate are reported in this QID.
QID: 38739
Title: Deprecated SSH Cryptographic Settings
Results: Type Name
key exchange diffie-hellman-group1-sha1
cipher arcfour256
cipher arcfour128
cipher 3des-cbc
cipher blowfish-cbc
cipher cast128-cbc
cipher arcfour
Threat: The target is using deprecated SSH cryptographic settings to communication
Cause
이 SSH 공개 키는 기본적으로 2048비트 대신 1024비트로 구성되며 더 이상 사용되지 않는 SSH 암호화 설정.
Resolution
1. Avamar Utility Node에 관리자로 로그인합니다.
2. 루트 권한으로 상승합니다.
3. 사용할 수 있는 암호를 결정합니다.
cat /etc/ssh/sshd_config | grep -i ciphers
샘플 출력:
# Ciphers and keying
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc
4. 다음 명령을 실행하여 어떤 암호가 사용되는지 확인합니다.
ssh -Q cipher
샘플 출력:
3des-cbc
blowfish-cbc
cast128-cbc
arcfour
arcfour128
arcfour256
aes128-cbc
aes192-cbc
aes256-cbc
rijndael-cbc@lysator.liu.se
aes128-ctr
aes192-ctr
aes256-ctr
aes128-gcm@openssh.com
aes256-gcm@openssh.com
chacha20-poly1305@openssh.com
5. 의 백업 복사본을 만듭니다. /etc/ssh/sshd_config 파일에서 내보낸 고유한 SSL 라이브러리를 제공합니다.
cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.`date +%y%m%d`
6. vi를 사용하여 /etc/ssh/sshd_config 파일에서 내보낸 고유한 SSL 라이브러리를 제공합니다.
vi /etc/ssh/sshd_config
7. 다음과 같이 변경합니다.
a. 보안 검사 보고서에 나열된 사용되지 않는 SSH 암호화 설정을 제거합니다. 이 예에서는 아래에 나열된 항목입니다.
cipher arcfour256
cipher arcfour128
cipher 3des-cbc
cipher blowfish-cbc
cipher cast128-cbc
cipher arcfour
b. 다음 매개변수를 1024에서 2048로 변경합니다.
ServerKeyBits 2048
c. 다음 줄의 주석을 제거하여 SSH가 사용할 키를 지정합니다.
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
8. 다음 각 키의 크기를 확인합니다.
ssh-keygen -lf /etc/ssh/ssh_host_rsa_key.pub
샘플 출력:
2048 82:4e:33:4a:1f:e6:81:7f:ef:c7:4c:1f:c7:b2:ce:59 [MD5] root@linux-host1 (RSA)
ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub
샘플 출력:
256 a9:2b:e7:0b:ab:0b:be:2f:d4:9b:6c:2d:6c:fb:3d:e9 [MD5] root@linux-host1 (ECDSA)
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
샘플 출력:
256 65:c5:1e:1c:ac:a3:7c:05:90:21:a3:3c:7e:d6:d4:bd [MD5] root@linux-host1 (ED25519)
크기(빨간색으로 강조 표시된 출력의 첫 번째 숫자)가 위의 출력보다 작으면 새 키를 생성해야 합니다.
필요한 경우 생성할 키에 해당하는 명령을 실행합니다.
sudo ssh-keygen -N '' -b 2048 -t rsa -f /etc/ssh/ssh_host_rsa_key
sudo ssh-keygen -N '' -b 256 -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
sudo ssh-keygen -N '' -b 256 -t ed25519 -f /etc/ssh/ssh_host_ed25519_key
덮어쓴 키를 확인합니다.
Generating public/private rsa key pair.
/etc/ssh/ssh_host_rsa_key already exists.
Overwrite (y/n)? y
Your identification has been saved in /etc/ssh/ssh_host_rsa_key.
Your public key has been saved in /etc/ssh/ssh_host_rsa_key.pub.
The key fingerprint is:
47:60:91:14:b1:15:6e:6d:ea:e9:36:37:31:08:d3:69 root@vmtest-debian8
The key's randomart image is:
+---[RSA 2048]----+
| .B=o. |
| ..= . |
| ..+.o |
| ooEo |
| S+o. |
| o..o |
| o o |
| .o o |
| ..o . |
+-----------------+
9. 구성에 오류가 없는지 확인합니다.
sshd -t
출력이 없어야 합니다. 오류가 있는 경우 수정한 후 계속합니다.
10. 를 다시 시작합니다. sshd 서비스:
service sshd restart
11. 이러한 변경 사항을 적용한 후 수락되는 암호를 확인하려면 위에 나열된 각 암호에 대해 다음 명령을 실행합니다.
ssh -c "cipher_name" localhost
-
- 암호를 수락하는 경우 출력이 부록 A와 일치해야 합니다
- 암호가 거부되는 경우 출력이 부록 B와 일치해야 합니다
Additional Information
부록 A:
root@hostname:~/#: ssh -c "cipher_name" localhost
Warning: Permanently added 'localhost' (ECDSA) to the list of known hosts.
Last login: Mon Oct 1 14:05:28 2018 from XX.XX.XX.XXX
*****************************************************************
* *
* This is the Avamar Virtual Appliance *
* *
* Please read the documentation before performing *
* any administrative functions on this node. *
* For help, contact EMC at 877.534.2867 (USA only) or *
* https://support.emc.com. *
* *
*****************************************************************
root@hostname:~/#:
부록 B:
root@hostname:~/#: ssh -c "cipher_name" localhost
no matching cipher found: client "cipher_name" server valid_cipher, valid_cipher, valid_cipher