Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Impersonation in asp.net

Reply
Thread Tools

Impersonation in asp.net

 
 
Samuel Shum
Guest
Posts: n/a
 
      07-14-2004
Hello, I have a problem on the impersonation in asp.net: I've developed some
components which can create user accounts on the web server. The asp files
resided on the server will call these components to do the job BUT the
"aspnet" (asp.net worker process account) doesn't have enough privilege to
do so... (as the components are called in the context of this "low
privilege" account). I understand that .Net framework has something called
"impersonation" which can run the worker process in the context of some
"higher" account (in this case, accounts under administrators group). The
problem seems to be solved with this approach but now the problem is that
the "impersonated" account, which is the "admin" account's name and
password, is stored in "cleartext" in the web.config file which imposes
serious security issue... A solution solving this is to store the username
and password in the registry and encrypt them... however, the debugger
returns error that the "password" entry cannot be read from the registry...
even I did give the permission "read" to the worker process... so how can
this be resolved? Or is this the right way to do this kind of job?

Thanks in advance.

Samuel


 
Reply With Quote
 
 
 
 
Mark Duregon
Guest
Posts: n/a
 
      07-14-2004
Use the DPAPI or one of the .NET encryption methods to encrpt the information in the web.config file. Information on this topic is in the Building Secure ASP.NET practices paper http://msdn.microsoft.com/library/de...asp?frame=true


"Samuel Shum" wrote:

> Hello, I have a problem on the impersonation in asp.net: I've developed some
> components which can create user accounts on the web server. The asp files
> resided on the server will call these components to do the job BUT the
> "aspnet" (asp.net worker process account) doesn't have enough privilege to
> do so... (as the components are called in the context of this "low
> privilege" account). I understand that .Net framework has something called
> "impersonation" which can run the worker process in the context of some
> "higher" account (in this case, accounts under administrators group). The
> problem seems to be solved with this approach but now the problem is that
> the "impersonated" account, which is the "admin" account's name and
> password, is stored in "cleartext" in the web.config file which imposes
> serious security issue... A solution solving this is to store the username
> and password in the registry and encrypt them... however, the debugger
> returns error that the "password" entry cannot be read from the registry...
> even I did give the permission "read" to the worker process... so how can
> this be resolved? Or is this the right way to do this kind of job?
>
> Thanks in advance.
>
> Samuel
>
>
>

 
Reply With Quote
 
 
 
 
Samuel Shum
Guest
Posts: n/a
 
      07-14-2004
Thanks Mark for the information, sorry if my query mislead you. I'd done the
encryption part: the username and password are encrypted and stored in the
registry with the tool "aspnet_setreg"
(http://support.microsoft.com/default...b;en-us;329290) and those
can be retrieved by stating the following entry in the web.config file:

<identity impersonate="true"
userName="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,use
rName"
password="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,pas
sword" />

I follow the procedures exactly but the browser returns the following error:
***
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Error reading the password from the registry.

Source Error:

Line 83: <globalization requestEncoding="utf-8" responseEncoding="utf-8"
/>
Line 84:
Line 85: <identity impersonate="true"
userName="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,use
rName"
password="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,pas
sword" />
Line 86: </system.web>

Source File: c:\inetpub\wwwroot\Encryption\web.config Line: 85

----------------------------------------------------------------------------
----
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
***

I'd given the "aspnet" account the permission to read the entries, just
don't know what the error exactly means.

Samuel


 
Reply With Quote
 
Stephen Shirley, MCSD .NET
Guest
Posts: n/a
 
      07-27-2004
Possible Solution: I have wrestled with this one also. I finally got
it to work by giving the MachineName(change this)\ASPNET account
permissions to read the registry key ASPNET_SETREG directly, not the
Identity key. Note, everytime you run aspnet_setreg it will drop and
recreate the key, so you will have to add the permissions everytime
you run it. Hope this helps.

Stephen Shirley,
MCSD .NET

"Samuel Shum" <> wrote in message news:<>...
> Thanks Mark for the information, sorry if my query mislead you. I'd done the
> encryption part: the username and password are encrypted and stored in the
> registry with the tool "aspnet_setreg"
> (http://support.microsoft.com/default...b;en-us;329290) and those
> can be retrieved by stating the following entry in the web.config file:
>
> <identity impersonate="true"
> userName="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,use
> rName"
> password="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,pas
> sword" />
>
> I follow the procedures exactly but the browser returns the following error:
> ***
> Configuration Error
> Description: An error occurred during the processing of a configuration file
> required to service this request. Please review the specific error details
> below and modify your configuration file appropriately.
>
> Parser Error Message: Error reading the password from the registry.
>
> Source Error:
>
> Line 83: <globalization requestEncoding="utf-8" responseEncoding="utf-8"
> />
> Line 84:
> Line 85: <identity impersonate="true"
> userName="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,use
> rName"
> password="registry:HKLM\Software\DummyApplication\ Identity\ASPNET_SETREG,pas
> sword" />
> Line 86: </system.web>
>
> Source File: c:\inetpub\wwwroot\Encryption\web.config Line: 85
>
> ----------------------------------------------------------------------------
> ----
> Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
> Version:1.1.4322.573
> ***
>
> I'd given the "aspnet" account the permission to read the entries, just
> don't know what the error exactly means.
>
> Samuel

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Impersonation code Pramod ASP .Net 1 05-12-2005 09:56 PM
Problem with impersonation and delegation Kelly D. Jones ASP .Net 1 09-12-2003 04:43 PM
Re: ASP.NET Fails after SP4 with Impersonation Hidulf ASP .Net 1 06-30-2003 05:23 PM
Re: ASP.NET Fails after SP4 with Impersonation Raymond Basque ASP .Net 3 06-29-2003 05:18 PM
RE: ASP.NET Fails after SP4 with Impersonation Bassel Tabbara [MSFT] ASP .Net 1 06-28-2003 12:01 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57