Score:0

policy-rate-limit "insert id" is not working

ge flag

I installed policyd-rate-limit from ubuntu aptitude package manager
my distro is: ubuntu 22.04 server TLS on AWS
policy-rate-limit "version": 1.0.1.1-2
I provided mysql database details in configuration file I found in: /etc/policyd-rate-limit.yaml
and was sure mysql is selected in the variable backend: 1
then configured postfix (version 3.6.4-1ubuntu1.1) to use it as smtpd_client_restriction
I created a database according to "Rust" docs pages here due to the sad lack of official documentation for policy-rate-limit
I sent a test email and /var/log/syslog has this:

Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: connection from
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: request=smtpd_access_policy
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: protocol_state=RCPT
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: protocol_name=ESMTP
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: client_address=***.***.***.***
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: client_name=****************
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: client_port=27370
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: reverse_client_name=****************
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: server_address=***.***.***.***
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: server_port=587
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: helo_name=smtpclient.apple
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: sender=****************
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: recipient=****************
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: recipient_count=0
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: queue_id=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: instance=2300.64da7642.a2eda.0
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: size=0
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: etrn_domain=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: stress=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: sasl_method=PLAIN
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: sasl_username=****************
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: sasl_sender=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: ccert_subject=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: ccert_issuer=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: ccert_fingerprint=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: ccert_pubkey_fingerprint=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: encryption_protocol=TLSv1.2
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: encryption_cipher=ECDHE-RSA-AES256-GCM-SHA384
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: encryption_keysize=256
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: policy_context=
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: 000/010 hit since 60s
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: 000/150 hit since 86400s
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: insert id **********@my-domain.com
Aug 14 18:45:22 AWS-EC2 policyd-rate-limit[8782]: action=dunno

so I can see insert id **********@my-domain.com but when I go check the database, nothing is there as I expected!
I remembber when installing policy-rate-limit, I had also these lines:

Suggested packages:
  python3-mysqldb python3-psycopg2
...
/usr/lib/python3/dist-packages/policyd_rate_limit/utils.py:88: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
self._config = yaml.load(f)
You need to install the python3 module MySQLdb to use the mysql backend

but the thing is am not using policy-rate-limit from python nor I installed it from pip. am using a standalone.
I don't want to set users limits from config files. I need mysql database for it. and installing mysql for python is so much troublesome, as I have python 3.10 from pyenv. and it has dependcy issue that can't be fixed using all workarounds I found

UPDATE:
I deleted the database table per Rust doc page. I no longer get the missing mysql error when running policyd-rate-limit --clean
after following pip instructions sudo apt-get install python3-mysqldb I had to convert the file in /var/lib/policyd-rate-limit/db.sqlite3 to mysql and run it, that created the correct database table needed called "mail_count".
I also temporarily enabled reporting in config file, and it also created another table called "limit_report"
now --clean flag runs like charm.
but still, the "insert" doesn't put anything in the database as I expect. (or are my expectations wrong ?)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.