Working in an environment with quite a large user-base means I get to think up all sorts of crazy stuff to make our lives easier in catering to the user- base. One such tidbit is the setting of a user's preferred browser home-page depending on a number of factors, such as where she is located within the network and the user's workstation IP address. Web browsers are supplied preconfigured with a home page pointing to a CGI script appropriately named home.cgi. This small program is invoked on a central Apache web server, and it first determines the IP address of the caller by inspecting the environment variable $REMOTE_ADDR. If a reverse lookup of this address in DNS returns a valid domain name, this latter name is looked up in a simple map to determine a preferred home-page for all users in that domain (should a PTR RR not exist, the IP address is searched for in the map). The map is a simple linear lookup table, and a sample looks like this:

# Match is performed on leftmost-portion of domainname
# or the IP address, in that order.
^10\.9\..*          http://be.example.com/info.html
^10\.253\.    http://nl.example.com/
nl.example.com http://nl.example.com/

Simple enough, what? You might be asking yourself: "why don't users simply configure their home page???". Good question. I can't give you a politically correct answer here. ;-) In addition to that, since we know the username by inspecting the IP address the home.cgi program can override the user's thus determined home page by checking the user's LDAP entry. If a labeledURI attribute type exists, its first value will be used as a home page. home.cgi actually also does more: it can issue a message of the day to users, forcing them to okay that before being directed to their final destination. home.cgi's last task is to issue a Location: header to redirect the browser to the determined URL.

Flattr this
LDAP, Linux, Apache, and DNS :: 22 Jun 2006 :: e-mail

Comments

blog comments powered by Disqus