Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES创建连接时使用“是否验证服务端ssl证书”字段 #2815

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6ca8e7f
添加favicon图片
May 9, 2024
870ea4e
Merge branch 'master' of https://github.com/hhyo/Archery
May 10, 2024
d24784d
Merge branch 'master' of https://github.com/hhyo/Archery
Jun 20, 2024
e80b335
firset
Jun 20, 2024
e4d02bb
修改
Jun 20, 2024
118504c
撤销
Jun 20, 2024
a4531d0
Merge branch 'master' of https://github.com/hhyo/Archery
Jun 21, 2024
7c2fea5
Merge branch 'master' of https://github.com/hhyo/Archery
Jun 27, 2024
64abe26
Merge branch 'master' of https://github.com/hhyo/Archery
Jul 31, 2024
bf3f327
Merge branch 'master' of https://github.com/hhyo/Archery
Aug 7, 2024
d23edba
Merge branch 'master' of https://github.com/hhyo/Archery
Aug 7, 2024
405b79e
Merge branch 'master' of https://github.com/hhyo/Archery
Aug 14, 2024
36bdde6
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Aug 16, 2024
75edaf7
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Aug 16, 2024
44230c0
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Aug 19, 2024
d9bea16
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Aug 20, 2024
09834da
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Aug 28, 2024
aee2867
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Aug 30, 2024
dd0c01c
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Sep 2, 2024
a769d28
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Sep 19, 2024
c4734b7
Merge branch 'master' of https://github.com/hhyo/Archery
feiazifeiazi Sep 19, 2024
4246c62
修改 ssl及是否验证证书
feiazifeiazi Sep 19, 2024
913d380
is_ssl使用实例的字段
feiazifeiazi Sep 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sql/engines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self, instance: Instance = None):
self.password = instance.password
self.db_name = instance.db_name
self.mode = instance.mode
self.is_ssl = instance.is_ssl

# 判断如果配置了隧道则连接隧道,只测试了MySQL
if self.instance.tunnel:
Expand Down
12 changes: 6 additions & 6 deletions sql/engines/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,13 +1046,13 @@ def get_connection(self, db_name=None):
if self.conn:
return self.conn
if self.instance:
scheme = "https" if self.is_ssl else "http"
scheme = "https" if self.instance.is_ssl else "http"
hosts = [
{
"host": self.host,
"port": self.port,
"scheme": scheme,
"use_ssl": self.is_ssl,
"use_ssl": self.instance.is_ssl,
}
]
http_auth = (
Expand All @@ -1064,7 +1064,7 @@ def get_connection(self, db_name=None):
self.conn = Elasticsearch(
hosts=hosts,
http_auth=http_auth,
verify_certs=True, # 需要证书验证
verify_certs=self.instance.verify_ssl, # 需要证书验证
)
except Exception as e:
raise Exception(f"Elasticsearch 连接建立失败: {str(e)}")
Expand Down Expand Up @@ -1095,13 +1095,13 @@ def get_connection(self, db_name=None):
if self.conn:
return self.conn
if self.instance:
scheme = "https" if self.is_ssl else "http"
scheme = "https" if self.instance.is_ssl else "http"
hosts = [
{
"host": self.host,
"port": self.port,
"scheme": scheme,
"use_ssl": self.is_ssl,
"use_ssl": self.instance.is_ssl,
}
]
http_auth = (
Expand All @@ -1114,7 +1114,7 @@ def get_connection(self, db_name=None):
self.conn = OpenSearch(
hosts=hosts,
http_auth=http_auth,
verify_certs=True, # 开启证书验证
verify_certs=self.instance.verify_ssl, # 开启证书验证
)
except Exception as e:
raise Exception(f"OpenSearch 连接建立失败: {str(e)}")
Expand Down
4 changes: 2 additions & 2 deletions sql/engines/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_connection(self, db_name=None):
encoding_errors="ignore",
decode_responses=True,
socket_connect_timeout=10,
ssl=self.is_ssl,
ssl=self.instance.is_ssl,
)
else:
return redis.Redis(
Expand All @@ -47,7 +47,7 @@ def get_connection(self, db_name=None):
encoding_errors="ignore",
decode_responses=True,
socket_connect_timeout=10,
ssl=self.is_ssl,
ssl=self.instance.is_ssl,
)

name = "Redis"
Expand Down
Loading