본문 바로가기
WORK-LIFE/Linux

SuSE15 SP6 & jsch 호환성

by 동해무울 2025. 7. 15.

최근 OS 업그레이드 진행하면서 APP와 문제가 되는 부분중 APP에서 OS ssh 를 사용하여 타 서버 연결 하는 과장에서 암호화 방식 지원 문제로 인해 키 인증이 되지 않는 경우가 종종 발생하고 있다.

아에 SuSE 15 SP6 와 java에서 사용하는  JSCH 를 대상으로 호환성 확인을 copilot에게 물어보았는데.. 

 

OS 변경 사항

SuSE 15 SP5 > SuSE 15 SP6

 

#### SuSE 15 SP6 암호화 방식

🔐 기본적으로 지원되는 SSH 암호화 알고리즘 (DEFAULT 정책 기준)
✅ Key Exchange (KEX) 알고리즘
curve25519-sha256
curve25519-sha256@libssh.org
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
🔒 암호화(Cipher) 알고리즘
chacha20-poly1305@openssh.com
aes256-gcm@openssh.com
aes128-gcm@openssh.com
aes256-ctr
aes192-ctr
aes128-ctr
🧮 MAC (Message Authentication Code) 알고리즘
hmac-sha2-512-etm@openssh.com
hmac-sha2-256-etm@openssh.com
hmac-sha2-512
hmac-sha2-256
🔑 호스트 키 알고리즘
rsa-sha2-512
rsa-sha2-256
ecdsa-sha2-nistp256
ssh-ed25519
### jsch-0.1.53.jar 암호화 방식

🔐 Key Exchange (KEX) 알고리즘
diffie-hellman-group-exchange-sha1
diffie-hellman-group-exchange-sha256
diffie-hellman-group1-sha1
diffie-hellman-group14-sha1
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
🔒 암호화(Cipher) 알고리즘
CBC 모드:
blowfish-cbc
3des-cbc
aes128-cbc
aes192-cbc
aes256-cbc
CTR 모드:
3des-ctr
aes128-ctr
aes192-ctr
aes256-ctr
기타:
arcfour
arcfour128
arcfour256
🧮 MAC (Message Authentication Code) 알고리즘
hmac-md5
hmac-md5-96
hmac-sha1
hmac-sha1-96
🔑 호스트 키 타입
ssh-dss
ssh-rsa
ecdsa-sha2-nistp256
ecdsa-sha2-nistp384
ecdsa-sha2-nistp521
👤 사용자 인증 방식
password
publickey (DSA, RSA, ECDSA)
keyboard-interactive
gssapi-with-mic
### jsch-2.27.2.jar 암호화 방식
🔐 Key Exchange (KEX) 알고리즘
curve25519-sha256
curve25519-sha256@libssh.org
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
Post-Quantum 지원 (Bouncy Castle 필요):
mlkem768x25519-sha256
mlkem768nistp256-sha256
mlkem1024nistp384-sha384
sntrup761x25519-sha512
🔒 암호화(Cipher) 알고리즘
aes128-ctr, aes192-ctr, aes256-ctr
aes128-gcm@openssh.com, aes256-gcm@openssh.com
chacha20-poly1305@openssh.com (Bouncy Castle 필요)
🧮 MAC (Message Authentication Code) 알고리즘
hmac-sha2-256
hmac-sha2-512
hmac-sha2-256-etm@openssh.com
hmac-sha2-512-etm@openssh.com
🔑 호스트 키 알고리즘
rsa-sha2-256
rsa-sha2-512
ecdsa-sha2-nistp256
ssh-ed25519 (Java 15 이상 또는 Bouncy Castle 필요)
ssh-ed448 (Java 15 이상 또는 Bouncy Castle 필요)
⚠️ ssh-rsa (SHA1 기반)는 보안상의 이유로 기본적으로 비활성화되어 있으며, 필요 시 수동으로 활성화해야 합니다 1 2.

📦 기타 기능
OpenSSH V1 키 파일 읽기/쓰기 지원
AEAD 암호화 키 파일 복호화 지원 (aes128-gcm, aes256-gcm, chacha20-poly1305)
Java 8 이상 지원 (일부 알고리즘은 Java 11/15 이상 또는 Bouncy Castle 필요)

 

### SuSE 15 SP6 와 가장 어울리는 jsch 버전 추천 (by copilot)
✅ 추천 버전: jsch-2.27.2 (mwiede 포크)
🔍 이유:
OpenSSH 9.6p1 호환성:
SLES 15 SP6은 OpenSSH 9.6p1을 사용하며, 이는 ssh-rsa(SHA1) 알고리즘을 기본적으로 비활성화합니다. jsch-2.27.2는 이에 대응하여 rsa-sha2-256, rsa-sha2-512 등 SHA2 기반 RSA 알고리즘을 기본 지원합니다 1.

현대적 암호화 알고리즘 지원:

curve25519-sha256, chacha20-poly1305@openssh.com, aes*-gcm@openssh.com 등 SLES 15 SP6에서 기본으로 허용하는 알고리즘과 일치합니다.
ssh-ed25519, ecdsa-sha2-nistp256 등도 지원 (Java 15 이상 또는 Bouncy Castle 필요)
보안 정책 연동 가능:
SUSE의 crypto-policies 시스템과 잘 맞는 알고리즘 우선순위를 설정할 수 있으며, 필요 시 ssh-rsa도 수동으로 활성화 가능.

Java 8 이상 지원:
SLES 15 SP6은 Java 8, 11, 17, 21을 지원하며, jsch-2.27.2는 Java 8 이상에서 작동합니다.

 

※ 결론

OS 버전이 올라가면 암호화 방식이 지원하지 않는 부분이 있는데, 구 버전에서 기본으로 사용하는 암호화 방식이 OS에서 지원하지 않는 방식이라 발생하고 있는 부분입니다.

jsch 버전이 너무 오래 되서 그런거임...

 

버전 업그레이드가 쉽지 않은건 알고 있는데.. 바꿔야 할때는 바꾸는게 맞죠..

 

 

2025.07.19

그래도 jsch 의 구버전을 써야하는 사항이라면...

Target 쪽 서버의 sshd_config에 아래 부분을 추가해주시고 sshd를 재시작해 주세요.

 

jsch-0.1.53.jar 에서 사용하는 구 알고리즘을 허용해주는 설정입니다.

KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256,curve25519-sha256@libssh.org,sntrup761x25519-sha512@openssh.com
 
Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
 
MACs +hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com
 
HostKeyAlgorithms +ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-dss,ssh-dss-cert-v01@openssh.com,ssh-rsa,ssh-rsa-cert-v01@openssh.com

 

해당 부분을 추가하기 시작하면..

여러대의 서버를 관리해야하는 쪽에선 일괄된 구성이 어려워지기 때문에 관리가 어려워지고, 추후 서버 변경(OS upgrade, patch 등) 작업이 발생될때 sshd_config 파일이 수정되는경우 동일한 장애가 발생될 가능성이 높습니다.