Advanced Guide to
Linux Networking and Security

Home

Publishers Page

Chapter 1

Chapter 2

Chapter 3

Feedback

Errata


Bonus Material

Installing ngrep
Netcat
Nast
OpenNTPD
HTP Time Sync
Squid
Remote Backup

HTP Time Sync

If you want to synchronize the time of computers on your network with sources of precise time on the Internet or other networks, you'd use the Network Time Protocol or NTP. You could do this as long as a firewall or proxy didn't block the NTP protocol. Many companies reacting (or overreacting) to frequent Internet-borne attacks often block all protocols except HTTP, SMTP, and DNS. Getting the people who manage the firewall to open another port may be difficult or impossible.

One solution to this time synchronization problem is to use the HTTP protocol for time synchronization. Every Web server runs HTTP and, by definition, Web servers always respond to HTTP requests with their current date and time. You can see this by using a program like telnet or netcat to communicate with a Web server. Here's an example of using netcat to ask a Web server to send it's HTTP headers (using the HTTP HEAD method):

#nc www.alcpress.com 80
HEAD / HTTP/1.1
Host: www.alcpress.com

HTTP/1.1 200 OK
Date: Wed, 05 Oct 2005 08:48:19 GMT
Server: Apache
Cache-Control: max-age=86400
Expires: Thu, 06 Oct 2005 08:48:19 GMT
Last-Modified: Sat, 12 Jun 2004 10:43:25 GMT
ETag: "6ced7-ab3-40cade4d"
Accept-Ranges: bytes
Content-Length: 2739
Content-Type: text/html

The Date: header shows the date and time in GMT. If the Web server computer is time synchronized to a precise time source, the Web server's time should be reasonably accurate and precise. You could synchronize your computer to the Web server's time. You could engineer your own code to do this - a shell script called by cron perhaps. You could use netcat to fetch the Web server's HTTP response and pipe the output to awk where you extract the data and time. Then call the date program to set your computer's clock.

Alternatively, you can download a program that's more highly evolved. It's called htpdate and it uses HTP.

HTP

Using HTTP for time synchronization was given the name HTTP Time Synchronization or HTP by Eddy Vervest and Roy Keene - the developers of a program called htpdate.

You can download the source code from http://www.clevervest.com/htp/

This page is still under construction.


Back