NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Trace

data/Dockerfiles/dovecot/quarantine_notify.py

Trace helps you understand code history line by line. See who changed each line, when it changed, and which commit introduced it.

quarantine_notify.py on main
Author Date Commit Line Code
zekeriya almost 7 years ago 8af9b5b

[Dovecot] Fixed quarantine_notify.py json decode error

Full commit hash
8af9b5b6d162adaa98c2b0e44e3b8213c3927088
Author
zekeriya <[email protected]>
Date
almost 7 years ago
Selected line
1
#!/usr/bin/python3
Open commit View diff
1 #!/usr/bin/python3
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
2
Open commit View diff
2
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
3
import smtplib
Open commit View diff
3 import smtplib
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
4
import os
Open commit View diff
4 import os
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
5
import sys
Open commit View diff
5 import sys
DerLinkman about 3 years ago accedf0

Updated mailcow Components to be ARM64 compatible

Full commit hash
accedf028003ad6f0511a41a8773562458038bed
Author
DerLinkman <[email protected]>
Date
about 3 years ago
Selected line
6
import MySQLdb
Open commit View diff
6 import MySQLdb
zekeriya almost 7 years ago b9e7d12

[Dovecot] notify scripts migrated to python3

Full commit hash
b9e7d12a5e2ba27ae60631dbb4b4846875df0fbc
Author
zekeriya <[email protected]>
Date
almost 7 years ago
Selected line
7
from email.mime.multipart import MIMEMultipart
Open commit View diff
7 from email.mime.multipart import MIMEMultipart
same change b9e7d12

[Dovecot] notify scripts migrated to python3

Full commit hash
b9e7d12a5e2ba27ae60631dbb4b4846875df0fbc
Author
zekeriya <[email protected]>
Date
almost 7 years ago
Selected line
8
from email.mime.text import MIMEText
Open commit View diff
8 from email.mime.text import MIMEText
same change b9e7d12

[Dovecot] notify scripts migrated to python3

Full commit hash
b9e7d12a5e2ba27ae60631dbb4b4846875df0fbc
Author
zekeriya <[email protected]>
Date
almost 7 years ago
Selected line
9
from email.utils import COMMASPACE, formatdate
Open commit View diff
9 from email.utils import COMMASPACE, formatdate
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
10
import jinja2
Open commit View diff
10 import jinja2
FreddleSpl0it about 1 year ago 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
11
from jinja2 import TemplateError
Open commit View diff
11 from jinja2 import TemplateError
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
12
from jinja2.sandbox import SandboxedEnvironment
Open commit View diff
12 from jinja2.sandbox import SandboxedEnvironment
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
13
import json
Open commit View diff
13 import json
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
14
import redis
Open commit View diff
14 import redis
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
15
import time
Open commit View diff
15 import time
andryyy over 7 years ago 2a5f641

[Dovecot] Derive text part in quota/quarantine notification mails from html

Full commit hash
2a5f6413fa11ffb9c0cb6b3e8c33ae38ecf523d7
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
16
import html2text
Open commit View diff
16 import html2text
andryyy over 7 years ago c438411

[Dovecot] Extend quarantine template: add score and release/delete buttons - depending on acl

Full commit hash
c438411a3d5fa4b168be1ba8d4c7f2a7a8ab60e5
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
17
import socket
Open commit View diff
17 import socket
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
18
Open commit View diff
18
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
19
pid = str(os.getpid())
Open commit View diff
19 pid = str(os.getpid())
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
20
pidfile = "/tmp/quarantine_notify.pid"
Open commit View diff
20 pidfile = "/tmp/quarantine_notify.pid"
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
21
Open commit View diff
21
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
22
if os.path.isfile(pidfile):
Open commit View diff
22 if os.path.isfile(pidfile):
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
23
  print("%s already exists, exiting" % (pidfile))
Open commit View diff
23 print("%s already exists, exiting" % (pidfile))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
24
  sys.exit()
Open commit View diff
24 sys.exit()
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
25
Open commit View diff
25
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
26
pid = str(os.getpid())
Open commit View diff
26 pid = str(os.getpid())
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
27
f = open(pidfile, 'w')
Open commit View diff
27 f = open(pidfile, 'w')
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
28
f.write(pid)
Open commit View diff
28 f.write(pid)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
29
f.close()
Open commit View diff
29 f.close()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
30
Open commit View diff
30
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
31
try:
Open commit View diff
31 try:
andryyy over 5 years ago 6c697f3

[Web, Quarantine] Allow to set the max score of a message up to which a quarantine notification will be sent

Full commit hash
6c697f3f3f1ad54c242a8f06748025ebc0e5dda1
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
32
Open commit View diff
32
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
33
  while True:
Open commit View diff
33 while True:
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
34
    try:
Open commit View diff
34 try:
FreddleSpl0it over 1 year ago 89fb132

Enable password protection for Redis

Full commit hash
89fb1322c6f486a9883e6435a73537b13fbf3582
Author
FreddleSpl0it <[email protected]>
Date
over 1 year ago
Selected line
35
      r = redis.StrictRedis(host='redis', decode_responses=True, port=6379, db=0, password=os.environ['REDISPASS'])
Open commit View diff
35 r = redis.StrictRedis(host='redis', decode_responses=True, port=6379, db=0, password=os.environ['REDISPASS'])
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
36
      r.ping()
Open commit View diff
36 r.ping()
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
37
    except Exception as ex:
Open commit View diff
37 except Exception as ex:
zekeriya almost 7 years ago b9e7d12

[Dovecot] notify scripts migrated to python3

Full commit hash
b9e7d12a5e2ba27ae60631dbb4b4846875df0fbc
Author
zekeriya <[email protected]>
Date
almost 7 years ago
Selected line
38
      print('%s - trying again...'  % (ex))
Open commit View diff
38 print('%s - trying again...' % (ex))
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
39
      time.sleep(3)
Open commit View diff
39 time.sleep(3)
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
40
    else:
Open commit View diff
40 else:
same change f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
41
      break
Open commit View diff
41 break
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
42
Open commit View diff
42
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
43
  time_now = int(time.time())
Open commit View diff
43 time_now = int(time.time())
andryyy over 5 years ago 971434d

[mailcow] Use ofelia instead of cron daemons (wip: remove init systems)

Full commit hash
971434ddd354a87208cbee87d399fc66be3e94ff
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
44
  mailcow_hostname = os.environ.get('MAILCOW_HOSTNAME')
Open commit View diff
44 mailcow_hostname = os.environ.get('MAILCOW_HOSTNAME')
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
45
Open commit View diff
45
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
46
  max_score = float(r.get('Q_MAX_SCORE') or "9999.0")
Open commit View diff
46 max_score = float(r.get('Q_MAX_SCORE') or "9999.0")
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
47
  if max_score == "":
Open commit View diff
47 if max_score == "":
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
48
    max_score = 9999.0
Open commit View diff
48 max_score = 9999.0
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
49
Open commit View diff
49
FreddleSpl0it 4 months ago 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
50
  def query_mysql(query, params = None, headers = True, update = False):
Open commit View diff
50 def query_mysql(query, params = None, headers = True, update = False):
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
51
    while True:
Open commit View diff
51 while True:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
52
      try:
Open commit View diff
52 try:
DerLinkman about 3 years ago accedf0

Updated mailcow Components to be ARM64 compatible

Full commit hash
accedf028003ad6f0511a41a8773562458038bed
Author
DerLinkman <[email protected]>
Date
about 3 years ago
Selected line
53
        cnx = MySQLdb.connect(user=os.environ.get('DBUSER'), password=os.environ.get('DBPASS'), database=os.environ.get('DBNAME'), charset="utf8mb4", collation="utf8mb4_general_ci")
Open commit View diff
53 cnx = MySQLdb.connect(user=os.environ.get('DBUSER'), password=os.environ.get('DBPASS'), database=os.environ.get('DBNAME'), charset="utf8mb4", collation="utf8mb4_general_ci")
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
54
      except Exception as ex:
Open commit View diff
54 except Exception as ex:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
55
        print('%s - trying again...'  % (ex))
Open commit View diff
55 print('%s - trying again...' % (ex))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
56
        time.sleep(3)
Open commit View diff
56 time.sleep(3)
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
57
      else:
Open commit View diff
57 else:
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
58
        break
Open commit View diff
58 break
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
59
    cur = cnx.cursor()
Open commit View diff
59 cur = cnx.cursor()
FreddleSpl0it 4 months ago 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
60
    if params:
Open commit View diff
60 if params:
same change 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
61
      cur.execute(query, params)
Open commit View diff
61 cur.execute(query, params)
same change 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
62
    else:
Open commit View diff
62 else:
same change 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
63
      cur.execute(query)
Open commit View diff
63 cur.execute(query)
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
64
    if not update:
Open commit View diff
64 if not update:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
65
      result = []
Open commit View diff
65 result = []
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
66
      columns = tuple( [d[0] for d in cur.description] )
Open commit View diff
66 columns = tuple( [d[0] for d in cur.description] )
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
67
      for row in cur:
Open commit View diff
67 for row in cur:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
68
        if headers:
Open commit View diff
68 if headers:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
69
          result.append(dict(list(zip(columns, row))))
Open commit View diff
69 result.append(dict(list(zip(columns, row))))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
70
        else:
Open commit View diff
70 else:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
71
          result.append(row)
Open commit View diff
71 result.append(row)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
72
      cur.close()
Open commit View diff
72 cur.close()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
73
      cnx.close()
Open commit View diff
73 cnx.close()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
74
      return result
Open commit View diff
74 return result
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
75
    else:
Open commit View diff
75 else:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
76
      cnx.commit()
Open commit View diff
76 cnx.commit()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
77
      cur.close()
Open commit View diff
77 cur.close()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
78
      cnx.close()
Open commit View diff
78 cnx.close()
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
79
Open commit View diff
79
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
80
  def notify_rcpt(rcpt, msg_count, quarantine_acl, category):
Open commit View diff
80 def notify_rcpt(rcpt, msg_count, quarantine_acl, category):
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
81
    if category == "add_header": category = "add header"
Open commit View diff
81 if category == "add_header": category = "add header"
FreddleSpl0it 4 months ago 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
82
    meta_query = query_mysql('SELECT `qhash`, id, subject, score, sender, created, action FROM quarantine WHERE notified = 0 AND rcpt = %s AND score < %s AND (action = %s OR "all" = %s)', (rcpt, max_score, category, category))
Open commit View diff
82 meta_query = query_mysql('SELECT `qhash`, id, subject, score, sender, created, action FROM quarantine WHERE notified = 0 AND rcpt = %s AND score < %s AND (action = %s OR "all" = %s)', (rcpt, max_score, category, category))
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
83
    print("%s: %d of %d messages qualify for notification" % (rcpt, len(meta_query), msg_count))
Open commit View diff
83 print("%s: %d of %d messages qualify for notification" % (rcpt, len(meta_query), msg_count))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
84
    if len(meta_query) == 0:
Open commit View diff
84 if len(meta_query) == 0:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
85
      return
Open commit View diff
85 return
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
86
    msg_count = len(meta_query)
Open commit View diff
86 msg_count = len(meta_query)
FreddleSpl0it about 1 year ago 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
87
    env = SandboxedEnvironment()
Open commit View diff
87 env = SandboxedEnvironment()
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
88
    if r.get('Q_HTML'):
Open commit View diff
88 if r.get('Q_HTML'):
FreddleSpl0it about 1 year ago 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
89
        try:
Open commit View diff
89 try:
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
90
            template = env.from_string(r.get('Q_HTML'))
Open commit View diff
90 template = env.from_string(r.get('Q_HTML'))
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
91
        except Exception:
Open commit View diff
91 except Exception:
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
92
            print("Error: Cannot parse quarantine template, falling back to default template.")
Open commit View diff
92 print("Error: Cannot parse quarantine template, falling back to default template.")
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
93
            with open('/templates/quarantine.tpl') as file_:
Open commit View diff
93 with open('/templates/quarantine.tpl') as file_:
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
94
                template = env.from_string(file_.read())
Open commit View diff
94 template = env.from_string(file_.read())
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
95
    else:
Open commit View diff
95 else:
FreddleSpl0it about 1 year ago 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
96
        with open('/templates/quarantine.tpl') as file_:
Open commit View diff
96 with open('/templates/quarantine.tpl') as file_:
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
97
            template = env.from_string(file_.read())
Open commit View diff
97 template = env.from_string(file_.read())
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
98
    try:
Open commit View diff
98 try:
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
99
        html = template.render(meta=meta_query, username=rcpt, counter=msg_count, hostname=mailcow_hostname, quarantine_acl=quarantine_acl)
Open commit View diff
99 html = template.render(meta=meta_query, username=rcpt, counter=msg_count, hostname=mailcow_hostname, quarantine_acl=quarantine_acl)
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
100
    except (jinja2.exceptions.SecurityError, TemplateError) as ex:
Open commit View diff
100 except (jinja2.exceptions.SecurityError, TemplateError) as ex:
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
101
        print(f"SecurityError or TemplateError in template rendering: {ex}")
Open commit View diff
101 print(f"SecurityError or TemplateError in template rendering: {ex}")
same change 2fbbbbe

[Dovecot] Use Jinja2 sandbox for rendering quota and quarantine notifications

Full commit hash
2fbbbbe9a981ed90834ee838016a3842915a00bd
Author
FreddleSpl0it <[email protected]>
Date
about 1 year ago
Selected line
102
        return
Open commit View diff
102 return
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
103
    text = html2text.html2text(html)
Open commit View diff
103 text = html2text.html2text(html)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
104
    count = 0
Open commit View diff
104 count = 0
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
105
    while count < 15:
Open commit View diff
105 while count < 15:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
106
      count += 1
Open commit View diff
106 count += 1
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
107
      try:
Open commit View diff
107 try:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
108
        server = smtplib.SMTP('postfix', 590, 'quarantine')
Open commit View diff
108 server = smtplib.SMTP('postfix', 590, 'quarantine')
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
109
        server.ehlo()
Open commit View diff
109 server.ehlo()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
110
        msg = MIMEMultipart('alternative')
Open commit View diff
110 msg = MIMEMultipart('alternative')
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
111
        msg_from = r.get('Q_SENDER') or "quarantine@localhost"
Open commit View diff
111 msg_from = r.get('Q_SENDER') or "quarantine@localhost"
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
112
        # Remove non-ascii chars from field
Open commit View diff
112 # Remove non-ascii chars from field
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
113
        msg['From'] = ''.join([i if ord(i) < 128 else '' for i in msg_from])
Open commit View diff
113 msg['From'] = ''.join([i if ord(i) < 128 else '' for i in msg_from])
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
114
        msg['Subject'] = r.get('Q_SUBJ') or "Spam Quarantine Notification"
Open commit View diff
114 msg['Subject'] = r.get('Q_SUBJ') or "Spam Quarantine Notification"
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
115
        msg['Date'] = formatdate(localtime = True)
Open commit View diff
115 msg['Date'] = formatdate(localtime = True)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
116
        text_part = MIMEText(text, 'plain', 'utf-8')
Open commit View diff
116 text_part = MIMEText(text, 'plain', 'utf-8')
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
117
        html_part = MIMEText(html, 'html', 'utf-8')
Open commit View diff
117 html_part = MIMEText(html, 'html', 'utf-8')
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
118
        msg.attach(text_part)
Open commit View diff
118 msg.attach(text_part)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
119
        msg.attach(html_part)
Open commit View diff
119 msg.attach(html_part)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
120
        msg['To'] = str(rcpt)
Open commit View diff
120 msg['To'] = str(rcpt)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
121
        bcc = r.get('Q_BCC') or ""
Open commit View diff
121 bcc = r.get('Q_BCC') or ""
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
122
        redirect = r.get('Q_REDIRECT') or ""
Open commit View diff
122 redirect = r.get('Q_REDIRECT') or ""
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
123
        text = msg.as_string()
Open commit View diff
123 text = msg.as_string()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
124
        if bcc == '':
Open commit View diff
124 if bcc == '':
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
125
          if redirect == '':
Open commit View diff
125 if redirect == '':
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
126
            server.sendmail(msg['From'], str(rcpt), text)
Open commit View diff
126 server.sendmail(msg['From'], str(rcpt), text)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
127
          else:
Open commit View diff
127 else:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
128
            server.sendmail(msg['From'], str(redirect), text)
Open commit View diff
128 server.sendmail(msg['From'], str(redirect), text)
andryyy about 6 years ago 6c92688

[Quarantine] Allow to redirect all quarantine messages to a specific address

Full commit hash
6c92688ff682e9e2b7ef1cea64dc8c7369f0702f
Author
andryyy <[email protected]>
Date
about 6 years ago
Selected line
129
        else:
Open commit View diff
129 else:
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
130
          if redirect == '':
Open commit View diff
130 if redirect == '':
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
131
            server.sendmail(msg['From'], [str(rcpt)] + [str(bcc)], text)
Open commit View diff
131 server.sendmail(msg['From'], [str(rcpt)] + [str(bcc)], text)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
132
          else:
Open commit View diff
132 else:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
133
            server.sendmail(msg['From'], [str(redirect)] + [str(bcc)], text)
Open commit View diff
133 server.sendmail(msg['From'], [str(redirect)] + [str(bcc)], text)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
134
        server.quit()
Open commit View diff
134 server.quit()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
135
        for res in meta_query:
Open commit View diff
135 for res in meta_query:
FreddleSpl0it 4 months ago 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
136
         query_mysql('UPDATE quarantine SET notified = 1 WHERE id = %s', (res['id'],), update = True)
Open commit View diff
136 query_mysql('UPDATE quarantine SET notified = 1 WHERE id = %s', (res['id'],), update = True)
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
137
        r.hset('Q_LAST_NOTIFIED', record['rcpt'], time_now)
Open commit View diff
137 r.hset('Q_LAST_NOTIFIED', record['rcpt'], time_now)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
138
        break
Open commit View diff
138 break
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
139
      except Exception as ex:
Open commit View diff
139 except Exception as ex:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
140
        server.quit()
Open commit View diff
140 server.quit()
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
141
        print('%s'  % (ex))
Open commit View diff
141 print('%s' % (ex))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
142
        time.sleep(3)
Open commit View diff
142 time.sleep(3)
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
143
Open commit View diff
143
FreddleSpl0it 4 months ago 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
144
  records = query_mysql('SELECT IFNULL(user_acl.quarantine, 0) AS quarantine_acl, count(id) AS counter, rcpt FROM quarantine LEFT OUTER JOIN user_acl ON user_acl.username = rcpt WHERE notified = 0 AND score < %s AND rcpt in (SELECT username FROM mailbox) GROUP BY rcpt', (max_score,))
Open commit View diff
144 records = query_mysql('SELECT IFNULL(user_acl.quarantine, 0) AS quarantine_acl, count(id) AS counter, rcpt FROM quarantine LEFT OUTER JOIN user_acl ON user_acl.username = rcpt WHERE notified = 0 AND score < %s AND rcpt in (SELECT username FROM mailbox) GROUP BY rcpt', (max_score,))
andryyy over 7 years ago f493d3a

[Dovecot] Simplify Docker image

Full commit hash
f493d3a9576905371c09dbfb73c6d5b0ae32ab31
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
145
Open commit View diff
145
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
146
  for record in records:
Open commit View diff
146 for record in records:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
147
    attrs = ''
Open commit View diff
147 attrs = ''
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
148
    attrs_json = ''
Open commit View diff
148 attrs_json = ''
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
149
    time_trans = {
Open commit View diff
149 time_trans = {
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
150
      "hourly": 3600,
Open commit View diff
150 "hourly": 3600,
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
151
      "daily": 86400,
Open commit View diff
151 "daily": 86400,
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
152
      "weekly": 604800
Open commit View diff
152 "weekly": 604800
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
153
    }
Open commit View diff
153 }
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
154
    try:
Open commit View diff
154 try:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
155
      last_notification = int(r.hget('Q_LAST_NOTIFIED', record['rcpt']))
Open commit View diff
155 last_notification = int(r.hget('Q_LAST_NOTIFIED', record['rcpt']))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
156
      if last_notification > time_now:
Open commit View diff
156 if last_notification > time_now:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
157
        print('Last notification is > time now, assuming never')
Open commit View diff
157 print('Last notification is > time now, assuming never')
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
158
        last_notification = 0
Open commit View diff
158 last_notification = 0
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
159
    except Exception as ex:
Open commit View diff
159 except Exception as ex:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
160
      print('Could not determine last notification for %s, assuming never' % (record['rcpt']))
Open commit View diff
160 print('Could not determine last notification for %s, assuming never' % (record['rcpt']))
andryyy over 7 years ago c7c1422

[Dovecot] Add quota_notify script

Full commit hash
c7c1422095a90d840e349f73bc64b0bda5ff5736
Author
andryyy <[email protected]>
Date
over 7 years ago
Selected line
161
      last_notification = 0
Open commit View diff
161 last_notification = 0
FreddleSpl0it 4 months ago 5a00b51

[Web][Dovecot] Add parameterized queries and input validation for quarantine_category

Full commit hash
5a00b5124b58c4399b6320270947683efb080e89
Author
FreddleSpl0it <[email protected]>
Date
4 months ago
Selected line
162
    attrs_json = query_mysql('SELECT attributes FROM mailbox WHERE username = %s', (record['rcpt'],))
Open commit View diff
162 attrs_json = query_mysql('SELECT attributes FROM mailbox WHERE username = %s', (record['rcpt'],))
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
163
    attrs = attrs_json[0]['attributes']
Open commit View diff
163 attrs = attrs_json[0]['attributes']
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
164
    if isinstance(attrs, str):
Open commit View diff
164 if isinstance(attrs, str):
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
165
      # if attr is str then just load it
Open commit View diff
165 # if attr is str then just load it
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
166
      attrs = json.loads(attrs)
Open commit View diff
166 attrs = json.loads(attrs)
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
167
    else:
Open commit View diff
167 else:
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
168
      # if it's bytes then decode and load it
Open commit View diff
168 # if it's bytes then decode and load it
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
169
      attrs = json.loads(attrs.decode('utf-8'))
Open commit View diff
169 attrs = json.loads(attrs.decode('utf-8'))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
170
    if attrs['quarantine_notification'] not in ('hourly', 'daily', 'weekly'):
Open commit View diff
170 if attrs['quarantine_notification'] not in ('hourly', 'daily', 'weekly'):
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
171
      continue
Open commit View diff
171 continue
Michael Gerdemann over 4 years ago b1314bd

[dovecot] Fix delayed quarantine notification (#4470)

Full commit hash
b1314bd9a3f7b03188f34ba327a813e50b98370b
Author
Michael Gerdemann <[email protected]>
Date
over 4 years ago
Selected line
172
    if last_notification == 0 or (last_notification + time_trans[attrs['quarantine_notification']]) <= time_now:
Open commit View diff
172 if last_notification == 0 or (last_notification + time_trans[attrs['quarantine_notification']]) <= time_now:
andryyy over 5 years ago 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
173
      print("Notifying %s: Considering %d new items in quarantine (policy: %s)" % (record['rcpt'], record['counter'], attrs['quarantine_notification']))
Open commit View diff
173 print("Notifying %s: Considering %d new items in quarantine (policy: %s)" % (record['rcpt'], record['counter'], attrs['quarantine_notification']))
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
174
      notify_rcpt(record['rcpt'], record['counter'], record['quarantine_acl'], attrs['quarantine_category'])
Open commit View diff
174 notify_rcpt(record['rcpt'], record['counter'], record['quarantine_acl'], attrs['quarantine_category'])
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
175
Open commit View diff
175
same change 410cb55

[Dovecot] Check if quarantine_notify.py holds a lock

Full commit hash
410cb558eeffd000fef64cb87b7ae63434793126
Author
andryyy <[email protected]>
Date
over 5 years ago
Selected line
176
finally:
Open commit View diff
176 finally:
Peter almost 4 years ago 852bf75

Use utf8mb4 charset and utf8mb4_general_ci collation

Full commit hash
852bf750cac27e3a4aa182189aae8e3082b8efff
Author
Peter <[email protected]>
Date
almost 4 years ago
Selected line
177
  os.unlink(pidfile)
Open commit View diff
177 os.unlink(pidfile)