Thursday, 28 November 2013

If you are going to install your own credential provider to a machine where Citrix virtual desktop agent is deployed, you may have the same problem I experienced with DualShield Windows Logon credential provider - Citrix simply filtered out DualShield.

Can they co-exist? How?

Make Certificate fully chained

Some web server, like Tomcat or Nginx, needs a fully chained certificate to provide SSL service.
However,  normally you are not given a fully chained certificate when you purchase a web server certificate from some famous public CA, instead they send you back a couple of certificates. You need to merge them yourself. In this link, I described the problem and provided a way to do the combination.

Monday, 11 November 2013

DVC (Dynamic Virtual Channel)

MS discarded static virtual channel(SVC) in Visual Studio 2012, so we decided to move on - using DVC.

In normal user mode application,  it is fine to call the API WTSVirtualChannelOpenEx. However it returned error 2 in Credential Provider. We are not alone, as someone else also reported the same issue.

We opened a support case with Microsoft more than two weeks ago , haven't got any positive answer from them.

If you are interested in solving this mystery, here is my test code and rough explanation.

Update: After one month email exchange, MS finally admits it is a BUG (Case NO REG:113102410891026). In addition, SVC Sounds like back in VS2013, as in this link, I see someone said

“cchannel.h is present in the Windows 8.1 SDK that will come with VS 2013.”

Here is their conclusion,

PROBLEM
========
You are calling WTSVirtualChannelOpenEx() from your Credential Provider (Windows Server 2008) and it is failing with error code 2 to the built-in "echo" listener. (Dynamic Virtual Channel)  The API succeeds after the user has logged on.  You need to transfer data from the client to the credential provider on the server for authentication data.

RESOLUTION
============
This is currently by design.

You cannot call WTSVirtualChannelOpenEx() from a Credential Provider.  It can only be called once the Remote Desktop Connection has been established which happens after the Credential Provider returns.

ADDITIONAL INFORMATION AND RECOMMENDATIONS
================================================
Based on some additional testing, the issue only happens if the RDC role is installed.  Static Virtual Channels (SVC) would be a work around.  (SVC support has NOT been removed from Windows).

The Remote Desktop Team is aware of your request for accessing a DVC from a Credential Provider.  You may see support for this in the future.

Saturday, 20 July 2013

Cisco ASA virtual appliance on ESXi


I followed the forum thread ASA 8.4(2) on QEMU and created a cisco ASA virtual machine ISO which can be used on ESXi.

Please read this link for the details. It also tells you how to
  • create and attach a serial port
  • activate a new license
  • change ip address of NICs
  • upload ASDM through tftp server.

Serial Port made easy under ESXi

When you are first time to configure your cisco device(router, switch and firewall), you need a console cable to connect to its console port, and attach the other end to PC serial port, then use HyperTerminal (on Windows).

What if it is a virtual appliance on ESXi? With the new type of virtual serial port "Connect over Network", the job becomes easy. Please read this link for the details.

Thursday, 11 July 2013

SAML Authentication on F5 Big-IP (Part 4)

The battle goes on.

F5 Product Development/Engineering Services came back  with following response:

Some research with "Apache Santuario" was done.

We tried the tool which came with install "c14n" "tool to dump a XML file to the console after canonacalising it through c14n"

We checked different options and found the following:

c14n -n -x assertion.xml      => This generates the canonicalized xml which is exactly same as what F5 generates.
c14n -n -x -1.1 assertion.xml => This generates what is explained in the BUG which is different from what F5 generated.

In the above command "1.1" refers to "Use c14n 1.1".
From the source code xml-security-c-1.7.1/xsec/dsig/DSIGConstants.hpp

#define URI_ID_C14N11_NOC       "http://www.w3.org/2006/12/xml-c14n11"
#define URI_ID_EXC_C14N_NOC     "http://www.w3.org/2001/10/xml-exc-c14n#"

This tells us that the canonicalization used by Apache Santuario is 'URI_ID_C14N11_NOC' but we see the inside SAML response which is not right.
Look at "http://www.w3.org/TR/DSig-usage/"

The solution to this problem is that, do not use "1.1" option with c14n when SAML response is generated to work with F5.


Basically, they doubted I was using C14N 1.1.

I can't find the authority in this field to get the verdict on this dispute, so I have to dive deeply into C14N, hopefully in the end I can convince F5 guys in theory where and why they were wrong.

After spending a whole week on trying to understand C14N in XML signature validation,  I can confirm F5  PD/EC opinion was  wrong.

Basically,  the CanonicalizationMethod (in my case which is "http://www.w3.org/2001/10/xml-exc-c14n#" ) defined in SignedInfo should be ONLY used on the second step of core validation - Signature Validation.

However, F5 also employed the same method (the exclusive one) onto the first step (Reference Validation), which  is wrong.

You can check my research details at this link.


Sunday, 26 May 2013

SAML Authentication on F5 Big-IP (Part 3)

I told F5 support team, if I got time, I would give them more evidence. This UK bank holiday gave me the chance.

I believe the SHA1 algorithm has no problem in F5 implementation, so I guess, for the same SAML response, F5 must have a different canonicalization result from Apache Santuario.

In Part 2, we see how the reference validation is done. In  Apache Santuario, actually we can dump the canonicalization xml content which the reference hash is computed on.

Now, let us see if we can  get the same thing on F5. After some assembly code analysis on F5, I think the hash is implemented in apd (Access Policy Daemon) around 0x0825C498.

Luckily I can do the remote debug of this process.
Luckily I managed to get the canonicalization xml content on F5. You can see the details from "Collecting the Canonicalization XML content on F5".

Now the truth is out.

  • On element samlp:Response, the canonicalization xml content by F5 missed two attributes

xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"

  • On element saml:Assertion, F5 coined an attribute

xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"

I am not an expert on  C14N (Canonical XML), but I am inclined to believe Apache is doing right - you should not remove the attributes which exist in the original xml, you should not coin an attribute which does not exist in the original xml.

For anyone who is interested in XML signature and who would like to prove that I am right(or wrong), here they are the files.

SAML response (txt)
SAML response (xml, decoded)
XML canonical by Apache
XML canonical by F5