Plugin
---------
TAR File
# cd /usr/share/roundcubemail/config/
cp /usr/share/roundcubemail/config/config.inc.php.dist /usr/share/roundcubemail/config/config.inc.php
# cp defaults.inc.php config.inc.php
# vi config.inc.php
RPM
# vi /etc/roundcubemail/config.inc.php
$config['plugins'] = array( 'archive', 'zipdownload', 'managesieve', 'password', );
managesieve
cp /usr/share/roundcubemail/plugins/managesieve/config.inc.php.dist /usr/share/roundcubemail/plugins/managesieve/config.inc.php
# cd /usr/share/roundcubemail/plugins/managesieve/config.inc.php [ config.inc.php.dist TO config.inc.php]
# vi /var/www/html/webmail/plugins/managesieve/config.inc.php
$config['managesieve_vacation'] = 1;
zipdownload plugin
The plugin is already shipped with the Roundcube packages but not enabled by default because it adds some requirements to the webserver Roundcube is installed on.
cp /usr/share/roundcubemail/plugins/zipdownload/config.inc.php.dist /usr/share/roundcubemail/plugins/zipdownload/config.inc.php
Make sure your PHP installation includes the Zip extension.
Enable the plugin by adding "zipdownload" to the list of plugins in Roundcube's config/config.inc.php file.
Enable the zipdownload_selection option by setting up the plugin config:
Copy the plugin config file plugins/zipdownload/config.inc.php.dist into config/zipdownload.inc.php
Edit the copied file and set $config['zipdownload_selection'] = true;
postfixadmin & rouncube vacation plugins
Member "roundcubemail-1.4.3/plugins/managesieve/skins/elastic/templates/vacation.html" (19 Feb 2020, 972 Bytes) of package /linux/www/roundcubemail-1.4.3.tar.gz:
Installation
# cd /var/www/roundcubemail/
# cd plugins
# tar xzf ~/rc-vacation.tar.gz
# cd vacation
# cp config.inc.php.dist config.inc.php
# vi config.inc.php
cd /usr/share/roundcubemail/plugins/
roundube/pluging/vacation I have the following config file:
#config.php
driver = "virtual"
defaultsubject = "Default subject"
defaultbody = "default.txt"
transport = "autoreply.exemple.org"
dbase = "postfixadmin"
dsn = "mysql://postfixadmin:<password>@localhost/postfixadmin"
always_keep_copy = true
select_query = "SELECT goto FROM %m.alias WHERE address='%e' AND goto='%g'"
delete_query = "DELETE FROM %m.alias WHERE domain=%d AND source='%e'"
insert_query = "INSERT INTO %m.alias (domain,address,goto) VALUES (%i,'%e','%g')"
createvacationconf = true
---------------X---------------
config.inc.php:
$rcmail_config['driver'] = 'virtual';
$rcmail_config['virtual']['dsn'] = 'mysql://postfix:password@localhost';
$rcmail_config['virtual']['transport'] = 'some.domain.tld;
// Database used by Postfix
$rcmail_config['virtual']['dbase'] = 'postfix';
$rcmail_config['virtual']['select_query'] = "SELECT 1 FROM postfix.alias where address='%e' AND goto='%g'";
$rcmail_config['virtual']['delete_query'] = "DELETE FROM postfix.alias WHERE domain='%d' AND goto='%g' AND address='%e' LIMIT 1";
$rcmail_config['virtual']['insert_query'] = "INSERT INTO postfix.alias (address,goto,domain) VALUES ('e','%g','%d')";
-------------------X-----------------------------
ok, this works great. thanks a lot!
just in case here my sql-query-configuration for the postfixadmin setup:
$rcmail_config['virtual']['select_query'] = "SELECT goto FROM %m.alias WHERE address='%e' AND goto='%g'";
$rcmail_config['virtual']['delete_query'] = "DELETE FROM %m.alias WHERE domain='%d' AND address='%e'";
$rcmail_config['virtual']['insert_query'] = "INSERT INTO %m.alias (address,goto,domain) VALUES ('%e','%g','%d')";
Download the latest stable release 1.2.7.1
Stable version - 1.4.3
https://sourceforge.net/projects/vacation/files/vacation/1.2.7.1/vacation-1.2.7.1.tar.gz/download
Install vacation plugin on Roundcube Mail in Centos 7
The standard roundcubemail in Centos 7 epel repository is 1.1.2 (LTS) which does not have the plugin vacation included, you should install it manually. The document logged the course of installing the plugin as well as the problems encountered.
1) Install the vacation binary program
The Centos 7 does not have vacation program in the yum repository. So it needs to be download from the source, compile and install.
Download the latest stable release 1.2.7.1 and extract it with the following command:
# tar -xvf vacation-1.2.7.1.tar.gz
Now you can compile it. You need to have the development packages to do so. The following packages are required: gcc, gdbm-devel
# make
gcc -g -Wall -Xlinker -warn-common -D_PATH_VACATION=\"/usr/bin/vacation\" -o vacation vacation.c strlcpy.c strlcat.c rfc822.c -lgdbm
Install it:
#make install
install -s -m 755 vacation /usr/bin/vacation
install -m 755 vaclook /usr/bin/vaclook
install -m 444 vacation.man /usr/man/man1/vacation.1
install: cannot create regular file ‘/usr/man/man1/vacation.1’: No such file or directory
make: *** [install] Error 1
There is an error encountered when installing the man files. The reason is it tries to install the man files into /usr/man instead of the /usr/share/man. So you need to edit the Makefile with the follow amendment:
MANDIR = $(PREFIX)/man/man ⟶ MANDIR = $(PREFIX)/share/man/man
Then do the installation again:
#make install
install -s -m 755 vacation /usr/bin/vacation
install -m 755 vaclook /usr/bin/vaclook
install -m 444 vacation.man /usr/share/man/man1/vacation.1
install -m 444 vaclook.man /usr/share/man/man1/vaclook.1
2) Install Roundcube vacation plugin
There are four sources of vacation plugin:
https://github.com/rplessl/roundcube-vacation-plugin (last active is 2018-7-11)
https://github.com/bhuisgen/rc-vacation (last active is 2018-10-24)
https://github.com/gabor-toth/roundcube-vacation-plugin (last active is 2018-2-1)
https://sourceforge.net/projects/rcubevacation/ (last active is 2015-8-20)
Except the second one (rc-vacation), all the rest are alike. I've tried to install the second one, but no luck, it requires to install some modules which are beyond my knowledge. Blah, blah, blah....
Requirements :
- jQuery UI for vacation date support.
- PEAR Net/LDAP2 module for LDAP driver.
I finally select the first one (rplessl).
Download and unzip it to the directory: /usr/share/roundcubemail/plugins/
Rename the folder from roundcube-vacation-plugin-master to vacation for simplicity.
Now edit the file config.ini to select the driver (the method to update the auto-reply and forward rule). Since the default method is "sshftp" which is the one I preferred. So, no need to be modified.
[default]
driver = "sshftp"
subject = "Default subject"
body = "default.txt"
However, according the the document, if the imap (default) server is not the same as the smtp (postfix) server, you can change the parameter "server =", so that the .forward file in the home directory can be updated.
Now set the config.ini to be apache group readable:
# chown 0440 config.ini
# chgrp apache config.ini
Next modify the file /etc/roundcubemail/config.inc.php to activate the plugin:
// ----------------------------------
// PLUGINS
// ----------------------------------
// List of active plugins (in plugins/ directory)
$config['plugins'] = array('vacation');
After this, you will see the vacation icon in roundcube menu.
However, when clicking on the item, a blank page appears. It is due to an internal error when executing the plugin. To see what is wrong, you need to increase the debug level in /etc/roundcubemail/config.inc.php to 4.
// ----------------------------------
// LOGGING/DEBUGGING
// ----------------------------------
// system error reporting, sum of: 1 = log; 4 = show, 8 = trace
$config['debug_level'] = 4;
Afterwords, you will see the error in the page:
Fatal error: Call to undefined function ssh2_connect() in /usr/share/roundcubemail/plugins/vacation/lib/sshftp.class.php on line 29
Well, it complains about the ssh2 module is not installed. We install the required package:
# yum install php-pecl-ssh2
All done now!
---------------------------------------------
Installation procedure
Installation procedure
Unzip vacation.tar.gz in plugins/
Enable the vacation plugin in config/main.inc.php: $rcmail_config['plugins'] = array('vacation');
Open plugins/vacation/config.ini in your editor and change the settings if needed.
chown $apache_user plugins/vacation/config.ini
chmod 0400 plugins/vacation/config.ini
See README.TXT for additional information and requirements for each driver.
Valid config.ini configuration options
An optional default subject and bodytext can be specified using:
subject = "Out of office" body = "default.txt"
The body refers to a template textfile that contains a default text. No HTML can be used in this template.
Here you'll find a list of available configuration options per driver:
[*** None Driver ***] This driver has no configuration options. Use this driver to disable the 'Vacation' subtab in the Settings tab.
[*** FTP Driver ***]
server = "ftp.host.org" If 'server' is omitted, the FTP driver will use the current IMAP-server as server. Optional.
passive = False If set, the FTP driver will try to establish a passive FTP connection. Optional.
disable_forward = False If set to True, the end-user will not be able to set forwards. Defaults to false. Optional.
[*** SSHFTP Driver ***]
server = "ssh.host.org" If 'server' is omitted, the SSHFTP driver will use the current IMAP-server as server. Optional.
disable_forward = False If set to True, the end-user will not be able to set forwards. Defaults to false. Optional.
[*** Setuid Driver ***]
executable = "/usr/bin/squirrelmail_vacation_proxy" Path to the actual setuid binary that read/writes the .forward file in a user's $HOME directory. Required.
disable_forward = False If set to True, the end-user will not be able to set forwards. Defaults to false. Optional.
[*** SQL/Virtual Driver ***]
dsn = "pgsql://roundcube:password@localhost" Specifies a DSN (see db.inc.php) that has access to the dbase specified below. Optional. If left empty, the DSN of db.inc.php will be used.
transport = "vacation.yourdomain.org" Applies to Postfix SMTP-server only. See http://www.postfix.org/VIRTUAL_README.html#autoreplies. Required. This must match the transport in /etc/postfix/transport and /etc/postfix/master.cf
dbase = "postfix" Database used by the mailserver. The vacation and virtual alias tables must exist in this database. Required.
always_keep_copy = true Always maintain an $email -> $email alias in the alias table. Defaults to true if omitted. Optional.
select_query = "SELECT destination FROM %m.virtual_aliases WHERE source='%e' AND destination='%g'" Query to retrieve aliases for the current user. Required. Parameters: %e = email address, %d = domainname, %i = domain_id, %g = goto . The latter is used for the transport. %g will expands to john@domain.org@$transport %m is required as the Roundcube database should be different from the mailserver's database.
delete_query = "DELETE FROM %m.virtual_aliases WHERE domain_id=%i AND source='%e'" Aliases are recreated when saving vacation settings. Required.
insert_query = "INSERT INTO %m.virtual_aliases (domain_id,source,destination) VALUES (%i,'%e','%g')" Query to create new aliases. Required.
domain_lookup_query = "SELECT id FROM postfix.virtual_domains WHERE name='%d'" Required if you use a domain_id for storing the domain's in the alias table.
createvacationconf = true Creates /etc/postfixadmin/vacation.conf which has database configuration for the vacation.pl script. Optional. It uses the selected DSN to create the file. Make sure this file is only readable by the vacation user after it's created. If unset or false, you must edit vacation.pl manually and set database accordingly.
always_keep_message = true If vacation/auto-reply gets disabled, should we delete the subject/body set by the end-user? Optional. Defaults to true.
disable_forward = False If set to True, the end-user will not be able to set forwards. Defaults to false. Optional
[*** Sieve Driver ***] TBD
[*** Dot forward ***] Path to vacation binary
binary = "/usr/bin/vacation"
Unsupported at the moment
flags = ""
File that contains the body & subject of the out of office mail. Required
message = ".vacation.msg"
Database file for vacation binary. Default should be ok. Required
database = ".vacation.db"
If set to true use -a $alias in the .forward file and allow the user to select the aliases. By default the identities are shown if available
alias_identities = true
If the vacation binary supports setting the envelop sender, set this to the right parameter. *BSD seems to use '-R' and Debian '-z'. See 'man vacation' for more info.
set_envelop_sender = false
If vacation/auto-reply gets disabled, should we keep the .vacation.msg? Optional.
always_keep_message = true
Protecting config.ini
If you use the 'virtual' driver, it's recommended to protect config.ini from being accessed directly using a browser. In the root of the plugin directory, you'll find .htaccess that prevents DSN password in config.ini from being exposed.
Configuration examples for config.ini
[default] driver = "sshftp"
[mail.server.org] driver = "none"
[mail.work.nl] driver = "setuid" executable = "/usr/bin/squirrelmail_vacation_proxy"
[imap.provider.org] driver = "ftp" server = "ftp.provider.org" passive = True
----------------------------------------------------
Configure the Sieve Message Filter
You can create folders in Roundcube webmail and then create rules to filter email messages into different folders. In order to do this, you need to install the dovecot-pigeonhole package with the following command.
sudo dnf install dovecot-pigeonhole
If you followed my PostfixAdmin tutorial and are using virtual mailbox domains, then you need to edit the sieve configuration file.
sudo /etc/dovecot/conf.d/90-sieve.conf
Find the following line:
sieve = file:~/sieve;active=~/.dovecot.sieve
Change it to:
sieve = file:/var/vmail/%d/%n/sieve;active=/var/vmail/%d/%n/.dovecot.sieve
By default, Postfix uses its builtin local delivery agent (LDA) to move inbound emails to the message store (inbox, sent, trash, Junk, etc). We can configure it to use Dovecot to deliver emails, via the LMTP protocol, which is a simplified version of SMTP. LMTP allows for a highly scalable and reliable mail system and it is required if you want to use the sieve plugin to filter inbound messages to different folders.
Edit the Dovecot main configuration file.
sudo nano /etc/dovecot/dovecot.conf
Add lmtp and sieve to the supported protocols.
protocols = imap lmtp sieve
Save and close the file. Then edit the Dovecot 10-master.conf file.
sudo nano /etc/dovecot/conf.d/10-master.conf
Change the lmtp service definition to the following.
service lmtp { unix_listener /var/spool/postfix/private/dovecot-lmtp { group = postfix mode = 0600 user = postfix } }
Next, edit the Postfix main configuration file.
sudo nano /etc/postfix/main.cf
Add the following lines at the end of the file. The first line tells Postfix to deliver emails to local message store via the dovecot LMTP server. The second line disables SMTPUTF8 in Postfix, because Dovecot-LMTP doesn’t support this email extension.
mailbox_transport = lmtp:unix:private/dovecot-lmtp smtputf8_enable = no
Save and close the file. Finally, restart Postfix and Dovecot.
sudo systemctl restart postfix dovecot
------------