Unable to login to Roundcube: PHP Error: Failed to create a user record.

Error found in error logs:

[28-Nov-2018 14:14:25 +0200]: <4d284o3h> DB Error: [1364] Field 'alias' doesn't have a default value (SQL Query: INSERT INTO `users` (`created`, `last_login`, `username`, `mail_host`, `language`) VALUES (now(), now(), 'microsoft@orsharlogistic.ro', 'localhost', 'en_US')) in /var/www/html/roundcubemail-1.0.3/program/lib/Roundcube/rcube_db.php on line 543 (POST /?_task=login&_action=login)
[28-Nov-2018 14:14:25 +0200]: <4d284o3h> PHP Error: Failed to create new user in /var/www/html/roundcubemail-1.0.3/program/lib/Roundcube/rcube_user.php on line 686 (POST /?_task=login&_action=login)
[28-Nov-2018 14:14:25 +0200]: <4d284o3h> PHP Error: Failed to create a user record. Maybe aborted by a plugin? in /var/www/html/roundcubemail-1.0.3/program/include/rcmail.php on line 650 (POST /?_task=login&_action=login)

List from useres table in roundcube database.
MariaDB [roundcube]> describe users;
| Field | Type | Null | Key | Default | Extra |
| user_id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| username | varchar(128) | NO | MUL | NULL | |
| mail_host | varchar(128) | NO | | NULL | |
| alias | varchar(128) | NO | MUL | NULL | |
| created | datetime | NO | | 1000-01-01 00:00:00 | |
| last_login | datetime | YES | | NULL | |
| language | varchar(5) | YES | | NULL | |
| preferences | text | YES | | NULL | |
| failed_login | datetime | YES | | NULL | |
| failed_login_counter | int(10) unsigned | YES | | NULL | |

Solutions: Remove alias column from users table.

Connect database:
mysql -u root -p

Use database you need to make change:
MariaDB [(none)]> use roundcube;

Alter table users;
ALTER TABLE roundcube.users DROP COLUMN roundcube.users.alias;

Now problem solved !


Source: https://support.plesk.com/hc/en-us/articles/360005898674-Unable-to-login-to-Roundcube-PHP-Error-Failed-to-create-a-user-record

Easy Install cbpolicyd On CentOS 7

I have encountered the situation when users have weak passwords and are guessed by spammers so valid accounts are used for SPAM. The solution they choose in case is the limitation of mails sent over a period of time.

1. Install dependencies on the application

yum install -y mariadb mariadb-server perl-Cache-FastMmap perl-Config-IniFiles

2. Download and install policyd rpm package and source files for setting up db.

wget https://download.policyd.org/v2.0.14/cluebringer-2.0.14-1.noarch.rpm
rpm -Uvh cluebringer-2.0.14-1.noarch.rpm
wget https://download.policyd.org/v2.0.14/cluebringer-v2.0.14.zip

3. Settings database.

unzip cluebringer-v2.0.14.zip
cd cluebringer-v2.0.14/database/

Prepare sql file

vim run.sh
for i in core.tsql access_control.tsql quotas.tsql amavis.tsql checkhelo.tsql checkspf.tsql greylisting.tsql;
./convert-tsql mysql $i
done > policyd.sql

Change in file
sed -i 's/TYPE=InnoDB CHARACTER SET latin1 COLLATE latin1_bin//' policyd.sql

4. Create database and populate.
mysql -u root -p
create database policyd;
GRANT all on policyd.* to ‘policyd’@’localhost’ identified by ‘Your-password’;
mysql -u root -p policyd < policyd.sql

5. Configure cbpolicyd database on webui.conf

vim /etc/policyd/cluebringer.conf
config line like this

vim /etc/policyd/webui.conf
config line like this

6. Setup in your page policyd and postfix.
Access for config file
cd /var/www/html/
ln -s /usr/share/cluebringer/webui/ policyd

Now you need to create your apache access with vhosts.

Modify postfix
Add the following Postfix config setting in BOTH smtpd_recipient_restrictions and

smtpd_end_of_data_restrictions: check_policy_service inet:

It’s recommended to add these parameters first, i.e.:

smtpd_recipient_restrictions = check_policy_service inet:, permit_mynetworks, ..

You can check logs on /var/log/cbpolicyd.log and /var/log/maillog
Start service /etc/init.d/cbpolicyd start
[root@mail html]# systemctl enable cbpolicyd
cbpolicyd.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig cbpolicyd on