aws rds监控慢sql_在AWS RDS SQL Server中实施SSL连接

本文介绍了如何在AWS RDS SQL Server中强制实施SSL连接,以增强数据安全性。通过创建新的参数组,启用'rds.force_ssl'参数并重启实例,确保所有连接都使用加密连接。
摘要由CSDN通过智能技术生成

aws rds监控慢sql

This article explores a method to enforce SSL for all connections in AWS RDS SQL Server.

本文探讨了一种对AWS RDS SQL Server中的所有连接强制实施SSL的方法。

介绍 (Introduction)

Each organization is concerned about data security. In a traditional data center, organizations host their entire infrastructure in a data center. Administrators control the firewall rules, security policies, and domain rules. In a cloud infrastructure, we access all resources over the internet. We do have a mechanism in AWS cloud to secure our infrastructure using custom VPC, security groups, public/private subnets.

每个组织都关注数据安全性。 在传统的数据中心中,组织将整个基础架构托管在一个数据中心中。 管理员控制防火墙规则,安全策略和域规则。 在云基础架构中,我们通过Internet访问所有资源。 我们在AWS云中确实有一种机制,可使用自定义VPC,安全组,公共/私有子网来保护我们的基础架构。

Suppose you configured an AWS RDS SQL Server instance. This database instance hosts your critical data. The following screenshot shows myrdsinstance running SQL Server Express edition.

假设您配置了一个AWS RDS SQL Server实例。 该数据库实例托管您的关键数据。 以下屏幕截图显示运行SQL Server Express版本的myrdsinstance

You can use article AWS RDS SQL Server – Launching a new database instance for creating a new RDS SQL instance.

您可以使用文章AWS RDS SQL Server –启动新的数据库实例以创建新的RDS SQL实例。

AWS RDS SQL Server instance

We enabled Public accessibility configuration to connect the database from the local machine outside the Amazon cloud.

我们启用了公共可访问性配置,以从Amazon云外部的本地计算机连接数据库。

RDS database endpoint and public accessibility

Let’s connect to this instance in SSMS using the endpoint. We want to check that it uses an encrypted connection or not. Open a new query window and execute the following query.

让我们使用端点连接到SSMS中的该实例。 我们要检查它是否使用加密连接。 打开一个新的查询窗口并执行以下查询。

Select session_id,encrypt_option from sys.dm_exec_connections
Where auth_scheme='SQL'

This query calls dynamic management view sys.dm_exec_connections to check connections that are using SQL authentication and their encryption status. It returns false value for encryption that indicates connections are not encrypted.

该查询调用动态管理视图sys.dm_exec_connections来检查使用SQL身份验证的连接及其加密状态。 它返回错误的加密值,指示未加密连接。

SSL connection

We can use connection encryption between client and RDS instance to reduce the connection spoofing or unauthorized network tampering.AWS uses the following two mechanisms for database connection encryption.

我们可以使用客户端和RDS实例之间的连接加密来减少连接欺骗或未经授权的网络篡改。AWS使用以下两种机制进行数据库连接加密。

  1. Force Secure Socket layer(SSL) for all connections

    对所有连接强制使用安全套接字层(SSL)
  2. Encrypt specific connections for encryption

    加密特定的连接以进行加密

In this article, we will focus on forcing SSL for all connections in the AWS RDS SQL Server.

在本文中,我们将重点介绍对AWS RDS SQL Server中的所有连接强制使用SSL。

Let’s explore encryption mechanism in detail.

让我们详细探讨加密机制。

对所有连接强制使用安全套接字层(SSL) (Force Secure Socket layer (SSL) for all connections)

In this approach, AWS uses Secure Socket Layer (SSL) for all connections. All connections are forced to use SSL encryption. By default, RDS SQL does not use any encryption.

在这种方法中,AWS对所有连接使用安全套接字层(SSL)。 所有连接都必须使用SSL加密。 默认情况下,RDS SQL不使用任何加密。

We need to enable rds.force_ssl in the parameter group and reboot the instance to activate this.

我们需要在参数组中启用rds.force_ssl并重新启动实例以激活它。

We defined a parameter group while creating the RDS SQL Server instance. By default, RDS provides default parameters group, and it contains default settings for all parameters.

我们在创建RDS SQL Server实例时定义了一个参数组。 默认情况下,RDS提供默认参数组,并且它包含所有参数的默认设置。

We can view the parameter group from the configuration page of instance.

我们可以从实例的配置页面查看参数组。

Go to the RDS dashboard and Navigate to the databases. Click on the RDS SQL instance myrdsinstance. It launches the following page.

转到RDS仪表板,然后导航到数据库。 单击RDS SQL实例myrdsinstance。 它启动以下页面。

Instance property
  • First part gives the RDS instance summary such as DB identifier, class, region, availability zone and current activity. It also contains options Modify (modify configurations) and Actions (start, stop, delete).

    第一部分给出了RDS实例摘要,例如数据库标识符,类,区域,可用性区域和当前活动。 它还包含选项Modify (修改配置)和Actions (开始,停止,删除)。

    RDS instance summary

    • Connectivity and Security

      连接性和安全性
    • Monitoring

      监控方式
    • Log & events

      日志和事件
    • Configuration

      组态
    • Maintenance & backups

      维护与备份
    • Tags

      标签

Click on the configuration. It gives you instance configuration details such as options group, ARN, Multi-AZ, Parameter group and IAM DB authentication.

configuration page

单击配置 。 它为您提供了实例配置详细信息,例如选项组,ARN,多可用区,参数组和IAM DB身份验证。

As per the screenshot, my instance uses default parameter group default.sqlserver-ex-14.0.

根据屏幕快照,我的实例使用默认参数组default.sqlserver-ex-14.0。

Click on this parameter group. It gives you all configurations, their value, source, type (static or dynamic), description.

单击此参数组。 它为您提供所有配置,它们的值,源,类型(静态或动态),描述。

default parameter group

It is a long list of parameters, and we can use a filter box to search for the required parameter. For example, let’s search for configuration options for keyword SSL. It filters the parameter as per the keyword.

这是一长串参数,我们可以使用过滤器框搜索所需的参数。 例如,让我们搜索关键字SSL的配置选项。 它根据关键字过滤参数。

In the following screenshot, we can note that the current value for rds.force_ssl is zero. It allows the following values:

在以下屏幕截图中,我们可以注意到rds.force_ssl的当前值为零。 它允许以下值:

  • Value 0: disable SSL ( default value)

    值0:禁用SSL(默认值)
  • Value 1: Enable force SSL for all connections

    值1:为所有连接启用强制SSL

rds.force_ssl

Click on Edit parameters and modify the value for rds.force_ssl to 1.

单击编辑参数,然后将rds.force_ssl的值修改为1。

Modify rds.force_ssl  to 1

Click on save changes. You get an error message while saving the change.

单击保存更改。 保存更改时,您会收到一条错误消息。

Error while saving changes

We get this error message because AWS RDS SQL Server does not allow changing default parameter group values. We can create a new parameter group and change the value of the required parameters. Further, we can modify an RDS instance to use the new parameter group.

我们收到此错误消息是因为AWS RDS SQL Server不允许更改默认参数组值。 我们可以创建一个新的参数组并更改所需参数的值。 此外,我们可以修改RDS实例以使用新的参数组。

In the left-hand menu, click on the Parameter groups. It shows both default and custom parameter groups.

在左侧菜单中,单击参数组 。 它显示默认和自定义参数组。

Parameter groups

为AWS RDS SQL Server创建新的参数组 (Create a new parameter group for AWS RDS SQL Server)

To create a new parameter group, click on Create parameter group.

要创建一个新的参数组,请点击创建参数组

It requires the following inputs.

它需要以下输入。

参数组族 (Parameter group family)

RDS supports Amazon Aurora, MySQL, MSSQL, Oracle, MariaDB, and PostgreSQL. In this parameter, choose the DB family and its version. My RDS instance is running SQL Server express edition version 14.0.3049.1. You can verify it by executing the following query in SSMS.

RDS支持Amazon Aurora,MySQL,MSSQL,Oracle,MariaDB和PostgreSQL。 在此参数中,选择数据库系列及其版本。 我的RDS实例正在运行SQL Server Express版本14.0.3049.1。 您可以通过在SSMS中执行以下查询来验证它。

SELECT @@Version;
SQL Version

Let’s choose parameter group family sqlsever-ex-14.0 from the drop-down.

让我们从下拉列表中选择参数组族sqlsever-ex-14.0。

团队名字 (Group Name)

Specify a name for this new parameter group. You should give a friendly name for the parameter group.

指定此新参数组的名称。 您应该给参数组起一个友好的名字。

描述 (Description)

Add a description in this text box. It helps you to distinguish parameter groups from the description. You do not need parameters comparison if RDS contains multiple parameter groups.

在此文本框中添加描述。 它可以帮助您从描述中区分参数组。 如果RDS包含多个参数组,则不需要参数比较。

create  new parameter group

Click on Create. It creates a copy of the default parameter group with the specified name.

点击创建 。 它使用指定名称创建默认参数组的副本。

New parameter group

We can make changes to this new parameter group. Click on new parameter group rdssql-ssl and change the value of rds.force_ssl to 1. It does not give any error message once we save the changes.

我们可以对此新参数组进行更改。 单击新的参数组rdssql-ssl并将rds.force_ssl的值更改为1。一旦保存更改,它不会给出任何错误消息。

change the value of rds.force_ssl

We have not modified the RDS instance to use this new parameter group. RDS instance is still running with the default parameter group. Let’s change the parameter group for the RDS instance.

我们尚未修改RDS实例以使用此新参数组。 RDS实例仍在使用默认参数组运行。 让我们更改RDS实例的参数组。

修改AWS RDS SQL Server实例以使用新的参数组 (Modify AWS RDS SQL Server instance to use the new parameter group)

Navigate to the Databases tab and click on the myrdsinstance. Click on the Modify.

导航到“数据库”选项卡,然后单击myrdsinstance 。 单击修改。

Modify AWS RDS SQL Server instance to use the new parameter group

It opens a new page that contains the following specifications.

它将打开一个新页面,其中包含以下规范。

实例规格 (Instance specifications)

It gives configuration for license model, DB engine version, DB instance class, storage type, allocated space.

它提供了许可证模型,数据库引擎版本,数据库实例类,存储类型和分配空间的配置。

Instance specifications
设定值 (Settings)

It shows property for DB instance identifier, master password.

它显示数据库实例标识符,主密码的属性。

Settings
网络安全 (Network & Security)

It gives an option for the Subnet group, VPC, Public accessibility.

它为子网组VPC公共访问提供了一个选项。

Network & Security
数据库选项 (Database Options)

We can modify the instance port, DB parameter group, option group. We will use this section to modify the parameter group for AWS RDS SQL Server.

我们可以修改实例端口,数据库参数组,选项组。 我们将使用此部分来修改AWS RDS SQL Server的参数组。

Database Options
备份,监视和维护配置 (Backup, Monitoring and Maintenance configurations)

We can modify backups, monitoring and DB maintenance configurations using this section.

我们可以使用此部分修改备份,监视和数据库维护配置。

Backup, Monitoring and Maintenance configurations

Let’s focus on the database options section. In the database options, we can change the parameter groups for AWS RDS SQL Server. Select the new parameter group from the drop-down.

让我们关注数据库选项部分。 在数据库选项中,我们可以更改AWS RDS SQL Server的参数组。 从下拉列表中选择新的参数组。

Database options to modify parameter group

Click on Continue. In the next page, we can see the following things:

单击继续。 在下一页中,我们可以看到以下内容:

  • Summary of modifications: It shows the changes. For example, we can see a change in the DB parameter group from default.sqlserver-ex-14.0 to rdssql-ssl 修改摘要:显示更改。 例如,我们可以看到数据库参数组从default.sqlserver-ex-14.0更改为rdssql-ssl
  • Scheduling of modifications: Suppose we do not want to apply the changes immediately for a production database instance. We want to do it in the scheduled maintenance window. By default, RDS applies the changes in the next scheduled maintenance window. You can see selected option – 修改计划:假设我们不想立即将更改应用于生产数据库实例。 我们想要在计划的维护窗口中执行此操作。 默认情况下,RDS在下一个计划的维护窗口中应用更改。 您可以看到选择的选项– Apply during the next scheduled maintenance window 在下一个计划的维护窗口中应用

It also shows the maintenance window for RDS instance.

它还显示RDS实例的维护窗口。

Summary of modification

If we want to apply changes immediately, select the option – Apply immediately. It gives you a potential expected downtime warning. We should be careful in applying changes immediately as it might require downtime for RDS instance.

如果我们要立即应用更改,请选择选项–立即应用。 它给您潜在的预期停机警告。 由于RDS实例可能需要停机,因此我们应立即应用更改时要小心。

Apply changes immediately

Click on Modify DB instance, and it returns to RDS instance property page.

单击修改数据库实例,它返回到RDS实例属性页面。

RDS instance property page

Navigate to databases, and in the status, you can see status Modifying. It is applying the DB parameter group changes to the RDS instance.

导航到数据库,然后在状态下看到状态“正在修改” 。 它正在将数据库参数组更改应用于RDS实例。

status Modifying

Once the status becomes available, execute the query to see SQL connection encryption status. It still shows false value for encryption.

状态变为可用后,执行查询以查看SQL连接加密状态。 它仍然显示错误的加密值。

Encryption status

An SSL change requires a reboot of AWS RDS SQL instance. Click on Actions followed by Reboot.

SSL更改要求重新启动AWS RDS SQL实例。 单击“ 操作”,然后单击“ 重新启动”

Actions and Reboot

It asks you for the confirmation of reboot operation. Click on Reboot.

它要求您确认重启操作。 单击重新启动。

Reboot RDS

RDS instance status changes to Rebooting.SQL Server does not allow any connection during rebooting. You should reboot the instance during the approved downtime window.

RDS实例状态更改为Rebooting.SQL Server在重新引导期间不允许任何连接。 您应该在批准的停机时间窗口内重新启动实例。

Rebooting status

Once the instance is available again, check the encryption status of DB connections. We can see the encryption connections ( encrypt_option=True) between RDS instance and client.

一旦实例再次可用,请检查数据库连接的加密状态。 我们可以看到RDS实例与客户端之间的加密连接(crypto_option = True)。

Encrypted connection

结论 (Conclusion)

We explored that using the rds.force_ssl parameter, and we can force SSL connections for all client requests to AWS RDS SQL Server instance. Users do not have to change any connection properties. By default, RDS forces SSL connections for all connections.

我们使用rds.force_ssl参数进行了探索,并且可以针对与AWS RDS SQL Server实例的所有客户端请求强制SSL连接。 用户不必更改任何连接属性。 默认情况下,RDS对所有连接强制使用SSL连接。

翻译自: https://www.sqlshack.com/enforce-ssl-connections-in-aws-rds-sql-server/

aws rds监控慢sql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值