Control Web Panel
WebPanel => E-Mail => Topic started by: AlexG on December 18, 2018, 06:31:42 PM
-
Hi everyone, like the title say, let's add the Google's reCaptcha into the Roundcube's login form. First, this post is based on this article (https://help.poralix.com/articles/protect-roundcube-with-google-recaptcha-directadmin-server).
Here we go:
Open a terminal and connect to CWP server.
#Installing GIT
yum install git -y
#Clone the plugin through git
cd /usr/local/cwpsrv/var/services/roundcube/plugins/
git clone https://github.com/dsoares/rcguard.git rcguard
#Change directory permission
chown -R cwpsvc:cwpsvc rcguard/
#Rename the config file
cd rcguard
mv config.inc.php.dist config.inc.php
#Edit the config file and adding the Keys
nano config.inc.php
Once in there look for:
// Public key for reCAPTCHA<br>$config['recaptcha_publickey'] = '';
// Private key for reCAPTCHA<br>$config['recaptcha_privatekey'] = '';
Add your Keys, if you don't have any, you can generate them here (https://www.google.com/recaptcha/admin)
NOTE: to save changes in nano editor, press Ctrl+O and Ctrl+X to exit
#Like the original article say:
You can change other settings of the plugin per your needs. For example this one:
// Number of failed logins before reCAPTCHA is shown
$rcmail_config['failed_attempts'] = 5;
Change it to 0 (zero) to show the captcha always.
#Create a new table in the Roundcube database.
Go to PHPMyAdmin, selec the Roundcube database (roundcube), click the SQL tab and copy/paste the following code:
CREATE TABLE `rcguard` (
`ip` VARCHAR(40) NOT NULL,
`first` DATETIME NOT NULL,
`last` DATETIME NOT NULL,
`hits` INT(10) NOT NULL,
PRIMARY KEY (`ip`),
INDEX `last_index` (`last`),
INDEX `hits_index` (`hits`)
) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci;
Then, click "Go"
-----------------------------------------------
Image for Reference:
-----------------------------------------------
(https://image.ibb.co/ehWWc0/recaptcha-roundcube-mysql.png)
#Last Step
Add 'rcguard' into Roundcube's config file. Should be something like this:
nano /usr/local/cwpsrv/var/services/roundcube/config/config.inc.php
$config['plugins'] = array(
'plugin1',
'plugin2',
'rcguard',
That's all, now Roundcube's form login should look like this:
-----------------------------------------------
Image for Reference:
-----------------------------------------------
(https://image.ibb.co/euFGc0/recaptcha-roundcube-login.png)
---------------------------------------------------------------------
Works great with CWP v0.9.8.753+ (CentOS 7)
---------------------------------------------------------------------
-
Thanks AlexG. Works great with CWPpro version: 0.9.8.850 Centos 7.
-
I used your advice and I like these changes.