prosource

MySQL ERROR 2026 - SSL 연결 오류 - Ubuntu 20.04

probook 2023. 10. 10. 20:39
반응형

MySQL ERROR 2026 - SSL 연결 오류 - Ubuntu 20.04

최근에 로컬 컴퓨터 OS를 Ubuntu 18.04에서 20.04로 업그레이드했으며, CentOS(AWS)에서 MySQL-server를 실행하고 있습니다.MySQL 서버에 연결하려고 할 때마다 업그레이드 후 SSL 연결 오류가 발생합니다.

$ mysql -u yamcha -h database.yourproject.com -p --port 3309

ERROR 2026 (HY000): SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol

하지만 내가 통과한다면,--ssl-mode=disabled옵션과 함께 원격으로 연결할 수 있습니다.

$ mysql -u yamcha -h database.yourproject.com -p --port 3309 --ssl-mode=disabled

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22158946
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

쿼리:

  1. 통과하지 않고 연결하는 방법--ssl-mode=disabled
  2. 전달방법--ssl-mode=disabled제 장고 어플에서 옵션으로, 현재 아래와 같이 정의했지만, 여전히 같은 오류가 발생하고 있습니다.
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'yamcha',
        'USER': 'yamcha',
        'PASSWORD': 'xxxxxxxxxxxxxxx',
        'HOST': 'database.yourproject.com',
        'PORT': '3309',
        'OPTIONS': {'ssl': False},
    }

우분투 20은 보안 수준을 향상시켰습니다.내가 연결할 수 있는 유일한 방법은 tls 1을 허용하는 것이었습니다.

이 파일 편집:

/usr/lib/ssl/openssl.cnf

그리고 파일의 맨 앞에 다음을 입력합니다.

openssl_conf = default_conf

그리고 그 파일의 마지막에도:

[ default_conf ]

ssl_conf = ssl_sect

[ssl_sect]

system_default = ssl_default_sect

[ssl_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT:@SECLEVEL=1

그것은 나에게 많은 도움이 됩니다.

구글을 검색하는 사람은 이 플래그를 사용할 수 있습니다.mysqlcmd: --ssl-mode=DISABLED. I.E:

mysql -uuser -p'myPassw0rd!' -hmysql.company.com --ssl-mode=DISABLED

이것을 mysql 5.7 서버 구성 파일에 추가한 다음 mysql 서비스를 다시 시작합니다.

[mysqld]
tls_version=TLSv1.2

이제 Ubuntu 20.04의 기본값인 tls 1.2를 사용하여 연결할 수 있습니다.


완성도를 위해 우분투 20.04에서 실제로my.cnf그리고.mysql.cnf사실 같은 파일입니다.둘 중 하나를 편집하면 됩니다.

$ readlink -f /etc/mysql/my.cnf
/etc/mysql/mysql.cnf

범프mysqlclient추가된 v2.X에ssl_mode옵션, https://github.com/PyMySQL/mysqlclient-python/blob/main/HISTORY.rst

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'yamcha',
        'USER': 'yamcha',
        'PASSWORD': 'xxxxxxxxxxxxxxx',
        'HOST': 'database.yourproject.com',
        'PORT': '3309',
        'OPTIONS': {'ssl_mode': 'DISABLED'},
    }
}

MYSQL Workbench를 사용하는 경우:

연결을 편집하여 SSL을 비활성화하기만 하면 됩니다.

  1. 연결 패널에서 연결 편집으로 이동

  2. 스크린샷 On 연결에 주어진 매개 변수 뒤의 옵션에서 SSL 선택

enter image description here

  1. SSL 사용 선택 : 아니오

enter image description here

  1. 드디어 이렇게 생겼네요.

enter image description here

Mysql workbench 이외의 클라이언트에서도 SSL 비활성화를 시도할 수 있습니다.

그래도 업그레이드된 보안 기능을 원한다면 mysql 서버를 5.7로 업그레이드하는 것을 고려해 볼 수 있습니다.

저도 같은 질문을 받았습니다.위의 아이디어와 문서를 결합합니다.https://dev.mysql.com/doc/refman/5.7/en/encrypted-connection-protocols-ciphers.html#encrypted-connection-supported-protocols

제 생각은 이렇습니다.

  1. os system openssl 버전과 해당 지원 SSL/tls 버전을 다음 기준으로 확인합니다.$ openssl version. 시스템 설정 확인/etc/ssl/openssl.cnf뿐만 아니라.
  2. 다음 기준으로 MySQL 지원 TLS 버전 확인SHOW GLOBAL VARIABLES LIKE 'tls_version';
  3. python mysql 클라이언트 TLS 버전을 확인합니다. 것은 였습니다.mysql-connector-python. 문서에는 8.0.28 이후 TLS 1.1 이하를 지원하지 않을 것이라고 나와 있습니다.그래서 MySQL에 연결할 수 없습니다. https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html

MySQL 문서에서는 클라이언트가 사용할 수 있는 TLS 버전을 호스트 os TLS 버전과 MySQL TLS 버전의 연합 세트로 언급했습니다.
예를 들어 호스트는 TLS 1.1/1.2 및 MySQL 설정 si TLS 1.0만 지원합니다.클라이언트에 호환되는 TLS 버전이 없습니다.

이 팁들이 도움이 되기를 바랍니다.

언급URL : https://stackoverflow.com/questions/61649764/mysql-error-2026-ssl-connection-error-ubuntu-20-04

반응형