如何在CentOS 7上安装cbpolicyd

时间:2020-02-23 14:31:08  来源:igfitidea点击:

将介绍如何在CentOS 7.x上安装和启动cbpolicy并使其运行。好吧,覆盖安装Mariadb服务器的策略设置。

安装软件关联包:

在终端上执行以下命令:

yum install -y mariadb mariadb-server  perl-Cache-FastMmap perl-Config-IniFiles
systemctl enable mariadb
systemctl start mariadb

下载并安装策略性rpm软件包

wget https://download.policyd.org/v2.0.14/cluebringer-2.0.14-1.noarch.rpm
rpm -ivh cluebringer-2.0.14-1.noarch.rpm

下载cbpolicy源文件以设置数据库

wget https://download.policyd.org/v2.0.14/cluebringer-v2.0.14.zip
unzip cluebringer-v2.0.14.zip
cd cluebringer-v2.0.14
cd database

在数据库/中运行以下命令:

for i in core.tsql access_control.tsql quotas.tsql amavis.tsql checkhelo.tsql checkspf.tsql greylisting.tsql accounting.tsql; 
do
./convert-tsql mysql $i
done > policyd.sql

现在创建策略数据库

mysqladmin -u root -p create policyd

将policyd.mysql加载到数据库中,在本例中为MySQL:

sed -i 's/TYPE=InnoDB CHARACTER SET latin1 COLLATE latin1_bin//' policyd.sql
mysql -u root -ppassword policyd < policyd.sql

配置cbpolicyd数据库

sed -i 's/#Username=root/Username=root/'  /etc/policyd/cluebringer.conf
sed -i 's/#Password=/Password=Password'  /etc/policyd/cluebringer.conf

要设置cbpolicy UI,请将webui/*安装到apache目录中,签出includes/config.php并调整数据库详细信息。

设置Postfix以使用cbpolicyd。

在smtpd_recipient_restrictions和smtpd_end_of_data_restrictions两者中添加以下Postfix配置设置:

check_policy_service inet:127.0.0.1:10031

建议先添加这些参数,即:

smtpd_recipient_restrictions = check_policy_service inet:127.0.0.1:10031, permit_mynetworks, ..., ...