Mail-IspMailGate
view release on metacpan or search on metacpan
running as root. Instead it impersonates itself to the same UID and GID
that sendmail uses for delivering mails. In what follows, I assume UID
*daemon* and GID <mail>, as used on a Red Hat Linux box.
IspMailGate needs its own directory for creating temporary files.
Usually this could be `/var/spool/ispmailgate' or something similar.
Make sure that the daemon user from above, (but noone else) has access
to this directory:
mkdir /var/spool/ispmailgate
chown daemon /var/spool/ispmailgate
chgrp mail /var/spool/ispmailgate
chmod 700 /var/spool/ispmailgate
Program installation
The program is installable like any other Perl module. Indeed, you can
even use the automatic CPAN installation. If you are not used to CPAN
installation or cannot use the CPAN shell, you need to perform a manual
installation: First, fetch the archive from any CPAN mirror, for example
You see, the only difference between these two instances of
mailertable is that the domain *ispsoft.de* is treated different.
Finally we have to execute some commands to get this configuration
running:
mkdir /var/spool/mqueue2
# The following should match the settings of
# /var/spool/mqueue exactly.
chown root /var/spool/mqueue2
chgrp root /var/spool/mqueue2
chmod 755 /var/spool/mqueue
cd /etc/mail
m4 sendmail.mc >sendmail.cf
makemap hash mailertable <mailertable
cd /etc/mail2
m4 sendmail.mc >sendmail.cf
makemap hash mailertable <mailertable
ispMailGateD.PL view on Meta::CPAN
if (!socket(SERVER, &Socket::AF_UNIX(), &Socket::SOCK_STREAM(), 0)) {
ErrExit("Cannot create socket: $!");
}
unlink $unixSock;
if (!bind(SERVER, &Socket::sockaddr_un($unixSock))) {
ErrExit("Cannot bind: $!");
}
if (!listen(SERVER, &Socket::SOMAXCONN)) {
ErrExit("Cannot listen: $!");
}
if (!chown $uid, $gid, $unixSock) {
ErrExit("Cannot change ownership of $unixSock: $!");
}
if (!chmod 0660, $unixSock) {
ErrExit("Cannot change mode of $unixSock: $!");
}
if ($fork) {
$SIG{CHLD} = \&catchChilds;
# Detach from the shell, as good as possible
ispMailGateD.PL view on Meta::CPAN
GID that sendmail uses for delivering mails. In what follows, I
assume UID I<daemon> and GID <mail>, as used on a Red Hat Linux
box.
IspMailGate needs its own directory for creating temporary files.
Usually this could be C</var/spool/ispmailgate> or something
similar. Make sure that the daemon user from above, (but noone else)
has access to this directory:
mkdir /var/spool/ispmailgate
chown daemon /var/spool/ispmailgate
chgrp mail /var/spool/ispmailgate
chmod 700 /var/spool/ispmailgate
=head2 Program installation
The program is installable like any other Perl module. Indeed, you
can even use the automatic CPAN installation. If you are not used
to CPAN installation or cannot use the CPAN shell, you need to
perform a manual installation: First, fetch the archive from any
CPAN mirror, for example
ispMailGateD.PL view on Meta::CPAN
is that the domain I<ispsoft.de> is treated different.
=back
Finally we have to execute some commands to get this configuration
running:
mkdir /var/spool/mqueue2
# The following should match the settings of
# /var/spool/mqueue exactly.
chown root /var/spool/mqueue2
chgrp root /var/spool/mqueue2
chmod 755 /var/spool/mqueue
cd /etc/mail
m4 sendmail.mc >sendmail.cf
makemap hash mailertable <mailertable
cd /etc/mail2
m4 sendmail.mc >sendmail.cf
makemap hash mailertable <mailertable
lib/Mail/IspMailGate/Filter/PGP.pm view on Meta::CPAN
might be more appropriate.
Do not forget to set the file permissions the right way. For example you
might do the following:
su
mkdir ~ispmailgate/.pgp
cp ~info/.pgp/pubring.pgp ~ispmailgate/.pgp
cp ~info/.pgp/secring.pgp ~ispmailgate/.pgp
cp ~info/.pgp/randseed.bin ~ispmailgate/.pgp
chown -R ispmailgate ~ispmailgate/.pgp
chgrp -R ispmailgate ~ispmailgate/.pgp
chmod 755 ~ispmailgate/.pgp
chmod 600 ~ispmailgate/.pgp/*
If you don't have an appropriate keyring, you can instead create a new
one. This is done with the following command:
su - ispmailgate -c "pgp -kg"
PGP will ask you some questions, for example:
lib/Mail/IspMailGate/Install.pm view on Meta::CPAN
}
my $tgid = $self->{'mail_group'};
if ($tgid !~ /^\d+$/) {
$tgid = getgrnam($tgid)
or die "Failed to determine GID of $self->{'mail_group'}.\n",
"Check mail_group in $inc_path.\n";
}
if ($gid != $tgid || $uid != $tuid) {
if ($created) {
chown $tuid, $tgid, $tmp_dir;
} else {
die "Directory $tmp_dir doesn't have user $self->{'mail_user'}\n",
"or group $self->{'mail_group'}. Please fix that or change\n",
"mail_user and mail_group in $inc_path.\n",
"and reinstall.\n";
}
}
if ($mode & 07777 != 0700) {
die "Directory $tmp_dir has insecure permissions. Please change",
( run in 0.687 second using v1.01-cache-2.11-cpan-71847e10f99 )