Return to labs index
"Extra: Shell Lab" - LDAP Queries

Due: Friday, October 3rd at 11:59PM

Overview

This lab asks you to query user account information form the University's LDAP servers and audit it to determine which active email users do not have spam filtering enabled.

You are required to use the query we specify and do the processing via the shell script, rather than fine tuning the query. As the University limits the number of results returned, you'll only get a subset of the results -- and possibly a different subset each time. This is okay -- you only need to process the records that you actually get per instance.

Using LDAP

The ldapsearch program, available on the unix.andrew cycle servers can be used to query relavant user information from within your shell script. Please use the following query -exactly-. We know more relevant queries can be constructed -- but we want you to do the post-processing via a shell script. This quesries for users who have spam filtering disabled.

  % ldapsearch -h ldap.andrew.cmu.edu -b ou=account,dc=andrew,dc=cmu,dc=edu cmuSpamFlag=FALSE
  

In general, LDAP neither guarantees that results are returned in any particular order -- nor that the attributes within a record are ordered in any particular way, or even consistently. Please be cautious of this in implementing your solution -- it should not depend on the order of records or attributes. You can, however, assume that each record will begin with a #-comment of the form given in the following example:

  # GKESDEN, account, andrew.cmu.edu
  

A blank line separates user records. You can also assume that, if present, an attribute of the following form indicates that a user is receiving email deilvery. And, since we only queried those records for which spam filtering is disabled -- these records meet both criteria: no spam filtering and enabled.

  emailDeliveryMethod: ENABLED
  

Sample Interaction

  % ./spamaudit.sh

  The following acocunts are active, but have spam filtering disabled:
  
  userid1
  userid2
  userid3
  userid4
  

We're Here To Help!

As always -- remember, we're here to help!

Mad Props

...to the little mouse!