2018年11月18日 星期日

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!


沒有留言:

張貼留言