mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
run removal of inactive users daily
This commit is contained in:
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## untagged
|
## untagged
|
||||||
|
|
||||||
|
- BREAKING: new required chatmail.ini value 'delete_inactive_users_after = 25'
|
||||||
|
which removes users from database and mails after 25 days without any login.
|
||||||
|
|
||||||
- remove checking of reverse-DNS PTR records. Chatmail-servers don't
|
- remove checking of reverse-DNS PTR records. Chatmail-servers don't
|
||||||
depend on it and even in the wider e-mail system it's not common anymore.
|
depend on it and even in the wider e-mail system it's not common anymore.
|
||||||
If it's an issue, a chatmail operator can still care to properly set reverse DNS.
|
If it's an issue, a chatmail operator can still care to properly set reverse DNS.
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ chatmail-metadata = "chatmaild.metadata:main"
|
|||||||
filtermail = "chatmaild.filtermail:main"
|
filtermail = "chatmaild.filtermail:main"
|
||||||
echobot = "chatmaild.echo:main"
|
echobot = "chatmaild.echo:main"
|
||||||
chatmail-metrics = "chatmaild.metrics:main"
|
chatmail-metrics = "chatmaild.metrics:main"
|
||||||
|
delete_inactive_users = "chatmaild.delete_inactive_users:main"
|
||||||
|
|
||||||
[project.entry-points.pytest11]
|
[project.entry-points.pytest11]
|
||||||
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import iniconfig
|
|||||||
|
|
||||||
|
|
||||||
def read_config(inipath, mail_basedir=None):
|
def read_config(inipath, mail_basedir=None):
|
||||||
|
assert Path(inipath).exists(), inipath
|
||||||
cfg = iniconfig.IniConfig(inipath)
|
cfg = iniconfig.IniConfig(inipath)
|
||||||
params = cfg.sections["params"]
|
params = cfg.sections["params"]
|
||||||
if mail_basedir is None:
|
if mail_basedir is None:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
"""
|
"""
|
||||||
Remove old user accounts
|
Remove inactive users
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ mail_domain = {mail_domain}
|
|||||||
#
|
#
|
||||||
|
|
||||||
#
|
#
|
||||||
# Restrictions on user addresses
|
# Restrictions on user addresses
|
||||||
#
|
#
|
||||||
|
|
||||||
# how many mails a user can send out per minute
|
# how many mails a user can send out per minute
|
||||||
@@ -20,7 +20,7 @@ max_mailbox_size = 100M
|
|||||||
# days after which mails are unconditionally deleted
|
# days after which mails are unconditionally deleted
|
||||||
delete_mails_after = 20
|
delete_mails_after = 20
|
||||||
|
|
||||||
# days after which users without a login are deleted (database and mails)
|
# days after which users without a login are deleted (database and mails)
|
||||||
delete_inactive_users_after = 25
|
delete_inactive_users_after = 25
|
||||||
|
|
||||||
# minimum length a username must have
|
# minimum length a username must have
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from time import time as now
|
from time import time as now
|
||||||
|
|
||||||
from chatmaild.doveauth import lookup_passdb
|
|
||||||
from chatmaild.delete_inactive_users import delete_inactive_users
|
from chatmaild.delete_inactive_users import delete_inactive_users
|
||||||
|
from chatmaild.doveauth import lookup_passdb
|
||||||
|
|
||||||
|
|
||||||
def test_remove_stale_users(db, example_config):
|
def test_remove_stale_users(db, example_config):
|
||||||
|
|||||||
@@ -9,3 +9,4 @@
|
|||||||
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
||||||
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/.*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
2 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -path '*/.*/tmp/*' -mtime +{{ config.delete_mails_after }} -type f -delete
|
||||||
3 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -name 'maildirsize' -type f -delete
|
3 0 * * * vmail find /home/vmail/mail/{{ config.mail_domain }} -name 'maildirsize' -type f -delete
|
||||||
|
4 0 * * * vmail /usr/local/lib/chatmaild/venv/bin/delete_inactive_users /home/vmail/passdb.lite /usr/local/lib/chatmaild/chatmail.ini
|
||||||
|
|||||||
Reference in New Issue
Block a user