PageRenderTime 48ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/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. -- Set up an initiator service broker endpoint for dialog
  16. -- certificate-based security.
  17. -- Modify domain_name and target_host in script to suit configuration.
  18. USE master;
  19. GO
  20. -- Create the broker endpoint using Windows authentication.
  21. IF EXISTS (SELECT * FROM sys.endpoints WHERE name = 'service_broker_endpoint')
  22. DROP ENDPOINT service_broker_endpoint;
  23. GO
  24. CREATE ENDPOINT service_broker_endpoint
  25. STATE = STARTED
  26. AS TCP (LISTENER_PORT = 4022)
  27. FOR SERVICE_BROKER (AUTHENTICATION = Windows);
  28. GO
  29. -- Create a login for the target machine (target_host) in the shared domain
  30. -- (domain_name). This assumes the availability of Kerberos authentication.
  31. -- Note: the '$' is significant.
  32. CREATE LOGIN [domain_name\target_host$] FROM Windows;
  33. GO
  34. -- Grant the target connection access to the endpoint.
  35. GRANT CONNECT ON ENDPOINT::service_broker_endpoint TO [domain_name\target_host$];
  36. GO