# # SPEC file for guardian-milter # # Noumenia (C) 2019 www.noumenia.gr # # License: GPLv3 # https://opensource.org/license/gpl-3-0/ # %global gitlab_owner noumenia %global gitlab_name guardian-milter %global gitlab_version 1.9 %global gitlab_commit 82cf3780100255c32679623d82ebfe2f562a9bae %global composer_vendor noumenia %global composer_project guardian-milter # "php": ">=8.0.0" %global php_min_ver 8.0.0 %{!?phpdir: %global phpdir %{_datadir}/php} %{!?licensedir: %global licensedir %{_datadir}/licenses} Name: %{gitlab_name} Version: %{gitlab_version} Release: 1%{?dist} Summary: Multi-purpose security milter. License: GPLv3 URL: https://gitlab.com/noumenia/guardian-milter Source0: %{name}-%{gitlab_version}-%{gitlab_commit}.tar.gz BuildArch: noarch # required for the _unitdir macro BuildRequires: systemd-rpm-macros # composer.json Requires: php(language) >= %{php_min_ver} Requires: php-iconv Requires: php-posix Requires: php-sockets Requires: libMilterPHP # composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description Guardian-milter is a Postfix/Sendmail milter for filtering various types of fake, phishing and spam emails. The milter executes highly crafted checks and marks incoming emails with a pass/fail header or rejects them during the SMTP dialogue. Features - Run regular expressions against the HELO/EHLO string - Detect phishing emails based on From/Subject - Detect fake WeTransfer emails - Detect fake banking emails - Save failed emails in JSON format - Remove the name part of the From: header %prep %setup -qn %{gitlab_name}-%{gitlab_commit} %install # systemd service mkdir -p %{buildroot}%{_unitdir}/ cp -rp guardian-milter.service %{buildroot}%{_unitdir}/ chmod 0644 %{buildroot}%{_unitdir}/guardian-milter.service # the daemon executable mkdir -p %{buildroot}%{_sbindir}/ cp -rp guardian-milter %{buildroot}%{_sbindir}/ # the ini file mkdir -p %{buildroot}%{_sysconfdir}/ cp -rp gu-milter.ini %{buildroot}%{_sysconfdir}/ # libraries mkdir -p %{buildroot}%{phpdir}/%{name}/ cp -rp controller %{buildroot}%{phpdir}/%{name}/ cp -rp interface %{buildroot}%{phpdir}/%{name}/ cp -rp library %{buildroot}%{phpdir}/%{name}/ # documentation mkdir -p %{buildroot}%{_docdir}/%{name}/ cp -rp CHANGELOG.md %{buildroot}%{_docdir}/%{name}/ cp -rp composer.json %{buildroot}%{_docdir}/%{name}/ cp -rp README.md %{buildroot}%{_docdir}/%{name}/ # license mkdir -p %{buildroot}%{licensedir}/%{name}/ cp -rp LICENSE %{buildroot}%{licensedir}/%{name}/ # run directory mkdir -p %{buildroot}%{_rundir}/gu-milter %pre # group getent group gu-milter >/dev/null || groupadd -r gu-milter # user getent passwd gu-milter >/dev/null || useradd -r -g gu-milter -d "/run/gu-milter" -M -s /sbin/nologin -c "guardian-milter daemon" gu-milter exit 0 %post if [ $1 -eq 1 ]; then # initial installation systemctl daemon-reload &>/dev/null || : systemctl preset guardian-milter.service &>/dev/null || : fi %preun if [ $1 -eq 0 ]; then # package removal, not upgrade systemctl --no-reload disable guardian-milter.service &>/dev/null || : systemctl stop guardian-milter.service &>/dev/null || : userdel gu-milter fi %postun systemctl daemon-reload &>/dev/null || : if [ $1 -ge 1 ]; then # package upgrade, not uninstall systemctl try-restart guardian-milter.service &>/dev/null || : fi %files # default attributes %defattr(644,root,root,755) # license %license LICENSE # docs %doc CHANGELOG.md README.md composer.json # library %{phpdir}/guardian-milter/ # executable %attr(0755,root,root) %{_sbindir}/guardian-milter # the ini file %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/gu-milter.ini # systemd service %attr(0644,root,root) %{_unitdir}/guardian-milter.service # run directory %dir %attr(0755,gu-milter,gu-milter) %{_rundir}/gu-milter %changelog * Mon Sep 18 2023 Maria Ksanthi - 1.1-1 - Initial package