IoTDB 入门教程 企业篇④——安全控制 | 白名单、审计日志、登录日志和操作日志

发布于:2024-08-08 ⋅ 阅读:(155) ⋅ 点赞:(0)

一、前文

IoTDB入门教程——导读

IoTDB企业版(TimechoDB)请求试用+激活启动的操作步骤:IoTDB 入门教程 企业篇①——IoTDB企业版(TimechoDB)快速上手

二、白名单

需要修改两个配置文件

  • \conf\iotdb-common.properties
  • \conf\white.list

在这里插入图片描述

2.1 配置文件iotdb-common.properties

  • \conf\iotdb-common.properties配置文件中,默认不启用白名单功能
# whether enable white list
# enable_white_list=false
enable_white_list=true

2.2 配置文件white.list

  • 将允许连接的IP地址写到\conf\white.list中。
  • 不在\conf\white.list中的IP地址,将无法连接到IoTDB服务。
# do not delete 127.0.0.1 of the local ip address. Otherwise, the local client cannot connect to the server after the whitelist is enabled
127.0.0.1

# support exact matching, each line has one ip address
# 10.2.3.4

# * wildcard characters are supported, with one ip address per line
# 10.*.1.3

2.3 注意事项

  • 通过Session客户端修改白名单,会立即生效,并同步更新white.list磁盘文件。
  • 通过修改white.list磁盘文件,需要等待IoTDB服务轮询(1分钟内)到文件更改内容,再生效修改后的白名单。
  • 白名单修改生效后,不会影响已经且正在连接的用户,只会影响后面创建连接的用户。
  • 删除white.list磁盘文件1分钟后,IoTDB服务会拒绝后面的所有连接。
  • 使用Java原生接口修改白名单,非root用户无法修改;修改内容必须合法,否则会抛出StatementExecutionException异常。

三、审计日志

  • 需要修改配置文件\conf\iotdb-common.properties
  • 重启IoTDB服务。
####################
### Audit log Configuration
####################

# whether to enable the audit log.
# Datatype: Boolean
# enable_audit_log=false
enable_audit_log=true

# Output location of audit logs
# Datatype: String
# IOTDB: the stored time series is: root.__system.audit._{user}
# LOGGER: log_audit.log in the log directory
# audit_log_storage=IOTDB,LOGGER

# whether enable audit log for DML operation of data
# whether enable audit log for DDL operation of schema
# whether enable audit log for QUERY operation of data and schema
# Datatype: String
# audit_log_operation=DML,DDL,QUERY

# whether the local write api records audit logs
# Datatype: Boolean
# This contains Session insert api: insertRecord(s), insertTablet(s),insertRecordsOfOneDevice
# MQTT insert api
# RestAPI insert api
# This parameter will cover the DML in audit_log_operation
# enable_audit_log_for_native_insert_api=true
  • 直接在IoTDB-Workbench可视化控制台上看审计日志

在这里插入图片描述

3.1 Cli操作日志

  • 操作如下:
[root@iZgw0bdpdtyqxyz77dha9nZ iotdb-enterprise-1.3.1.4-bin]# bash sbin/start-cli.sh 
---------------------
Starting IoTDB Cli
---------------------
 _____       _________  ______   ______    
|_   _|     |  _   _  ||_   _ `.|_   _ \   
  | |   .--.|_/ | | \_|  | | `. \ | |_) |  
  | | / .'`\ \  | |      | |  | | |  __'.  
 _| |_| \__. | _| |_    _| |_.' /_| |__) | 
|_____|'.__.' |_____|  |______.'|_______/  Enterprise version 1.3.1.4 (Build: 9658c9d)
                                           

Successfully login at 127.0.0.1:6667
IoTDB> select * from root.test.test order by time desc
+-----------------------------+---------------------+
|                         Time|root.test.test.status|
+-----------------------------+---------------------+
|2024-08-02T11:56:47.598+08:00|                123.0|
|2024-08-02T11:55:21.823+08:00|                 88.0|
|2024-08-02T11:53:28.544+08:00|                 88.0|
|2024-08-02T11:51:41.432+08:00|                 88.0|
|2024-08-02T11:46:55.591+08:00|                123.0|
|2024-08-02T09:39:23.891+08:00|                123.0|
|2024-08-02T09:30:56.883+08:00|                333.0|
|2024-08-02T09:30:54.368+08:00|                222.0|
|2024-08-02T09:30:50.961+08:00|                111.0|
|2024-08-01T20:29:35.022+08:00|                  2.0|
|2024-08-01T20:29:28.027+08:00|                  1.0|
+-----------------------------+---------------------+
Total line number = 11
It costs 0.182s
IoTDB> INSERT INTO root.test.test(status) values(1782)
Msg: The statement is executed successfully.
IoTDB> exit
  • 日志如下:

在这里插入图片描述

3.2 RESTful操作日志

3.3 MQTT操作日志

在这里插入图片描述

3.4 Java操作日志

在这里插入图片描述

3.5 C#操作日志

在这里插入图片描述

3.6 Python操作日志

在这里插入图片描述

四、参考

安全控制_天谋IoTDB


网站公告

今日签到

点亮在社区的每一天
去签到