initial commit of file from CVS for e-smith-email on Wed 12 Jul 08:53:55 BST 2023

This commit is contained in:
Brian Read
2023-07-12 08:53:55 +01:00
parent 3e32600b26
commit 7b4659df54
267 changed files with 10708 additions and 2 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
{
return "set hostname=$DomainName";
}

View File

@@ -0,0 +1 @@
set folder=imaps://localhost/

View File

@@ -0,0 +1 @@
set spoolfile=imaps://localhost/INBOX

View File

@@ -0,0 +1,130 @@
{
$OUT = '';
my $status = $fetchmail{"status"};
if (defined $status && $status eq "enabled")
{
my $method = $fetchmail{'Method'};
if (($method eq 'etrn') || ($method eq 'multidrop'))
{
$OUT .= "\n";
$OUT .= "# fetchmail times during office hours\n";
$OUT .= "\n";
my $FetchmailFreqOffice = $fetchmail{'FreqOffice'};
if ($FetchmailFreqOffice)
{
if ($FetchmailFreqOffice eq 'every5min')
{
$OUT .= "*/5\t8-17\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOffice eq 'every15min')
{
$OUT .= "*/15\t8-17\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOffice eq 'every30min')
{
$OUT .= "*/30\t8-17\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOffice eq 'everyhour')
{
$OUT .= "0\t8-17\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOffice eq 'every2hrs')
{
$OUT .= "0\t8-17/2\t*\t*\t1-5\troot\t/etc/startmail\n";
}
else
{
$OUT .= "# FetchmailFreqOffice - never\n";
}
}
else
{
$OUT .= "# FetchmailFreqOffice - not defined\n";
}
$OUT .= "\n";
$OUT .= "# fetchmail times outside office hours\n";
$OUT .= "\n";
my $FetchmailFreqOutside = $fetchmail{'FreqOutside'};
if ($FetchmailFreqOutside)
{
if ($FetchmailFreqOutside eq 'every5min')
{
$OUT .= "*/5\t0-7\t*\t*\t1-5\troot\t/etc/startmail\n";
$OUT .= "*/5\t18-23\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOutside eq 'every15min')
{
$OUT .= "*/15\t0-7\t*\t*\t1-5\troot\t/etc/startmail\n";
$OUT .= "*/15\t18-23\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOutside eq 'every30min')
{
$OUT .= "*/30\t0-7\t*\t*\t1-5\troot\t/etc/startmail\n";
$OUT .= "*/30\t18-23\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOutside eq 'everyhour')
{
$OUT .= "0\t0-7\t*\t*\t1-5\troot\t/etc/startmail\n";
$OUT .= "0\t18-23\t*\t*\t1-5\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqOutside eq 'every2hrs')
{
$OUT .= "0\t0-7/2\t*\t*\t1-5\troot\t/etc/startmail\n";
$OUT .= "0\t18-23/2\t*\t*\t1-5\troot\t/etc/startmail\n";
}
else
{
$OUT .= "# FetchmailFreqOutside - never\n";
}
}
else
{
$OUT .= "# FetchmailFreqOutside - not defined\n";
}
$OUT .= "\n";
$OUT .= "# fetchmail times during the weekend\n";
$OUT .= "\n";
my $FetchmailFreqWeekend = $fetchmail{'FreqWeekend'};
if ($FetchmailFreqWeekend)
{
if ($FetchmailFreqWeekend eq 'every5min')
{
$OUT .= "*/5\t*\t*\t*\t6-7\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqWeekend eq 'every15min')
{
$OUT .= "*/15\t*\t*\t*\t6-7\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqWeekend eq 'every30min')
{
$OUT .= "*/30\t*\t*\t*\t6-7\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqWeekend eq 'everyhour')
{
$OUT .= "0\t*\t*\t*\t6-7\troot\t/etc/startmail\n";
}
elsif ($FetchmailFreqWeekend eq 'every2hrs')
{
$OUT .= "0\t*/2\t*\t*\t6-7\troot\t/etc/startmail\n";
}
else
{
$OUT .= "# FetchmailFreqWeekend - never\n";
}
}
else
{
$OUT .= "# FetchmailFreqWeekend - not defined\n";
}
}
}
}

View File

@@ -0,0 +1,15 @@
{
my $status = $fetchmail{'status'};
if (!defined $status || $status ne "enabled")
{
}
else
{
my $method = $fetchmail{'Method'};
if (!defined $method)
{
$OUT .= "# This service is enabled but no Method is specified";
}
}
}

View File

@@ -0,0 +1,21 @@
{
$OUT = '';
return unless ($fetchmail{status} eq 'enabled' && $fetchmail{Method} eq 'etrn');
$OUT .= "# ETRN configuration; fetchmail sends ETRN command ";
$OUT .= "to flush mail from remote mail server:\n";
$OUT .= "\n";
my $verbosity = $fetchmail{Verbosity} || "--silent";
my $SecondaryMailServer = $fetchmail{SecondaryMailServer};
use esmith::DomainsDB;
my $ddb = esmith::DomainsDB->open_ro or die "Could not open domains DB\n";
my @domains = map { $_->key } $ddb->get_all;
$OUT .= "/usr/bin/fetchmail --syslog $verbosity --protocol ";
$OUT .= "ETRN --fetchdomains " . join(',', @domains);
$OUT .= " $SecondaryMailServer ";
$OUT .= "> /dev/null 2>&1\n";
}

View File

@@ -0,0 +1,72 @@
{
$OUT = '';
my $status = $fetchmail{"status"}
|| 'disabled';
my $method = $fetchmail{"Method"}
|| 'standard';
if ($status eq "enabled" && $method eq 'multidrop')
{
# Write a fetchmail command which connects to a POP
# server, retrieves all mail from a single account,
# and feeds it to the local SMTP server.
my $envelopeSpec =
$fetchmail{"SecondaryMailEnvelope"};
my $SecondaryMailServer =
$fetchmail{"SecondaryMailServer"};
my $SecondaryMailAccount =
$fetchmail{"SecondaryMailAccount"};
my $SecondaryMailPassword =
$fetchmail{"SecondaryMailPassword"};
$envelopeSpec = defined $envelopeSpec ?
"envelope \"$envelopeSpec\"\n" : "";
my $verbosity = $fetchmail{"Verbosity"}
|| "--silent";
my $protocol = $fetchmail{"Protocol"}
|| "POP3";
my $ssl = $fetchmail{"SSL"}
|| "disabled";
use esmith::DomainsDB;
my $ddb = esmith::DomainsDB->open_ro();
my $locals = join ' ', map { $_->key } $ddb->domains;
$OUT .= "# multi-drop configuration; fetchmail ";
$OUT .= "retrieves all mail from a remote POP mailbox:\n";
$OUT .= "\n";
$OUT .= "/usr/bin/fetchmail --syslog $verbosity ";
$OUT .= " -i /var/lib/fetchmail/.fetchids "; # fix SME: 11979/12131
my $AuthenticationMethod =
$fetchmail{"AuthenticationMethod"}
|| "password";
$OUT .= "--auth $AuthenticationMethod ";
$OUT .= "--fetchmailrc - <<EOF\n";
$OUT .= "\n";
$OUT .= "set postmaster \"postmaster\@$DomainName\"\n";
$OUT .= "set bouncemail\n";
$OUT .= "set properties \"\"\n";
$OUT .= "\n";
$OUT .= "poll $SecondaryMailServer\n";
$OUT .= $envelopeSpec;
$OUT .= " protocol $protocol\n";
$OUT .= " ssl\n" if $ssl eq 'enabled';
$OUT .= " no dns\n";
$OUT .= " localdomains $locals\n";
$OUT .= " username \"$SecondaryMailAccount\" ";
$OUT .= "password \"$SecondaryMailPassword\" to * here\n";
$OUT .= " smtphost 127.0.0.200" . ($smtpd{TCPPort} ? "/$smtpd{TCPPort}" : "") . "\n";
$OUT .= " fetchall\n";
$OUT .= " forcecr\n";
$OUT .= "\n";
$OUT .= "EOF";
}
}

View File

@@ -0,0 +1 @@
/etc/e-smith/templates-default/template-begin-shell

View File

@@ -0,0 +1 @@
folder-collection=\{localhost/novalidate-cert\}[]

View File

@@ -0,0 +1 @@
inbox-path=\{localhost/novalidate-cert\}inbox

View File

@@ -0,0 +1 @@
ldap-servers=localhost

View File

@@ -0,0 +1 @@
smtp-server=localhost

View File

@@ -0,0 +1 @@
user-domain={ $DomainName }

View File

@@ -0,0 +1 @@
default-saved-msg-folder=""

View File

@@ -0,0 +1,28 @@
{
$OUT = "\n";
# Create new chain to manage SMTPProxy stuff
# Note: We send all traffic destined to port 25, regardless of
# where it's from, since the filter table will worry about source.
$OUT .= " /sbin/iptables --table nat --new-chain SMTPProxy\n";
$OUT .= " /sbin/iptables --table nat --append PREROUTING\\\n";
$OUT .= "\t-p tcp --dport 25 -j SMTPProxy\n";
# Accept any accesses to the local IPs directly
$OUT .= " /sbin/iptables --table nat --append SMTPProxy \\\n";
$OUT .= "\t--destination 127.0.0.1 --jump ACCEPT\n";
$OUT .= " /sbin/iptables --table nat --append SMTPProxy \\\n";
$OUT .= "\t--destination $LocalIP --jump ACCEPT\n";
if (defined $ExternalIP)
{
# Accept any accesses to the ExternalIP directly
$OUT .= " /sbin/iptables --table nat --append SMTPProxy \\\n";
$OUT .= "\t--destination \$OUTERNET --jump ACCEPT\n";
}
$OUT .= " /sbin/iptables --table nat --append SMTPProxy\\\n";
$OUT .= "\t-p TCP -j DNAT --to $LocalIP:25\n";
}

View File

@@ -0,0 +1,7 @@
{
$OUT .= "\n # Check outbound SMTP\n";
$OUT .= " /sbin/iptables --new-chain SMTPProxy\n";
$OUT .= " /sbin/iptables --append FORWARD \\\n";
$OUT .= "\t-p tcp --dport 25 -j SMTPProxy\n";
}

View File

@@ -0,0 +1,36 @@
{
# Update any rules which may have changed, meaning
# - $ExternalIP
my $rule = 3;
if (defined $ExternalIP)
{
# Accept any accesses to the ExternalIP directly
$OUT .= " /sbin/iptables --table nat \\\n";
$OUT .= "\t--replace SMTPProxy $rule\\\n";
$OUT .= "\t--destination \$OUTERNET --jump ACCEPT\n";
$rule++;
}
$OUT .= " /sbin/iptables --flush SMTPProxy\n";
if (${qpsmtpd}{'Proxy'} eq 'transparent')
{
$OUT .= " /sbin/iptables --table nat --replace SMTPProxy $rule\\\n";
$OUT .= "\t-p TCP -j DNAT --to $LocalIP:25\n";
}
elsif (${qpsmtpd}{'Proxy'} eq 'blocked')
{
# Replace it with nothing, but keep the rule entry as a placeholder
# for each re-enabling.
$OUT .= " /sbin/iptables --table nat --replace SMTPProxy $rule\n";
$OUT .= " /sbin/iptables --append SMTPProxy\\\n";
$OUT .= "\t-p tcp --dport 25 -i \$INTERNALIF -j denylog\n";
}
else
{
# Replace it with nothing, but keep the rule entry as a placeholder
# for each re-enabling.
$OUT .= " /sbin/iptables --table nat --replace SMTPProxy $rule\n";
}
}

View File

@@ -0,0 +1,49 @@
{
my $status = $fetchmail{status};
if (defined $status)
{
if ($status eq "enabled")
{
$command = "/bin/su - qmailr -s /bin/bash -c \\\n";
$command .= "\t\"FETCHMAILHOME=/var/lock/fetchmail";
$command .= " /etc/fetchmail\"";
if ($AccessType eq 'dialup')
{
$OUT .= "\n";
$OUT .= "# dialup connection; if we're already connected, ";
$OUT .= "call fetchmail.\n";
$OUT .= "# otherwise, bring up the line (which will invoke ";
$OUT .= "fetchmail in\n";
$OUT .= "# the ip-up script).\n";
$OUT .= "\n";
$OUT .= "if /sbin/ifconfig | /bin/grep -q 'ppp'\n";
$OUT .= "then\n";
$OUT .= " ${command}\n";
$OUT .= "else\n";
$OUT .= " /usr/bin/killall -USR1 diald\n";
$OUT .= "fi\n";
}
else
{
$OUT .= "\n";
$OUT .= "# dedicated connection; just call fetchmail to get ";
$OUT .= "things started\n";
$OUT .= "${command}\n";
}
}
else
{
$OUT .= "\n";
$OUT .= "# This service has been flagged as 'disabled'\n";
$OUT .= "# in the e-smith services database.\n";
}
}
else
{
$OUT .= "\n";
$OUT .= "# This service does not exist in the e-smith services";
$OUT .= " database.\n";
}
}

View File

@@ -0,0 +1 @@
/etc/e-smith/templates-default/template-begin-shell