Geneva Server beta 2 included a new issuance language that allows you to specify which claims should be burnt into security tokens.  I am really excited about this specialized claims DSL, not for the ways its creators had envisioned it being used, but because of how it can be used in the implementation of a custom STS.  You see?  The DLL that contains this language, Microsoft.IdentityServer.ClaimsPolicy, is completely isolated from the server proper.  You can use it to help you decide how to issue claims in your custom STS.  To begin leveraging this new DSL, do the following:
  1. Add a reference the aforementioned assembly,
  2. Create a claims policy engine,
  3. Create a policy context that includes the attributes stores you want to use and the IClaimsIdentity with the claims you want to transform, and
  4. Perform the mapping by feeding the policy context to the engine's issue method.
Before diving into the details, it may be helpful to see an example script:

c1:[ Type == "t1" ] =>

    issue(Type = "xxx", Value = c1.Value);

 

c2:[ Type == "t2" ] =>

    issue(Store = "_FooAttributeStore", Types = ("t2"), Query = "Get me {0}", Param = c2.Value);   

 

c3:[ Type == "t3" ] =>

    issue(Type = c3.Type, Issuer = "yyy", Value = c3.Value);

 

c4:[ Value == "v4" ] =>

    issue(Store = "_FooAttributeStore", Types = ("_T_2", "_T_3"), Query = "Get me {0}", Param = "Some Param");

 

c5:[ Value =~ "v\d$" ] =>

    issue(Type = "Regex Transformed", Value = c5.Value + "_XXX");


As Jon Alexander talked about on Channel 9, this language is a set of rules that consist of antecedents and conclusions.  Those antecedents that match an input claim will cause the function in the conclusion to be fired which can insert new claims into the output (if the issue function is called as in this example).

With a script like this, you just need to perform the steps listed above to begin using this awesome new feature of Geneva Server outside of the server itself.  To see how this might work, here is a simple example.

static void Main()

{

    var policyEngine = GetPolicyEngine();

    var originalIdentity = GetIdentity();

    var context = GetPolicyContext(originalIdentity);

    var transformedIdentity = policyEngine.Issue(context);

 

    WriteClaims(policyEngine.Policy, originalIdentity, transformedIdentity);

 

    Console.ReadLine();

}


To create the policy engine, you need to read your script into a string.  This is done by calling the Initialize method defined by the IPolicyEngine interface.

Untitled picture.png

As I said before, you create a PolicyContext to be used during the transformation process.  Here's how that might look:

private static PolicyContext GetPolicyContext(IClaimsIdentity identity)

{

    var attributeStores = GetAttributeStores();

 

    // NOTE: The attribute stores argument can't be null even if your

    // transformation script doens't include the use of any stores.

    Debug.Assert(attributeStores != null);

 

    const string resource = "resource???", action = "issue???";

    var subject = new ClaimsPrincipal(identity);

 

    return new PolicyContext(subject, resource, action, attributeStores);

}

 

private static Dictionary<string, IAttributeStore> GetAttributeStores()

{

    return new Dictionary<string, IAttributeStore>();

}

If you want to use a custom attribute store (a class that implements IAttributeStore), you might do something like this:

private static Dictionary<string, IAttributeStore> GetAttributeStores()

{

    var attributeStores = new Dictionary<string, IAttributeStore>();           

    var store = AttributeStoreFactory.CreateAttributeStore(

        typeof(FooAttributeStore).AssemblyQualifiedName, null);

 

    attributeStores.Add("_FooAttributeStore", store);

 

    return attributeStores;

}


As you can see from the snippet above, I don't really understand what values you should use for the resource and action arguments given to the PolicyContext constructor.  If you know, please leave a comment or contact me.

Once you've created IPolicyEngine and PolicyContext objects, you call the BeginIssue and EndIssue methods on the engine:

var context = GetPolicyContext(originalIdentity);

var transformedIdentity = EndIssue(BeginIssue(context, null, null));


The fictitious attribute store might get values from a Web service, XML file, .NET remoting component, mainframe, or any other source that contains data you would like to include in claims.  The IAttributeStore requires that you use .NET's async programming model.  As a result, you'll end up with something like this:


public class FooAttributeStore : IAttributeStore

{

    public void Initialize(Dictionary<string, string> config) { }

 

    public IAsyncResult BeginExecuteQuery(string query, string[] parameters, AsyncCallback callback, object state)

    {

        Func<string[][]> func = () =>

        {

            var result = new string[2][];

 

            result[0] = new[] { "stuff from attribute store", string.Format(query, parameters) };

            result[1] = new[] { "1", "2" };

 

            return result;

        };

 

        return func.BeginInvoke(callback, state);

    }

 

    public string[][] EndExecuteQuery(IAsyncResult result)

    {

        result.AsyncWaitHandle.WaitOne();

 

        var del = ((AsyncResult)result).AsyncDelegate as Func<string[][]>;

 

        Debug.Assert(del != null);

 

        return del.EndInvoke(result);

    }

}


Note that the Func in BeginExecuteQuery returned two objects.  The cardinality of this array needs to match the number of types given in your script that uses that attribute store:

issue(Store = "_FooAttributeStore", Types = ("_T_2", "_T_3"), Query = "Get me {0}", Param = "Some Param");

As Dominick mentioned recently, you can find more info about creating custom attribute stores on the Connect Web site

Why this DSL is Interesting to Custom STS Developers

Why is this new DSL so interesting to people developing a custom STS?  One fundamental problem in developing a custom STS (that I've encountered at least) is how and where to store the values it uses when issuing claims.  In case you haven't encountered this problem, let me explain.  Imagine you have hundreds of relying parties.  Each one will eventually need to make an authorization decision.  To do this, it needs claims that are very specific to it -- http://iaea.gov/can/launch/nukes, http://eaa.org/ready/for/flight, etc.  Though many Geneva-related samples use claim types such as email, given name, and other common types, some RPs require claim types that are very specific to them (as these examples were intended to show).  Who knows if a certain user is allowed to launch nuclear missiles or is ready to fly experimental planes?  Not the STS (either FP- or RP-STS).  It's the RP that has this data.

Assuming these assertions are correct, what should we do?  Shall we replicate the claim values to the STS from our 100 RPs and store that info in some monstrous, ever-growing STS database?  I don't believe that would scale (though some have disagreed with me on this).  What's the alternative?  Use Geneva Server's issuance language and its attribute stores to fetch the values from the RP itself.  When an RST is sent to the STS, it can figure out which RP the request is for, query its data store for a script specific to that RP, and (presuming it contains rules to query the RP's database) execute it to get data from the RP's database.  This decentralized approach leaves the RP in control of its data, decreases latency related to synchronization, avoids problems when replication goes awry, and scales out the load on the system.  If you're uncomfortable querying the RP's database from your STS (and you should be), implement a custom attribute store that calls a Web service.  If that service's API conforms to a standard, such as WS-Transfer (i.e., "WS-CRUD"), you have yourself a pretty nice system IMO.

The Bad News about the Issuance Language

The DLL that contains this language is included with Geneva Server.  This means that everyone with a Windows Server license is allowed to freely use it.  The types in it are (currently as of beta 2) public, making them generally available; however, this type of usage is not what Microsoft had in mind (IINM).  So, if you link against Microsoft.IdentityServer.ClaimsPolicy, you're swimming in shark infested waters.  They, and I, make no promises that things won't break when you install future versions of Geneva Server.  In no way, do I imply any warranty of the code or information in this blog post.  It is provided AS IS.  If the types in the assembly are made internal in a future release, if the interface changes and breaks a ton of your code, or for any other reason you incur damages by using this information or code, it is not my fault, and I accept no responsibility whatsoever.  Can you tell I just finished a class in business law? ;-)

If you need this language as bad as I do, please tell Microsoft to put it in the Geneva Framework where, IMHO, it belongs.

Geneva beta 2 is out! You can register and download the bits from Microsoft's web site. With this new preview, they have also released a training kit that has a number of samples, labs, and walk-throughs. There are some other blog posts about the release here, here, and here. Also, on the Id Element show on Channel 9, they have created 4 new episodes about the new beta:

Enjoy!  I know I'm going to.

RSA Day 4 & 5

| | Comments (0) | TrackBacks (0) |

On day four and five of my first RSA Conference, I spent most of the day going to lectures about current and future hacks that are being launched against businesses by cyber criminals. I learned a lot, because, as I've said before, I'm pretty new to the information security domain. For instance, I went to one lecture given by David Barroso of S21sec about common browser hijacking techniques. This was a really interesting session wherein Barroso discussed the following attacks:

These are really dangerous attacks. All of them exploit only the Windows operating system; none of them target Mac, Linux, UNIX, or mobile devices (a characteristic I heard over and over this week). They are installed in drive-by attacks and via email. Sinowal even installs itself into the Master Boot Record (MBR), allowing it to load a driver into the kernel as the OS boots that it uses to hide its files and registry keys and to intercept certain Win32 API calls (e.g., to capture key strokes). Some will also kill the OS after they've stolen sensitive information from the victim (more on this later).

These malware are very clever and dangerous. They jump on the box when you go to some hacker's Web site (e.g., by clicking the link to the Web site of a new Twitter follower or by clicking the unsubscribe link in SPAM). After installing themselves, they wait for you to go to Web sites in their lists of sites they can alter with their own HTML. For instance, a certain SilentBanker variant may be configured to inject HTML into the standard Web page of banks X, Y, and Z. When the user of an infected machine browses to www.BankX.com, it will alter the HTML of it login form to include additional fields used to harvest sensitive data (e.g., mother's maiden name, SSN, first pet's name, DOB, etc.). It will also alter the page to submit the data to some bogus Web page that looks like the bank's saying that the login failed due to a system outage. The private data will be transmitted to a drop site, and the malware may then kill your OS.

After executing this crime, the attacker wants to erase all evidence of how he perpetrated it. To conceal his tracks, the Trojan will delete some system resources that are required for the system to run, effectively killing the OS. For example, the malware might delete ntdetect.com, ntldr, a bunch of device drivers, registry keys like HKCU, etc. After this the OS is totally unusable, the victim calls their IT department (or teenage child) and asks them to reinstall Windows. While doing so, the hard drive is reformatted and the evidence is lost.

So, the lesson here: If your bank asks for a different or large amount of sensitive data while logging in, don't provide it. If you do and your computer stops working shortly thereafter, don't reformat it; call the police and make sure their cyber forensics experts analyze it.

If there is anything I learned this week, it's that we are currently in the middle of a cyber war with virtual cartels and e-terrorist organizations. The civilized world is under attack from terrorist that are utilizing the Internet to rob us. Our children, friends, family, businesses, and governments are all soldiers in this war. Every software engineer is a sergeant with authority over at least a small platoon made up of his or her community. As software developers, we have the skills, duty, and ethical responsibility IMO to protect our families, friends, and employers from the cyber attacks of an immoral and determined advisory.

To this end, we must teach our children, for example, how to use MySpace not insist that they avoid it; they must be taught how to disarm the landmines while under our command or else they'll unknowingly step on them once they're not. We must ensure that we have virus protection software on our computers at all times. We need to insist that our employers prioritize pen testing, threat modeling, and security reviews. More of us engineers need to attend conferences like RSA, and we need to share what we learn at them with our communities. To this end, I will happily (with what little time I have and within reason) answer emails, phone calls, IMs, blog comments, invites to lunches or coffee, and meeting requests to share more about what I learned at RSA this week. You can find my contact info on my Web site if you'd like to take me up on this offer.

I went to some good sessions yesterday during the third day of the RSA Conference. Three things jumped out at me during the lectures and chats that I had with other delegates:

  1. Building an identity management system is largely a political thing not a technical one (a reoccurring theme)
  2. The cloud isn't all roses and not everyone is looking at it positively
  3. Kantara

The fist is a theme I've been hearing over and over again this week in the various identity-related sessions I've attended. The most obvious mention of it yesterday was in a lecture given by Kevin Kampman and Alice Wang of the Burton Group about role-based access and entitlements management. They said at various points in their presentation that the creation of such a system required a sponsor/advocate in the non-IT side of the business that would fight the political battles. They stressed the importance of this citing various reasons. For example, such a system is needed, after all, for the sole purpose of solving the issues confronting the business, so product will have a huge stake in its capabilities, features, timelines, etc. Balancing these with those of IT and security will be a difficult people-centric journey.

This theme is especially important to security professionals (even for those that identity-management isn't their primary focus) if what Microsoft's John "JG" Chirapurath said later that day is correct that security is rapidly become an identity problem. I don't know for sure (because I'm relatively new to the information security space), but I would imagine that security experts and business people have a relatively hard time getting along; I know IT and business do. So, we have a serious problem: IT and security aren't getting along with business and vice versa, and the successful collaboration of all three is fundamental if organizations are going to meet their objectives without falling prey to the tireless forces of competition and cyber crime. What needs to change for us all to get along better? Humility, commitment to the objectives of the organization by all parties, trust, openness and avoidance of group think, and accountability to name a few.

I talked with more of my fellow attendees yesterday than I did on Monday and Tuesday. Robert McMillian (@bobmcmillan on Twitter) of IDG News Service warned that many vendors are recasting themselves as cloud service providers in hopes of capitalizing on the buzz. I heard this from Jay Chaudhry of Zscaler on Tuesday as well. This isn't a new ploy, but it is one to watch out for of course. I also talked with a gentleman at the VeriSign party I was at last night who's name I didn't catch; he said that he thought cloud computing would have a moderate impact on our society and our businesses but it would not be as profound as some (myself included) are predicting. Who knows how cloud computing will pan out? None of us do, so let's be passionate and excited about technology and its possibilities while simultaneously thinking critically about it. If we all do this, it won't matter how and what cloud computing becomes ;-)

The third big take away from the RSA Conference yesterday for me was a new project called Kantara. This initiative, led by representatives from the OpenID, Information Card, and SAML communities, is seeking to create a digital identity system by conflating the three technologies (i.e., creating an intersection of them as shown in the Venn of Identity). Identity is a really hard problem especially at the Internet-scale and considering what I just mentioned about it being largely a political/people issue. The fact that this project has no barrier for entry indicates to me that the folks behind Kantara get this and understand that the brightest minds must be brought to bear on the problem not just those that work for companies willing to put some cash on the line. This grassroots, bottom-up effort is a tact that I think has a lot of potential to go farther faster, and I support and thank those pioneers who stepped up to the challenge by collaborating on the problem in this way.

If you want to learn more about Kantara, join the mailing list, visit the project's Web site, follow @KantaraNews on Twitter, join the group discussions, watch some videos describing the effort, and become a member. I know I'm going to!

I learned a lot today during day two of the RSA Conference.  A lot of it was from one-on-one conversations I had with helpful, inspiring gentlemen, but I also learned a lot from the keynotes, panel discussions, and sessions that I attended.  There was too much to go into it all here, but there was one red thread that I heard over and over today.  It was a theme I did not expected to be so dominant and so positive at a conference full of security buffs, C-level execs, and enterprise architects: cloud computing represents a tremendous opportunity that is there for the taking.

I heard it described today by one panelist as the technology of the gods.  The president of RSA, Art Coviello, said in his keynote that cloud computing is bringing our society to a tipping point.  After teetering over it, humankind will be complexly revolutionized.  This sentiment was echoed by Microsoft's Scott Charney.  Symantec's CEO, Enrique Salem, said that the interfaces of some cloud-based software that will be implemented by many different vendors should be standardized in a collaborative, open manner.  During a panel discussion that included some of the world's leading cryptographers (Whitfield Diffie, Martin Hellman, Ronald Rivest, Bruce Schneier, and Adi Shamir), two of the five said that cloud computing is one of the most compelling and interesting areas that is occupying a large part of their time, research, and thoughts. Another panel included Eva Chen, co-founder of TrendMicro, who's been in the security industry for 21 years and said that cloud computing is the most interesting development that she has ever seen. The co-founder of America's Growth Capital investment banking group said that the SaaS market is currently 1.3B in size and is growing by 17% annually according to an IDC study recently published.  Kim Cameron said that the claims-based model would help support the need to identify users both in the cloud and on-prem. 

Some at the conference are voicing their counter views, however.  I've heard some say that they are board with cloud computing as it's just the resurgence of the mainframe.  Others have said that cloud computing coupled with SSO increases a user's attack surfaces tremendously should they happen to get infect by a virus that uses SSO to connect to remote cloud services to perform unbeknownst and undesired operations as them.  Some participants have said during open mic sessions that they would never store their data in the cloud.

In every keynote, panel, and session, cloud computing came up and usually with a positive tone.