[packages/exim-surbl] - initial

arekm arekm at pld-linux.org
Mon May 13 13:41:35 CEST 2019


commit 228a95e425cdcb8a4c1158304880f993601000d2
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Mon May 13 13:41:14 2019 +0200

    - initial

 config.patch           | 46 ++++++++++++++++++++++++++++++++++++++
 exim-surbl.spec        | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++
 path.patch             | 30 +++++++++++++++++++++++++
 public_resolvers.patch | 22 ++++++++++++++++++
 4 files changed, 158 insertions(+)
---
diff --git a/exim-surbl.spec b/exim-surbl.spec
new file mode 100644
index 0000000..14f590f
--- /dev/null
+++ b/exim-surbl.spec
@@ -0,0 +1,60 @@
+%include	/usr/lib/rpm/macros.perl
+Summary:	Blocking Spam in Exim with URI Block Lists
+Name:		exim-surbl
+Version:	2.3
+Release:	1
+License:	GPL
+Group:		Networking/Daemons/SMTP
+Source0:	https://www.teuton.org/~ejm/exim_surbl/exim_surbl-%{version}.tar.gz
+# Source0-md5:	fe23aad8d686ef9c48f9e82461a2f1bc
+Patch0:		path.patch
+Patch1:		config.patch
+Patch2:		public_resolvers.patch
+URL:		https://www.teuton.org/~ejm/exim_surbl/
+Requires:	exim
+Requires:	perl-Config-IniFiles
+Requires:	perl-Net-DNS
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This document describes using SURBL (Spam URI Realtime Blocklists),
+URIBL, and the Spamhaus DBL in conjunction with the Exim MTA to block
+spam containing "spamvertizing" URLs. To achieve this, one can use the
+Perl script that is found below. This utilizes Exim's MIME and/or DATA
+ACLs and Exim's embedded Perl engine.
+
+The Perl routine from this page should be relatively easy to modify to
+use in any other MTA that can call an external script to scan a
+message.
+
+%prep
+%setup -q -n exim_surbl-%{version}
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+install -d $RPM_BUILD_ROOT%{_datadir}/%{name}
+
+chmod 755 exim_surbl.pl
+cp -p exim_surbl.pl $RPM_BUILD_ROOT%{_datadir}/%{name}
+
+cp -p config.ini surbl_whitelist.txt three-level-tlds two-level-tlds $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README
+%dir %{_datadir}/%{name}
+%attr(755,root,root) %{_datadir}/%{name}/exim_surbl.pl
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/config.ini
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/surbl_whitelist.txt
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/three-level-tlds
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/two-level-tlds
diff --git a/config.patch b/config.patch
new file mode 100644
index 0000000..e682cc9
--- /dev/null
+++ b/config.patch
@@ -0,0 +1,46 @@
+diff -urN exim_surbl-2.3.org/config.ini exim_surbl-2.3/config.ini
+--- exim_surbl-2.3.org/config.ini	1970-01-01 01:00:00.000000000 +0100
++++ exim_surbl-2.3/config.ini	2019-05-13 13:26:40.581571134 +0200
+@@ -0,0 +1,5 @@
++[config]
++max_file_size = 50000
++surbl_enable = 1
++uribl_enable = 1
++dbl_enable = 1
+diff -urN exim_surbl-2.3.org/exim_surbl.pl exim_surbl-2.3/exim_surbl.pl
+--- exim_surbl-2.3.org/exim_surbl.pl	2019-05-13 13:28:21.937931916 +0200
++++ exim_surbl-2.3/exim_surbl.pl	2019-05-13 13:28:43.838583229 +0200
+@@ -20,9 +20,13 @@
+ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ 
++use Config::IniFiles;
++
+ sub surblspamcheck
+ {
+ 
++    my $cfg = new Config::IniFiles -file => '/etc/exim-surbl/config.ini';
++
+ # Designed and written by Erik Mugele, 2004-2010,1http://www.teuton.org/~ejm
+ # Version 2.3-beta
+ #
+@@ -56,14 +60,14 @@
+     # This variable defines the maximum MIME file size that will be checked
+     # if this script is called by the MIME ACL.  This is primarily to
+     # keep the load down on the server.  Size is in bytes.
+-    my $max_file_size = 50000;
++    my $max_file_size = $cfg->val('config', 'max_file_size', 50000);
+     
+     # The following ariables enable or disable the SURBL, URIBL and DBL
+     # lookups.  Set to 1 to enable and 0 to disable.
+-    my $surbl_enable = 1;
+-    my $uribl_enable = 1;
+-    my $dbl_enable = 1;
+-    
++    my $surbl_enable = $cfg->val('config', 'surbl_enable', 1);
++    my $uribl_enable = $cfg->val('config', 'uribl_enable', 1);
++    my $dbl_enable = $cfg->val('config', 'dbl_enable', 1);;
++
+     # Check to see if a decode MIME attachment is being checked or 
+     # just a plain old text message with no attachments
+     my $exim_body = "";
diff --git a/path.patch b/path.patch
new file mode 100644
index 0000000..7b1dbe9
--- /dev/null
+++ b/path.patch
@@ -0,0 +1,30 @@
+diff -urN exim_surbl-2.3.org/exim_surbl.pl exim_surbl-2.3/exim_surbl.pl
+--- exim_surbl-2.3.org/exim_surbl.pl	2012-03-07 04:16:45.000000000 +0100
++++ exim_surbl-2.3/exim_surbl.pl	2019-05-13 12:52:14.053011594 +0200
+@@ -35,7 +35,7 @@
+     # THIS VARIABLE MUST BE SET TO THE FULL PATH AND NAME OF THE FILE 
+     # CONTAINING THE TWO LEVEL TLD!
+     # ---------------------------------------------------------------------
+-    my $twotld_file = "/etc/exim/two-level-tlds";    
++    my $twotld_file = "/etc/exim-surbl/two-level-tlds";    
+     
+     # The following variable is the full path to the file containing the 
+     # three-level top level domains (TLD).
+@@ -43,7 +43,7 @@
+     # THIS VARIABLE MUST BE SET TO THE FULL PATH AND NAME OF THE FILE 
+     # CONTAINING THE THREE LEVEL TLD!
+     # ---------------------------------------------------------------------
+-    my $threetld_file = "/etc/exim/three-level-tlds";
++    my $threetld_file = "/etc/exim-surbl/three-level-tlds";
+ 
+     # The following variable is the full path to the file containing
+     # whitelist entries.  
+@@ -51,7 +51,7 @@
+     # THIS VARIABLE MUST BE SET TO THE FULL PATH AND NAME OF THE FILE 
+     # CONTAINING THE WHITELIST DOMAINS!
+     # ---------------------------------------------------------------------
+-    my $whitelist_file = "/etc/exim/surbl_whitelist.txt";
++    my $whitelist_file = "/etc/exim-surbl/surbl_whitelist.txt";
+     
+     # This variable defines the maximum MIME file size that will be checked
+     # if this script is called by the MIME ACL.  This is primarily to
diff --git a/public_resolvers.patch b/public_resolvers.patch
new file mode 100644
index 0000000..99042cb
--- /dev/null
+++ b/public_resolvers.patch
@@ -0,0 +1,22 @@
+diff -urN exim_surbl-2.3.org/exim_surbl.pl exim_surbl-2.3/exim_surbl.pl
+--- exim_surbl-2.3.org/exim_surbl.pl	2019-05-13 13:28:21.937931916 +0200
++++ exim_surbl-2.3/exim_surbl.pl	2019-05-13 13:36:33.962564434 +0200
+@@ -91,7 +91,17 @@
+         # the return message for the SURBL lookup.
+         my @params = @_;
+         my $surbldomain = ".multi.surbl.org";
+-        @dnsbladdr=gethostbyname($params[0].$surbldomain);
++	my $res = Net::DNS::Resolver->new(
++		nameservers => [qw(8.8.8.8 8.8.4.4, 1.1.1.1, 1.0.0.1)],
++	);
++	my $reply = $res->search(@params[0].$surbldomain);
++	if ($reply) {
++		foreach my $rr ($reply->answer) {
++			next unless $rr->type eq "A";
++			print $rr->address, "\n";
++			@dnsbladdr = $rr->address;
++		}
++	}
+         # If gethostbyname() returned anything, build a return message.
+         $return_string = "";
+         if (scalar(@dnsbladdr) != 0) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/exim-surbl.git/commitdiff/228a95e425cdcb8a4c1158304880f993601000d2



More information about the pld-cvs-commit mailing list