Arne Garvander's web site

How to create trust between an IIS server in the DMZ and a SQL Server in a domain:
  1. Read: Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication
    That document has some broken links. The link below has been corrected:
    Create a Service Account for an ASP.NET 2.0 Application.
  2. Create two identical local accounts on the DMZ server where IIS reside and the server where SQL server reside. Use the same account name and password on both computers.
  3. In SQL Server create the local account:
    CREATE LOGIN [ComputerName\User1] FROM WINDOWS WITH DEFAULT_DATABASE=[mydatabase]
    Give this account the appropriate rights to the database and stored procedures that it will access.
  4. On the DMZ server:
    1. open a cmd prompt
      got C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
      aspnet_regiis -ga MachineName\AccountName
    2. Open the IIS Manager.
      Open properties for your website.
      Click on the directory security tab
      Click the first Edit button
      Enter the local account you just created as the windows account for anonymous user.
    3. Edit the web.config for your website:
      under <system.web> enter:
      <identity impersonate="true"/>
    4. Use a connection string in this format:
      "Data Source=sqlserver;Initial Catalog=topsecret;Trusted_Connection=yes"
    5. Write a test page to test the connection
    6. Be proud of yourselves and roar like a lion.

© Copyright 2009 Arne Garvander Home | Contact Valid XHTML 1.0 Transitional | Valid CSS!