Cannot read a Security Log from ASP.net web service

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Cannot read a Security Log from ASP.net web service

    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?


    Ian Wright Guest

  2. Similar Questions and Discussions

    1. Web service security
      Hello I am new to web services and I have a number of questions. I have read the WSE documentation and various other articles, but I am not sure...
    2. Web Service and Application Security
      My application software is deployed across two tiers; a WinForms workstation client and a Web Services layer. My application will require...
    3. Web Service Security?
      I have created a Windows app in C# which makes a call to a dll created in C# and to a Web Service, also created in C#. I have put the exe along...
    4. How to get or read Session Info from Java Web Service?
      Hi Everyone, I am accessing a Java web service from my Windows Form App wrttien in Vb.Net. I want to read some cookies set by the web service....
    5. how do i read data from this web service?
      Imports System.Web.Services 'Imports System.Data.SqlClient Imports System.Data.OleDb <System.Web.Services.WebService(Namespace :=...
  3. #2

    Default Re: Cannot read a Security Log from ASP.net web service

    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 [email]sales@bangproject.com[/email] for Information on Our Architecture and
    Mentoring Services

    </shameless self promotion>


    Eric Marvets Guest

  4. #3

    Default Re: Cannot read a Security Log from ASP.net web service

    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-wright@msn.com> wrote in message
    news:eL5cgGEQEHA.640@TK2MSFTNGP09.phx.gbl...
    > 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?
    >
    >

    Ian Wright Guest

  5. #4

    Default Re: Cannot read a Security Log from ASP.net web service

    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 [email]sales@bangproject.com[/email] for Information on Our Architecture and
    Mentoring Services

    </shameless self promotion>


    Eric Marvets Guest

  6. #5

    Default Re: Cannot read a Security Log from ASP.net web service

    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" <ericm@bangproject.com> wrote in message
    news:%23S$m8kFQEHA.632@TK2MSFTNGP12.phx.gbl...
    > 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 [email]sales@bangproject.com[/email] for Information on Our Architecture and
    > Mentoring Services
    >
    > </shameless self promotion>
    >
    >

    Ian Wright Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139