+ All Categories
Home > Documents > Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the...

Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the...

Date post: 21-Aug-2021
Category:
Upload: others
View: 0 times
Download: 0 times
Share this document with a friend
27
Database Security Service Best Practices Issue 05 Date 2020-12-25 HUAWEI TECHNOLOGIES CO., LTD.
Transcript
Page 1: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Database Security Service

Best Practices

Issue 05

Date 2020-12-25

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Copyright © Huawei Technologies Co., Ltd. 2021. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. i

Page 3: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Contents

1 Database Audit Best Practices..............................................................................................11.1 Auditing a Self-built Database on ECS............................................................................................................................ 11.2 Auditing an RDS DB Instance..............................................................................................................................................81.3 Checking for Slow SQL Statements................................................................................................................................ 161.4 Checking for Data Reduction............................................................................................................................................ 20

A Change History...................................................................................................................... 24

Database Security ServiceBest Practices Contents

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

1 Database Audit Best Practices

1.1 Auditing a Self-built Database on ECSDatabase audit is deployed in bypass mode. The database audit agent is deployedon the database or application server to obtain access traffic, upload traffic datato the audit system, receive audit system configuration commands, and reportdatabase monitoring results, implementing security audit on self-built databaseson ECS and BMS.

Figure 1-1 shows the architecture used for auditing a self-built database on ECS.

Figure 1-1 Auditing self-built databases on ECS and BMS

Scenario

Assume you have created a database on HUAWEI CLOUD Elastic Cloud Server(ECS). Table 1-1 describes its details. You need to locate and track internalviolations and improper operations in the database to meet compliancerequirements. This section describes how to install an agent on the database,enable the database audit function, and check audit results.

Table 1-1 ECS database information

Database Type MySQL

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 1

Page 5: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

DatabaseVersion

5.7

IP Address 192.168.1.5

Port 3306

OS LINUX64

Limitations and Constraints● Disable SSL for a database before auditing it.● The database audit instance and the database to be audited must be in the

same region.● For connection purposes, ensure the VPC of the database audit instance is the

same as that of the agent node.For details about how to choose the node, see How Do I Determine Whereto Install an Agent?

Step 1: Purchase Database AuditConfigure and purchase the database audit service. For details, see PurchasingDatabase Audit.

NO TE

For connection purposes, ensure the VPC of the database audit instance is the same as thatof the agent node.

For details about how to choose the node, see How Do I Determine Where to Install anAgent?

Step 2: Add a Database and Enable AuditAfter purchasing database audit, add the example database to the database auditinstance and enable the database audit function for the database.

Step 1 Log in to the management console.

Step 2 Click and choose Security > Database Security Service.

Step 3 In the left navigation pane, choose Databases.

Step 4 In the Instance drop-down list, select the instance whose database is to be added.Click Add Database.

Step 5 In the displayed dialog box, set database parameters described in Table 1-1, asshown in Figure 1-2.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 2

Page 6: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-2 Add Database dialog box

Step 6 Click OK. The database is added to the database list and its audit status isDisabled.

Step 7 Locate the row that contains the database and click Enable in the Operationcolumn to enable audit.

----End

Step 3: Add an Agent

Step 1 In the Agent column of the database, click Add, as shown in Figure 1-3.

Figure 1-3 Adding an agent

Step 2 In the displayed dialog box, select an addition mode.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 3

Page 7: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-4 Adding an agent to a database

Step 3 Click OK.

----End

Step 4: Add a Security Group RuleConfigure TCP (port 8000) and UDP (ports 7000 to 7100) in the security groupinbound rule of the database audit instance to allow the agent to communicatewith the audit instance.● If the inbound rules of the security group have been configured for the

installing node, go to Step 5: Install an Agent.● If no inbound rule has been configured, perform the following operations.

NO TE

You can configure security group rules before or after installing an agent.

Step 1 Obtain the IP address of the agent node.

Step 2 Click Add Security Group.

Step 3 In the displayed dialog box, record the security group name (for example, default)of the database audit instance, as shown in Figure 1-5.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 4

Page 8: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-5 Adding a security group rule

Step 4 Click Go to VPC.

Step 5 Enter the security group name default in the search box in the upper right cornerof the list, and click or press Enter. The group information is displayed in thelist.

Step 6 Click the group name default.

Step 7 On the Inbound Rules tab, click Add Rule. See Figure 1-6.

Figure 1-6 Adding rules

Step 8 In the Add Inbound Rule dialog box, add TCP (port number 8000) and UDPprotocols (port number from 7000 to 7100) for the installing node IP address inFigure 1-7.

Figure 1-7 Add Inbound Rule dialog box (ECS)

----End

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 5

Page 9: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Step 5: Install an Agent

Download the agent package and install it on the required node. A database canbe audited only after it is connected to a database audit instance.

NO TE

Each agent has a unique ID, which is used as the key for connecting to a database auditinstance. If you delete an agent and add it back, you need to download and install theagent again.

Step 1 Log in to the DBSS console.

Step 2 In the navigation tree on the left, choose Database Audit > Databases.

Step 3 Select an instance in the Instance drop-down list.

Step 4 Click next to the database to view details of its agent. In the Operationcolumn of the agent, click Download Agent, as shown in Figure 1-8.

The agent installation package will be downloaded to your local PC.

Figure 1-8 Downloading an agent

Step 5 Use a cross-platform transmission tool (for example, WinSCP) to upload thedownloaded agent installation package xxx.tar to the node specified by InstallingNode IP Address in Figure 1-8.

Step 6 Log in to the node as user root by using a cross-platform remote access tool (forexample, PuTTY) via SSH.

Step 7 Run the following command to access the directory where the agent installationpackage xxx.tar is stored:

Step 8 cd Agent_installation_package_directory

Step 9 Run the following command to decompress the installation package xxx.tar:

Step 10 tar -xvf xxx.tar

Step 11 Run the following command to go to the directory in which the install.sh script isstored:

Step 12 cd install.sh_script_directory

Step 13 Run the following command to install the agent:

Step 14 sh install.sh

Step 15 If the following information is displayed, the agent has been installed successfully:start agentstarting audit agentaudit agent started

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 6

Page 10: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

start successinstall dbss audit agent done!

----End

Step 6: Verify the Communication Between the Agent and the DatabaseAudit Instance

Check to ensure the communication between the agent and the database auditinstance is normal.

Step 1 Run an SQL statement or perform an operation on the database (for example,Select 1;) on the node where the agent is installed.

Step 2 In the left navigation pane, choose Dashboard.

Step 3 Click the Statements tab.

Step 4 The SQL statement list displays the record of database login, as shown in Figure1-9.

If no SQL statement is displayed, check your network connection. For details, seeWhat Should I Do If the Communication Between the Agent and DatabaseAudit Instance Is Abnormal?

Figure 1-9 Viewing SQL statements

----End

Step 7: View Audit ResultsYou can check audit results on the Dashboard page, or generate, preview, ordownload reports.

Step 1 Check overview information.

In the left navigation pane, choose Dashboard.

The Dashboard page displays the audit duration, total number of SQL statementsand risks, statements and risks today, and today's sessions of an instance.

You can click the Statements tab to view SQL statement information or theSessions tab to view session distribution.

Step 2 Generate, download, or preview reports.1. Go to the report management page, as shown in Figure 1-10.

Figure 1-10 Accessing the report management page

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 7

Page 11: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

2. In the left navigation pane, choose Reports.3. In the Instance drop-down list, select the instance whose instance report is to

be generated. Click the Reports tab.4. In the row containing the desired report template, click Generate Report in

the Operation column.

5. In the displayed dialog box, click to set the start time and end time of thereport, and select the database for which you want to generate a report.

6. Click OK.The Reports page is displayed. You can view the report status on this page.After a report is generated, you can preview or download it, as shown inFigure 1-11.

NO TICE

To preview a report online, use Google Chrome or Mozilla FireFox.

Figure 1-11 Previewing or downloading an audit report

----End

1.2 Auditing an RDS DB InstanceThis section describes how to audit the security of an RDS DB instance.(Applications connected to this DB instance are deployed on ECS.)

ScenarioDatabase audit is deployed in bypass mode. The database audit agent is deployedon the database or application server to obtain access traffic, upload traffic datato the audit system, receive audit system configuration commands, and reportdatabase monitoring results, implementing security audit on RDS DB instances.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 8

Page 12: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-12 Auditing an RDS DB instance (connected to applications on ECS)

Take the following RDS DB instance as an example. Assume you need to locateand track internal violations and improper operations in the database to meetcompliance requirements. This section describes how to enable the database auditfunction and check audit results.

Table 1-2 RDS DB instance

Database Type POSTGRESQL

DatabaseVersion

7.4

IP Address 192.168.1.31

Application IPaddress(Agent node IPaddress)

192.168.1.132

Port 8000

OS LINUX64

Limitations and Constraints● Disable SSL for a database before auditing it.● The database audit instance and the database to be audited must be in the

same region.● For connection purposes, ensure the VPC of the database audit instance is the

same as that of the agent node.For details about how to choose the node, see How Do I Determine Whereto Install an Agent?

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 9

Page 13: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Step 1: Purchase Database Audit

Configure and purchase the database audit service. For details, see PurchasingDatabase Audit.

NO TE

For connection purposes, ensure the VPC of the database audit instance is the same as thatof the agent node.

For details about how to choose the node, see How Do I Determine Where to Install anAgent?

Step 2: Add a Database and Enable Audit

After purchasing database audit, add a database to the database audit instanceand enable audit for the database.

1. Log in to the management console.

2. Click and choose Security > Database Security Service.3. In the left navigation pane, choose Databases.4. In the Instance drop-down list, select the instance whose database is to be

added. Click Add Database.5. In the displayed dialog box, set database parameters described in Table 1-2.

Database audit supports UTF-8 and GBK character sets encoding.

Figure 1-13 Add Database dialog box

6. Click OK. The database is added to the database list and its audit status isDisabled.

7. Locate the row that contains the database and click Enable in the Operationcolumn to enable audit.

Step 3: Add an Agent

Step 1 In the Agent column of the database, click Add, as shown in Figure 1-14.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 10

Page 14: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-14 Adding an agent

Step 2 In the displayed dialog box, select an addition mode.● Mode 1: Create an agent

If no agent has been added for the database audit instance, you need tocreate an agent.Set Installing Note Type to Application. In the Installing Node IP Addresstext box, enter the application IP address in Table 1-2, as shown in Figure1-15.

Figure 1-15 Adding an agent to an application

● Mode 2: Select an existing agentFor details about when you should select this option, see When Should ISelect an Existing Agent?

NO TE

If an agent has been installed on the application, you can select it to audit the desireddatabase.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 11

Page 15: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-16 Selecting an existing agent

Step 3 Click OK.

----End

Step 4: Add a Security Group RuleConfigure TCP (port 8000) and UDP (ports 7000 to 7100) in the security groupinbound rule of the database audit instance to allow the agent to communicatewith the audit instance.● If the inbound rules of the security group have been configured for the

installing node, go to Step 5: Install an Agent.● If no inbound rule has been configured, perform the following operations.

NO TE

You can configure security group rules before or after installing an agent.

Step 1 Obtain the IP address of the agent node.

Step 2 Click Add Security Group.

Step 3 In the displayed dialog box, record the security group name (for example, default)of the database audit instance, as shown in Figure 1-17.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 12

Page 16: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-17 Adding a security group rule

Step 4 Click Go to VPC.

Step 5 Enter the security group name default in the search box in the upper right cornerof the list, and click or press Enter. The group information is displayed in thelist.

Step 6 Click the group name default.

Step 7 Click the Inbound Rules tab. Inbound rules are displayed.

Step 8 Click Add Rule, as shown in Figure 1-18.

Figure 1-18 Adding assignments

Step 9 In the Add Inbound Rule dialog box, add TCP (port number 8000) and UDPprotocols (port number from 7000 to 7100) for the installing node IP address inTable 1-2. See Figure 1-19.

Figure 1-19 Add Inbound Rule dialog box

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 13

Page 17: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Step 10 Click OK.

----End

Step 5: Install an AgentDownload the agent package and install it on the required node. A database canbe audited only after it is connected to a database audit instance.

NO TE

Each agent has a unique ID, which is used as the key for connecting to a database auditinstance. If you delete an agent and add it back, you need to download and install theagent again.

Step 1 Log in to the DBSS console.

Step 2 In the navigation tree on the left, choose Database Audit > Databases.

Step 3 Select an instance in the Instance drop-down list.

Step 4 Click next to the database to view details of its agent. In the Operationcolumn of the agent, click Download Agent, as shown in Figure 1-20.

The agent installation package will be downloaded.

Figure 1-20 Downloading an agent

Step 5 Use a cross-platform transmission tool (for example, WinSCP) to upload thedownloaded agent installation package xxx.tar to the node specified by InstallingNode IP Address in Figure 1-20.

Step 6 Log in to the node as user root by using a cross-platform remote access tool (forexample, PuTTY) via SSH.

Step 7 Run the following command to access the directory where the agent installationpackage xxx.tar is stored:

cd Directory_containing_agent_installation_package

Step 8 Run the following command to decompress the installation package xxx.tar:

tar -xvf xxx.tar

Step 9 Run the following command to go to the directory in which the install.sh script isstored:

cd Directory of the install.sh script

Step 10 Run the following command to install the agent:

sh install.sh

If the following information is displayed, the agent has been installed successfully:

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 14

Page 18: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

start agentstarting audit agentaudit agent startedstart successinstall dbss audit agent done!

----End

Step 6: Verify the Communication Between the Agent and the DatabaseAudit Instance

Check to ensure the communication between the agent and the database auditinstance is normal.

Step 1 Run an SQL statement or perform an operation on the database (for example,Select 1;) on the node where the agent is installed.

Step 2 In the left navigation pane, choose Dashboard.

Step 3 Click the Statements tab.

Step 4 The SQL statement list displays the record of database login, as shown in Figure1-21.

If no SQL statement is displayed, check your network connection. For details, seeWhat Should I Do If the Communication Between the Agent and DatabaseAudit Instance Is Abnormal?

Figure 1-21 Viewing SQL statements

----End

Step 7: View Audit Results

You can check audit results on the Dashboard page, or generate, preview, ordownload reports.

Step 1 Check overview information.

In the left navigation pane, choose Dashboard.

The Dashboard page displays the audit duration, total number of SQL statementsand risks, statements and risks today, and today's sessions of an instance.

You can click the Statements tab to view SQL statement information or theSessions tab to view session distribution.

Step 2 Generate, download, or preview reports.

1. Go to the report management page, as shown in Figure 1-22.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 15

Page 19: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-22 Accessing the report management page

2. In the left navigation pane, choose Reports.3. In the Instance drop-down list, select the instance whose instance report is to

be generated. Click the Reports tab.4. In the row containing the desired report template, click Generate Report in

the Operation column.

5. In the displayed dialog box, click to set the start time and end time of thereport, and select the database for which you want to generate a report.

6. Click OK.The Reports page is displayed. You can view the report status on this page.After a report is generated, you can preview or download it, as shown inFigure 1-23.

NO TICE

To preview a report online, use Google Chrome or Mozilla FireFox.

Figure 1-23 Previewing or downloading an audit report

----End

1.3 Checking for Slow SQL Statements

ScenariosDatabase audit provides a preconfigured rule to check for slow SQL statements,whose response time recorded in audit logs is greater than 1 second.

You can learn the execution duration, number of affected rows, and databaseinformation of the slow SQL statements, and optimize the statements accordingly.

The following types of statements can be audited:● Data Definition Language (DDL):

– CREATE TABLE– CREATE TABLESPACE

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 16

Page 20: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

– DROP TABLE– DROP TABLESPACE

● Data Manipulation Language (DML):– INSERT– UPDATE– DELETE– SELECT– SELECT FOR UPDATE

● Data Control Language (DCL):– CREATE USER– DROP USER– GRANT

Checking Slow SQL Statements

Perform the following steps:

Step 1 Log in to the management console.

Step 2 In the upper part of the page, select a region, click , and choose Security >Database Security Service.

Step 3 In the left navigation pane, choose Dashboard.

Step 4 In the Instance drop-down list, select the instance whose slow SQL statementinformation you want to view.

Step 5 Click the Statements tab.

Step 6 Set filter criteria to query SQL statements.

● Select Last 30 minutes, 1 hour, 24 hours, 7 days, or 30 days, or click toset start time and end time. Click Submit to view SQL statements of thespecified time range.

● Set Risk Severity (the default value in the slow SQL rule is Low) and clickSubmit.

● Click next to Advanced Settings, enter required information, and clickSubmit, as shown in Figure 1-24. The specified SQL statements are displayedin the list.

NO TE

A maximum of 10,000 records can be retrieved in a query.

Figure 1-24 Advanced settings

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 17

Page 21: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Step 7 In the row containing the desired slow SQL statement, click Details in theOperation column. See Figure 1-25.

Figure 1-25 Viewing slow SQL statement details

Step 8 In the Details dialog box, view the detailed information about the SQL statement.See Figure 1-26. Table 1-3 describes the parameters.

Figure 1-26 Details dialog box

Table 1-3 SQL statement parameters

Parameter Description

Session ID ID of an SQL statement, which is automatically generated

Database Instance Database where an SQL statement is executed

Database Type Type of the database where an SQL statement is executed

Database User Database user for executing an SQL statement

Client MACAddress

MAC address of the client where an SQL statement isexecuted

Database MACAddress

MAC address of the database where an SQL statement isexecuted

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 18

Page 22: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Parameter Description

Client IP Address IP address of the client where an SQL statement isexecuted

Database IPAddress

IP address of the database where an SQL statement isexecuted

Client Port Port of the client where an SQL statement is executed

Database Port Port of the database where the SQL statement is executed

Client Name Name of the client where an SQL statement is executed

Operation Type Type of an SQL statement operation

Operation ObjectType

Type of an SQL statement operation object

Response Result Response to an SQL statement

Affected Rows Number of rows affected by executing an SQL statement

Started Time when an SQL statement starts to be executed

Ended Time when the SQL statement execution ends

SQL Statement Name of an SQL statement

Request Result Result of requesting for executing an SQL statement

----End

Managing Slow SQL Detection Settings

Choose Rules and click the Risky Operations tab. Here you can perform thefollowing operations:

Figure 1-27 Slow SQL detection settings

● EnableIn the row containing the slow SQL detection rule, click Enable in theOperation column.

● Edit

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 19

Page 23: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

In the row containing the slow SQL detection rule, click Edit in the Operationcolumn.

● DisableIn the row containing the slow SQL detection rule, click Disable in theOperation column. Disabled rules will not be audited.

● DeleteIn the row containing the slow SQL detection rule, click Delete in theOperation column. To add the rule again, follow the instructions in AddingRisky Operations.

1.4 Checking for Data Reduction

Scenario

Database audit provides a preconfigured rule to check audit logs for data securityrisks, such as SQL statements used for data breach.

You can learn the execution duration, number of affected rows, and databaseinformation of the SQL statements.

The following types of statements can be audited:● DDL:

– CREATE TABLE– CREATE TABLESPACE– DROP TABLE– DROP TABLESPACE

● DML:– INSERT– UPDATE– DELETE– SELECT– SELECT FOR UPDATE

● DCL:– CREATE USER– DROP USER– GRANT

Viewing Data Reduction Check Results

Perform the following steps:

Step 1 Log in to the management console.

Step 2 In the upper part of the page, select a region, click , and choose Security >Database Security Service.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 20

Page 24: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Step 3 In the left navigation pane, choose Dashboard.

Step 4 In the Instance drop-down list, select the instance whose data reductionstatement information you want to view.

Step 5 Click the Statements tab.

Step 6 Set filter criteria to query SQL statements.

● Select Last 30 minutes, 1 hour, 24 hours, 7 days, or 30 days, or click toset start time and end time. Click Submit to view SQL statements of thespecified time range.

● Set Risk Severity (the default value in the data reduction rule is High) andclick Submit.

● Click next to Advanced Settings, enter required information, and clickSubmit, as shown in Figure 1-28. The specified SQL statements are displayedin the list.

NO TE

A maximum of 10,000 records can be retrieved in a query.

Figure 1-28 Advanced settings

Step 7 In the row containing the desired SQL statement, click Details in the Operationcolumn. See Figure 1-29.

Figure 1-29 Viewing data reduction details

Step 8 In the Details dialog box, view the detailed information about the SQL statement.See Figure 1-30. Table 1-4 describes the parameters.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 21

Page 25: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Figure 1-30 Details dialog box

Table 1-4 SQL statement parameters

Parameter Description

Session ID ID of an SQL statement, which is automatically generated

Database Instance Database where an SQL statement is executed

Database Type Type of the database where an SQL statement is executed

Database User Database user for executing an SQL statement

Client MACAddress

MAC address of the client where an SQL statement isexecuted

Database MACAddress

MAC address of the database where an SQL statement isexecuted

Client IP Address IP address of the client where an SQL statement isexecuted

Database IPAddress

IP address of the database where an SQL statement isexecuted

Client Port Port of the client where an SQL statement is executed

Database Port Port of the database where the SQL statement is executed

Client Name Name of the client where an SQL statement is executed

Operation Type Type of an SQL statement operation

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 22

Page 26: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

Parameter Description

Operation ObjectType

Type of an SQL statement operation object

Response Result Response to an SQL statement

Affected Rows Number of rows affected by executing an SQL statement

Started Time when an SQL statement starts to be executed

Ended Time when the SQL statement execution ends

SQL Statement Name of an SQL statement

Request Result Result of requesting for executing an SQL statement

----End

Viewing Data Reduction Check Rules

Choose Rules and click the Risky Operations tab. Here you can perform thefollowing operations:

Figure 1-31 Data reduction detection

● Enable

In the row containing the data reduction detection rule, click Enable in theOperation column.

● Edit

In the row containing the data reduction detection rule, click Edit in theOperation column.

● Disable

In the row containing the data reduction detection rule, click Disable in theOperation column. Disabled rules will not be audited.

● Delete

In the row containing the data reduction detection rule, click Delete in theOperation column. To add the rule again, follow the instructions in AddingRisky Operations.

Database Security ServiceBest Practices 1 Database Audit Best Practices

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 23

Page 27: Best Practices - HUAWEI CLOUD · 2021. 3. 22. · Each agent has a unique ID, which is used as the key for connecting to a database audit instance. If you delete an agent and add

A Change History

Released On Description

2020-12-25 This issue is the fifth official release.● Added Checking for Slow SQL

Statements.● Added Checking for Data

Reduction.

2020-12-21 This issue is the fourth official release.● Added the description about setting

a security group rule in Auditing aSelf-built Database on ECS.

● Added the description about settinga security group rule in Auditingan RDS DB Instance.

2020-05-20 This issue is the third official release.Updated some screenshots.

2020-02-24 This is the second official release.Modified descriptions in thisdocument.

2019-09-18 This is the first official release.

Database Security ServiceBest Practices A Change History

Issue 05 (2020-12-25) Copyright © Huawei Technologies Co., Ltd. 24


Recommended