Event Log Source creation security hang up.

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

  1. #1

    Default Event Log Source creation security hang up.

    I want to have my trace statements log to the event viewer and have the
    following test code in Page_Load:
    If Not Page.IsPostBack Then

    Try

    System.Diagnostics.Trace.Listeners.Add(New
    System.Diagnostics.EventLogTraceListener("CustomSo urce"))

    System.Diagnostics.Trace.WriteLine("TestMsg", "Info-Test")

    Catch e1 As Exception

    Dim str As String = e1.Message

    End Try

    End If

    I get a SecurityException with the message "Required registry access is not
    allowed"

    I'm not doing anything beyond the default with security at the moment.
    Web.config is the default as far as security is concerned.

    I am not sure the best approach. I may have to alter the ASPNET account's
    permissions, or create the event log by hand (or in any future install
    script) but I am reluctant do alter permissions of any accounts. I could
    probably create the event log using a RegistryActions install segment but
    I'm wondering if there is a better way to do it? Would I need to
    impersonate an actual user? Would this work with Forms authentication?

    Thanks.




    Eric Guest

  2. Similar Questions and Discussions

    1. Sandbox Security and Data Source Permissions Error
      I continually receive the following ColdFusion error when trying to login to some of my ColdFusion applications: 11:47:54.054 -...
    2. Error Creating Event Source
      Hi, My web application which runs on Windows 2003 server writes to EventLog during application startup but I get the following exception ...
    3. Dynamic Datagrid Creation - ItemCommand event not firing
      I am generating a dynamic datagrid that gets assigned to a cell within the parent grid. Here's the html: <asp:DataGrid id="dgPositions"...
    4. About: [SECURITY] [DSA-358-1] New kernel source and i386
      What's not clear to me (unless I just missed in my coffee-less state) is what is required, if anything since I'm using: ii kernel-source-...
    5. why doesn't this script creation, from .aspx.vb work, for this event handler???
      where szStartDate, szEndDate, szStatus, szMsgType, szClient, szFilter are all strings declared and containing data as this code executes... '...
  3. #2

    Default Re: Event Log Source creation security hang up.

    You should create the event log in advance with the privileged account.
    That is the normal pattern for this type of issue. You can use a script or
    an installer or do it by hand; whatever works.

    It is a pain from your application's perspective, but in general you are
    much better off from a security perspective if the ASP.NET account has as
    few privileges as possible.

    Joe K.

    "Eric" <glorfindel02@hotmail.com> wrote in message
    news:us4FJEQHEHA.2656@TK2MSFTNGP12.phx.gbl...
    > I want to have my trace statements log to the event viewer and have the
    > following test code in Page_Load:
    > If Not Page.IsPostBack Then
    >
    > Try
    >
    > System.Diagnostics.Trace.Listeners.Add(New
    > System.Diagnostics.EventLogTraceListener("CustomSo urce"))
    >
    > System.Diagnostics.Trace.WriteLine("TestMsg", "Info-Test")
    >
    > Catch e1 As Exception
    >
    > Dim str As String = e1.Message
    >
    > End Try
    >
    > End If
    >
    > I get a SecurityException with the message "Required registry access is
    not
    > allowed"
    >
    > I'm not doing anything beyond the default with security at the moment.
    > Web.config is the default as far as security is concerned.
    >
    > I am not sure the best approach. I may have to alter the ASPNET account's
    > permissions, or create the event log by hand (or in any future install
    > script) but I am reluctant do alter permissions of any accounts. I could
    > probably create the event log using a RegistryActions install segment but
    > I'm wondering if there is a better way to do it? Would I need to
    > impersonate an actual user? Would this work with Forms authentication?
    >
    > Thanks.
    >
    >
    >
    >

    Joe Kaplan \(MVP - ADSI\) Guest

  4. #3

    Default Re: Event Log Source creation security hang up.

    Thanks. I had sort of settled on that as the way to go. I'm not sure how
    to create the event log source in an installation script, though. If I go
    directly to the registry, I could use a Registry Editor action, or a Custom
    Action if want to write some code to do it, which may be the way to go.

    "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
    in message news:OIQlXjQHEHA.3200@TK2MSFTNGP10.phx.gbl...
    > You should create the event log in advance with the privileged account.
    > That is the normal pattern for this type of issue. You can use a script
    or
    > an installer or do it by hand; whatever works.
    >
    > It is a pain from your application's perspective, but in general you are
    > much better off from a security perspective if the ASP.NET account has as
    > few privileges as possible.
    >
    > Joe K.
    >
    > "Eric" <glorfindel02@hotmail.com> wrote in message
    > news:us4FJEQHEHA.2656@TK2MSFTNGP12.phx.gbl...
    > > I want to have my trace statements log to the event viewer and have the
    > > following test code in Page_Load:
    > > If Not Page.IsPostBack Then
    > >
    > > Try
    > >
    > > System.Diagnostics.Trace.Listeners.Add(New
    > > System.Diagnostics.EventLogTraceListener("CustomSo urce"))
    > >
    > > System.Diagnostics.Trace.WriteLine("TestMsg", "Info-Test")
    > >
    > > Catch e1 As Exception
    > >
    > > Dim str As String = e1.Message
    > >
    > > End Try
    > >
    > > End If
    > >
    > > I get a SecurityException with the message "Required registry access is
    > not
    > > allowed"
    > >
    > > I'm not doing anything beyond the default with security at the moment.
    > > Web.config is the default as far as security is concerned.
    > >
    > > I am not sure the best approach. I may have to alter the ASPNET
    account's
    > > permissions, or create the event log by hand (or in any future install
    > > script) but I am reluctant do alter permissions of any accounts. I
    could
    > > probably create the event log using a RegistryActions install segment
    but
    > > I'm wondering if there is a better way to do it? Would I need to
    > > impersonate an actual user? Would this work with Forms authentication?
    > >
    > > Thanks.
    > >
    > >
    > >
    > >
    >
    >

    Eric Guest

  5. #4

    Default Re: Event Log Source creation security hang up.

    I was thinking the custom action route with an installer class and an
    installer you build in VS. I think that is easiest by a long shot.

    Joe K.

    "Eric" <glorfindel02@hotmail.com> wrote in message
    news:uRf3vfSHEHA.3528@TK2MSFTNGP09.phx.gbl...
    > Thanks. I had sort of settled on that as the way to go. I'm not sure how
    > to create the event log source in an installation script, though. If I go
    > directly to the registry, I could use a Registry Editor action, or a
    Custom
    > Action if want to write some code to do it, which may be the way to go.
    >
    > "Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan@removethis.accenture.com> wrote
    > in message news:OIQlXjQHEHA.3200@TK2MSFTNGP10.phx.gbl...
    > > You should create the event log in advance with the privileged account.
    > > That is the normal pattern for this type of issue. You can use a script
    > or
    > > an installer or do it by hand; whatever works.
    > >
    > > It is a pain from your application's perspective, but in general you are
    > > much better off from a security perspective if the ASP.NET account has
    as
    > > few privileges as possible.
    > >
    > > Joe K.
    > >
    > > "Eric" <glorfindel02@hotmail.com> wrote in message
    > > news:us4FJEQHEHA.2656@TK2MSFTNGP12.phx.gbl...
    > > > I want to have my trace statements log to the event viewer and have
    the
    > > > following test code in Page_Load:
    > > > If Not Page.IsPostBack Then
    > > >
    > > > Try
    > > >
    > > > System.Diagnostics.Trace.Listeners.Add(New
    > > > System.Diagnostics.EventLogTraceListener("CustomSo urce"))
    > > >
    > > > System.Diagnostics.Trace.WriteLine("TestMsg", "Info-Test")
    > > >
    > > > Catch e1 As Exception
    > > >
    > > > Dim str As String = e1.Message
    > > >
    > > > End Try
    > > >
    > > > End If
    > > >
    > > > I get a SecurityException with the message "Required registry access
    is
    > > not
    > > > allowed"
    > > >
    > > > I'm not doing anything beyond the default with security at the moment.
    > > > Web.config is the default as far as security is concerned.
    > > >
    > > > I am not sure the best approach. I may have to alter the ASPNET
    > account's
    > > > permissions, or create the event log by hand (or in any future install
    > > > script) but I am reluctant do alter permissions of any accounts. I
    > could
    > > > probably create the event log using a RegistryActions install segment
    > but
    > > > I'm wondering if there is a better way to do it? Would I need to
    > > > impersonate an actual user? Would this work with Forms
    authentication?
    > > >
    > > > Thanks.
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    >
    >

    Joe Kaplan \(MVP - ADSI\) 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