1 (edited by Alastor 2022-10-05 21:11:40)

Topic: Quota calculation error stops incoming mail from being recieved Ubuntu

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.1 MARIADB edition
- Deployed with iRedMail Easy or the downloadable installer? It had a GUI, I believe it was the "easy" set up described
- Linux/BSD distribution name and version: Ubuntu 20.04.5 LTS
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MariaDB
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Unsure, I believe it's... dovecot??
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.

ERROR THAT IS OCCURING:

NOQUEUE: reject: RCPT from mail-ex-ex1.google.com[209.85.160.49]: 450 4.7.1 <mail@example.com>: Recipient address rejected: Internal quota calculation error; from=<example@gmail.com> to=<mail@example.com> proto=ESMTP helo=<mail-ex1-fw2.google.com>
====

Links may not be actual links just to protect any potential personal things, the gmail account is the sender, the example.com account is the reciever which is, of  course, where I have the mail server

CONFIG FILES PER postconf -n:

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
allow_min_user = no
allow_percent_hack = no
biff = no
body_checks = pcre:/etc/postfix/body_checks.pcre
command_directory = /usr/sbin
compatibility_level = 2
content_filter = smtp-amavis:[127.0.0.1]:10024
daemon_directory = /usr/lib/postfix/sbin
data_directory = /var/lib/postfix
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
enable_long_queue_ids = yes
enable_original_recipient = no
header_checks = pcre:/etc/postfix/header_checks
inet_interfaces = all
inet_protocols = ipv4
lmtp_tls_mandatory_protocols = !SSLv2 !SSLv3
lmtp_tls_protocols = !SSLv2 !SSLv3
mail_owner = postfix
mailq_path = /usr/bin/mailq
message_size_limit = 15728640
mlmmj_destination_recipient_limit = 1
mydestination = $myhostname, localhost, localhost.localdomain
mydomain = mail.example.com
myhostname = mail.example.com
mynetworks = 127.0.0.1
myorigin = mail.example.com
newaliases_path = /usr/bin/newaliases
postscreen_access_list = permit_mynetworks cidr:/etc/postfix/postscreen_access.cidr
postscreen_blacklist_action = drop
postscreen_dnsbl_action = drop
postscreen_dnsbl_reply_map = texthash:/etc/postfix/postscreen_dnsbl_reply
postscreen_dnsbl_sites = zen.spamhaus.org=127.0.0.[2..11]*3 b.barracudacentral.org=127.0.0.2*2
postscreen_dnsbl_threshold = 2
postscreen_dnsbl_whitelist_threshold = -2
postscreen_greet_action = drop
proxy_read_maps = $canonical_maps $lmtp_generic_maps $local_recipient_maps $mydestination $mynetworks $recipient_bcc_maps $recipient_canonical_maps $relay_domains $relay_recipient_maps $relocated_maps $sender_bcc_maps $sender_canonical_maps $smtp_generic_maps $smtpd_sender_login_maps $transport_maps $virtual_alias_domains $virtual_alias_maps $virtual_mailbox_domains $virtual_mailbox_maps $smtpd_sender_restrictions $sender_dependent_relayhost_maps
queue_directory = /var/spool/postfix
recipient_bcc_maps = proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_user.cf proxy:mysql:/etc/postfix/mysql/recipient_bcc_maps_domain.cf
recipient_delimiter = +
relay_domains = $mydestination proxy:mysql:/etc/postfix/mysql/relay_domains.cf
sender_bcc_maps = proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_user.cf proxy:mysql:/etc/postfix/mysql/sender_bcc_maps_domain.cf
sender_dependent_relayhost_maps = proxy:mysql:/etc/postfix/mysql/sender_dependent_relayhost_maps.cf
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
show_user_unknown_table_name = no
smtp-amavis_destination_recipient_limit = 1
smtp_tls_CAfile = $smtpd_tls_CAfile
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_loglevel = 1
smtp_tls_mandatory_protocols = !SSLv2 !SSLv3
smtp_tls_note_starttls_offer = yes
smtp_tls_protocols = !SSLv2 !SSLv3
smtp_tls_security_level = may
smtpd_command_filter = pcre:/etc/postfix/command_filter.pcre
smtpd_data_restrictions = reject_unauth_pipelining
smtpd_end_of_data_restrictions = check_policy_service inet:127.0.0.1:7777
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks permit_sasl_authenticated check_helo_access pcre:/etc/postfix/helo_access.pcre reject_non_fqdn_helo_hostname reject_unknown_helo_hostname
smtpd_recipient_restrictions = reject_non_fqdn_recipient reject_unlisted_recipient check_policy_service inet:127.0.0.1:7777 permit_mynetworks permit_sasl_authenticated reject_unauth_destination check_policy_service inet:127.0.0.1:12340
smtpd_reject_unlisted_recipient = yes
smtpd_reject_unlisted_sender = yes
smtpd_sasl_path = private/dovecot-auth
smtpd_sasl_type = dovecot
smtpd_sender_login_maps = proxy:mysql:/etc/postfix/mysql/sender_login_maps.cf
smtpd_sender_restrictions = reject_non_fqdn_sender reject_unlisted_sender permit_mynetworks permit_sasl_authenticated check_sender_access pcre:/etc/postfix/sender_access.pcre reject_unknown_sender_domain
smtpd_tls_CAfile = /etc/cloudflare/public/example.com.pem
smtpd_tls_CApath = /etc/cloudflare/public/
smtpd_tls_cert_file = /etc/cloudflare/public/example.com.pem
smtpd_tls_dh1024_param_file = /etc/ssl/dh2048_param.pem
smtpd_tls_dh512_param_file = /etc/ssl/dh512_param.pem
smtpd_tls_exclude_ciphers = aNULL, eNULL, EXPORT, DES, RC4, MD5, PSK, aECDH, EDH-DSS-DES-CBC3-SHA, EDH-RSA-DES-CDC3-SHA, KRB5-DE5, CBC3-SHA
smtpd_tls_key_file = /etc/cloudflare/private/example.com.pem
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_protocols = !SSLv2 !SSLv3
smtpd_tls_protocols = !SSLv2 !SSLv3
smtpd_tls_security_level = may
swap_bangpath = no
tls_random_source = dev:/dev/urandom
transport_maps = proxy:mysql:/etc/postfix/mysql/transport_maps_user.cf proxy:mysql:/etc/postfix/mysql/transport_maps_maillist.cf proxy:mysql:/etc/postfix/mysql/transport_maps_domain.cf
unknown_local_recipient_reject_code = 550
virtual_alias_domains =
virtual_alias_maps = proxy:mysql:/etc/postfix/mysql/virtual_alias_maps.cf proxy:mysql:/etc/postfix/mysql/domain_alias_maps.cf proxy:mysql:/etc/postfix/mysql/catchall_maps.cf proxy:mysql:/etc/postfix/mysql/domain_alias_catchall_maps.cf
virtual_gid_maps = static:2000
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_domains.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf
virtual_minimum_uid = 2000
virtual_transport = dovecot
virtual_uid_maps = static:2000

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

i would suggest to empty the quota database and then recalculate it manually:

doveadm quota recalc -A

3

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

if you can login the mariadb vmail db.

try 
select a.*,b.quota from used_quota a,mailbox b where a.username=b.username  order by bytes desc;

cheers

4

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

chris.23lo wrote:

if you can login the mariadb vmail db.

try 
select a.*,b.quota from used_quota a,mailbox b where a.username=b.username  order by bytes desc;

cheers

I have just managed to drop my roundcubemail DB...... bruh, is there an easy way for roundcube to re-create its DB?

5

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

There is a cronjob every night to backup the databases.

https://docs.iredmail.org/backup.restore.html

6

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

iredmail creates backups each day, so there should be a backup from today in

/var/vmail/backup/mysql/2022/10/05/

7 (edited by Alastor 2022-10-05 23:26:26)

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Alastor wrote:
chris.23lo wrote:

if you can login the mariadb vmail db.

try 
select a.*,b.quota from used_quota a,mailbox b where a.username=b.username  order by bytes desc;

cheers

I have just managed to drop my roundcubemail DB...... bruh, is there an easy way for roundcube to re-create its DB?

To further expand upon this, it would seem I cannot locate where roundcube stores its password that it uses to try and access the DB, and seeing as though I could not remember the password for it but still had to give it permissions for the DB... it has become an issue, please do let me know where the password is stored so I can correct this,

Thanks in advance

8

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

i don't see the problem, you only dropped the database, not the permissions for it nor the user itself, so if you just use the backup and restore the roundcube database, everyting should be okay

9

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Cthulhu wrote:

i don't see the problem, you only dropped the database, not the permissions for it nor the user itself, so if you just use the backup and restore the roundcube database, everyting should be okay


Where is said backup, I am sorry for the silly-seeming questions, it has been months since I first set it up, file locations have become very hazy regarding roundcube

10

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Cthulhu wrote:

iredmail creates backups each day, so there should be a backup from today in

/var/vmail/backup/mysql/2022/10/05/

11 (edited by Alastor 2022-10-05 23:52:14)

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

I have tried to restore the .sql file back to mysql with this command:

mysql -u root -p roundcubemail < roundcubemail-2022-10-05-03-30-01.sql


But I recieve this error:

ERROR at line 46: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''

I will also need to know where the password is stored in the config of roundcubemail

12

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

i don't know this, but why would you want to change the password?
then you would need to recreate the user and permissions aswell

13

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Cthulhu wrote:

i don't know this, but why would you want to change the password?
then you would need to recreate the user and permissions aswell

As in a bid to create a new DB I had ran the command to grant user “roundcubemail” all permissions to the DB “roundcubemail” identified by a certain password that I typed that I can almost guarantee was different to the original one

14

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

dude, you dropped the database, not the user, the user still exists with all permissions and old password

what are you even doing?

15

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Cthulhu wrote:

dude, you dropped the database, not the user, the user still exists with all permissions and old password

what are you even doing?


I am aware, it was a weird spur of the moment thing that was unnecessary, and now I am needing to find where the password is to set it back from this silly thing that I did, after that I should be fine, I cleared the vmail DB as suggested

16 (edited by Cthulhu 2022-10-06 04:27:01)

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

i hope you ONLY emptied the table used_quota and nothing else, not dropping or deleting it

you need to rerun the installer for roundcube to get it working then if it is in a such messed up state where i still don't know how you managed this

17 (edited by Alastor 2022-10-06 16:25:27)

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Cthulhu wrote:

i hope you ONLY emptied the table used_quota and nothing else, not dropping or deleting it

you need to rerun the installer for roundcube to get it working then if it is in a such messed up state where i still don't know how you managed this

I ran this command:

chris.23lo wrote:

select a.*,b.quota from used_quota a,mailbox b where a.username=b.username  order by bytes desc;

So yes just from used_quota, I just need to restore my roundcubemail DB and change the password in RC (RoundCube) config, please do provide a link or some instructions on how to at least restore the DB if you can :) I should be able to do the rest myself :)

EDIT: I have now fixed the issue with my database password but I am still receiving this error on my mail site:

`DATABASE ERROR!
Unable to connect to the database!
Please contact your server administrator.`

I do not know if this is because I must now restore my DB, but I am assuming so, I am needing to now ONLY restore the `roundcubemail` database (MariaDB) using, assumably, a .sql file

18

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Alastor wrote:
Cthulhu wrote:

i hope you ONLY emptied the table used_quota and nothing else, not dropping or deleting it

you need to rerun the installer for roundcube to get it working then if it is in a such messed up state where i still don't know how you managed this

I ran this command:

chris.23lo wrote:

select a.*,b.quota from used_quota a,mailbox b where a.username=b.username  order by bytes desc;

So yes just from used_quota, I just need to restore my roundcubemail DB and change the password in RC (RoundCube) config, please do provide a link or some instructions on how to at least restore the DB if you can smile I should be able to do the rest myself smile

This command does

1) not empty the database
2) querys the mailbox table

so if that would have been the command to empty, the mailbox table would be emtpy aswell now.

for me it seems you lack of simple basics and have no clue what you are doing at all

https://stackoverflow.com/questions/644 … a-sql-file

just check this lil "guide" maybe you manage to restore it

Cthulhu wrote:

you need to rerun the installer for roundcube to get it working then if it is in a such messed up state where i still don't know how you managed this

since you ignore everything (not the first time)

Cthulhu wrote:

iredmail creates backups each day, so there should be a backup from today in

/var/vmail/backup/mysql/2022/10/05/

where you afterwards ask where the backups are located, you should reconsider operating a mail server which will end up in a spamming zombie sooner or later because you dont't have basic knowledge on how to handle it

19

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Cthulhu wrote:
Alastor wrote:
Cthulhu wrote:

i hope you ONLY emptied the table used_quota and nothing else, not dropping or deleting it

you need to rerun the installer for roundcube to get it working then if it is in a such messed up state where i still don't know how you managed this

I ran this command:

chris.23lo wrote:

select a.*,b.quota from used_quota a,mailbox b where a.username=b.username  order by bytes desc;

So yes just from used_quota, I just need to restore my roundcubemail DB and change the password in RC (RoundCube) config, please do provide a link or some instructions on how to at least restore the DB if you can smile I should be able to do the rest myself smile

This command does

1) not empty the database
2) querys the mailbox table

so if that would have been the command to empty, the mailbox table would be emtpy aswell now.

for me it seems you lack of simple basics and have no clue what you are doing at all

https://stackoverflow.com/questions/644 … a-sql-file

just check this lil "guide" maybe you manage to restore it

Cthulhu wrote:

you need to rerun the installer for roundcube to get it working then if it is in a such messed up state where i still don't know how you managed this

since you ignore everything (not the first time)

Cthulhu wrote:

iredmail creates backups each day, so there should be a backup from today in

/var/vmail/backup/mysql/2022/10/05/

where you afterwards ask where the backups are located, you should reconsider operating a mail server which will end up in a spamming zombie sooner or later because you dont't have basic knowledge on how to handle it


I very much understand your frustration, thank you very much for all of your help, I will work on this with the help you have given, thank you again

20

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Alastor wrote:

I have tried to restore the .sql file back to mysql with this command:

mysql -u root -p roundcubemail < roundcubemail-2022-10-05-03-30-01.sql


But I recieve this error:

ERROR at line 46: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: ''

I will also need to know where the password is stored in the config of roundcubemail


FTR, the issue I had here was because I SHOULD have run this:

`mysql -u root -p --binary-mode roundcubemail < /var/vmail/backup/mysql/2022/10/05/roundcubemail-2022-10-05-03-30-01.sql`


OR

`mysql -u root -p --binary-mode roundcubemail < roundcubemail-2022-10-05-03-30-01.sql`


If already in the directory

21 (edited by Alastor 2022-10-12 03:30:13)

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

This issue is still not currently resolved after restoring the DB, it seems even recalculating the quota and whatnot does not solve this issue for me, unless I have done something significantly incorrect, which I doubt given I have followed advice on this thread with my own knowledge and research, the mail server can send mail and the sent mailbox is fine, but it will not/can not receive mail.

And yes I do appreciate the help I have gotten.

22

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Alastor wrote:

but it will not/can not receive mail.

What's the related error log lines in /var/log/maillog?

23

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

ZhangHuangbin wrote:
Alastor wrote:

but it will not/can not receive mail.

What's the related error log lines in /var/log/maillog?


Feb 16 13:06:48 mail postfix/smtpd[3422121]: NOQUEUE: reject: RCPT from mail-blahblahblah.protection.outlook.com[x.x.x.x]: 450 4.7.1 <alastor@example.com>: Recipient address rejected: Internal quota calculation error; from=<example@ex.example2.com> to=<alastor@example.com> proto=ESMTP helo=<EUR01-HE1-obe.outbound.protection.outlook.com>

24

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

Try this command to recalculate the mailbox quota:

doveadm quota recalc -u alastor@example.com

25

Re: Quota calculation error stops incoming mail from being recieved Ubuntu

ZhangHuangbin wrote:

Try this command to recalculate the mailbox quota:

doveadm quota recalc -u alastor@example.com

doveadm(Alastor): Error: net_connect_unix(/var/run/dovecot/stats-writer) failed: Permission denied
doveadm(alastor@example.com)<3495735><>: Error: auth-master: userdb lookup(alastor@example.com): connect(/var/run/dovecot/auth-userdb) failed: Permission denied (euid=1000(Alastor) egid=1000(Alastor) missing +r perm: /var/run/dovecot/auth-userdb, we're not in group 5000(vmail), dir owned by 0:0 mode=0755)
doveadm(alastor@example.com): Error: User lookup failed: Internal error occurred. Refer to server log for more information.

Sudo? Or are these lack of permissions precisely the issue?