TDengine taosAdapter启用HTTPS

HTTPS (Hypertext Transfer Protocol Secure ),是以安全为目标的 HTTP 通道,在HTTP的基础上通过传输加密和身份认证保证了传输过程的安全性 。HTTPS 在HTTP 的基础下加入SSL,HTTPS 的安全基础是 SSL,因此加密的详细内容就需要 SSL。 HTTPS 存在不同于 HTTP 的默认端口及一个加密/身份验证层(在 HTTP与 TCP 之间)。

TDengine 3.x 开始支持 HTTPS,配置步骤如下:

1. 生成自签名

自己测试用 OpenSSL 生成 SSL 证书即可。

## 生成私钥
[root@c3-65 taos]# openssl  genrsa  -out server.pem 2048
Generating RSA private key, 2048 bit long modulus
................+++
.................................+++
e is 65537 (0x10001)

## 生成签名
[root@c3-65 taos]# openssl req -new -key server.pem  -out cert.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BJ
Locality Name (eg, city) [Default City]:BJ
Organization Name (eg, company) [Default Company Ltd]:Taosdata
Organizational Unit Name (eg, section) []:Adapter
Common Name (eg, your name or your server's hostname) []:
Email Address []:

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:Adapter

## 创建SSL证书
[root@c3-65 taos]#  openssl x509 -req -days 3650 -in cert.csr -signkey server.pem  -out cert.crt
Signature ok
subject=/C=CN/ST=BJ/L=BJ/O=Taosdata/OU=Adapter
Getting Private key

2. 修改taosadapter配置

[ssl]
enable = true
certFile = "/etc/taos/cert.crt"
keyFile = "/etc/taos/server.pem"

重启taosAdapter

systemctl restart taosadapter

3. 测试

curl 测试

[root@c3-65 ~]# curl -uroot:taosdata 127.0.0.1:6041/rest/sql -d "select server_version()"
Client sent an HTTP request to an HTTPS server.

[root@c3-65 ~]# curl -k --insecure -uroot:taosdata https://127.0.0.1:6041/rest/sql -d "select server_version()"
{"code":0,"column_meta":[["server_version()","VARCHAR",7]],"data":[["3.2.3.3"]],"rows":1}[root@c3-65 ~]# 

浏览器测试

在这里插入图片描述

openssl 测试

在这里插入图片描述

相关推荐

  1. Spring启用https

    2024-04-13 06:30:05       51 阅读
  2. 16. Spring Boot启用HTTPS

    2024-04-13 06:30:05       34 阅读
  3. SpringBoot 启用 Https,生成 jks 自签证书

    2024-04-13 06:30:05       18 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-13 06:30:05       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-13 06:30:05       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-13 06:30:05       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-13 06:30:05       20 阅读

热门阅读

  1. 修改当前Git仓库的地址、用户名、密码

    2024-04-13 06:30:05       17 阅读
  2. 多线程7

    2024-04-13 06:30:05       21 阅读
  3. 如何升级node.js版本

    2024-04-13 06:30:05       19 阅读
  4. K8S资源管理之LimitRange

    2024-04-13 06:30:05       19 阅读
  5. Lua语法(二)——闭包/日期和时间

    2024-04-13 06:30:05       19 阅读
  6. Apache Storm的详细配置

    2024-04-13 06:30:05       18 阅读
  7. 优雅关闭jar程序shell 脚本

    2024-04-13 06:30:05       20 阅读
  8. Gateway基本配置与使用介绍

    2024-04-13 06:30:05       19 阅读
  9. NVIC中断分组和配置

    2024-04-13 06:30:05       17 阅读
  10. 多线程交替打印

    2024-04-13 06:30:05       32 阅读
  11. 简单了解仿真测试

    2024-04-13 06:30:05       20 阅读