Per poter permettere ad un'applicazione ASP.NET di scrivere sull'Event Viewer di Windows 2003 SP1, è necessario modificare una chiave di registry, per poter permettere al servizio Network Service di scrivere.
Questo perchè Microsoft, con l'introduzione della SP1 di Windows2003 ha "blindato" l'events log!
Per ovviare a ciò, operare come segue:
1. Aprire il registry e posizionarsi nella chiave HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Eventlog\Application\CustomSD
Le ACL di default per l'Application Log sono:
O:BAG:SYD:(D;;0xf0007;;;AN)(D;;0xf0007;;;BG)(A;;0xf0007;;;SY)(A;;0x7;;;BA) (A;;0x7;;;SO)(A;;0x3;;;IU)(A;;0x3;;;SU)(A;;0x3;;;S-1-5-3)
Questi sono gli SDDL (Security Descriptor Description Language) che si possono impostare sulla chiave in questione:
O:BA Object owner is Built-in Admin (BA).
G:SY Primary group is System (SY).
D: This is a DACL, rather than an audit entry or SACL.
(D;;0xf0007;;;AN) Deny Anonymous (AN) all access.
(D;;0xf0007;;;BG) Deny Built-in Guests (BG) all access.
(A;;0xf0005;;;SY) Allow System Read and Clear, including DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER (indicated by the 0xf0000).
(A;;0x7;;;BA) Allow Built-in Admin READ, WRITE and CLEAR.
(A;;0x7;;;SO) Allow Server Operators READ, WRITE and CLEAR.
(A;;0x3;;;IU) Allow Interactive Users READ and WRITE.
(A;;0x3;;;SU) Allow Service accounts READ and WRITE.
(A;;0x3;;;S-1-5-3) Allow Batch accounts (S-1-5-3) READ and WRITE.
Per poter permettere al Network Service di scrivere sull'Application Log, bisogna inserire questa stringa alla fine della lista:
(A;;0x3;;;NS)
Nota: se si utilizza l'impersonation (<identity impersonate="true" /> nel web.config), l'accesso all'event log verrà effettuato con le credenziali dell'impersonated user. In questo caso, bisogna permettere agli utenti autenticati (authenticated users) l'accesso in lettura/scrittura, tramite l'utilizzo della stringa:
(A;;0x3;;;AU)
Per ulteriori informazioni, vedere questo articolo tecnico di Microsoft http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncode/html/secure06122003.asp
Technorati tags:
Windows Server 2003