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. 生成自签名](#1. 生成自签名)
    • [2. 修改taosadapter配置](#2. 修改taosadapter配置)
    • [3. 测试](#3. 测试)
      • [curl 测试](#curl 测试)
      • 浏览器测试
      • [openssl 测试](#openssl 测试)

1. 生成自签名

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

bash 复制代码
## 生成私钥
[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配置

bash 复制代码
[ssl]
enable = true
certFile = "/etc/taos/cert.crt"
keyFile = "/etc/taos/server.pem"

重启taosAdapter

bash 复制代码
systemctl restart taosadapter

3. 测试

curl 测试

bash 复制代码
[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 测试

相关推荐
sibylyue3 分钟前
MariaDB / H2
数据库·mariadb
zone_z15 分钟前
07 · 等待事件与 OWI 方法:从 OSW 到 BUG 的完整破案实录
linux·数据库·oracle·ffmpeg·bug·troubleshooting
左钦杨17 分钟前
如何剩下一笔SSL(https)证书的钱?
网络协议·https·ssl
A.说学逗唱的Coke20 分钟前
【数据库专题】ClickHouse 深度实战:从列式存储原理到 PB 级海量日志与可观测性分析
数据库·clickhouse·硬件架构
tg_xianheyun27 分钟前
腾讯云国际账号注册代充值服务商怎么选?
大数据·运维·服务器·云计算·github·腾讯云·cdn加速
佳&弥39 分钟前
数据库提权
服务器·数据库·安全·web安全·网络安全
赛逸会展s44 分钟前
2027北京AI健康科技与智慧医疗展6月举办:全周期对接体系保障高转化率
大数据·人工智能·科技
智购科技自动售货机工厂1 小时前
2026自动售货机电机驱动芯片选型:从L298N到DRV8870的工程实践~YH
大数据·开发语言·数据库·人工智能·单片机·嵌入式硬件·scikit-learn
用户3610588626121 小时前
SparkSQL 之 UDF、UDAF 函数代码实现
大数据
2501_915918411 小时前
Rust 程序抓包解密,rustls 不认系统证书的几种办法
开发语言·后端·网络协议·ios·adb·https·rust