Apr 272007
 

Kerberos is a fundamental infrastructure technology for Active Directory authentication, and plays a major role in enterprise web applications, including SharePoint and enterprise servers like NewsGator Enterprise Server (the news and syndication platform of choice, with a rich web interface and a rich set of APIs for enterprise integration. And the best dev team, of course.) 

Fortunately, Kerberos is the default setting for IIS 6.0, but when you use a named identity for the IIS application pool, as you must for server farm SharePoint installations (and should ALWAYS do), you must also create a Service Principal Name (SPN).

The folowing "SETSPN" comands are for use with the SETSPN tool available from www.microsoft.com/downloads. SETSPN is a command line tool that sets, deletes, and lists SPNs for serice accounts and for servers.

Enabling Kerberos using Application Pool Identities

To create the SPN for the SharePoint Site http://litwareportal for the app pool running as "LITWAREportalservice", run the following SETSPN command. This will let clients browsers authenticate to the application pool’s Web site using Kerberos. Without this, they’ll get a 401.2 error.

setspn -a http/litwareportal LITWAREportalservice

From within SharePoint, set the site to use Kerberos in SharePoint Central Administration. Go to the Application Management tab, choose "Authentication Providers", and then choose the site. Under IIS Authentication Settings, check that "Negotiate (Kerberos)" is selected.

In order to enable "portalservice" to delegate those credentials to backend systems, you must also set the delegation tab for the portalservice account. This tab does not show up unless the SETSPN command was run to create the SPN for the account. In Active Directory Users and Computers, open the account’s properties and choose the delgation tab. In the delegation tab, choose "trust this acount for delegation to specified servers only", and "Use any authentication protocol". Then, you MUST choose the delegation constraints for each site the account needs to delegate to. Click on "add", enter the host name, and choose "http". If the web server is not running under a named identity, you won’t have to run the SETSPN account on the delegation target as we did above.

Enabling Kerberos Delegation

To delegate credentials, the service account that will do the delegation needs to have the following rights on the server it is running on, set in Local Security Policy of the local server:

  • Act as part of the Operating System
  • Create a Token Object
  • Impersonate a Client After Authentication
  • Replace a Process Level Token

If you are running a Windows Service on a remote computer that is NOT running a web application, you can create an arbitrary service principal name for the account, and that account can then perform the delegation and constraints can be entered in the delegation constraints tab in AD. The folowing command creates an SPN for the LITWARE/newsgatorService account, which used with NewsGator Enterprise Server’s Windows 2003 Domain Level, will let the NewsGator Content Service delegate user’s credentials to the SharePoint Server. Note that while the SPN is arbitrary, we will create the SPN for the NewsGator Content Service (ngcontentsvc) on the NGES server:

setspn -a ngcontentsvc/nges LITWAREnewsgatorService

Now, on the LITWAREnewsgatorService account properties, you can set the delegation constraints to constrain its delegation rights to known RSS data sources in the enterprise such as the SharePoint Server and any other secured corporate news feed sources. In NewsGator Enterprise Server installations, you would also enable the SharePoint Server to delegate redentials back to the NGES server so you could use the NewsGator Enterprise APIs from within your SharePoint installation. Since NewsGator Enterprise’s API site typically runs as Network Service, you wouldn’t need to create an SPN for it, but you would need to enable delegation from the portal account (LITWAREportalservice) to the http SPN of the NGES box (you would do this in the AD account properties).

The delegation choices may not be obvious at first. In the AD account properties, the setting "Use Kerberos only" means that for the delegation to success, the client must have authenticated to the service using Kerberos in the first place. For the service to create arbitrary Kerberos tickets for accounts (also known as Protocol Transition), the setting should be set to "Use any Authentication Protocol". This does NOT mean that the account can delegtate NTLM credentials– it just means that there isn’t a requirement for an original kerb ticket for the service to delegate– the service can "protocol transition" or delegate credentials from a Windows service, as does NewsGator Enterprise Content Service.

Kerberos Troubleshooting

If you’re having trouble with this, there’s a good chance you don’t have the right SPNs for the accounts and servers. I used Microsoft’s NETMON (a required tool in any enterprise developer or IT pro’s toolkit, available free fron microsoft.com/downloads) to view the Kerberos traffic to and from the boxes in question. You can also export the domain to a text file and search for the SPNs in question such as http/litwareportal. The account that is handling the kerberos delegation, as well as potentially clients that will authenticate, will also need to reauthenticate in order to pick up the changes from AD. Just restart the service, or do an IISRESET, to pick up the new changes from AD.

Summary

Kerberos can be tricky to set up without instructions. But follow these simple steps and you’ll be on your way to an enterprise security infrastructure with Kerberos that will let you delegate credentials between trusted servers, without compromising security or using shared credentials.

Apr 272007
 

VS Orcas is available as a CTP install from Microsoft.com. I’ve been using it side by side VS 2005 on my laptop and haven’t had any issues in THIS environment, although I think it screwed up my workstation at NewsGator. (Don’t tell Lane.) The following applies to the March CTP.

WHY would I even THINK about using an MS Tool in CTP stages? Well… here’s the short list:

1. JavaScript intellisense for JS class libraries.

Well, I’m not sure of any other benefits– that one alone is worth it if you’re writing AJAX libraries in JavaScript! I’m sure there are a ton of new features for the Orcas framework (.NET 3.5), but I’m quite happy with the 2.0 framework these days– most of my professional coding has been in AJAX components, using my favorite web architecture pattern of JavaScript and HTML components that talk to a Web Services API (SOAP and REST). I suppose I could benefit from WCF, but ASMX (SOAP) is fine for my current needs. And LINQ is cool– but again, I have no need for it until it’s ready for production code, since my dev to production cycles are shorter than Microsoft’s.

So I repeat- IF you’re an AJAX developer writing object oriented JavaScript Code (and you SHOULD be!), VS Orcas is for you! If you’re writing "ASP.NET Classic" apps or just using the UpdatePanel (shame on you!), VS Orcas may be too bleeding edge for you.

So can you use VS Orcas against .NET 2.0 code? You bet! After loading a class library for the first time with VS Orcas, it will upgrade the .csproj file by adding just a few Xml elements. (It’s JUST Xml using the MSBUILD schema.) The csproj file will maintain compatibility with VS 2005– but you’ll need to edit the csproj file for compatibility with the 2.0 Framework.

Editing the CSPROJ File for .NET 2.0 Compatibility

To edit the CSPROJ file, right click it and select "Unload Project".

From their, choose "Edit CSPROJ file:"

 Next, edit the XML.

The root Project element, change the ToolsVersion from 3.5 to 2.0.

In the top PropertyGroup element, find the TargetFramework node. It should say:

<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> Just change it to <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>, and be sure to remove any 3.5 references such as <Reference Include="System.Core"> from the file. You may also need to change <RequiredTargetFramework>3.5</RequiredTargetFramework> to <RequiredTargetFramework>2.0</RequiredTargetFramework>.  

That’s it! When adding new classes, you may need to remove the references to System.Linq. Also, the solution files are NOT backwards-compatible, so you’ll need to keep a VS’05 version and a VS Orcas version.

With these tweaks, you can enjoy VS Orcas today using the 2.0 framework. If you’re slinging Atlas code, this may be worth it to you! Here’s an example of intellisense on the Litware.WikiControl, INCLUDING methods that it inherits from Litware.EditableControl:

With these steps, you should have no problem using VS Orcas side by side with VS 2005– but do it in an environment that isn’t your main dev box, or be prepared to un-hork your environment in case it gets horked! BTW– to get it installed, you’ll need to install .NET 3.5 "Greenbits", the .NET framework add-on for Orcas. It’s also LIKE 3.0– it’s not a NEW framework, just new toys on top of the 2.0 framework. (A really great approach that MS is taking!!!)

Apr 202007
 

Tonight is the FINAL deadline for edits and corrections for our book (Inside Microsoft Windows SharePoint Services 3.0), and I’m going through the final pre-flight check to make sure all the page compositions and editor changes are correct. I’m also doing this on Ted’s final chapters (which are QUITE good!), and his chapter on Workflow is probably the best resource available for workflow in WSS. I’m quite proud it’s in our book.

So what would YOU do if you were going over the final edits while your partner is on the beach drinking Mai-Tais?  That’s right– you’d send an email like the following to the (pre-alerted) editor with him on the CC line:

Kathleen,

I’m sorry to hear about the page limit length—it’s a shame we have that cap! Ted is going to be disappointed, although I think it’s alright to cut out the last half of the workflow chapter as suggested.

Let’s go ahead and drop pages 271, titled "Developing Custom Workflow Templates", through the chapter summary on page 309. The first 20 pages really do a great job at explaining the core workflow concepts, so if we have to drop 40 pages from the book as required then this would be the least impact.

Again, I’m sad to hear about this requirement, but I think Ted will agree these are the pages to be dropped.

Daniel

So Ted Pattison, you worlflow-slinging, c sharp coding, mai-tai drinking, beach house sleeping, book writing, web part coding, master of all things SharePoint,… YOU sir, have been PUNK’d!!! (And THAT, my friend, is the best chapter on Workflow I’ve ever read, and a highlight of our book!)

And to all who read our book– we DO hope you have as much fun reading it as we did writing it. It should hit shelves JUST in time for Tech Ed– in fact, Ted should have the very first copies at his booth.

Technorati tags: , , ,
Apr 122007
 

Over the course of writing Inside Windows SharePoint Services (which should be available in the Tech Ed timeframe, that’s June to the rest of us), Ted and I came up with this great project format for Web Parts. (With some small tweaks, you can use this project template for any WSS project.) The project format is a Visual Studio project that creates a WSP Solution Package for the Web Part Package. Ted Pattison came up with the method, I perfected it and created the VS template.

What is a WSP Solution Package?

 The WSP Solution Package is a specially formatted CAB file that enabels the WSS runtime to deploy and install the code across the server farm. The Solution Package solves enterprise dpeloyment issues such as deploying both code, template files, and dlls to multiple fornt-end web serers across the server farm, while also managing things like web.config settings. Without WSP packages, this is quite a feat for IT. A few years back we implemented a solution for WSS 2.0 using timer jobs (using Scheduled Tasks) and ZIP files with a similar strategy. With WSP, this is all handled through STSADM commands. Another benefit of the WSP technology is that it is installed to the WSS site, which is abstracted from the IIS web site, so if a new server is added to the web farm it will pick up the WSPs.

What best practices are in the Visual Studio project template?

  1. BIN directory deployment
  2. CAS security policy management, "least-priveleged code"
  3. WSP deployment package
  4. ASP.NET WebPart "best practice" WebPart example
  5. WSS Feature for Web Part Gallery entries

Get the Visual Studio Template (C# only at this time)

I uploaded the project template to my SharePoint Ajax Toolkit project on Codeplex.

Get it here.

 

Apr 062007
 

Happy Easter to all! Today is Good Friday… the day we remember Christ’s sacrifice for our sins. Here are a few of my favorite Biblical quotes.

"For to me, to live is Christ" – Paul

"A new commandment I give to you, that you love one another. And by this all men will know you are my disciples." – Jesus

"Pure and undefiled religion before God is this: to visit the widows and orphans in their time of need". -James

"But as many as received Him, to them He gave the right to become children of God, even to those who believe in His name". -John

Apr 032007
 

Every time I use Microsoft Betas, I am shocked to learn that they don’t uninstall. And yet, as Solomon wrote "as a dog returns to its vomit", I continue to try to run Microsoft betas and CTPs. When they work, they’re beautiful. Just be aware that they won’t uninstall, or at least, probably not completely. Stacy tells me that I shouldn’t be surprised. And to their credit, MS always says "don’t install this on a production machine". Yet with the dangling of the bells and whistles, I cannot resist. Since all I write is AJAX code these days, I really need an IDE that targets the AJAX developer, as does visual Studio code name "Orcas".

So after running into a few problems on my dev box, I uninstalled. Then I found that I coulnd’t run Whidbey’s web dev server (VS 05). It seems that the webdev.webserver.exe in the 2.0 framework tree gets overwritten by the Orcas web server, which of course won’t run after you uninstall Orcas and the 3.5 "greenbits" framework.

The error you get is: "Could not load file or assembly ‘WebDev.WebHost, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified."

To fix this, grab C:WINDOWSMicrosoft.NETFrameworkv2.0.50727WebDev.WebServer.EXE from another dev box with VS 05 (that hasn’t met Mr. Orcas yet) and copy that over to the same path on your post-Orcas box. The timestamp of the web server for VS 2005 SP1 is 12/2/2006. The Orcas version is timestamped 2/9/2007.

Other than that, I haven’t had much bad experiences with Orcas. Just run it in a VPC so you can wipe it when you’re done. Hopefully you can learn from my experience, and if you find yourself in the same bind you now can solve it!

Apr 032007
 

Here’s some recommended reading for developers wanting to cross over into AJAX development. It IS a new programming model– simply wrapping datagrids with the UpdatePanel is really missing the point. To write great ajax code you will embrace the client side (JavaScript) programming model, and create script components that talk to backend data services.  

I came across this book at Borders, and this looks like a great book for the ASP.NET developer who wants to transition to AJAX development: Beginning Ajax with ASP.NET, by Wallace B. McClure, Scott Cate, Paul Glavich, and Craig Shoemaker.

Other recommended reading (online):