- How not to deal with fraud
- More on domain squatting
- The 45nm Xeon 5400 series in the lab
- Domain squatting for fun and profit
- If the shoe fits
- Full circle: How Microsoft is trying to eradicate email
- The Air, a month later
- /etc/hosts.deny, hackers, and automation run amok
- Finally, Leopard
- Clearing the Air
August 19, 2003 | Comments: (0)
Profile of a Duct Tape Tool
Yet another interesting problem. A client of mine has EmbeddedNT WYSE terminals scattered across the country, talking to a Citrix MetaFrame farm on the East coast. The terminals are built from a single master image created in the lab on the East coast, assuring an identical user experience at every location.
All is well as the implementation rolls across the country, until they cross a time zone. The MetaFrame servers use the client time as the time for their session, and clients in CST have EST time. This is a big problem, since all records entered by those clients are one hour off. The problem gets worse as the migration pushes west.
WYSE included D4Time, a freeware utility, to handle the SNTP synchronization of every client, but the utility doesn't have timezone support, and the EmbeddedNT DHCP client doesn't pay attention to the time-offset DHCP option. Bugger.
The IT staff doesn't want to maintain separate client images for every timezone, as that would be a big investment of time an resources to remedy a really small, but really big problem.
What to do? Perl to the rescue, once again.
On the server side, I wrote a script that was placed in a CGI directory. Its' only task is to evaluate remote_host(), seach against a list defining the timezone for that subnet, and return a numerical value corresponding to the appropriate timezone.
#!/usr/bin/perl -w
#
use Net::Nslookup;
use Net::IPv4Addr qw( :all );
use CGI qw/:standard *table start_ul/;
use strict;
my ($TZ, $client_ip, $client_addr, %tz, $q, $timezone, %zones);
#If a subnet below appears in more than one Timezone the
#timezone listed first will be returned
#
################# Configure Subnets Below ##################
my @EST=qw(10.1.0.0/24 10.1.5.0/24 10.1.10.0/24 10.1.15.0/24 10.1.20.0/24 10.1.25.0/24 10.1.30.0/24 );
my @ESTI=qw(10.0.0.0/24);
my @CST=qw(172.16.32.0/24 10.8.0.0/24 10.8.5.0/24 10.8.10.0/24);
my @MST=qw(10.0.0.0/24 172.16.1.0/24);
my @MSTA=qw(10.0.0.0/24);
my @PST=qw(10.0.0.0/24 172.16.32.0/24);
################# End Configurable Section #################
%zones = ( EST => "1",
ESTI => "2",
CST => "3",
MST => "4",
MSTA => "5",
PST => " 6");
foreach (<@EST>) { push( @{$tz{EST}}, $_ ) };
foreach (<@ESTI>) { push( @{$tz{ESTI}}, $_ ) };
foreach (<@CST>) { push( @{$tz{CST}}, $_ ) };
foreach (<@MST>) { push( @{$tz{MST}}, $_ ) };
foreach (<@MSTA>) { push( @{$tz{MSTA}}, $_ ) };
foreach (<@PST>) { push( @{$tz{PST}}, $_ ) };
$client_addr = remote_host();
if ($client_ip =~ /[A-Z]*/i) {
$client_ip = nslookup(host => $client_addr, type => "A" );
}
else {
$client_ip = $client_addr;
}
$q = new CGI;
print $q->header;
foreach $timezone ( keys %tz) {
foreach (<@{$tz{$timezone}}>) {
if ( ipv4_in_network ( $_, $client_ip ) ) {
$TZ = $zones{$timezone};
next;
}
}
}
$TZ = "NO ENTRY FOR $client_ip" if ( ! $TZ );
print $TZ;
On the client side, a freeware application called settz.exe was placed on the EmbeddedNT images, along with curl.exe. A single-line batch file was then called at startup:
for /F %%A in ('curl -s http://timezone.company.com/cgi-bin/set-tz.pl') do settz %%A
The result? Every client sets their timezone upon boot. This takes less than a second, and any client can be placed anywhere on the network will always have the correct timezone.
NB: The script above is *nix compatible, but will run under IIS with ActivePerl and a few tweaks. There is no Net::Nslookup package for AP, so that code has to come out of the script, and the server must be configured to *not* do DNS lookups for remote_host().
Posted by Paul Venezia on August 19, 2003 07:00 PM
RATE THIS ARTICLE:
-

- COMMENTS
TOP STORIES
ADDITIONAL RESOURCES

- Remote Access: Maintain Security and Decrease the Burden on IT
- Beyond AntiVirus: Symantec Endpoint Protection
- What Every Enterprise Needs to Know About VDI

- Solution for Open Virtualization Provides Server Consolidation
- Help Simplify Virtualization
- A Guide to Rich Internet Application (RIA) Security





