The Network Manager at Westminster School presents solutions to sticky problems...

Friday, 19 February 2010

SCCM, WinPE and 802.1x

Running deployment tasks from SCCM on a network with 802.1x security is now possible, thanks to an update from Microsoft. It is a shame that we seem to have been left with an Ikea table set with all the parts but no instructions. So here is a first run "How to enable 802.1x on your SCCM" implentation. This example uses MS-PEAP without certificates.

First off, I will not explain how to set up a 802.1x on your network. Sufficient enouogh it is to say that you need to have an authentication rule that identifies a group with a single domain user specifically for network connectivity alone. This is so that when your winPE 802.1x client passes the username and password, it is authorised and passed a vlan for the installation to run on. I would strongly suggest that this account has no other privilege. For comparison, our test bed is running on Cisco 3560 switches, with a Windows Server 2008 Network Policy Server standing in for RADIUS. We are running SCCM 2007 SP2. We use MDT 2010 which includes winPE 3.0.

The first thing to do is add the KB972831 Hotfix to winPE. I choose to forgive Microsoft for writing in their documentation for this fix (and I quote) "Install and run" and "There are no prerequisites" both of which are most unhelpful. There are two ways to add the hotfix. Before importing the boot image, and SCCM builds the image. You are going to have to amend the boot image after it is built and before it is distributed to the distribution points anyway, so I have taken the second option.

If you want to add the hotfix to a clean winPE image, then before adding the hotfix, add the winPE components for Scripting, WDS Tools and WMI. SCCM does this anyway when it prepares an image. My best guess is that one of these is an unwritten prerequisite to the hotfix.

After updating the boot image with the required drivers, you can find the BOOT.XXX99999.WIM file under \Program Files\Microsoft Configuration Manager\OSD\boot\i386. Copy this to your MDT (Microsoft Deployment Toolkit) prepared workstation. Make sure you have an empty mount directory first. Run your department tools command prompt and then run:

C:\>imagex /mountrw boot.xxx99999.wim 1 c:\mount
C:\>dism /image:c:\mount /add-package /packagepath:c:\temp\Windows6.1-KB972831-x86.MSU
C:\>dism /image:c:\mount .get-packages

(Needless to say that you need to match architectures - No egg sucking lessons here...) Get-Packages confirms that the package is indeed added.

Before committing the image, we need to make a few more changes. The DOT3SVC (Wired Autoconfiguration) does not start automatically, so we need to find a way to kick it off before the task sequence runs. This is an ugly hack, so I hope you do not mind. I am sure the next release of SCCM will have this sorted natively...

We are going to create 3 files and amend another one already in the image. The first is profile.xml - a LANProfile for the Local Area Connection interface. This contains the settings for the interface. (Thanks to Andrew Husking for this version.) You can create your own be going to any Windows 7 interface and exporting the configuration using netsh if you wish. This one works fine.

The second file is uprofile.xml. This file contains the user credentials (EapHostUserCredentials) needed to log into the network. Remember that I said you want an account that has no other purpose, this is because this account will be included in this plain text file and sent to the pxe client. (Once again thanks to Andrew Husking.) Just change the usename and password.

You can find the xml for these two files on this technet board here... (Note that I left the RoutingIdentity as 'test' and it did no harm.

Place these two files in c:\mount\windows\system32

The third file is a batch file pretsmboot.cmd. This contains the following:

@echo off
net start dot3svc
netsh lan set autoconfig enable=yes interface="Local Area Connection"
netsh lan add profile filename=%SYSTEMDRIVE%\windows\system32\profile.xml interface="Local Area Connection"
netsh lan set eapuserdata filename=%SYSTEMDRIVE%\windows\system32\uprofile.xml interface="Local Area Connection"
netsh lan reconnect interface="Local Area Connection"
del %SYSTEMDRIVE%\windows\system32\uprofile.xml /Q
x:\sms\bin\i386\TsmBootstrap.exe /env:WinPE /configpath:%CONFIGPATH%

Copy this file to c:\mount\sms\bin\i386

Finally, copy the file TsBootShell.ini out from c:\mount\sms\bin\i386 to Documents. Edit it so that the last line reads:

Run=x:\sms\bin\i386\pretsmboot.cmd

You will notice that the last thing pretsmboot.cmd does is kick off the line that you have just replaced. Copy the tsBootShell.ini back to c:\mount\sms\bin\i386

Now you can commit the changes back to the wim using:

C:\>imagex /unmount /commit c:\mount

(It is possible to do the image mounting and dismounting with DISM but I find imagex more mature and cleaner.) Copy the boot.xxx99999.wim file back to its original location on your SCCM server. Go into the Configuration Manager Console and go back to Boot Images. Right click your boot image and select Manage Distribution Points to start the wizard off. Choose Refresh the package on selected distribution points. If you select Update anywhere in this process, you will overwrite the image you have just made changes to.

There are consequences to this. The biggest and most obvious is that you cannot allow your boot image to automatically rebuild and update (obviously) because you need to inject the scripts and profile before refreshing the distribution points. The update of files can easily be scripted into a batch file but needs to be manually monitored as the MSU update can fail???

Another consequence is that you lose to ability to build on insecure ports. This new image you have created is 802.1x only. You will need to create another boot image without the amendments.

The final consequence I want to mention is the ugly dos screen this hack brings up. Yes, I could probably write a vbs that does the same thing without the dos window. I might just do that, but I am running out of half term...

So there you are - one working 802.1x winPE implementation using SCCM.

Saturday, 30 January 2010

What to do with an iPad

Okay, let's think about it. What would make the iPad something I would want? The device has just been released. It is smooth, responsive, powerful and portable. Whatever you might think of Apple, this is the device that is closest to what you see envisioned in sci-fi. The pad device.

But with the missing feature list as long as my arm, what would I need it for? The answer is clearly for me, nothing! So, if they asked me what would I see it do?

Well, there are always the easy things that everyone has been shouting about: running non-proprietary software, connectivity, multi-tasking. But what I really want a device like this is portability. Not how I can carry it around, but what it can connect to while carrying it around.

I want to take my pad to a desk with a keyboard on it, put the pad in a holder and start typing. While I type, the keyboard station is charging my pad. After finishing my document I pick up my pad and go to the printer. Pressing one button on the printer and one on my pad I am printing the document. I want to hand my document to someone else, I bring my pad to theirs and another button press, my document is now on their pad. I want to collaborate and in a meeting documents are passed electronically between pads. I am in a lecture or briefing and I can submit questions and make comments on distributed materials, answer voting calls.

In my work I want to be able to identify equipment or stock by bringing my pad next to it and updating a network service automatically. The options become more limitless when you consider writing your own applications.

But for now, if I want a nice looking toy, I'll go for an iPad. It'll keep my interest until the next nice toy comes along.

Monday, 25 January 2010

Server 2008 R2 and VMWare vSphere 4

Server 2008 R2 is supported as an experimental product on vSphere 4. As a consequence, there are some gotchas that the boys at VMWare have yet to fix in an official patch. The biggest problem so far is the unexpected and unpredictable lockup on the console. If you want to run Server 2008 R2 on you VMWare box, here is what to look out for:

  • Network Drivers - The E1000 driver is alledged to be responsible for server lock up. Once you have created your initial VM, remove the standard E1000 interface that is added by default, and add a new network interface with a vmxnet 3 driver. Now the OS will not have a driver for this, so you will have to install vmware tools before you start doing any network activity. If you are building from PXE you will need to import the vmxnet drivers into your OS building applciation.

  • Video Drivers - This is the reason the console will lock up, but only after you have installed vmware tools. When installing vmware tools, do a custom installation. Expand the drivers section and change the video driver option to "This option is unavailable." Continuing without this driver will not affect your experience in the slightest.

Other than this, 2008 R2 virtual machines run well in vSphere 4.

Thursday, 5 November 2009

How to create a Software Publisher Certificate for internal use from a CA

Not that I am suggesting that there is any conspiracy to make money from hapless IT departments wishing to sign their internal applications, but...

Apart from purchasing a Software Publishing Certificate (SPC) from a commercial and recognised issuer there is a way to create a SPC using free tools and the PKI infrastructure in your organisation. This does have the disadvantage that you can only verify the application on PCs that have your organisation's root certificate installed in the Trusted Root Certificate Authorities partition. An easy thing to do with Group Policy, and also possible for non-domain computers that really require it without heavy lifting.

Whey would you want to do this? Anyone wanting to distribute custom applications or custom installers can now distribute their internally compiled software without reducing security levels. Want users to install an application on Vista or Windows 7 from the control panel when they need it? If it is not signed, it will not happen without a certificate.

So, how to do it? Requirements: An Enterprise CA (running on Windows Server 2008 Enterprise - important as you need to manage certificate templates - not possible on Standard editions,) OpenSSL, PVK from Code Sign here, and Microsoft Platform SDK (which, if you are developing, one assumes you are using.)

Another thing you need to identify is what you want to appear when you install an application and the UAC pops up. Typically, you will wnat your users to identify you as the source of the software, so somehting like "Company Name IT Department." I will refer to this later as "your certificate name."

On your CA you will need to right click Certificate Template and select Manage. In the templates Console you will need to create a code signing template. For our purposes I created a 2008 Enterprise Certificate with the extended purpose of Code Signing. Under request handling, "Allow private key to be exported" MUST be ticked. Under Subject Name ensure "Supply in the request" is set. Under Issuance Requirements ensure "CA certificate manage approval" is ticked. Click OK and close the Template Console.

In the CA Manager, right click Certificate Templates and select new -> Certificate template to issue. Select your newly created template.

Open a command prompt and run certmgr to open the certificate manager for the user account. Right click personal and select All tasks -> Request new certificate. Click next until you see a list of certificates you can enrol for. You should now see your new certificate template with a warning "More information is required..." (because you selected the "Supply in the request" option.) Tick this certificate template, expand and click on Properties. In the Subject tab, select "Common Name" from the drop down list and enter your certificate name as noted above. Click Add. You may want to identify this certificate later by added a friendly name and description under the general tab. When finished, click OK. Click on Enroll and you should be told that the request is pending.

In the CA Manager, note the Request ID (important for later) and approve the request. We are not finished with the CA Manager yet...

In certmgr, refresh the tree and you will have a Certificate Enrollment Requests branch. Expand this to find a certificate with issued to "your certificate name" (as noted above) and issued by "your certificate name" with a private key, specifying a password. This is practically useless, but we need to to get the Private Key. Export the certificate with the private key to a pfx file. Use openssl to extract the private key to a PEM file:

openssl pkcs12 -in filename.pfx -nocerts -nodes -out filename.pem

This extracts the key after specifying the password noted above. The certificate is useless to us, so once you have the PEM file, you can practically dispose of this certificate. Now you need to convert the PEM to a PVK file.

pvk -in filename.pem -topvk -out filename.pck

You will be asked to specify a new password for the private key and to re key it to verify. This password will be needed later to sign installers - so remember it.

Because of the bug in the certificate (it being issued by itself and therefore untrusted) you now need to retrieve the certificate from the CA. In CA Manager, go to Issued Certificates and list them in Request ID order. Find the Request ID (noted when you approved the request) and double click the request to view the certificate details. Note that this version of the certificate has no private key and is issued to "Your certificate name" but is correctly issued by your CA. This is what we want. On the details tab, click the "Copy to File" button to begin the export wizard. Save the certificate as a DER X.509 certificate with a .spc extension. (A .cer extension will do, but for the purposes of identifying this file later, let's just give it .spc)

Okay you now have a .spc certificate with code signing extensions, and a .pvk file that corresponds to the .spc certificate. In order to turn this into something useful, you now need to use the Platform SDK Tools:

pvk2pfx.exe -pvk filename.pvk -pi password -spc filename.spc -pfx newfilename.pfx -po password

The password corresponds to the important password you noted when creating the pvk file. I would keep the second password the same. If you import this pfx file you will now have the correct certificate, with the correct extension, subject and issued by, for signing your installers.

Finally, for ease of use, I use Tech-Pro's codesign from within Visual Studio's tools menu to do all my signing (because it works.) Of course you may use signtool and the command line or any other method using this certificate. Now all my installers are signed and can be used within the organisation without the need to reduce security AND I can continue to distribute them via active directory just as I do with commercial applications.

Tuesday, 6 October 2009

SharePoint Mysteries

SharePoint can do some pretty weird stuff. One day everyone is publishing quite happily. The next, they cannot add a new page, and some page properties give errors. They are normally presented with an "Error: Access Denied" page even though they are presented with the link to create a new page. While we have not traced what causes this, we have been able to fix it. The problem lies with Page Layouts and Style Libraries.

To resolve the issue, you will first have to log into the site as a site owner. Go to the top site and then Site Actions, All Site Settings, and select Master pages and page layouts. Go to Document Library Settings and click Permissions for this document library. Now add the group that you want to be able to create pages to this list and select at least "Restricted Read."

Now go back to your top site and select "View All Site Content" and select "Style Library." Once again go to Document Library Settings and click Permissions for this document library. Again add the group that you want to be able to create pages to this list and select at least "Restricted Read."

Your users will once again be able to create pages. Keep an eye on this, because we have suspicions that there is some automated process that clears the permissions for these libraries, possibly an update.

Monday, 28 September 2009

Windows 7 will push back the tide...

When Windows Vista arrived, everyone had a good excuse to go to Linux. The hardware specifications were hard on old hardware. Even PCs that were just above specification they lagged quite badly if you ran too many applications side by side. Ubuntu, though derided by Linux die-hards, has brought Linux to the masses. Easy installation and hardware compatibility makes installing Linux on a 2-3 year old laptop a breeze, and a viable option against staying with a compromised, buggy XP or moving to the lagging new secure Vista.

However, if you were expecting to see blistering speeds, forget it. There was a time when you could load Unreal Tournament on a like for like Linux PC and push all the sliders to the right, when you could only go half way on Windows. While gaming performance may still be better, the desktop certainly lags. KDE 4, shipping with the latest versions of Ubuntu provides a nice shine, but does not impress with program launch times. Even Gnome, now the flavour of Linux, does provide a measure of speed, but is so unfamilier to traditionally Windows users. It still lags when launching programs. Add to this the difficulty in managing Wireless connectivity.

After 9 months of KDE 4, I finally decided to go back to Windows. With the release of Windows 7, I was impressed with the apparant lightness on a low processor, 1Gb RAM laptop. Vista is do-able on that specification, but it lags and makes your hardware feel like a dog. Windows 7 provides the response time not far off how it felt when you first loaded XP (before all the addons and start programs are added to drag XP into the quagmire.) Windows 7 was installed in around 30 minutes. Hardware drivers were mostly installed within 10 minutes (after running a Windows Update) and one driver in particular took some hunting down (the lastest sound drivers did not work, I had to use an early driver.)

All in all, it was quicker to install Windows than it was to install Linux. And the wireless, once configured, just worked, without constant wallet passwords or dropping out after hibernation. If this is the way Windows is going, there is no reason for the average person to turn to Linux any more, other than the price.

But then again in the business of life and business, would you not rather pay for something that works out of the box? Or would you rather spend time on getting a free product working. Time is money, you know. How much does Linux really cost?

Wednesday, 22 July 2009

Migrating to vSphere (VI4 for those that know)

Migrating to vSphere 4 from VI3 is a very easy process. There are a, however, couple of gotchas you need to look out for.

But first, are there many good reasons to upgrade from VI3? There are some nifty feature additions in the background: Virtual IDE controllers and USB may be a good reason to upgrade. And of course there is better 64 bit support. Add to that a greater range of settings and a sparkling new interface for vCenter, making administration a little easier. Permissions are scaled out to all objects. And, of course, there is the vNetwork Switch (an expensive step up to Enterprise Plus.) This makes your networking datacentre based, as opposed to machine based, which means your switch ports migrate with your VM, reducing packet loss and maintaining connection integrity.

And now the Gotchas:

vCenter Update Manager now works differently. No longer are the Hosts defences switched off in order to scan or run updates. Instead, the hosts communication with vCenter over port 80 to collect update definitions. vCenter proxies this to the Update Manager, running on whatever you set it to on installation. Of course, if you have a proxy server set on the server, you need to make sure that the local IP address of the Update Manager is excluded, or you could be spending the day trying to figure out why updates do not work...

Setup of the client tools is the shakiest yet. For a start, the new version of the tools requires a complete uninstal of the older version. This in itself is not a bad thing, unless the previous version cannot uninstall itself without leaving parts of itself all over your server. Look up VMware KB Article 1001354 (http://kb.vmware.com/kb/1001354) you will get very familier with it. After attempting an uninstall and falls over in spectular failure, run through the KB article, removing all the remenants of the previous installation. Then run setup64.exe to install the latest tools. A reboot is required. It's possible that trying to uninstall 32bit tools and then install the new 64bit tools. Hopefully the next upgrade will not be so painfull.

Finally, after completing the upgrade, put each of the hosts into maintenance mode and watch for VMs that refuse to migrate. One of the reasons for failure to migrate is hardware. vSphere 4 introduces more hardware virtualisation, such as USB ports. If you previously P2V'd a physical machine or a VMware Server VM, with VI3.5 it ignored the USB ports. vSphere 4 recognises the USB but does not quite integrate the original settings and therefore cannot migrate the VM. For these VMs, a simple edit of virtual hardware will resolve these problems. But you want to find these out sooner rather than later.

Happy migrations...