Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
b2917e06
提交
b2917e06
authored
9月 16, 2014
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve ssl errors
上级
47ae1837
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
74 行增加
和
25 行删除
+74
-25
mod_verto.c
src/mod/endpoints/mod_verto/mod_verto.c
+74
-25
没有找到文件。
src/mod/endpoints/mod_verto/mod_verto.c
浏览文件 @
b2917e06
...
@@ -137,15 +137,36 @@ static void verto_deinit_ssl(verto_profile_t *profile)
...
@@ -137,15 +137,36 @@ static void verto_deinit_ssl(verto_profile_t *profile)
}
}
}
}
static
void
close_file
(
int
*
sock
)
{
if
(
*
sock
>
-
1
)
{
close
(
*
sock
);
*
sock
=
-
1
;
}
}
static
void
close_socket
(
int
*
sock
)
{
if
(
*
sock
>
-
1
)
{
shutdown
(
*
sock
,
2
);
close_file
(
sock
);
}
}
static
int
ssl_init
=
0
;
static
int
ssl_init
=
0
;
static
void
verto_init_ssl
(
verto_profile_t
*
profile
)
static
int
verto_init_ssl
(
verto_profile_t
*
profile
)
{
{
const
char
*
err
=
""
;
int
i
=
0
;
if
(
!
ssl_init
)
{
if
(
!
ssl_init
)
{
SSL_library_init
();
SSL_library_init
();
ssl_init
=
1
;
ssl_init
=
1
;
}
}
profile
->
ssl_method
=
SSLv23_server_method
();
/* create server instance */
profile
->
ssl_method
=
SSLv23_server_method
();
/* create server instance */
profile
->
ssl_ctx
=
SSL_CTX_new
(
profile
->
ssl_method
);
/* create context */
profile
->
ssl_ctx
=
SSL_CTX_new
(
profile
->
ssl_method
);
/* create context */
profile
->
ssl_ready
=
1
;
profile
->
ssl_ready
=
1
;
...
@@ -162,21 +183,65 @@ static void verto_init_ssl(verto_profile_t *profile)
...
@@ -162,21 +183,65 @@ static void verto_init_ssl(verto_profile_t *profile)
/* set the local certificate from CertFile */
/* set the local certificate from CertFile */
if
(
!
zstr
(
profile
->
chain
))
{
if
(
!
zstr
(
profile
->
chain
))
{
SSL_CTX_use_certificate_chain_file
(
profile
->
ssl_ctx
,
profile
->
chain
);
if
(
switch_file_exists
(
profile
->
chain
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
err
=
"SUPPLIED CHAIN FILE NOT FOUND
\n
"
;
goto
fail
;
}
if
(
!
SSL_CTX_use_certificate_chain_file
(
profile
->
ssl_ctx
,
profile
->
chain
))
{
err
=
"CERT CHAIN FILE ERROR"
;
goto
fail
;
}
}
}
SSL_CTX_use_certificate_file
(
profile
->
ssl_ctx
,
profile
->
cert
,
SSL_FILETYPE_PEM
);
if
(
switch_file_exists
(
profile
->
cert
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
err
=
"SUPPLIED CERT FILE NOT FOUND
\n
"
;
goto
fail
;
}
if
(
!
SSL_CTX_use_certificate_file
(
profile
->
ssl_ctx
,
profile
->
cert
,
SSL_FILETYPE_PEM
))
{
err
=
"CERT FILE ERROR"
;
goto
fail
;
}
/* set the private key from KeyFile */
/* set the private key from KeyFile */
SSL_CTX_use_PrivateKey_file
(
profile
->
ssl_ctx
,
profile
->
key
,
SSL_FILETYPE_PEM
);
if
(
switch_file_exists
(
profile
->
key
,
NULL
)
!=
SWITCH_STATUS_SUCCESS
)
{
err
=
"SUPPLIED KEY FILE NOT FOUND
\n
"
;
goto
fail
;
}
if
(
!
SSL_CTX_use_PrivateKey_file
(
profile
->
ssl_ctx
,
profile
->
key
,
SSL_FILETYPE_PEM
))
{
err
=
"PRIVATE KEY FILE ERROR"
;
goto
fail
;
}
/* verify private key */
/* verify private key */
if
(
!
SSL_CTX_check_private_key
(
profile
->
ssl_ctx
)
)
{
if
(
!
SSL_CTX_check_private_key
(
profile
->
ssl_ctx
)
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"SSL NOT AVAILABLE
\n
"
);
err
=
"PRIVATE KEY FILE ERROR"
;
profile
->
ssl_ready
=
0
;
goto
fail
;
verto_deinit_ssl
(
profile
);
}
else
{
SSL_CTX_set_cipher_list
(
profile
->
ssl_ctx
,
"HIGH:!DSS:!aNULL@STRENGTH"
);
}
}
SSL_CTX_set_cipher_list
(
profile
->
ssl_ctx
,
"HIGH:!DSS:!aNULL@STRENGTH"
);
return
1
;
fail:
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SSL ERR: %s
\n
"
,
err
);
profile
->
ssl_ready
=
0
;
verto_deinit_ssl
(
profile
);
for
(
i
=
0
;
i
<
profile
->
i
;
i
++
)
{
if
(
profile
->
ip
[
i
].
secure
)
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"SSL NOT ENABLED FOR LISTENER %s:%d. REVERTING TO WS
\n
"
,
profile
->
ip
[
i
].
local_ip
,
profile
->
ip
[
i
].
local_port
);
profile
->
ip
[
i
].
secure
=
0
;
}
}
return
0
;
}
}
...
@@ -385,22 +450,6 @@ static switch_status_t jsock_sub_channel(jsock_t *jsock, const char *event_chann
...
@@ -385,22 +450,6 @@ static switch_status_t jsock_sub_channel(jsock_t *jsock, const char *event_chann
static
uint32_t
ID
=
1
;
static
uint32_t
ID
=
1
;
static
void
close_file
(
int
*
sock
)
{
if
(
*
sock
>
-
1
)
{
close
(
*
sock
);
*
sock
=
-
1
;
}
}
static
void
close_socket
(
int
*
sock
)
{
if
(
*
sock
>
-
1
)
{
shutdown
(
*
sock
,
2
);
close_file
(
sock
);
}
}
static
void
del_jsock
(
jsock_t
*
jsock
)
static
void
del_jsock
(
jsock_t
*
jsock
)
{
{
jsock_t
*
p
,
*
last
=
NULL
;
jsock_t
*
p
,
*
last
=
NULL
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论