/Katmai_Trunk/Security/Dialog/Scripts/1 - Initiator endpoint setup.sql
SQL | 43 lines | 14 code | 7 blank | 22 comment | 0 complexity | 47ebc3595dd8be96dbff7c8cabd03c88 MD5 | raw file
1-------------------------------------------------------------------- 2-- Script for dialog security sample. 3-- 4-- This file is part of the Microsoft SQL Server Code Samples. 5-- Copyright (C) Microsoft Corporation. All Rights reserved. 6-- This source code is intended only as a supplement to Microsoft 7-- Development Tools and/or on-line documentation. See these other 8-- materials for detailed information regarding Microsoft code samples. 9-- 10-- THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF 11-- ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO 12-- THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 13-- PARTICULAR PURPOSE. 14-------------------------------------------------------------------- 15 16-- Set up an initiator service broker endpoint for dialog 17-- certificate-based security. 18-- Modify domain_name and target_host in script to suit configuration. 19 20USE master; 21GO 22 23-- Create the broker endpoint using Windows authentication. 24IF EXISTS (SELECT * FROM sys.endpoints WHERE name = 'service_broker_endpoint') 25 DROP ENDPOINT service_broker_endpoint; 26GO 27 28CREATE ENDPOINT service_broker_endpoint 29STATE = STARTED 30AS TCP (LISTENER_PORT = 4022) 31FOR SERVICE_BROKER (AUTHENTICATION = Windows); 32GO 33 34-- Create a login for the target machine (target_host) in the shared domain 35-- (domain_name). This assumes the availability of Kerberos authentication. 36-- Note: the '$' is significant. 37CREATE LOGIN [domain_name\target_host$] FROM Windows; 38GO 39 40-- Grant the target connection access to the endpoint. 41GRANT CONNECT ON ENDPOINT::service_broker_endpoint TO [domain_name\target_host$]; 42GO 43