APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Exposing hidden data to users


Although this article deals with a very specific task, the basic idea could be used to make any sort of hidden information available to email users.

In this case, we're going to expose the members of certain groups to users. The purpose is so that users who may not be sure that a certain person is in the group or are just not familiar with group naming conventions can easily see the members.

We could do something very similar for the members of mailing lists, to create lists of people who have their email forwarded elsewhere, to show users the current set of system spam rules and so on.

We're sending this data in the form of an email that will end up in a Public Folder, but it could just as easily go to a web page or anywhere else.


Our first task is to create a Public Folder to store these messages. I called mine "Groups". Then we need a filter rule that will move certain messages to that folder.

Do remember that Public Folders are only as "public" as you choose to make them: each folder has individual sharing rights you can set to match your requirements. If you want everyone to see a particular folder, you can do that, but you can also limit it to specific users.

Filter needed for this script

The script is simple enough. Modify it for your specific environment (items needing editing are marked in red). The user we send to needs at least "Change" permission in the specific Public Folder. I used "admin" here, but that's not a requirement.

foreach (@groups) {
  $subj="-s Group Contains";
  open(O,"|/opt/kerio/mailserver/sendmail admin\@aplawrence.com");
print O <<EOF;
Mime-Version: 1.0
Content-Type: text/html
Content-Transfer-Encoding: 8BIT
From: admin\@aplawrence.com
Subject: Members of Group $group 


  foreach (@stuff) {
    $start=1 if /<list name="User">/;
    $start=0 if /<.list>/;
    next if not $start;
    $user=$_ if /<variable name="Name">/;
    $user=~ s/<variable name="Name">//;
    $user=~ s/<.*//;
    print O "$user<br />\n" if /<variable name="Groups">$group/;


If you run that script on a regular basis and clean out the older messages in Groups (which you can do with Messages settings for the user you send to) , your users will see something like this in the Groups public folder:

Script results

Using the API

You could also use Kerio's Administration API to get the group members (see Exposing hidden data to users (API method). That is how I'd do this if I wanted to put up web pages that could display this information on demand.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Exposing hidden data to users

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Anthony Lawrence

Kerio Connect Mailserver

Kerio Samepage

Kerio Control Firewall

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Securing a computer system has traditionally been a battle of wits: the penetrator tries to find the holes, and the designer tries to close them. (Gosser)

Random numbers should not be generated with a method chosen at random (Donald Knuth)

This post tagged: