在python3中实现的后缀速率限制策略服务器。
policyd-rate-limit的Python项目详细描述
安装
首先,创建将运行后台程序的用户:
adduser --system --group --home /run/policyd-rate-limit --no-create-home policyd-rate-limit
由于版本是0.6.0,配置文件是使用yaml编写的,因此您需要 包装:
- pyyaml ( sudo apt get 在类似debian的系统上安装 python3 yaml )
根据您计划使用的后端存储,可能需要安装其他软件包。 (默认设置使用sqlite3 bakends,不需要额外的包)。
- mysqldb ( sudo apt get 在类似debian的系统上安装python3 mysqldb )用于mysql后端。
- psycopg2 ( sudo apt get 在类似debian的系统上安装python3-psycopg2 )用于postgresql后端
使用pip安装:
sudo pip3 install policyd-rate-limit
或源代码:
sudo make install
这将安装 policyd_rate_limit 模块和 policyd rate limit 二进制文件, 如果文件不存在,则将默认配置复制到 /etc/policyd rate limit.conf, 将init脚本复制到 /etc/init.d/policyd rate limit 并将一个单元文件复制到 /etc/systemd/system/policyd速率限制。服务
安装完成后,您可能需要运行sudo systemctl 后台程序重新加载 系统显示的文件。
您应该定期运行policyd rate limit来删除 数据库。把它放在每日cron中可能是明智的,例如:
0 0 * * * policyd-rate-limit /usr/local/bin/policyd-rate-limit --clean >/dev/null