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 测试

相关推荐
utf8mb4安全女神3 分钟前
【Redis数据库】哨兵集群/redis集群/安装配置/主从复制/数据持久化操作/数据结构/安全限制/PHP redis/
linux·服务器·数据结构·数据库·redis·缓存
蜡笔削薪3 分钟前
财联万业(杭州)数字科技有限公司能否给代理划定独家经营区域?
大数据·人工智能·python·科技
lzz的编码时刻14 分钟前
Liquibase 入门实战教程
数据库·运维开发
Zk.Sun21 分钟前
Linux设置触屏双击距离容差
linux·运维·数据库
动恰客流统计21 分钟前
零食集合店爆火背后:客流统计技术如何重构新零售运营决策
大数据·人工智能
山峰哥2 小时前
数据库工程:Explain执行计划对比实战指南‌
数据库·sql·oracle·深度优先·宽度优先
crisps_ww2 小时前
自媒体运营分析-BI可视化仪表盘制作
数据库
Geek-Chow2 小时前
微服务认证与授权:01 — 概念
java·前端·数据库
烤代码的吐司君2 小时前
Redis IO 多路复用原理与引入原因深度解析
数据库·redis·php
B8017913Y3 小时前
2026撰写行业报告总写不完零散专业词汇?可系统梳理行业专业词汇
大数据·人工智能