ImpersonatingWrapper

3 messages Options
Embed this post
Permalink
Jaroslaw Kowalski

ImpersonatingWrapper

Reply Threaded More More options
Print post
Permalink
I've just committed the ImpersonatingWrapper for NLog. It lets you
change the thread credentials used by the wrapped target. Works on
Windows under both .NET and Mono.

Usage is simple:

<target type="ImpersonatingWrapper" username="myuser" domain="CORP"
password="123456">
    <target type="File" type="file.txt" filename="log.txt" />
</target>

This will cause the "log.txt" to be created and written to in the
security context of user "CORP\myuser". There can be some issues with
internal logging to file (internal logger opens/closes the file on each
write, so there can be "access denied" problems), so threat this wrapper
as experimental.

The new snapshot should be in place in half an hour.
--

Jarek Kowalski
http://blog.jkowalski.net
http://www.nlog-project.org/ - A .NET Logging Library



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
todthomson

Re: ImpersonatingWrapper

Reply Threaded More More options
Print post
Permalink
Hi Jaroslaw,

I am attempting to use the ImpersonatingWrapper, but I can't get it to work :(

I have tried both of the following, but I can't seem to get it to work :(

<target name="Impersonate" type="ImpersonatingWrapper" revertToSelf="True" wrappedTarget="FOO">
        <target name="FOO" xsi:type="File" fileName="${logshome}\FOO.log" layout="${longdate}|${level}|${message}" />
</target>
       
<target name="Impersonate" type="ImpersonatingWrapper" domain="DOMAIN" username="username"  password="password" wrappedTarget="FOO">
        <target name="FOO" xsi:type="File" fileName="${logshome}\FOO.log" layout="${longdate}|${level}|${message}" />
</target>

Any help would be much appreciated! :)

Cheers!

Tod.

Jaroslaw_Kowalski wrote:
I've just committed the ImpersonatingWrapper for NLog. It lets you
change the thread credentials used by the wrapped target. Works on
Windows under both .NET and Mono.

Usage is simple:

<target type="ImpersonatingWrapper" username="myuser" domain="CORP"
password="123456">
    <target type="File" type="file.txt" filename="log.txt" />
</target>

This will cause the "log.txt" to be created and written to in the
security context of user "CORP\myuser". There can be some issues with
internal logging to file (internal logger opens/closes the file on each
write, so there can be "access denied" problems), so threat this wrapper
as experimental.

The new snapshot should be in place in half an hour.
--

Jarek Kowalski
http://blog.jkowalski.net
http://www.nlog-project.org/ - A .NET Logging Library



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nlog-list mailing list
Nlog-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nlog-list
Jaroslaw Kowalski

Re: ImpersonatingWrapper

Reply Threaded More More options
Print post
Permalink
You don't need to use wrappedTarget name - just put one target inside the
other and don't give it a name.
Also, try to enable detailed internal logging - <nlog
internalLogFile="c:\path\to\file.txt" internalLogLevel="Trace" /> to see
what may be going on.

Jarek

----- Original Message -----
From: "todthomson" <[hidden email]>
To: <[hidden email]>
Sent: Tuesday, December 04, 2007 9:05 PM
Subject: Re: [Nlog-list] ImpersonatingWrapper


>
> Hi Jaroslaw,
>
> I am attempting to use the ImpersonatingWrapper, but I can't get it to
> work
> :(
>
> I have tried both of the following, but I can't seem to get it to work :(
>
> <target name="Impersonate" type="ImpersonatingWrapper" revertToSelf="True"
> wrappedTarget="FOO">
> <target name="FOO" xsi:type="File" fileName="${logshome}\FOO.log"
> layout="${longdate}|${level}|${message}" />
> </target>
>
> <target name="Impersonate" type="ImpersonatingWrapper" domain="DOMAIN"
> username="username"  password="password" wrappedTarget="FOO">
> <target name="FOO" xsi:type="File" fileName="${logshome}\FOO.log"
> layout="${longdate}|${level}|${message}" />
> </target>
>
> Any help would be much appreciated! :)
>
> Cheers!
>
> Tod.
>
>
> Jaroslaw_Kowalski wrote:
>>
>> I've just committed the ImpersonatingWrapper for NLog. It lets you
>> change the thread credentials used by the wrapped target. Works on
>> Windows under both .NET and Mono.
>>
>> Usage is simple:
>>
>> <target type="ImpersonatingWrapper" username="myuser" domain="CORP"
>> password="123456">
>>     <target type="File" type="file.txt" filename="log.txt" />
>> </target>
>>
>> This will cause the "log.txt" to be created and written to in the
>> security context of user "CORP\myuser". There can be some issues with
>> internal logging to file (internal logger opens/closes the file on each
>> write, so there can be "access denied" problems), so threat this wrapper
>> as experimental.
>>
>> The new snapshot should be in place in half an hour.
>> --
>>
>> Jarek Kowalski
>> http://blog.jkowalski.net
>> http://www.nlog-project.org/ - A .NET Logging Library
>>
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share
>> your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Nlog-list mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nlog-list
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/ImpersonatingWrapper-tf1962217s6167.html#a14165418
> Sent from the NLog-list mailing list archive at Nabble.com.
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by: The Future of Linux Business White Paper
> from Novell.  From the desktop to the data center, Linux is going
> mainstream.  Let it simplify your IT future.
> http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
> _______________________________________________
> Nlog-list mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nlog-list
>



-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list