initial commit of file from CVS for smeserver-sendmail-wrapper on Sat Sep 7 21:04:04 AEST 2024
This commit is contained in:
parent
d2f8a76157
commit
a6b5501abf
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
*.rpm
|
||||||
|
*.log
|
||||||
|
*spec-20*
|
||||||
|
*.tgz
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Makefile for source rpm: smeserver-sendmail-wrapper
|
||||||
|
# $Id: Makefile,v 1.1 2021/11/07 02:45:48 jpp Exp $
|
||||||
|
NAME := smeserver-sendmail-wrapper
|
||||||
|
SPECFILE = $(firstword $(wildcard *.spec))
|
||||||
|
|
||||||
|
define find-makefile-common
|
||||||
|
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||||
|
|
||||||
|
ifeq ($(MAKEFILE_COMMON),)
|
||||||
|
# attept a checkout
|
||||||
|
define checkout-makefile-common
|
||||||
|
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||||
|
endif
|
||||||
|
|
||||||
|
include $(MAKEFILE_COMMON)
|
16
README.md
16
README.md
@ -1,3 +1,15 @@
|
|||||||
# smeserver-sendmail-wrapper
|
# <img src="https://www.koozali.org/images/koozali/Logo/Png/Koozali_logo_2016.png" width="25%" vertical="auto" style="vertical-align:bottom"> smeserver-sendmail-wrapper
|
||||||
|
|
||||||
SMEServer Koozali developed git repo for smeserver-sendmail-wrapper smecontribs
|
SMEServer Koozali developed git repo for smeserver-sendmail-wrapper smecontribs
|
||||||
|
|
||||||
|
## Wiki
|
||||||
|
<br />https://wiki.koozali.org/Sendmail-wrapper
|
||||||
|
|
||||||
|
## Bugzilla
|
||||||
|
Show list of outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=smeserver-sendmail-wrapper&product=SME%20Contribs&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
<br />*This description has been generated by an LLM AI system and cannot be relied on to be fully correct.*
|
||||||
|
*Once it has been checked, then this comment will be deleted*
|
||||||
|
<br />
|
||||||
|
1
contriborbase
Normal file
1
contriborbase
Normal file
@ -0,0 +1 @@
|
|||||||
|
contribs10
|
6
createlinks
Normal file
6
createlinks
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
use esmith::Build::CreateLinks qw(:all);
|
||||||
|
|
||||||
|
|
||||||
|
# create smeserver-sendmail-wrapper-ipdate event as link to
|
||||||
|
safe_symlink("webapps-update", "root/etc/e-smith/events/smeserver-sendmail-wrapper-update")
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
return ";sendmail-wrapper.pl disabled to enable do: config setprop php sendmail enabled" if ($php{sendmail} || 'enabled') eq "disabled" ;
|
||||||
|
my $mailog = $phpcur->prop(MailLog) || $php{"MailLog"} || "disabled";
|
||||||
|
|
||||||
|
$OUT= "# smeserver-sendmail-wrapper contrib\n";
|
||||||
|
$OUT= "mail.log= \"/var/log/sendmail/mail.log\"\n" if $mailog eq "disabled";
|
||||||
|
|
||||||
|
$OUT= "sendmail_path= \"/usr/bin/sendmail-wrapper.pl\"\n";
|
||||||
|
|
||||||
|
}
|
10
root/etc/logrotate.d/sendmail-wrapper
Normal file
10
root/etc/logrotate.d/sendmail-wrapper
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/var/log/sendmail/*.log {
|
||||||
|
missingok
|
||||||
|
notifempty
|
||||||
|
compress
|
||||||
|
weekly
|
||||||
|
rotate 5
|
||||||
|
create 0640 www www
|
||||||
|
su www www
|
||||||
|
}
|
||||||
|
|
76
root/usr/bin/sendmail-wrapper.pl
Executable file
76
root/usr/bin/sendmail-wrapper.pl
Executable file
@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# initial script from https://github.com/xtremespb/sendmail-wrapper
|
||||||
|
# MIT License (MIT) Copyright (c) 2015 Michael Matveev
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Net::SMTP;
|
||||||
|
use Email::Address;
|
||||||
|
use Email::MessageID;
|
||||||
|
use Email::Date::Format qw(email_date);
|
||||||
|
use Net::Domain qw(hostname hostfqdn hostdomain domainname);
|
||||||
|
|
||||||
|
my $user = getpwuid( $< );
|
||||||
|
my $smtp_password = 'password';
|
||||||
|
my $smtp_default_password = 'password';
|
||||||
|
my $server = hostdomain () || hostfqdn () || domainname () || 'localhost';
|
||||||
|
my $input = '';
|
||||||
|
my $to_string = '';
|
||||||
|
my $from_string = '';
|
||||||
|
my $subject = '';
|
||||||
|
my $messageID = '';
|
||||||
|
my $Date = '';
|
||||||
|
|
||||||
|
# improve here to be sure it is in headers !
|
||||||
|
# Email::Simple should do better !
|
||||||
|
foreach my $line ( <STDIN> ) {
|
||||||
|
$input .= $line;
|
||||||
|
if ($line =~ /^To:/i) {
|
||||||
|
$to_string = $line;#
|
||||||
|
}
|
||||||
|
if ($line =~ /^From:/i) {
|
||||||
|
$from_string = $line;
|
||||||
|
}
|
||||||
|
if ($line =~ /^Subject:/i) {
|
||||||
|
$subject = $line;
|
||||||
|
}
|
||||||
|
if ($line =~ /^Message-Id:/i) {
|
||||||
|
$messageID = $line;
|
||||||
|
}
|
||||||
|
if ($line =~ /^Date:/i) {
|
||||||
|
$Date = $line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# add header if missing
|
||||||
|
my $mid= Email::MessageID->new->in_brackets;
|
||||||
|
$input = "Message-ID: $mid\r\n$input" unless $messageID ne '';
|
||||||
|
|
||||||
|
# add date if missing
|
||||||
|
my $dateheader = email_date(time);
|
||||||
|
$input = "Date: $dateheader\r\n$input" unless $Date ne '';
|
||||||
|
|
||||||
|
#check destination
|
||||||
|
my @addrs = Email::Address->parse($to_string);
|
||||||
|
if (0+@addrs eq 0) {
|
||||||
|
die "No recipients";
|
||||||
|
}
|
||||||
|
|
||||||
|
for (my$index=0;$index<=$#addrs;$index++){
|
||||||
|
my $rec = $addrs[$index];
|
||||||
|
$rec=$rec->address;
|
||||||
|
|
||||||
|
my @fraddrs = Email::Address->parse($from_string);
|
||||||
|
my $frec = $user.'@'.$server;
|
||||||
|
$frec = $fraddrs[0]->address unless (0+@fraddrs eq 0) ;
|
||||||
|
|
||||||
|
|
||||||
|
my $smtp = Net::SMTP->new('127.0.0.1', Port => 25, Timeout => 10, Debug => 0);
|
||||||
|
die "Could not connect to qpsmtpd\n" unless $smtp;
|
||||||
|
$smtp->mail($frec);
|
||||||
|
$smtp->to($rec);
|
||||||
|
$smtp->data();
|
||||||
|
$smtp->datasend($input);
|
||||||
|
$smtp->dataend();
|
||||||
|
$smtp->quit;
|
||||||
|
}
|
0
root/var/log/sendmail/.gitignore
vendored
Normal file
0
root/var/log/sendmail/.gitignore
vendored
Normal file
77
smeserver-sendmail-wrapper.spec
Normal file
77
smeserver-sendmail-wrapper.spec
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
# $Id: smeserver-sendmail-wrapper.spec,v 1.4 2024/02/29 02:19:25 jpp Exp $
|
||||||
|
# Authority: unnilennium
|
||||||
|
# Name: Jean-Philippe Pialasse
|
||||||
|
|
||||||
|
Summary: smeserver-sendmail-wrapper
|
||||||
|
%define name smeserver-sendmail-wrapper
|
||||||
|
%define version 0.1
|
||||||
|
%define release 7
|
||||||
|
Name: %{name}
|
||||||
|
Version: %{version}
|
||||||
|
Release: %{release}%{?dist}
|
||||||
|
License: GPL
|
||||||
|
Group: Applications/System
|
||||||
|
Source: %{name}-%{version}.tar.xz
|
||||||
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-buildroot
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: e-smith-devtools >= 1.13.1-03
|
||||||
|
Requires: smeserver-release >= 9.0
|
||||||
|
|
||||||
|
%description
|
||||||
|
sendmail wrapper and templates to redirect php emails to qpsmtpd instead of qmail.
|
||||||
|
This is intended to introduce a little more verification before sending email thanks to the plugins of qpsmtpd instead of simply sending them blindly withthe qmail sendmail wrapper.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup
|
||||||
|
mkdir -p root/var/log/sendmail
|
||||||
|
|
||||||
|
rm -rf root/etc/e-smith/templates/opt
|
||||||
|
|
||||||
|
%build
|
||||||
|
/usr/bin/perl createlinks
|
||||||
|
|
||||||
|
%install
|
||||||
|
/bin/rm -rf $RPM_BUILD_ROOT
|
||||||
|
(cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT)
|
||||||
|
/bin/rm -f %{name}-%{version}-filelist
|
||||||
|
/sbin/e-smith/genfilelist $RPM_BUILD_ROOT \
|
||||||
|
| grep -v var/log/sendmail > %{name}-%{version}-filelist
|
||||||
|
|
||||||
|
%files -f %{name}-%{version}-filelist
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%attr( 770 , www,www) /var/log/sendmail
|
||||||
|
|
||||||
|
%clean
|
||||||
|
rm -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%post
|
||||||
|
touch /etc/hosts.deny_ssh
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Sat Sep 07 2024 cvs2git.sh aka Brian Read <brianr@koozali.org> 0.1-7.sme
|
||||||
|
- Roll up patches and move to git repo [SME: 12338]
|
||||||
|
|
||||||
|
* Sat Sep 07 2024 BogusDateBot
|
||||||
|
- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
|
||||||
|
by assuming the date is correct and changing the weekday.
|
||||||
|
|
||||||
|
* Wed Feb 28 2024 Jean-Philippe Pialasse <tests@pialasse.com> 0.1-6.sme
|
||||||
|
- fix missing su for logrotate [SME: 12495]
|
||||||
|
|
||||||
|
* Sat Nov 06 2021 Jean-Philippe Pialasse <tests@pialasse.com> 0.1-5.sme
|
||||||
|
- import to SME10 [SME: 11739]
|
||||||
|
|
||||||
|
* Tue Apr 07 2020 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-4.sme
|
||||||
|
- add php73 support [SME: 10737]
|
||||||
|
fix typo for php72
|
||||||
|
|
||||||
|
* Wed Mar 07 2018 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-3.sme
|
||||||
|
- fix error on logrotate [SME: 10525]
|
||||||
|
|
||||||
|
* Fri Mar 02 2018 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-2.sme
|
||||||
|
- fix log not accessible [SME: 10525]
|
||||||
|
moved to a www writable directory, also a logrotate has been added
|
||||||
|
- fix sendmail wrapper fails if not used by root
|
||||||
|
|
||||||
|
* Fri Aug 18 2017 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-1.sme
|
||||||
|
- Initial version
|
Loading…
Reference in New Issue
Block a user