1

Just curious as to best practice for managing db access from an asp.net web application. We were currently putting the username and password in the web.config, but this wasn't good enough internal security (obviously), so I decided to use a windows domain user instead by modifying the web.config to use windows domain, and then adding the user to the app pool identity. This all works fine, but what happens when the domain user's password changes? Does that mean that all the webapps that use this user's identity in app pool will require the password change too? This would be an IT nightmare. Does anyone have suggestions on best approach for allowing webapp to access database without exposing password and without having to update passwords in all webapps if the password changes? Thanks

u84six
  • 4,604
  • 6
  • 38
  • 65

2 Answers2

1

A better solution would be to set up a separate app pool that is set up with a service account that has full access to the database restart the web app after selecting the new app pool and use integrated security.

Use a very strong ( and lengthy ) password and set the account to password does not expire and user can not change password.

This prevents using clear text in the web.config files.

Mike Beeler
  • 4,081
  • 2
  • 29
  • 44
  • I'm already doing this. My problem is that we want to easily manage the passwords for several app pools without having to re-type them into every one of them after one password changes. – u84six Mar 06 '13 at 06:39
0

I would recommend using SQL Mixed-mode Authentication and using a SQL account for your app. The username and password in the web.config and encrypt that section of the config file.

Here is some information about configuration encryption.

http://msdn.microsoft.com/en-us/library/zhhddkxy(v=vs.100).aspx

Glenn Ferrie
  • 10,290
  • 3
  • 42
  • 73
  • But wouldn't this cause the same problem? I am granting access to the domain user on the sql server, which is currently working from IIS. But the only problem I'm having is password management. If I have 20 sites that are using that same domain user, and the password is changed for the user, does all db access fail? The same thing will happen if the SQL user password needs to change. Then all the webapp's web.configs will need to be updated. That's not something I want to do. There has to be a way to manage passwords without breaking the web app's db access. – u84six Mar 06 '13 at 01:48
  • When you configure an application to authenticate a certain user (AD or SQL) and you change the password, you will need to re-configure the application. I dont know if there is anything you can do to avoid that. – Glenn Ferrie Mar 06 '13 at 02:23
  • I'm kind of surprised by that. You'd think MS would have a simple tool to update applications when the password changes. There has to be a better way. – u84six Mar 06 '13 at 06:37