Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2008

Tip: Looking for answers? Try searching our database.

WCF security advice (and clarification) needed

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anders Jensen - 11 Mar 2008 17:08 GMT
Hi

After a couple of days of trying to get to grips with WCF i need some advice
on how to implement security.

We will be using the NetTcpBinding and message-level security, the only
thing is, we are not completely sure what actually happens per default. If I
set SecurityMode.Message, per default, Windows authentication is used on both
server and client? If we assume that the server is in fact who it claims to
be, is this communication then secure in both directions (encrypted and
signed)?

Let me put it in another way. If I had a public/private-key pair on both the
server and client I would encrypt with the public-key and decrypt using the
private-key in both directions which means that given both client and server
are who they claim to be, I have secure communication. When using Windows
authentication, some kind of token is created? How does this work (in simple
terms)?

If I then add a CA-signed certificate on the server to verify the servers
identity to the client, how does the scheme then change? I assume that
Windows authenication is still used on the client side?

If I then again add ClientCredentials (Username and Password) on the client,
can I then use those for authorization without altering the way the server
and client communicates?

We are having some trouble getting an overview of WCF security so if this is
basic stuff, please bear with me.

Cheers
Tiago Halm - 11 Mar 2008 23:59 GMT
Anders,

There are two parties participating in a security scenario, the server and
the client. Let me give you a simple example for HTTP parlor. I'll then
follow up with WebServices specifics.

When you use HTTPS (SSL) in a webserver, you're using a server certificate
and whenever a client connects to that webserver he's in fact validating the
server is who he says he is by following the certificate chain of the server
certificate. The webserver is in fact presenting the client with the public
key allowing the client to send information encrypte with that public key
which only the webserver can decrypt with its private key.

When/If the client uses a client certificate, he'll be authenticating
himself to the server, and the server will use the same methodology to
validate the credentials. He'll then authorize the client the way it sees
fit.

Now, all this HTTP talk mentioned a single security token supported by the
HTTP protocol - X.509 certificates. HTTP supports other authentication
modes, like Negotiate (SPNEGO/NTLM), NTLM, Digest and Basic Authentication.

WebServices present us with a richer protocol able to handle multiple
security tokens, the ability to use multiple security tokens in a single
message and the ability the secure different parts of the message with
different security tokens for different recipients. The security tokens
supported are - Username Token (similar to Basic Auth), Kerberos Token
(similar to SPNEGO), X.509 (similar to certificates) and SAML.

When you create a WebService you define the binding (basicHttpBinding,
wsHttpBinding, netTcpBinding, NamedPipeBinding, others ...). All these
bindings support the latest WS standards (except basicHttpBinding which
supports only some of the standards) and allow you to specify the security
settings of your choosing.

When selecting security settings you must choose how the server will
authenticate to client and how the client authenticates to the server. Only
some combinations are possible, ex:
client (Username) + server (X.509)
client (X.509) + server (X.509)
client (Kerberos or Windows) + server (Kerberos or Windows)
(more)

You also have the option of choosing where (with constraints) the security
tokens are set, the message (SOAP) or the transport protocol (HTTP/TCP.IP)

SAML is a different beast, where you have 3 participants. The client
contacts an STS (issuer) to get a SAML authenicating himself with any
combination of the above, and presents the SAML to the server on every
operation allowing the client to present himself in a uniform way to any
server able to validate the SAML.

Anyway, I think you already have a lot to chew on.
You can browse examples of the WebService security scenarios here:
http://msdn2.microsoft.com/en-us/library/ms730301.aspx

Finally, choosing your security settings can be (almost) independent of the
chosen binding. That is one of the beauties of WS-* :)

By the way, with Windows (Kerberos) on both sides (client and server) the
communication is already encrypted and signed because Kerberos already makes
use of session keys/tickets.

hope it helps
Tiago Halm

> Hi
>
[quoted text clipped - 37 lines]
>
> Cheers
Anders Jensen - 12 Mar 2008 01:09 GMT
Hi Tiago

First, thank you very much for the answer, it answered almost everything I
needed to know. For our application I think Windows/Kerberos is appropriate,
I am just wondering about one thing. How is the servers identity ensured when
using Windows/Kerberos? I mean, wouldn't it be possible for some malicious
party to spoof the servers identity when the server is not authenticated
through some 3rd party (CA or STS)?

Cheers

> Anders,
>
[quoted text clipped - 103 lines]
> >
> > Cheers
Tiago Halm - 12 Mar 2008 01:34 GMT
No, its not possible.

When authenticating with Windows/Kerberos (say
http://foo.mycompany.com/mypage.aspx or
nettcp://foo.mycompany.com/mysvc.svc) you'll be asking your KDC (with a TGT
on your hand) to give you a service ticket for the SPN
HTTP/foo.mycompany.com, or MyService/foo.mycompany.com. The KDC validates
your TGT and looks for the account with that SPN registered. On finding one,
it creates a service ticket with your information and with an
"authenticator" which only a process whose identity is that account can
decrypt. You, the client, resolve the foo.mycompany.com hostname within your
own DNS. Having the IP address you then make a SOAP call (within HTTP or
TCP/IP) with that ticket as the security token. Upon receiving the request,
the service will look into the token, decrypt it and be able to see that the
ticket is valid, the ticket is from you and the ticket is to access
"himself" and will then process your request.

Tiago Halm

> Hi Tiago
>
[quoted text clipped - 137 lines]
>> >
>> > Cheers

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.