

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 設定 SQL Server 安全性通訊協定和密碼
<a name="SQLServer.Ciphers"></a>

您可以使用資料庫參數開啟和關閉特定安全性通訊協定和密碼。您可以設定的安全性參數 (TLS 1.2 版除外) 如下表所示。


****  

| 資料庫參數 | 允許的值 (預設值以粗體表示) | 描述 | 
| --- | --- | --- | 
| rds.tls10 | default、enabled、disabled | TLS 1.0。 | 
| rds.tls11 | default、enabled、disabled | TLS 1.1。 | 
| rds.tls12 | default | TLS 1.2。您無法修改此值。 | 
| rds.fips | 0、1 |  當您將參數設定為 1 時，RDS 會強制使用符合美國聯邦資訊處理標準 (FIPS) 140-2 標準的模組。 如需詳細資訊，請參閱 Microsoft 文件中[使用符合 FIPS 140-2 模式的 SQL Server 2016](https://docs.microsoft.com/en-us/troubleshoot/sql/security/sql-2016-fips-140-2-compliant-mode)。  | 
| rds.rc4 | default、enabled、disabled | RC4 串流密碼。 | 
| rds.diffie-hellman | default、enabled、disabled | Diffie-Hellman 金鑰交換加密。 | 
| rds.diffie-hellman-min-key-bit-length | default、1024、2048、3072、4096 | Diffie-Hellman 金鑰的最小位元長度。 | 
| rds.curve25519 | default、enabled、disabled | Curve25519 橢圓曲線加密密碼。並非所有引擎版本都支援此參數。 | 
| rds.3des168 | default、enabled、disabled | 具有 168 位元金鑰長度的三重資料加密標準 (DES) 加密密碼。 | 

**注意**  
對於 16.00.4120.1、15.00.4365.2、14.00.3465.1、13.00.6435.1 和 12.00.6449.1 之後的次要引擎版本，會*停用*資料庫參數 `rds.tls10`、`rds.tls11`、`rds.rc4`、`rds.curve25519` 和 `rds.3des168` 的預設設定。其他版本的預設設定會*啟用*。  
對於 16.00.4120.1、15.00.4365.2、14.00.3465.1、13.00.6435.1 和 12.00.6449.1 之後的次要引擎版本，`rds.diffie-hellman-min-key-bit-length` 的預設設定為 3072。其他版本的預設設定為 2048。

請使用下列程序來設定安全性通訊協定和密碼：

1. 建立自訂資料庫參數群組。

1. 修改參數群組中的參數。

1. 將資料庫參數群組與您的資料庫執行個體建立關聯。

如需資料庫參數群組的詳細資訊，請參閱[Amazon RDS 的參數群組](USER_WorkingWithParamGroups.md)。

## 建立安全性相關參數群組
<a name="CreateParamGroup.Ciphers"></a>

為對應到 SQL Server 版本和資料庫執行個體版本的安全性相關參數建立參數群組。

### 主控台
<a name="CreateParamGroup.Ciphers.Console"></a>

下列範例會建立 SQL Server Standard Edition 2016 的參數群組。

**建立參數群組**

1. 登入 AWS 管理主控台，開啟位於 [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/) 的 Amazon RDS 主控台。

1. 在導覽窗格中，選擇 **Parameter groups** (參數群組)。

1. 選擇 **Create parameter group (建立參數群組)**。

1. 在 **Create parameter group (建立參數群組)** 窗格中執行下列動作：

   1. 對於 **Parameter group family (參數群組家族)**，請選擇 **sqlserver-se-13.0**。

   1. 對於 **Group name (群組名稱)**，輸入參數群組的識別碼，例如 **sqlserver-ciphers-se-13**。

   1. 對於 **Description (說明)**，輸入 **Parameter group for security protocols and ciphers**。

1. 選擇**建立**。

### CLI
<a name="CreateParamGroup.Ciphers.CLI"></a>

下列範例會建立 SQL Server Standard Edition 2016 的參數群組。

**建立參數群組**
+ 請執行下列其中一個命令：  
**Example**  

  針對 Linux、macOS 或 Unix：

  ```
  aws rds create-db-parameter-group \
      --db-parameter-group-name sqlserver-ciphers-se-13 \
      --db-parameter-group-family "sqlserver-se-13.0" \
      --description "Parameter group for security protocols and ciphers"
  ```

  針對 Windows：

  ```
  aws rds create-db-parameter-group ^
      --db-parameter-group-name sqlserver-ciphers-se-13 ^
      --db-parameter-group-family "sqlserver-se-13.0" ^
      --description "Parameter group for security protocols and ciphers"
  ```

## 修改安全性相關參數
<a name="ModifyParams.Ciphers"></a>

修改參數群組中對應至 SQL Server 版本和資料庫執行個體版本的安全性相關參數。

### 主控台
<a name="ModifyParams.Ciphers.Console"></a>

下列範例會修改您為 SQL Server Standard Edition 2016 建立的參數群組。此範例會關閉 TLS 1.0 版。

**修改參數群組**

1. 登入 AWS 管理主控台，開啟位於 [https://console.aws.amazon.com/rds/](https://console.aws.amazon.com/rds/) 的 Amazon RDS 主控台。

1. 在導覽窗格中，選擇 **Parameter groups (參數群組)**。

1. 選擇參數群組，例如 **sqlserver-ciphers-se-13**。

1. 在 **Parameters (參數)** 下，篩選 **rds** 的參數清單。

1. 選擇 **Edit parameters** (編輯參數)。

1. 選擇 **rds.tls10**。

1. 對於 **Values (值)**，選擇 **disabled**。

1. 選擇**儲存變更**。

### CLI
<a name="ModifyParams.Ciphers.CLI"></a>

下列範例會修改您為 SQL Server Standard Edition 2016 建立的參數群組。此範例會關閉 TLS 1.0 版。

**修改參數群組**
+ 請執行下列其中一個命令：  
**Example**  

  針對 Linux、macOS 或 Unix：

  ```
  aws rds modify-db-parameter-group \
      --db-parameter-group-name sqlserver-ciphers-se-13 \
      --parameters "ParameterName='rds.tls10',ParameterValue='disabled',ApplyMethod=pending-reboot"
  ```

  針對 Windows：

  ```
  aws rds modify-db-parameter-group ^
      --db-parameter-group-name sqlserver-ciphers-se-13 ^
      --parameters "ParameterName='rds.tls10',ParameterValue='disabled',ApplyMethod=pending-reboot"
  ```

## 將安全性相關參數群組與資料庫執行個體建立關聯
<a name="AssocParamGroup.Ciphers"></a>

若要將參數群組與資料庫執行個體建立關聯，請使用 AWS 管理主控台 或 AWS CLI。

### 主控台
<a name="AssocParamGroup.Ciphers.Console"></a>

您可以將參數群組與新的或現有的資料庫執行個體建立關聯。
+ 對於新的資料庫執行個體，請在啟動執行個體時建立關聯。如需更多詳細資訊，請參閱 [建立 Amazon RDS 資料庫執行個體](USER_CreateDBInstance.md)。
+ 對於現有的資料庫執行個體，請透過修改執行個體來建立關聯。如需詳細資訊，請參閱 [修改 Amazon RDS 資料庫執行個體](Overview.DBInstance.Modifying.md)。

### CLI
<a name="AssocParamGroup.Ciphers.CLI"></a>

您可以將參數群組與新的或現有的資料庫執行個體建立關聯。

**使用參數群組建立資料庫執行個體**
+ 指定建立參數群組時所使用的相同資料庫引擎類型和主要版本。  
**Example**  

  針對 Linux、macOS 或 Unix：

  ```
  aws rds create-db-instance \
      --db-instance-identifier mydbinstance \
      --db-instance-class db.m5.2xlarge \
      --engine sqlserver-se \
      --engine-version 13.00.5426.0.v1 \
      --allocated-storage 100 \
      --master-user-password secret123 \
      --master-username admin \
      --storage-type gp2 \
      --license-model li \
      --db-parameter-group-name sqlserver-ciphers-se-13
  ```

  針對 Windows：

  ```
  aws rds create-db-instance ^
      --db-instance-identifier mydbinstance ^
      --db-instance-class db.m5.2xlarge ^
      --engine sqlserver-se ^
      --engine-version 13.00.5426.0.v1 ^
      --allocated-storage 100 ^
      --master-user-password secret123 ^
      --master-username admin ^
      --storage-type gp2 ^
      --license-model li ^
      --db-parameter-group-name sqlserver-ciphers-se-13
  ```
**注意**  
指定此處所顯示提示以外的密碼，作為安全最佳實務。

**修改資料庫執行個體並建立參數群組的關聯**
+ 請執行下列其中一個命令：  
**Example**  

  針對 Linux、macOS 或 Unix：

  ```
  aws rds modify-db-instance \
      --db-instance-identifier mydbinstance \
      --db-parameter-group-name sqlserver-ciphers-se-13 \
      --apply-immediately
  ```

  針對 Windows：

  ```
  aws rds modify-db-instance ^
      --db-instance-identifier mydbinstance ^
      --db-parameter-group-name sqlserver-ciphers-se-13 ^
      --apply-immediately
  ```