如何:允許 Service Broker 網路使用憑證進行存取 (Transact-SQL)

若要允許另一個執行個體使用以憑證為基礎的 Service Broker 傳輸安全性傳送訊息,您可以為其他執行個體建立使用者並安裝憑證。

若要允許從另一個執行個體使用憑證進行存取

  1. 從受信任的來源取得其他執行個體的憑證。通常,這涉及使用加密的電子郵件傳送憑證,或在實體媒體 (如磁片) 上傳送憑證。

    ms166077.security(zh-tw,SQL.90).gif安全性注意事項:
    僅安裝來自受信任來源的憑證。
  2. 建立登入。

  3. master 資料庫中建立用於登入的使用者。

  4. master 資料庫中安裝其他執行個體的憑證。在步驟 3 中建立的使用者擁有該憑證。

  5. 授與登入對 Service Broker 端點的 CONNECT 存取權。

  6. 傾印用於本機執行個體中之 Service Broker 傳輸安全性的憑證。

    ms166077.security(zh-tw,SQL.90).gif安全性注意事項:
    只會傾印用於傳輸安全性的憑證。請不要傾印或散髮與憑證關聯的私密金鑰。
  7. 將憑證提供給其他資料庫的管理員。遠端資料庫的管理員會使用上述步驟 1-4 來安裝此憑證。

一旦在每個執行個體中設定了存取,則兩個執行個體間的通訊會在這兩個執行個體的端點都設定為允許傳輸安全性時,使用 Service Broker 傳輸安全性。

範例

USE master ;
GO

-- Create a login for the remote instance.

CREATE LOGIN RemoteInstanceLogin
    WITH PASSWORD = '#gh!3A%!1@f' ;
GO

-- Create a user for the login in the master database.

CREATE USER RemoteInstanceUser
    FOR LOGIN RemoteInstanceLogin ;
GO

-- Load the certificate from the file system. Notice that
-- the login owns the certificate.

CREATE CERTIFICATE RemoteInstanceCertificate
    AUTHORIZATION RemoteInstanceUser
    FROM FILE='C:\Certificates\AceBikeComponentsCertificate.cer' ;
GO
GRANT CONNECT ON ENDPOINT::ThisInstanceEndpoint to RemoteInstanceLogin ;
GO
-- Write the certificate from this instance
-- to the file system. This command assumes
-- that the certificate used by the Service Broker
-- endpoint is named TransportSecurity.

BACKUP CERTIFICATE TransportSecurity
    TO FILE = 'C:\Certificates\ThisInstanceCertificate.cer' ;
GO

請參閱

工作

如何:建立 Service Broker 傳輸安全性的憑證 (Transact-SQL)

其他資源

CREATE CERTIFICATE (Transact-SQL)
CREATE LOGIN (Transact-SQL)
CREATE USER (Transact-SQL)
BACKUP CERTIFICATE (Transact-SQL)

說明及資訊

取得 SQL Server 2005 協助