IP address 192.168.10.31
IMAP services:
This document contains information relating to :
- imapd and saslauthd
- apache2
- mailstore
Note: Whilst we can create and manage mailboxes here - we don't add the user to the radus system - a radius entry for the username and password must be created either in daloradius or in the irax portal
cyrus imapd and saslauthd:
systemctl restart cyrus-imapd
systemctl status saslauthd
Config Files
nano /etc/imapd.conf
nano /etc/cyrus.conf
IMAP management
There are a number of ways that imap mailboxes can be managed. Below is how to do some management on the imap server
There is also the Server_manager system that provides an api to do the same - direct access using our own perl functions can be found here:
cd /var/Smtp_service_manger/perlimap/
further detail regarding the api and its use in the Irax portal is here: SMTP Service Manager
quick reconstruct of mailbox
root@imap:~# cyrus reconstruct -r -f user/me@irax.com
Log into cyrus user:
root@imap:~# cyradm -u cyrus localhost -p 143
Here we can use the imap commands lm dm cm lam dam sam to manage mailboxes
so lm we can do things like
- lm user/ian@irax.com
- lm user ian*@irax.com
- lm user/*@irax.com
note the use of * can be quite powerful especially with delete mailbox
- dm /user/fred/*@irax.com
will delete all mailboxes for fred@irax.com
lam lists the acls
lam user/ian1*@irax.com gives this
localhost> lam user/ian1*@irax.com
user/ian1@irax.com:
ian1@irax.com lrswipkxtecdan
user/ian1/Drafts@irax.com:
ian1@irax.com lrswipkxtecdan
user/ian1/Sent@irax.com:
ian1@irax.com lrswipkxtecdan
user/ian1/Spam@irax.com:
ian1@irax.com lrswipkxtecdan
user/ian1/Trash@irax.com:
ian1@irax.com lrswipkxtecdan
We could not use dm to delete this mailbox because cyrus has no ACLs
sam is 'set acls on mailbox'
sam user/ian1*@irax.com cyrus all
localhost> sam user/ian1*@irax.com cyrus all
Setting ACL on user/ian1@irax.com...OK.
Setting ACL on user/ian1/Drafts@irax.com...OK.
Setting ACL on user/ian1/Sent@irax.com...OK.
Setting ACL on user/ian1/Spam@irax.com...OK.
Setting ACL on user/ian1/Trash@irax.com...OK.
So now the mailbox can be deleted
localhost> dm user/ian1*@irax.com
Deleting mailbox user/ian1@irax.com...OK.
Deleting mailbox user/ian1/Drafts@irax.com...Mailbox does not exist
localhost> lm user/ian1*@irax.com
localhost>
Success!
Sometimes a mailbox does not work properly. you may see a message like
Setting ACL on user/ian1/Drafts@irax.com…cyrus: lrswipkxtea: System I/O error
One way of fixing this is creating a temporary mailbox of a similar name ( and possibly its sub mailboxes. This mailbox structure can then be copied in the mailstore to the broken mailbox for example:
on the imap server:
localhost> cm ianx@irax.com
localhost> cm user/ianx/Drafts@irax.com
localhost> cm user/ianx/Sent@irax.com
localhost> cm user/ianx/Spam@irax.com
localhost> cm user/ianx/Trash@irax.com
then on the mailstore server: root@mailstore:/irax/mail/domain/i/irax.com/i/user# cp ianx ian1 -rp now back on the imap server localhost> sam user/ian1*@irax.com cyrus all now works
localhost> sam ianx@irax.com cyrus/all
Apache2
systemctl restart apache2
Files:
Apache config file for wsgi
nano /etc/apache2/sites-enabled/ipmanagement.conf
Git repo for python flask SMTP Service Manager:
cd /var/Smtp_service_manger
SMTP Service Manager SMTP Service Manager
Mailstore mounted on /home/mail/ You should be able to see the mounted nfs drive. is it mounted ?
root@imap:/# mount |grep mail
192.168.10.33:/irax/mail on /home/mail type nfs4
rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.10.31,local_lock=non e,addr=192.168.10.33)
root@imap:/#
and
root@imap:/# showmount -e 192.168.10.33
Export list for 192.168.10.33:
/irax/mail 192.168.10.30,192.168.10.31,192.168.1.99
root@imap:/#
From this host home mail is only accessible by user cyrus
root@imap:/# cd /home/mail
bash: cd: /home/mail: Permission denied
root@imap:/# su cyrus
cyrus@imap:/$ cd /home/mail
cyrus@imap:/home/mail$ ls
a b c d domain e f g h i j k l m n o p q r s stage. t u v w x y z
cyrus@imap:/home/mail$