Aracılığıyla paylaş


Nasıl Yapılır: Tam güvenlik iletişim (Transact-SQL) Hizmetleri başlatılıyor yapılandırın.

SQL Server uzak hizmet bağlaması başlatan hizmeti barındıran veritabanında bulunduğu bir hizmet için bir konuşma için iletişim güvenliği'ni kullanır.Sonra hedef hizmet barındıran veritabanı iletişim kutusu oluşturan kullanıcıya karşılık gelen bir kullanıcı içerir ve uzak hizmet bağlama anonim güvenlik belirtin, tam güvenlik iletişim kutusunu kullanır.

Başlatan bir hizmet iletişim güvenliği kullandığından emin olmak için hizmetin uzak hizmet bağlaması oluşturun.Için SQL Server Tam güvenlik kullanmak için , uzak hizmet bağlaması anonim güvenlik belirtmemelisiniz ve hedef veritabanının tam güvenlik için bu hizmeti kullanmak için yapılandırılmalıdır.

Tam iletişim güvenliği başlatan bir hizmet yapılandırmak için

  1. Sahibin hedef hizmet uzak veritabanının güvenilir bir kaynaktan gelen bir sertifika alın.Bu genellikle, şifrelenmiş e-posta kullanarak veya disket gibi fiziksel ortam üzerindeki sertifika aktarma bir sertifika gönderiliyor içerir.

    Security noteSecurity Note:

    Yalnızca sertifikaları güvenilen kaynaklardan yükleyin.

    Not

    Sertifika veritabanı için ana anahtar ile şifrelenmelidir.Daha fazla bilgi için bkz: MASTER anahtar (Transact-SQL) CREATE.

  2. Bir oturumu uzaktan hizmet olmayan bir kullanıcı oluşturun.

  3. Yükleme sertifika uzak hizmet kullanıcı.Önceki adımda oluşturduğunuz kullanıcı sertifika sahibi.

  4. Uzak hizmet kullanıcı ve hizmetin belirten uzak hizmet bağlaması oluşturun.

  5. Yerel hizmet sahibi olmayan bir oturum açma kullanıcı oluşturun.

  6. Yerel hizmet için bir sertifika oluşturun.Önceki adımda oluşturduğunuz kullanıcı sertifika sahibi.

    Not

    Sertifika veritabanı için ana anahtar ile şifrelenmelidir.Daha fazla bilgi için bkz: MASTER anahtar (Transact-SQL) CREATE.

  7. yedeklemek Sertifika.

    Security noteSecurity Note:

    Yalnızca yedekleme sertifika bu kullanıcı için.Yedekleme veya ilişkili özel anahtar dağıtmak sertifika.

  8. Sertifika ve başlatan hizmet adı için veritabanı yöneticisi uzak veritabanı için sağlar.Örneğin, dosya paylaşımında veya güvenli e-posta yoluyla sertifika yerleştirerek sertifikayı diskete ya da bir CD-ROM, fiziksel ortam üzerindeki exchange.

    Not

    SQL Server'ı tam iletişim güvenliği'ni kullanmak için sertifika uzak veritabanında yüklü olmalıdır ve 7. adımda oluşturduğunuz kullanıcı konuşmaya başlamadan kullanıcı olmalıdır.

Example

USE AdventureWorks ;
GO

--------------------------------------------------------------------
-- The first part of the script configures security to allow the
-- remote service to send messages in this database. The script creates
-- a user in this database, loads the certificate for the remote service,
-- grants permission to the user, and creates a remote service binding.

-- Given a certificate for the owner of the remote target service
-- SupplierOrders, create a remote service binding for
-- the service.  The remote user will be granted permission
-- to send messages to the local service OrderParts. 
-- This example assumes that the certificate for the service 
-- is saved in the file'C:\Certificates\SupplierOrders.cer' and that
-- the initiating service already exists.


-- Create a user without a login.  For convenience,
-- the name of the user is based on the name of the
-- the remote service.

CREATE USER [SupplierOrdersUser]
    WITHOUT LOGIN ;
GO

-- Install a certificate for a user
-- in the remote database. The certificate is
-- provided by the owner of the remote service. The
-- user for the remote service owns the certificate.

CREATE CERTIFICATE [SupplierOrdersCertificate]
    AUTHORIZATION [SupplierOrdersUser]
    FROM FILE='C:\Certificates\SupplierOrders.cer' ;
GO

-- Create the remote service binding. Notice
-- that the user specified in the binding
-- does not own the binding itself.

-- Creating this binding specifies that messages from
-- this database are secured using the certificate for
-- the [SupplierOrdersUser] user.

-- When the anonymous option is omitted, anonymous is OFF.
-- Therefore, the credentials for the user that begins
-- are used in the remote database.

CREATE REMOTE SERVICE BINDING [SupplierOrdersBinding]
    TO SERVICE 'SupplierOrders'
    WITH USER = [SupplierOrdersUser] ;
GO

--------------------------------------------------------------------
-- The second part of the script creates a local user that will begin
-- conversations to the remote service. The certificate for this
-- user must be provided to the owner of the remote service.


-- Create a user without a login for the local service.

CREATE USER [OrderPartsUser]
    WITHOUT LOGIN ;
GO

-- Create a certificate for the local service.
CREATE CERTIFICATE [OrderPartsCertificate]
    AUTHORIZATION [OrderPartsUser]
    WITH SUBJECT = 'Certificate for the order service user.';
GO

-- Make this user the owner of the initiator service.

ALTER AUTHORIZATION ON SERVICE::OrderParts TO OrderPartsUser 

-- Backup the certificate for the user that initiates the
-- conversation. This example assumes that the certificate
-- is named OrderServiceCertificate.
BACKUP CERTIFICATE [OrderPartsCertificate]
    TO FILE = 'C:\Certificates\OrderParts.cer' ;
GO

-- Grant RECEIVE permissions on the queue for the service.
-- This allows the local user to begin conversations from
-- services that use the queue.

GRANT RECEIVE ON [OrderPartsQueue] TO [OrderPartsUser] ;
GO