1

Topic: sql_force_change_password not work

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):
- Deployed with iRedMail Easy or the downloadable installer?
- Linux/BSD distribution name and version:
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):
- Web server (Apache or Nginx):
- Manage mail accounts with iRedAdmin-Pro?
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

iRedMail 1.6.0 MARIADB edition.
Deployed with iRedMail downloadable installer
Debian 11 (v. 5.10.0-16-cloud-amd64 64)
Store mail accounts with MySQL backend
Web server Nginx
Manage mail accounts with iRedAdmin-Pro
iRedAPD-5.0.4

user test (postmaster@alleata.it) with vmail.mailbox.passwordlastchange = 2020-05-05 00:00:00

in file /opt/iredapd/settings.py there are this settings:

plugins = ['sql_force_change_password', "reject_null_sender", "wblist_rdns", "reject_sender_login_mismatch", "greylisting", "throttle", "amavisd_wblist", "sql_alias_access_policy"]
CHANGE_PASSWORD_MESSAGE = 'Password expired or never changed, please change your password in (url of my server)before sending email'

relevant logs:
Jul 28 11:04:46 iredmail iredapd SQL to get mailbox.passwordlastchange of sender (postmaster@alleata.it): SELECT passwordlastchange FROM mailbox WHERE username='postmaster@alleat
a.it' LIMIT 1
Jul 28 11:04:46 iredmail iredapd Returned SQL Record: (datetime.datetime(2020, 5, 5, 0, 0),)
Jul 28 11:04:46 iredmail iredapd Date of password last change: 2020-05-05 00:00:00
Jul 28 11:04:46 iredmail iredapd Sender didn't change password in last 90 days.
Jul 28 11:04:46 iredmail iredapd <-- Result: None
Jul 28 11:04:46 iredmail iredapd Unexpected error: AttributeError("'NoneType' object has no attribute 'startswith'"). Fallback to default action: DUNNO
Jul 28 11:04:46 iredmail iredapd Session ended.


any ideas?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Stable release is out.

2

Re: sql_force_change_password not work

Could you please try this fix?
https://github.com/iredmail/iRedAPD/com … eb6e84c54f

3

Re: sql_force_change_password not work

Uhmm...with your patch the error is

Jul 28 14:47:13 iredmail iredapd --> Apply plugin: sql_force_change_password
Jul 28 14:47:13 iredmail iredapd SQL to get mailbox.passwordlastchange of sender (postmaster@alleata.it): SELECT passwordlastchange FROM mailbox WHERE username='postmaster@alleata.it' LIMIT 1
Jul 28 14:47:13 iredmail iredapd Returned SQL Record: (datetime.datetime(2020, 5, 5, 0, 0),)
Jul 28 14:47:13 iredmail iredapd Date of password last change: 2020-05-05 00:00:00
Jul 28 14:47:13 iredmail iredapd Sender didn't change password in last 90 days.
Jul 28 14:47:13 iredmail iredapd <!> Error while applying plugin 'sql_force_change_password': ['Traceback (most recent call last):\n', '  File "/opt/iRedAPD-5.0.4/libs/utils.py", line 90, in apply_plugin\n', '  File "/opt/iredapd/plugins/sql_force_change_password.py
", line 73, in restriction\n', "KeyError: 'REJECT Password expired or never changed, please change your password in (ulr removed) before sending email'\n"]
Jul 28 14:47:13 iredmail iredapd Session ended.
Jul 28 14:47:13 iredmail iredapd [127.0.0.1] RCPT, postmaster@alleata.it => claudio@bizzarri.net, DUNNO [sasl_username=postmaster@alleata.it, sender=postmaster@alleata.it, client_name=localhost, reverse_client_name=localhost, helo=localhost, encryption_protocol=TLSv
1.3, encryption_cipher=TLS_AES_256_GCM_SHA384, server_port=587, process_time=0.0438s]

But it works using

return reject_action

instead of

return SMTP_ACTIONS[reject_action]

Thank you!

Claudio

4

Re: sql_force_change_password not work

Oops, my mistake. Your "return reject_action" is correct. Fixed moment ago.