HighTechTalks DotNet Forums  

How to get the WindowsIdentity of the caller of my excutable?

Dotnet Security microsoft.public.dotnet.security


Discuss How to get the WindowsIdentity of the caller of my excutable? in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Cindy Liu
 
Posts: n/a

Default How to get the WindowsIdentity of the caller of my excutable? - 06-21-2004 , 06:17 PM






Hi Everyone,

I created my Windows service. I want to get the WindowsIdentity of the caller that calls my method in my Windows service. How do I do that?

Thanks in advance!!!
Cindy

Reply With Quote
  #2  
Old   
Alek Davis
 
Posts: n/a

Default Re: How to get the WindowsIdentity of the caller of my excutable? - 06-21-2004 , 06:48 PM






Cindy,

I assume that your Windows service encapsulates a .NET remoting object;
otherwise, your question does not make much sense: a regular Windows service
just runs on its own with the identity defined in the Service Control
Manager (which is trivial to obtain). If my assumption is correct, you are
out of luck, because CLR does not support any security aspects in .NET
remoting objects running inside of Windows services. You options would be
to: (a) host your .NET remoting object in an ASP.NET application instead of
Windows service; (b) use SSPI (I cannot comment on this, but there are some
references on the Web); or (c) use a commercial product like GenuineChannels
(see http://www.genuinechannels.com/).

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Everyone,

I created my Windows service. I want to get the WindowsIdentity of the
caller that calls my method in my Windows service. How do I do that?

Thanks in advance!!!
Cindy



Reply With Quote
  #3  
Old   
Cindy Liu
 
Posts: n/a

Default Re: How to get the WindowsIdentity of the caller of my excutable? - 06-22-2004 , 12:49 PM



Yes, my Windows service hosts a .Net remoting object, and I have a COM+ dll talking to it from different computer, and a web server on the same box calling COM+ methods. Now I want to pass WondowsIdentity token from COM+ dll to my Windows service. Can COM+ dll determine who is the caller, or my web server has to get the token and pass to COM+ dll?

"Alek Davis" wrote:

Quote:
Cindy,

I assume that your Windows service encapsulates a .NET remoting object;
otherwise, your question does not make much sense: a regular Windows service
just runs on its own with the identity defined in the Service Control
Manager (which is trivial to obtain). If my assumption is correct, you are
out of luck, because CLR does not support any security aspects in .NET
remoting objects running inside of Windows services. You options would be
to: (a) host your .NET remoting object in an ASP.NET application instead of
Windows service; (b) use SSPI (I cannot comment on this, but there are some
references on the Web); or (c) use a commercial product like GenuineChannels
(see http://www.genuinechannels.com/).

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:EE740459-E1C4-4AAE-8E5E-A6DB5C72FE27 (AT) microsoft (DOT) com...
Hi Everyone,

I created my Windows service. I want to get the WindowsIdentity of the
caller that calls my method in my Windows service. How do I do that?

Thanks in advance!!!
Cindy




Reply With Quote
  #4  
Old   
Alek Davis
 
Posts: n/a

Default Re: How to get the WindowsIdentity of the caller of my excutable? - 06-22-2004 , 03:23 PM



I am confused: which module do you want to detect the identity of the
caller: COM+ DLL or remoting object hosted in a Windows service. COM+ must
be able to do it easily, but not the remoting object.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote

Quote:
Yes, my Windows service hosts a .Net remoting object, and I have a COM+
dll talking to it from different computer, and a web server on the same box
calling COM+ methods. Now I want to pass WondowsIdentity token from COM+ dll
to my Windows service. Can COM+ dll determine who is the caller, or my web
server has to get the token and pass to COM+ dll?
Quote:
"Alek Davis" wrote:

Cindy,

I assume that your Windows service encapsulates a .NET remoting object;
otherwise, your question does not make much sense: a regular Windows
service
just runs on its own with the identity defined in the Service Control
Manager (which is trivial to obtain). If my assumption is correct, you
are
out of luck, because CLR does not support any security aspects in .NET
remoting objects running inside of Windows services. You options would
be
to: (a) host your .NET remoting object in an ASP.NET application instead
of
Windows service; (b) use SSPI (I cannot comment on this, but there are
some
references on the Web); or (c) use a commercial product like
GenuineChannels
(see http://www.genuinechannels.com/).

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:EE740459-E1C4-4AAE-8E5E-A6DB5C72FE27 (AT) microsoft (DOT) com...
Hi Everyone,

I created my Windows service. I want to get the WindowsIdentity of the
caller that calls my method in my Windows service. How do I do that?

Thanks in advance!!!
Cindy






Reply With Quote
  #5  
Old   
Alek Davis
 
Posts: n/a

Default Re: How to get the WindowsIdentity of the caller of my excutable? - 06-23-2004 , 02:36 PM



This is a very bad approach. If the user identity is passed as a method
parameter, what will prevent a malicious application to call this method
specifying any user it wants? If you need to know caller's identity for
security reasons, you should not do this. Regarding how to detect caller's
identity from a COM+ object, it depends how you implemented the com object.
If it is a C/C++ application, you get the caller's identity from the thread
context (or HTTP context). I am not sure about C#, but there must be lots of
examples how to do this. Sorry, I haven't worked with COM+ for years, so I
do not have an example at hand, but really this should not be difficult to
find.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote

Quote:
If COM+ can do it easily, can you tell me how?

Since there is no way to get the identity of the caller from .Net remoting
object hosted by Windows service, so I decide to pass the identity of the
caller with the methods of my remoting object. The caller of my remoting
object is COM+ dll and its callers are asp pages. So now I want to get the
identity of caller from COM+.
Quote:
Thanks for your help!!!
Cindy

"Alek Davis" wrote:

I am confused: which module do you want to detect the identity of the
caller: COM+ DLL or remoting object hosted in a Windows service. COM+
must
be able to do it easily, but not the remoting object.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:F1F901AA-883F-4AF7-BEFE-A425BDB6A20E (AT) microsoft (DOT) com...
Yes, my Windows service hosts a .Net remoting object, and I have a
COM+
dll talking to it from different computer, and a web server on the same
box
calling COM+ methods. Now I want to pass WondowsIdentity token from COM+
dll
to my Windows service. Can COM+ dll determine who is the caller, or my
web
server has to get the token and pass to COM+ dll?

"Alek Davis" wrote:

Cindy,

I assume that your Windows service encapsulates a .NET remoting
object;
otherwise, your question does not make much sense: a regular Windows
service
just runs on its own with the identity defined in the Service
Control
Manager (which is trivial to obtain). If my assumption is correct,
you
are
out of luck, because CLR does not support any security aspects in
..NET
remoting objects running inside of Windows services. You options
would
be
to: (a) host your .NET remoting object in an ASP.NET application
instead
of
Windows service; (b) use SSPI (I cannot comment on this, but there
are
some
references on the Web); or (c) use a commercial product like
GenuineChannels
(see http://www.genuinechannels.com/).

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:EE740459-E1C4-4AAE-8E5E-A6DB5C72FE27 (AT) microsoft (DOT) com...
Hi Everyone,

I created my Windows service. I want to get the WindowsIdentity of
the
caller that calls my method in my Windows service. How do I do that?

Thanks in advance!!!
Cindy









Reply With Quote
  #6  
Old   
Cindy Liu
 
Posts: n/a

Default Re: How to get the WindowsIdentity of the caller of my excutable? - 06-23-2004 , 05:03 PM



I know it is not a good approach. Since my remoting object has to be hosted by Windows service, as you said that CLR does not support any security aspects in .NET
remoting objects running inside of Windows services, so the only way is to pass in the identity. Do you have any other way?

Thanks,
Cindy

"Alek Davis" wrote:

Quote:
This is a very bad approach. If the user identity is passed as a method
parameter, what will prevent a malicious application to call this method
specifying any user it wants? If you need to know caller's identity for
security reasons, you should not do this. Regarding how to detect caller's
identity from a COM+ object, it depends how you implemented the com object.
If it is a C/C++ application, you get the caller's identity from the thread
context (or HTTP context). I am not sure about C#, but there must be lots of
examples how to do this. Sorry, I haven't worked with COM+ for years, so I
do not have an example at hand, but really this should not be difficult to
find.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:8298CBE8-D8EB-4A05-A584-4E8A88655DBC (AT) microsoft (DOT) com...
If COM+ can do it easily, can you tell me how?

Since there is no way to get the identity of the caller from .Net remoting
object hosted by Windows service, so I decide to pass the identity of the
caller with the methods of my remoting object. The caller of my remoting
object is COM+ dll and its callers are asp pages. So now I want to get the
identity of caller from COM+.

Thanks for your help!!!
Cindy

"Alek Davis" wrote:

I am confused: which module do you want to detect the identity of the
caller: COM+ DLL or remoting object hosted in a Windows service. COM+
must
be able to do it easily, but not the remoting object.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:F1F901AA-883F-4AF7-BEFE-A425BDB6A20E (AT) microsoft (DOT) com...
Yes, my Windows service hosts a .Net remoting object, and I have a
COM+
dll talking to it from different computer, and a web server on the same
box
calling COM+ methods. Now I want to pass WondowsIdentity token from COM+
dll
to my Windows service. Can COM+ dll determine who is the caller, or my
web
server has to get the token and pass to COM+ dll?

"Alek Davis" wrote:

Cindy,

I assume that your Windows service encapsulates a .NET remoting
object;
otherwise, your question does not make much sense: a regular Windows
service
just runs on its own with the identity defined in the Service
Control
Manager (which is trivial to obtain). If my assumption is correct,
you
are
out of luck, because CLR does not support any security aspects in
..NET
remoting objects running inside of Windows services. You options
would
be
to: (a) host your .NET remoting object in an ASP.NET application
instead
of
Windows service; (b) use SSPI (I cannot comment on this, but there
are
some
references on the Web); or (c) use a commercial product like
GenuineChannels
(see http://www.genuinechannels.com/).

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:EE740459-E1C4-4AAE-8E5E-A6DB5C72FE27 (AT) microsoft (DOT) com...
Hi Everyone,

I created my Windows service. I want to get the WindowsIdentity of
the
caller that calls my method in my Windows service. How do I do that?

Thanks in advance!!!
Cindy










Reply With Quote
  #7  
Old   
Alek Davis
 
Posts: n/a

Default Re: How to get the WindowsIdentity of the caller of my excutable? - 06-23-2004 , 08:21 PM



Please read my first reply. It mentions the three most obvious options I can
suggest.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote

Quote:
I know it is not a good approach. Since my remoting object has to be
hosted by Windows service, as you said that CLR does not support any
security aspects in .NET
Quote:
remoting objects running inside of Windows services, so the only way is to
pass in the identity. Do you have any other way?

Thanks,
Cindy

"Alek Davis" wrote:

This is a very bad approach. If the user identity is passed as a method
parameter, what will prevent a malicious application to call this method
specifying any user it wants? If you need to know caller's identity for
security reasons, you should not do this. Regarding how to detect
caller's
identity from a COM+ object, it depends how you implemented the com
object.
If it is a C/C++ application, you get the caller's identity from the
thread
context (or HTTP context). I am not sure about C#, but there must be
lots of
examples how to do this. Sorry, I haven't worked with COM+ for years, so
I
do not have an example at hand, but really this should not be difficult
to
find.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:8298CBE8-D8EB-4A05-A584-4E8A88655DBC (AT) microsoft (DOT) com...
If COM+ can do it easily, can you tell me how?

Since there is no way to get the identity of the caller from .Net
remoting
object hosted by Windows service, so I decide to pass the identity of
the
caller with the methods of my remoting object. The caller of my remoting
object is COM+ dll and its callers are asp pages. So now I want to get
the
identity of caller from COM+.

Thanks for your help!!!
Cindy

"Alek Davis" wrote:

I am confused: which module do you want to detect the identity of
the
caller: COM+ DLL or remoting object hosted in a Windows service.
COM+
must
be able to do it easily, but not the remoting object.

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in message
news:F1F901AA-883F-4AF7-BEFE-A425BDB6A20E (AT) microsoft (DOT) com...
Yes, my Windows service hosts a .Net remoting object, and I have a
COM+
dll talking to it from different computer, and a web server on the
same
box
calling COM+ methods. Now I want to pass WondowsIdentity token from
COM+
dll
to my Windows service. Can COM+ dll determine who is the caller, or
my
web
server has to get the token and pass to COM+ dll?

"Alek Davis" wrote:

Cindy,

I assume that your Windows service encapsulates a .NET remoting
object;
otherwise, your question does not make much sense: a regular
Windows
service
just runs on its own with the identity defined in the Service
Control
Manager (which is trivial to obtain). If my assumption is
correct,
you
are
out of luck, because CLR does not support any security aspects
in
..NET
remoting objects running inside of Windows services. You options
would
be
to: (a) host your .NET remoting object in an ASP.NET application
instead
of
Windows service; (b) use SSPI (I cannot comment on this, but
there
are
some
references on the Web); or (c) use a commercial product like
GenuineChannels
(see http://www.genuinechannels.com/).

Alek

"Cindy Liu" <CindyLiu (AT) discussions (DOT) microsoft.com> wrote in
message
news:EE740459-E1C4-4AAE-8E5E-A6DB5C72FE27 (AT) microsoft (DOT) com...
Hi Everyone,

I created my Windows service. I want to get the
WindowsIdentity of
the
caller that calls my method in my Windows service. How do I do
that?

Thanks in advance!!!
Cindy












Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.