Author Topic: Google's reCaptcha on Roundcube's Login Form  (Read 8222 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Google's reCaptcha on Roundcube's Login Form
« 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.

Here we go:

Open a terminal and connect to CWP server.

#Installing GIT

Code: [Select]
yum install git -y
#Clone the plugin through git

Code: [Select]
cd /usr/local/cwpsrv/var/services/roundcube/plugins/
git clone https://github.com/dsoares/rcguard.git rcguard

#Change directory permission

Code: [Select]
chown -R cwpsvc:cwpsvc rcguard/
#Rename the config file

Code: [Select]
cd rcguard
mv config.inc.php.dist config.inc.php

#Edit the config file and adding the Keys

Code: [Select]
nano config.inc.php
Once in there look for:

Code: [Select]
// 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

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:

Code: [Select]
// 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:

Code: [Select]
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:
-----------------------------------------------




#Last Step

Add 'rcguard' into Roundcube's config file. Should be something like this:

Code: [Select]
nano /usr/local/cwpsrv/var/services/roundcube/config/config.inc.php
Code: [Select]
$config['plugins'] = array(
    'plugin1',
    'plugin2',
    'rcguard',

That's all, now Roundcube's form login should look like this:

-----------------------------------------------
Image for Reference:
-----------------------------------------------



---------------------------------------------------------------------
Works great with CWP v0.9.8.753+ (CentOS 7)
---------------------------------------------------------------------

Offline
*
Re: Google's reCaptcha on Roundcube's Login Form
« Reply #1 on: July 14, 2019, 03:52:20 PM »
Thanks AlexG. Works great with CWPpro version: 0.9.8.850 Centos 7.

Offline
*
Re: Google's reCaptcha on Roundcube's Login Form
« Reply #2 on: July 18, 2019, 03:35:39 PM »
I used your advice and I like these changes.