Configuring Anonymous Dialog Security in SQL Server 2005 Express Service Broker ConversationJanuary 9, 2009 In the recent installments of our series dedicated to the most relevant features of SQL Server 2005 Express Edition, we have described the steps necessary to configure Service Broker full dialog level security. As we have explained, this not only resulted in encryption of all messages that were part of the same conversation with a unique set of symmetric keys, but also made it possible to tighten security of individual database objects. Since both initiator and target were capable of identifying each other, we could restrict access to them to specific principals. However, such configuration required a mechanism facilitating the exchange of certificates between communication partners, which might not be logistically feasible in some situations. In this article, we will present an alternative approach, which eliminates this requirement by relying on anonymous dialog security. As with anonymous transport level security (which we have presented earlier), there are situations where the logistics of managing certificate exchange are too complex to consider their implementation (for example, due to a large number of initiators or lack of administrative authority over them). In such cases, you have an option of employing anonymous dialog security. While the resulting compromise precludes the ability to prevent receiving messages from unauthorized senders, it continues to protect all conversations with distinct encryption keys and ensures that messages originating from initiators can be decrypted only by their intended targets. As before, for the sake of brevity, we will assume that all rudimentary
Service Broker components, including a message type, contract, queues,
associated services, and their respective routes are defined on both initiator
and target systems (for specifics regarding their creation, refer to our
earlier article). In addition, in order to implement anonymous dialog
security, we need to have transport level security in place. Since the most
logical option in this context is its anonymous type, such setup involves (as
we have recently described) generating a master key in the master database on
SQL Server 2005 instances hosting initiator and target services (using Since anonymous dialog security involves encryption, both initiator and
target databases need to have their master keys present. This is accomplished
by executing the already familiar -- on srvEnt01 USE SB_02 GO CREATE MASTER KEY ENCRYPTION BY PASSWORD = 't0UGh2gu3$$' GO CREATE CERTIFICATE cert_dbSBEnt01 WITH SUBJECT = 'dbSBEnt01 Certificate' GO BACKUP CERTIFICATE cert_dbSBEnt01 TO FILE = 'C:\Temp\cert_dbSBEnt01.cer' GO GRANT SEND ON SERVICE::[//databaseJournal.com/SQL2005EX/ServiceBroker/svcRecv] TO Public GO Once the certificate file is copied to an arbitrary location on the target
system, it has to be imported into the database containing local Service Broker
objects (note that this requires the presence of a master key). The certificate
needs to be associated with a database user (we create, for this purpose, a
designated account not linked to a SQL Server login) via -- on srvExp01 USE SB_01 CREATE MASTER KEY ENCRYPTION BY PASSWORD = '1@mS0$ecReT' GO CREATE USER udbSBEnt01 WITHOUT LOGIN GO CREATE CERTIFICATE cert_dbSBEnt01 AUTHORIZATION udbSBEnt01 FROM FILE = 'C:\Temp\cert_dbSBEnt01.cer' GO CREATE REMOTE SERVICE BINDING rsbSBEnt01 TO SERVICE '//databaseJournal.com/SQL2005EX/ServiceBroker/svcRecv' WITH USER = udbSBEnt01, ANONYMOUS = ON GO To launch an encrypted dialog at this point, you simply need to execute the -- on srvExp01 USE SB_01 GRANT RECEIVE ON qSend TO udbSBEnt01 GO In the next article of our series, we will look at the Service Broker activation mechanism, which can be used to automate processing of messages arriving at a target service queue. |