How install Roundcube plugins?

Discussion in 'Plugins/Modules/Addons' started by Planea, Mar 11, 2023.

  1. Planea

    Planea New Member

    oxyash likes this.
  2. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    You may need to modify the extra plugins that do not come with ISPConfig Roundcube Plugins to make them work on an ISPConfig system.
    Reading the troubleshooting instructions available from ISPConfig Roundcube plugins github page may help.
     
    Planea likes this.
  3. Alex Mamatuik

    Alex Mamatuik Member

    In case, i was using a tutorial from the how_to_forge website:https://www.howtoforge.com/tutorial...php-pureftpd-postfix-dovecot-and-ispconfig/3/
    and we have installed the Roundcube software...

    By the way, @Th0m , there is a problem with the inactive popup window id="ez-cookie-dialog": button id="ez-accept-all" doesn't react at all.
    Every time i have to apply
    #ez-cookie-dialog-wrapper {
    display: none;
    }


    the default plugins-container is: /usr/share/roundcubemail/plugins
    Code:
    ├── plugins
    │   ├── acl
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       │   ├── images
    │   │       │   └── templates
    │   │       ├── elastic
    │   │       │   └── templates
    │   │       └── larry
    │   │           ├── images
    │   │           └── templates
    │   ├── additional_message_headers
    │   ├── archive
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       └── larry
    │   ├── attachment_reminder
    │   │   └── localization
    │   ├── autologon
    │   ├── database_attachments
    │   ├── debug_logger
    │   │   └── runlog
    │   ├── emoticons
    │   │   └── localization
    │   ├── enigma
    │   │   ├── bin
    │   │   ├── lib
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       │   └── templates
    │   │       ├── elastic
    │   │       │   └── templates
    │   │       └── larry
    │   │           └── templates
    │   ├── example_addressbook
    │   ├── filesystem_attachments
    │   ├── help
    │   │   ├── content
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       │   └── templates
    │   │       ├── elastic
    │   │       │   └── templates
    │   │       └── larry
    │   │           └── templates
    │   ├── hide_blockquote
    │   │   ├── localization
    │   │   └── skins
    │   │       └── larry
    │   ├── http_authentication
    │   ├── identicon
    │   ├── identity_select
    │   ├── jqueryui
    │   │   ├── js
    │   │   │   └── i18n
    │   │   └── themes
    │   │       ├── classic
    │   │       │   └── images
    │   │       ├── elastic
    │   │       │   └── images
    │   │       └── larry
    │   │           └── images
    │   ├── krb_authentication
    │   ├── managesieve
    │   │   ├── codemirror
    │   │   │   ├── addon
    │   │   │   │   └── selection
    │   │   │   ├── lib
    │   │   │   └── mode
    │   │   │       └── sieve
    │   │   ├── helpdocs
    │   │   │   ├── en_US
    │   │   │   └── po
    │   │   ├── lib
    │   │   │   └── Roundcube
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       │   ├── images
    │   │       │   └── templates
    │   │       ├── elastic
    │   │       │   └── templates
    │   │       └── larry
    │   │           ├── images
    │   │           └── templates
    │   ├── markasjunk
    │   │   ├── drivers
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       │   └── images
    │   │       └── larry
    │   │           └── images
    │   ├── newmail_notifier
    │   │   └── localization
    │   ├── new_user_dialog
    │   │   └── localization
    │   ├── new_user_identity
    │   ├── password
    │   │   ├── drivers
    │   │   ├── helpers
    │   │   └── localization
    │   ├── redundant_attachments
    │   ├── show_additional_headers
    │   ├── squirrelmail_usercopy
    │   ├── subscriptions_option
    │   │   └── localization
    │   ├── userinfo
    │   │   └── localization
    │   ├── vcard_attachments
    │   │   ├── localization
    │   │   └── skins
    │   │       ├── classic
    │   │       └── larry
    │   ├── virtuser_file
    │   ├── virtuser_query
    │   └── zipdownload
    │       ├── localization
    │       └── skins
    │           ├── classic
    │           └── larry
    By the example of the password plugin let's puzzle out of what should be done:
    An initial structure: /usr/share/roundcubemail/plugins/password
    Code:
    password
    ├── composer.json
    ├── config.inc.php.dist
    ├── drivers
    ........................
    ├── password.js
    ├── password.min.js
    ├── password.php
    └── README
    We must make a copy of config.inc.php.dist to config.inc.php and set the options as described within the file:
    Code:
    cp config.inc.php.dist config.inc.php
    A working configuration: https://forum.howtoforge.com/attach...8/?temp_hash=05aff12cfe99875ca3eb1e2d58bbfc54


    Some other decent plugin is rcguard
    Download it either using composer
    or manually to the folder plugins:
    /usr/share/roundcubemail/plugins
    rcguard
    ├── composer.json
    ├── config.inc.php
    ├── config.inc.php.dist
    ├── lib
    │ └── recaptchalib.php
    ├── localization
    │ ├── de_CH.inc
    │ ├── de_DE.inc
    │ ├── en_US.inc
    │ ├── es_AR.inc
    │ ├── es_ES.inc
    │ ├── fr_FR.inc
    │ ├── hu_HU.inc
    │ ├── it_IT.inc
    │ ├── nl_NL.inc
    │ ├── pt_BR.inc
    │ ├── ru_RU.inc
    │ ├── sv_SE.inc
    │ ├── tr_TR.inc
    │ └── zh_TW.inc
    ├── rcguard.php
    ├── README.md
    ├── skins
    │ ├── classic
    │ │ └── rcguard.css
    │ ├── elastic
    │ │ └── rcguard.css
    │ └── larry
    │ └── rcguard.css
    └── SQL
    ├── mysql
    │ └── 2018051200.sql
    ├── mysql.initial.sql
    ├── postgres
    │ └── 2018051200.sql
    ├── postgres.initial.sql
    ├── sqlite
    │ └── 2018051200.sql
    └── sqlite.initial.sql

    All your added/enabled plugins must be written to /usr/share/roundcubemail/config/config.inc.php:
    Code:
    // ----------------------------------
    // PLUGINS
    // ----------------------------------
    // List of active plugins (in plugins/ directory)
    $config['plugins'] = array(
    'acl',
      'archive',
       'attachment_reminder',
        'autologon',
         'emoticons',
        'identity_select', 'krb_authentication',  'virtuser_file', 'virtuser_query',
        
         'debug_logger',
         'identicon',
        
    'filesystem_attachments',
      'hide_blockquote', 
        'jqueryui',
         'managesieve',
          'markasjunk',
           'new_user_dialog',
            'new_user_identity',
             'newmail_notifier',
              'password',
               'show_additional_headers',
                 'subscriptions_option',
                  'userinfo',
                  'vcard_attachments',             
                    'zipdownload',
                    'additional_message_headers',  'help',  'http_authentication', 'squirrelmail_usercopy', 'persistent_login', 
    
    // !!!newly added Roundcube plugin that enforces reCAPTCHA for users that have too many failed logins
    'rcguard'
    );
    
     

    Attached Files:

    Planea and ahrasis like this.
  4. Planea

    Planea New Member

    From which path should I run this?
    /usr/share/plugins?
     
  5. Alex Mamatuik

    Alex Mamatuik Member

    Normally, from your root path of the roundcube folder:
    /usr/share/roundcubemail
    Code:
    result=$(find / -type d -name roundcubemail) && cd $result
    - you can see a composer.json file on there.

    Don't forget to switch user to non-root and assign user-related permissions to composer.lock & composer.json.
    Code:
    composer require dsoares/rcguard
    But if you are unfamiliar with the composer, just fairly load a plugin like:
    Code:
    cd plugins
    git clone https://github.com/dsoares/roundcube-rcguard.git
     
    ahrasis likes this.
  6. atmomin2003

    atmomin2003 New Member

    I am trying to add rcguard on ispconfig roundcube, I followed below instructions, but recaptcha does not show up.

    Code:
    sudo apt update && sudo apt upgrade -y
    sudo apt install git unzip php-cli php-curl php-mbstring php-xml
    
    Code:
    sudo apt install composer -y
    
    Code:
    apt install git -y
    cd /usr/share/roundcube/plugins
    git clone https://github.com/dsoares/rcguard.git rcguard
    ln -s /usr/share/roundcube/plugins/rcguard /var/lib/roundcube/plugins/rcguard
    cd rcguard/
    sudo composer install --no-dev
    mv config.inc.php.dist config.inc.php
    nano config.inc.php
    
    Below commands maybe needed, but not sure about it.
    Code:
    sudo find /usr/share/roundcube/plugins/rcguard -type d -exec chmod 755 {} \;
    sudo find /usr/share/roundcube/plugins/rcguard -type f -exec chmod 644 {} \;
    
    Add keys in below lines
    Code:
    Public key for reCAPTCHA<br>$config['recaptcha_publickey'] = '';
    Private key for reCAPTCHA<br>$config['recaptcha_privatekey'] = '';
    
    Change below as u see fit for your need
    // Number of failed logins before reCAPTCHA is shown
    Code:
    $rcmail_config['failed_attempts'] = 1;
    
    change recaptcha version depending on the keys created for, I found only v2 works. but I maybe wrong.
    Code:
    $config['recaptcha_api_version'] = 'v2'; // v3 | v2 | v2invisible
    
    Add rcguard in plugins array in /etc/roundcube/config.inc.php
    Code:
    $config['plugins'] = array(
        'plugin1',
        'plugin2',
        'rcguard',
    );
    
    Go to PHPMyAdmin, ideally, login with root login from LAN, select the Roundcube database (roundcube), click the SQL tab and copy/paste the following code:
    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".

    Code:
    systemctl restart apache2
    
    Check for errors as below
    Code:
    sudo tail -f /var/log/roundcube/errors
    
    All worked well, didn't get any error while doing the above.

    Am I doing anything wrong or missing anything? Also am I installing rcguard in right folder, there's also /etc/roundcube/plugins.
    Thank you for any guidance!
     
    Last edited: Oct 24, 2024
  7. Alex Mamatuik

    Alex Mamatuik Member

    /usr/share/roundcubemail/plugins/rcguard/config.inc.php
    PHP:
    <?php
    /**
     * rcguard configuration file.
     */

    // Number of failed logins before reCAPTCHA is shown
    $config['failed_attempts'] = 3;

    // Release IP after how many minutes (after last failed attempt)
    $config['expire_time'] = 30;

    // Reset failure count after successfull login (see bratkartoffel/rcguard@670395e)
    $config['rcguard_reset_after_success'] = true;

    // reCAPTCHA API version and url
    $config['recaptcha_api_version'] = 'v3'// v3 | v2 | v2invisible
    $config['recaptcha_api_url'] = 'https://www.google.com/recaptcha/api.js';

    // !!! DEPRECATED - not used anymore !!!
    //$config['recaptcha_api']        = 'http://www.google.com/recaptcha/api.js';
    //$config['recaptcha_api_secure'] = 'https://www.google.com/recaptcha/api.js';
    //$config['recaptcha_https']      = true;

    // Keys can be obtained from http://www.google.com/recaptcha/

    // reCAPTCHA site key
    $config['recaptcha_publickey'] = 'your_public_key';

    // reCAPTCHA secret key
    $config['recaptcha_privatekey'] = 'your_private_key';

    // Send client IP to Google for reCAPTCHA verification
    $config['recaptcha_send_client_ip'] = false;

    // If defined, use this proxy to request ReCaptcha
    // $config['recaptcha_proxy'] = 'proxy.example.com:5100';
    $config['recaptcha_proxy'] = false;

    // Proxy authentication credentials
    // $config['recaptcha_proxy:auth'] = 'login:password';
    $config['recaptcha_proxy_auth'] = false;

    // Log events
    $config['recaptcha_log'] = false;

    // Recaptcha widget theme: light | dark (only for v2*)
    $config['recaptcha_theme'] = 'light';

    // Recaptcha widget size: normal | compact (only for v2*)
    $config['recaptcha_size'] = 'normal';

    // Event is not logged when set to NULL
    // Parameter expansion:
    // %r - Remote IP
    // %u - Username
    $config['recaptcha_log_success'] = 'Verification succeeded for %u. [%r]';
    $config['recaptcha_log_failure'] = 'Error: Verification failed for %u. [%r]';
    $config['recaptcha_log_unknown'] = 'Error: Unknown log type.';

    // Block IPv6 clients based on prefix length
    // Use an integer between 16 and 128, 0 to disable
    $config['rcguard_ipv6_prefix'] = 0;

    // Do not show recaptcha for this IPs
    $config['rcguard_ignore_ips'] = [];

    // Do not show recaptcha of these networks
    $config['recaptcha_whitelist'] = [];

    /usr/share/roundcubemail/config/config.inc.php -
    pay an attention that the rcguard is enabled!!!
    PHP:
    // ----------------------------------
    // PLUGINS
    // ----------------------------------
    // List of active plugins (in plugins/ directory)
    $config['plugins'] = array(
    'acl',
      
    'archive',
       
    'attachment_reminder',
        
    'autologon',
         
    'emoticons',   
         
    'identity_select''krb_authentication',  'virtuser_file''virtuser_query',
         
    'debug_logger',
         
    'identicon',
    'filesystem_attachments',
      
    'hide_blockquote',
        
    'jqueryui',
         
    'managesieve',
          
    'markasjunk',
           
    'new_user_dialog',
            
    'new_user_identity',
             
    'newmail_notifier',
              
    'password',
               
    'show_additional_headers',
                 
    'subscriptions_option',
                  
    'userinfo',
                  
    'vcard_attachments',            
                    
    'zipdownload',
                    
    'additional_message_headers',  'help',  'http_authentication''squirrelmail_usercopy''persistent_login''rcguard');
     
    ahrasis likes this.
  8. Alex Mamatuik

    Alex Mamatuik Member


    my command earlier was:

    Code:
    mysql -u root -p
    USE your_real_roundcube_database_name;
    CREATE TABLE IF NOT EXISTS `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;
     
    atmomin2003 and ahrasis like this.
  9. atmomin2003

    atmomin2003 New Member

    There's no such folder /usr/share/roundcubemail/, I only see /usr/share/roundcube folder and plugins folder inside. Do I need to create new roundcubemail folder for rcguard to work?

     
  10. Alex Mamatuik

    Alex Mamatuik Member

    come on! you were using Debian - as i understood, - my case is Centos
    ... keep doing all these procedures inside the folder, where you have installed the rounde_cube.
     
    atmomin2003 likes this.
  11. atmomin2003

    atmomin2003 New Member

    I updated my post for some other steps I performed, so, now captcha is trying to load, but now CSP is causing problem.

    Content-Security-Policy: The page’s settings blocked a script (script-src-elem) at https://www.google.com/recaptcha/api.js?hl=en_CA from being executed because it violates the following directive: “default-src 'self' 'unsafe-inline' 'unsafe-eval'”

    I added below line but did not help. CSP error does not allow to login, shows error Captcha is empty when trying to login.
    Code:
    nano /etc/apache2/sites-available/000-default.conf
    Code:
    <IfModule mod_headers.c>
      Header set Content-Security-Policy "default-src 'self'; script-src 'self' https://www.google.com https://www.gstatic.com 'unsafe-inline'; style-src 'self' 'unsafe-inline';"
    </IfModule>
    
     
  12. Alex Mamatuik

    Alex Mamatuik Member

    add a screenshot of your page (where it happens... with url)
    and try to run /rounducbe smoothly from the server' path
    i guess, you run it from the website, which has pre-installed severe restrictions to .htaccess

    try also this:
    PHP:
    <?php

      
    // Turn off the X-Frame-Options header entirely, to restore the previous
      // behavior of allowing the site to be embedded in a frame on another site.
      
    $conf['x_frame_options'] = '';
     
      
    header_remove('X-Frame-Options');
     

Share This Page