Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Cannot read a Security Log from ASP.net web service

Reply
Thread Tools

Cannot read a Security Log from ASP.net web service

 
 
Ian Wright
Guest
Posts: n/a
 
      05-22-2004
I'm attempting to read the security event log for a WinXP Pro machine using
a web form that calls a web service. Both files are stored in the same
directory in IIS. The directory is set to use Windows Integrated security
and I've set up the web app to use impersonation with the local admin
account on a WinXP Pro box.

I get the following error though whenever I attempt to iterate over the
Entries collection of the EventLog object:

Cannot open log Security on machine .. Windows has not provided an error
code.

The application log and the system log can both be read though using the
same web service. I've altered the machine.config file to use both the
LOCAL and Administrator accounts with the same result. If I put the same
code into a Win form project, it works just fine and I'm able to view the
entries of the security log. Within the web method, I can see that the
current user making the request is the local administrator by using the
IIdentity interface of the User object. Explicitly impersonating the local
admin using objects of the System.Security namespace doesn't help either.

Signing the web service with sn.exe and putting it into the GAC has not
helped. I created a code permission that included full privileges to the
registry and event logs and set my sn assembly to use it, but the same error
occurs. Using Regmon.exe, I can see the requests to the registry keys that
are made, but no error messages are reported.

Can anyone provide suggestions for a fix?


 
Reply With Quote
 
 
 
 
Eric Marvets
Guest
Posts: n/a
 
      05-22-2004
Its all about the process identity. You could put the ASPNET account in the
Administrators group and it would work, but that's a security risk.

Here's what you do. Open regedit. Find
'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servi ces\Eventlog\Security' and
go to Edit -> Permissions. Give the ASPNET account full control to this
key.

--
Eric Marvets
Principal Consultant

the bang project

<shameless self promotion>

Email for Information on Our Architecture and
Mentoring Services

</shameless self promotion>


 
Reply With Quote
 
 
 
 
Ian Wright
Guest
Posts: n/a
 
      05-22-2004
Good suggestion, but I tried that a little earlier just to see if it would
work (and yes, it's a very bad idea to grant that permission to the ASPNET
account). Anyway, the error is still the same. It looks to me as though
it's just a defect in the runtime/IIS. Maybe MS just decided to lock down
the security log so that nothing even remotely related to the ASPNET process
can touch it.

Here's the error I get after adding the ASPNET account to the Admin group:

Cannot open log Security on machine .. Windows has not provided an error
code.

at System.Diagnostics.EventLog.OpenForRead()
at System.Diagnostics.EventLog.get_EntryCount()
at System.Diagnostics.EventLogEntryCollection.get_Cou nt()
at System.Diagnostics.EntriesEnumerator.MoveNext()
at EventLogArchiver.ServerEventLogReader.GetServerEve nts(String LogName) in
c:\inetpub\wwwroot\EventLogArchiver\ServerEventLog Reader.asmx.vb:line 71

TY Eric for taking the time to respond.



"Ian Wright" <ian-c-> wrote in message
news:...
> I'm attempting to read the security event log for a WinXP Pro machine

using
> a web form that calls a web service. Both files are stored in the same
> directory in IIS. The directory is set to use Windows Integrated security
> and I've set up the web app to use impersonation with the local admin
> account on a WinXP Pro box.
>
> I get the following error though whenever I attempt to iterate over the
> Entries collection of the EventLog object:
>
> Cannot open log Security on machine .. Windows has not provided an error
> code.
>
> The application log and the system log can both be read though using the
> same web service. I've altered the machine.config file to use both the
> LOCAL and Administrator accounts with the same result. If I put the same
> code into a Win form project, it works just fine and I'm able to view the
> entries of the security log. Within the web method, I can see that the
> current user making the request is the local administrator by using the
> IIdentity interface of the User object. Explicitly impersonating the

local
> admin using objects of the System.Security namespace doesn't help either.
>
> Signing the web service with sn.exe and putting it into the GAC has not
> helped. I created a code permission that included full privileges to the
> registry and event logs and set my sn assembly to use it, but the same

error
> occurs. Using Regmon.exe, I can see the requests to the registry keys

that
> are made, but no error messages are reported.
>
> Can anyone provide suggestions for a fix?
>
>



 
Reply With Quote
 
Eric Marvets
Guest
Posts: n/a
 
      05-23-2004
Have you turned on auditing and looked at the security or even the
application log for a better error message? I have had no problems doing
this in the past.

--
Eric Marvets
Principal Consultant

the bang project

<shameless self promotion>

Email for Information on Our Architecture and
Mentoring Services

</shameless self promotion>


 
Reply With Quote
 
Ian Wright
Guest
Posts: n/a
 
      05-23-2004
There are no events recorded in the either of the logs you mentioned that
have to do with my problem.

I looked at the Programming .NET Security book by Freeman and Jones. In
there, they point out that the security log requires a special permission
("Manage auditing and security log") in order to do certain operations (p.
514). Even after explicitly adding the ASPNET account to this user right
group though, it still fails with the same error. I've also added the
ASPNET account with Full Control rights to the registry key for the Services
stuff to no avail.

At this point, my hunch is that the functionality I need is broken as the
result of a recent MS security patch. The same error happens on both of my
WinXP machines. I'll try a Win2K box tomorrow. The thing that's so
frustrating is that even by granting the ASPNET the highest privileges and
access to the system, the web service cannot enumerate thru the log
collection. Perhaps service pack 2 addresses this bug.

"Eric Marvets" <> wrote in message
news:%23S$...
> Have you turned on auditing and looked at the security or even the
> application log for a better error message? I have had no problems doing
> this in the past.
>
> --
> Eric Marvets
> Principal Consultant
>
> the bang project
>
> <shameless self promotion>
>
> Email for Information on Our Architecture and
> Mentoring Services
>
> </shameless self promotion>
>
>



 
Reply With Quote
 
Chris Rolon
Guest
Posts: n/a
 
      05-25-2004
The user account that ASP .Net runs under on the 1.1 framework is "Network
Service". Check to make certain that you have granted the right account the
necessary privileges.

--

Chris Rolon

This posting is provided "AS IS" with no warranties, and confers no rights.

"Ian Wright" <ian-c-> wrote in message
news:Of7U#...
> There are no events recorded in the either of the logs you mentioned that
> have to do with my problem.
>
> I looked at the Programming .NET Security book by Freeman and Jones. In
> there, they point out that the security log requires a special permission
> ("Manage auditing and security log") in order to do certain operations (p.
> 514). Even after explicitly adding the ASPNET account to this user right
> group though, it still fails with the same error. I've also added the
> ASPNET account with Full Control rights to the registry key for the

Services
> stuff to no avail.
>
> At this point, my hunch is that the functionality I need is broken as the
> result of a recent MS security patch. The same error happens on both of

my
> WinXP machines. I'll try a Win2K box tomorrow. The thing that's so
> frustrating is that even by granting the ASPNET the highest privileges and
> access to the system, the web service cannot enumerate thru the log
> collection. Perhaps service pack 2 addresses this bug.
>
> "Eric Marvets" <> wrote in message
> news:%23S$...
> > Have you turned on auditing and looked at the security or even the
> > application log for a better error message? I have had no problems

doing
> > this in the past.
> >
> > --
> > Eric Marvets
> > Principal Consultant
> >
> > the bang project
> >
> > <shameless self promotion>
> >
> > Email for Information on Our Architecture and
> > Mentoring Services
> >
> > </shameless self promotion>
> >
> >

>
>



 
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
Does timer in Web Service Global.asax block my Web Service from processing web-site requests? Leo Violette ASP .Net Web Services 0 04-17-2009 12:39 AM
InvocationTargetException when calling "new Service()" in Axis web service to call another web service Michael Averstegge Java 0 01-10-2006 11:05 PM
Web Service Client Cannot Connect to Web Service From Some Machine EagleRed@HighFlyingBirds.com ASP .Net Web Services 0 10-10-2005 11:15 PM
Cannot log me on since my profile cannot be located psion Computer Support 4 12-31-2004 11:28 PM
Cannot log you on since your profile cannot be located psion Computer Support 0 12-31-2004 02:32 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