Coverage for policyd_rate_limit/config.py: 100%
31 statements
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-27 09:19 +0000
« prev ^ index » next coverage.py v7.3.0, created at 2023-08-27 09:19 +0000
1# This program is distributed in the hope that it will be useful, but WITHOUT
2# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
3# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
4# more details.
5#
6# You should have received a copy of the GNU General Public License version 3
7# along with this program; if not, write to the Free Software Foundation, Inc., 51
8# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
9#
10# (c) 2015-2016 Valentin Samir
11from policyd_rate_limit.const import SQLITE_DB, MYSQL_DB, PGSQL_DB # noqa: F401
13debug = True
15user = "policyd-rate-limit"
16group = "policyd-rate-limit"
17pidfile = "/var/run/policyd-rate-limit/policyd-rate-limit.pid"
19mysql_config = {
20 "user": "username",
21 "passwd": "*****",
22 "db": "database",
23 "host": "localhost",
24 "charset": 'utf8',
25}
27sqlite_config = {
28 "database": "/var/lib/policyd-rate-limit/db.sqlite3",
29}
31pgsql_config = {
32 "database": "database",
33 "user": "username",
34 "password": "*****",
35 "host": "localhost",
36}
38backend = SQLITE_DB
40# SOCKET=("127.0.0.1", 8552)
41SOCKET = "/var/spool/postfix/ratelimit/policy"
42socket_permission = 0o666
44# list of (number of mails, number of seconds)
45limits = [
46 (10, 60), # limit to 10 mails by minutes
47 (150, 86400), # limits to 150 mails by days
48]
50# dict of id -> limit list. Used to override limits and use custom limits for
51# a particular id. Use an empty list for no limits for a particular id.
52# ids are sasl usernames or ip addresses
53limits_by_id = {}
55limit_by_sasl = True
56limit_by_sender = False
57limit_by_ip = False
59limited_networks = []
61# actions return to postfix, see http://www.postfix.org/access.5.html for a list of actions.
62success_action = "dunno"
63fail_action = "defer_if_permit Rate limit reach, retry later"
64# action to return to postfix when we are unable to contect the database backend
65db_error_action = "dunno"
68# if True, send a report to report_email about users reaching limits each time --clean is called
69report = False
70# from who to send emails reports
71report_from = None
72# address to send emails reports to. It can be a single email or a list of emails
73report_to = None
74# subject of the report email
75report_subject = "policyd-rate-limit report"
76# add number of seconds from the limits list for which you want to be reported
77report_limits = [86400]
78# only send a report if some users have reach a reported limit
79report_only_if_needed = True
81# The smtp server to use to send emails (host, port)
82smtp_server = ("localhost", 25)
83# Should we use starttls (you should set this to True if you use smtp_credentials)
84smtp_starttls = False
85# Should we use credentials to connect to smtp_server ? if yes set ("user", "password"), else None
86smtp_credentials = None
88# The time in seconds before an unused socket gets closed
89delay_to_close = 300
91# count mode. 0 for RCPT, 1 for DATA
92count_mode = 0