Web based Cyrus IMAP user admin client.

Installation:

necessary files:

IMAP::Admin-1.4.1.tar.gz or newer (used by funclib.pl version 2.4)
*NOTE* : Don't use version 1.5.1 of IMAP::Admin.  There is a bug in the 
getquotaroot function that causes a timeout.

perlsieve-0.4.9b.tar.gz  NOTE: Adds SSL functions - fixes scripts listing
			 - fixed SSL connection problem
funclib.pl (version 2.4)
funclib.cyrus (version 1.1 - optional - uses Cyrus 2.x.x builtin perl modules)
	      IMAP::Admin and perlsieve not required if using funclib.cyrus. 
	      NOTE:  You must have the Cyrus 2.x.x perl modules installed. 	     
websieve.pl (version 0.61)
websieve.conf ( for versions 0.57+)
readme.txt
auth.pl (optional - change passwords on an ldap server) 
auth-pop.pl (optional - change passwords on Qualcomm poppasswd server)
allfiles.tar.gz (all the files above)

Other files:
	websieve-test.pl: alpha version 0.59-test of websieve
	websieve.frames.tar.gz:  
	- This is an example setup of using websieve.pl in a customized frame based menu environment.  

- untar,make and install the following modules (if required):
(eg. after untaring the modules  change to the untarred directory, run 'perl Makefile.pl', then 'make', then 'make install' to complete the installation.)

IMAP::Admin from Eric Estabrooks (available locally or on CPAN)
IMAP::Sieve (available locally - from Alain Turbide, filename: perlsieve.x.x.tar.gz)

Note: Version 0.4x+ of websieve requires version 0.4.x+ of IMAP::Sieve.

- copy websieve.pl, websieve.conf and funclib.pl to your cgi directory
- if using ldap for password storage you can also copy auth.pl to your cgi directory and modify the parameters at the start of the module.
  (Alternatively you could use your own custom auth.pl or if using the Qualcomm
poppassd daemon you can use auth-pop.pl)
- change the execute permissions and ownerships of the 
  scripts (eg: chmod 555 websieve.pl)
- modify websieve.conf to suit your preferences 
- to use this script you must have the timsieved daemon setup as per the 
  install instructions in the Cyrus distribution.

Useage:

Point your browser to websieve.pl eg: http://webhost/cgi-bin/websieve.pl.
You will then be greeted with a login screen.  Enter your
Cyrus UID and PASS and you should see the script entry screen 
as well as your current mail quota, acl's.
Please note that only plain text (LOGIN) authorization is supported at this
time.  I also recommend that you run this on an SSL enabled server 
to avoid sending passwords in the clear. If you need to run the script 
on a separate server then the mail server, please remember that the passwords are sent in clear text.  To ensure better security in such scenerio's I recommend using SSL to encrypt the session to the Imap and Sieve daemon's.  I've successfully used Stunnel in these cases. 

This cgi module allows full user control of sieve script creation, 
as well as acl settings for mailboxes.  It also displays the 
current available quota. The basic setting is for easy script 
creation with no scripting involved.  The advanced setting allows 
direct script access and editing. Please note that the "basic" mode does not 
use all of Sieve's features.  If you require more functionality you can use 
the "advanced" mode or you can drop me an email if you would like a particular 
feature added to "basic" mode.


NOTE1:

To use the "vacation" or "reply with" features of sieve you must 
be running deliver in LMTP mode otherwise you will not be able to 
save scripts on the server if you try to use these features.  
Please consult the Cyrus IMAP sieve docs for more info on the Sieve
language and setting up deliver for LMTP. 


NOTE2:

This is BETA software.  There probably are quite a few bugs yet 
to fix but it is mostly functional here.      
I am not responsible for any loss or damage that can occur to your 
system from the use of these scripts.  It is free software and 
you may do as you wish with it.  If you make any modifications to it 
or need changes made, let me know and I'll apply them to my source 
for others to use if possible.
There is still a lot I want to do with it as well as clean up the 
source (It's a bit rough at this time - still learning PERL).

If there are any questions, suggestions I can be reached via email at:

"aturbide@toshiba.ca"

CHANGES:
	Version: 0.61h:
	- fixed introduced bug in funclib.pl that caused timeouts
	- fixed bug that caused rules list to have a copy of a old rule if rule lists include disabled rules.  Rules weren't able to be saved in those cases.
	- added fix to remove invalid pseudo rules 
	Version: 0.61:
	Note: Websieve can now be used for most user administration tasks.  Password management requires the appropriate auth.pl for your system (Currently onlyLDAP and poppassd supported)
	NOTE: You must set variable $cyrusadminuid to the uid of your cyrus admin user id and log in as that user in websieve to administer mailboxes.
	- added ldapextras.pl and ldapextras.conf from Jules Agee to provide LDAP directory user maintenance.  Allows mailbox creation, groups, quota settings and passwords changes.
	- also added capability in websieve.pl to set quotas, acl's, create and delete mailboxes by an admin user. (LDAP not needed)
	- Added new rule option - "keep a copy" to force a keep on a per rule bais - useful in redirect actions.
	- Various cosmetic changes
	- To allow admin use of websieve.pl, had to modify the script to not read all user mailboxes in memory (too large and slow) for admins.  Instead, admin user has to enter the specific mailbox or wildcard to view acl's of mailboxes.
	- Changed %serverlist hash in conf file slightly to have display name has the first element.  Please update your conf file accordingly.

	Version: 0.60:
	- up version to beta 0.60
	- fixed bug that prevented a script with all rules removed from being deleted properly
	(fix submitted by Jules Agee - thanks)
	
	Version: 0.59j:
	- added more secure RC4 encryption capability to cookies (set $userc4=1 to use)
	- fixed bug in avanced mode that prevented deletion of currently viewed script
	- added some help text in vacation screen
	- fixed bug in call to openimap that returned error on connect in certain
	occasions with Cyrus Imapd 2.x.x with valid credentials.
	- allow setting active script to inactive in advanced mode

	Version: 0.59i:
	- added server and uid info to infoline
	Version: 0.59h:
	- fixed bug in "copy only" settings that prevented the generated script from working as expected. 
	- made default script active always when $usemulti=0;
	- applied patch from William Hardeman to work with alt_namespace Cyrus patch. 
	Version: 0.59g:
	- added more secure encryption to cookies.  Variable $skey must be set to a random string value in websieve.conf
	- added remote_host check to ensure remote host is same as set in original cookie to deter cookie hijacking.
	- added option ($useservercookie) to use server URL based session cookies instead of client based ones for users who don't want to use client cookies.
	- added option ($session_exp) to set session expiry time (server and client)
	- removed password hidden variable - not needed - now encrypted

	Version: 0.59f: 
	- added msg size rule selection
	- cleaned up some warnings

	Version: 0.59d:
	- change vacation reply text in scripts to use "text: \r\n.\r\n" format to support in line \r\n within message to work properly with sieve version 2.x.x
	- set general rights to default to nothing selected in acl view
	- add option $returntoview to control return to rules view after rules addition
	- fixed missing \r\n in reject action
	- change script to not resend cookie after authentication

	Version: 0.59c:
	- Better error reporting, returns properly on errors
	- Allow more flexibility in addresses terminators in vacation addresses(i.e. commas, newlines, semi-colons or spaces
	
	Version: 0.59b: 
	- remove error messages when creating initial sieve script
	- bug fix in parsing message text

	Version: 0.59a:
	- added easier access rights selection
	- fixed duplicate INBOX entry

	Version: 0.59:
	- created new funclib.pl (funclib.cyrus) that uses the builtin perl Imap and Sieve modules of Cyrus Imap version 2.x.x and above for administration.  Therefore IMAP::Admin and IMAP::Sieve not required for these servers.  Make sure you have the Cyrus perl modules working first.  Rename funclib.cyrus to funclib.pl and save in your cgi-bin directory with websieve.pl and websieve.conf
	NOTE:  To use this funclib.pl you require version 0.59 of websieve and above.  
	- Also modified current funclib.pl (version 2.4) to compensate for the changes made to support the Cyrus perl modules therefore to use version 0.59 of websieve you will need version 2.4 of the standard funclib.pl (that uses IMAP::Admin and IMAP::Sieve)

	Version 0.58b:
	- Fixed bug in custom rule creation
	Version 0.58:
	- further screen display changes
	- moved version 0.58c-test to beta version 0.58
	- new feature - SSL, multi server support
	Version 0.58b-test:
	- Added Forward All messages menu option ($useforwardall=1)
	- Now allow creation of rules with no conditions (ie no From,To,etc)
	- Fixed some cosmetic issues on some screens
	Version 0.58-test (Websieve-test.pl):
	- Added SSL functionality to encrypt connetions to SSL enabled Imap and Sieve servers.  Uses a new version of perlsieve 0.4.9 (using IO::Socket::SSL and Net::SSLeay) (shamelessly copied from Eric Estabrooks IMAP::Admin module - Thanks Eric!).  Also required is version 2.3 of funclib.pl.
	- Added ability for users to select the Imap server to connect to from the login screen.  This is to enable the script to be better integrated with multiple domain/server scenerios.  
	- script now checks object->{'Error'} for any connection errors
	Version 0.57: 
	- changed websieve-test.pl alpha version 057b-test to beta version 0.57
	Version 0.57b-test: (websieve-57.pl)
	- split configuration settings to a seperate websieve.conf file
	for easier upgrades
	- add option $showhome to allow display of (logout,home,help) only
	Version 0.57a-test: (websieve-57.pl)
	- store imap server name and script name in cookie
	- modified auth.pl subroutines to be more generic.
	- add ability to store direct sieve scripts within the basic rules
	Version 0.56:
	- created workaround for problem with IMAP::Admin 1.4.x always returning a valid object on new imap connetion even when wrong password submitted.
	  This requires a new funclib.pl (version 2.2).  websieve.pl version 0.56 requires it to run.  Now the script tries to login to both imap and sieve to ensure a valid connection to both before allowing a logon.
	- on login in advanced mode user is sent to script edit mode
	Version 0.55:
	- fixed bug which prevented viewing or editing scripts other then default in multi script mode
	- fixed broken advanced script editing mode implementation
	- added line to display currently edited script
	- various cosmetic fixes
	- fixed bug in activate script selection
	- add warning about loss of changes from advanced to basic mode
	Version 0.54:
	- add cookie value encoding to protect against cursory sniffing for passowrds sent in the cookie.  Weak protection but better than nothing.  Still recommend using the script with an SSL web server.
	- allow cookie expiration to be set.  Default to Session expiration (no cookie file saved). Session ends on logout or when browser shut down.
	- fixed a typo in variable field rule entry.
	Version 0.53:
	- added regular expression search capability
	- added ability to search on any header field
	  (patch submitted by user - Sorry I lost the original email.. Thanks!)
	- added ! operator useage to create a "not" rule per field
	- moved advanced functions into their own menu
	Version 0.52:
	- cosmetic  fixes
	- allow the removal of screen menu and mail server line  
	Version 0.51: 
	- fixed various warnings
	- reduce amount of sent form variables  
	Version 0.50: 
	- New interface - broke up all functions into individual menu items 
	(ie: vacation, rulesview, rule addition, password, acl)
	- Changed script to use cookies to keep authentication settings when 
	moving from one menu item to another.  
	- fixed bug when displaying/using folders with spaces in their names in the ACL section
	- Note: passwords are not encrypted in the cookies and may be recoverable from your pc.  Will look into encryption for session parameters.
	
	Version 0.48:
	- improved public folder handling as well as fix folder display bugs
	- some fixes submitted by Jens Rosesiger - Thanks
	NOTE: if you modify an existing rule that uses a folder and does'nt have INBOX prepended to it, you must re-point the destination back using the pull down list - othwise it will default to INBOX the first time.

	Version 0.47:
	- fixed various unitialized warning errors in websieve.pl, funclib.pl 
	and IMAP::Sieve
	- change ldap auth.pl to use Net::LDAP perl module from Graham Barr.
	
	Version 0.46:
	- fixed prepended INBOX folder name bug
	- added fix to support IMAP-ADmin-1.2.5 and above.  Set quotemailbox=0
	- added patch to support selective users to use advanced mode
	  patch submitted by: Scot Hetzel, Thanks.
	
	Version 0.45:
	- Modified to work with version 2.x.x of Cyrus IMAP as well as previous 	versions (includes modification of Perlsieve module)
	- fixed html header problem
 
	Version 0.39d:
	-fixed bug in vacation display code

	Version 0.39c: 
	- minor bug fix in quota display
	- various cosmetic changes

	Version 0.39:
	- added ability to use * and ? for wildcard matching in fields
	  for rule creation in basic mode
	
	Version 0.38b:
	- changed reply action to use vacation addresses instead of
	  the default "uid@domain" - patch submited by Udo Schifferdecker

	Version 0.38:
	- fixed bug in vacation addresses where space or comma 
	  delimiter not parsed properly
	- added $usemulti to allow admin to set cgi to only use the 
	  defaultscript on the server - patch submitted by David Manifold 

	Version 0.37:
	- fixed bug where vacation needed at least one rule to become active

	Version 0.36:
	- added option $shortacl to control type of mailbox ACL display

	Version 0.35:
	- added root INBOX in ACL view and modify 
	- fixed inability to create folders with spaces

	Version 0.34: 
	- added discard action to basic mode
	- a couple of cosmetic changes
	
	Version 0.33:
	- fixed bug where folders with spaces did'nt show in ACL list
	- added option $useacl to remove ACL modification dialog 
	- added option $usevacation to remove Vacation dialog

	Version 0.32:
	- a few bugfixes regarding not being able to create new basic scripts
	- fixed a bug when switching from basic to advanced mode caused an error

	Version 0.31:
	- Added reject function in basic mode
	- Added ability to create new folders
	- Various bug fixes
	- Script renamed from user.pl to websieve.pl to better reflect its use



