All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 4cbcaa5f authored by Leigh B Stoller's avatar Leigh B Stoller

Generate and install mail relay access file on ops.

parent b506bc42
......@@ -89,6 +89,13 @@ sub Install($$$)
ExecQuietFatal("$SCP $TOP_OBJDIR/named/resolv.conf.ops ".
" ${FSNODE}:/etc/resolv.conf");
};
Phase "copying3", "Copying mail access file over to ops", sub {
ExecQuietFatal("$SCP $TOP_OBJDIR/named/mail.access ".
" ${USERNODE}:/etc/mail/access");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" makemap hash /etc/mail/access \\< ".
" /etc/mail/access");
};
};
return 0;
......
#
# Install mail relaying access file on Geni Racks.
#
use strict;
use libinstall;
use installvars;
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
if ($PGENISUPPORT && $PROTOGENI_GENIRACK &&
$phase eq "post" && !IMPOTENT_MODE()) {
Phase "access", "Copying mail access file over to ops", sub {
ExecQuietFatal("$SCP $TOP_OBJDIR/named/mail.access ".
" ${USERNODE}:/etc/mail/access");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" makemap hash /etc/mail/access \\< ".
" /etc/mail/access");
};
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
......@@ -50,7 +50,7 @@ USERTOKEN = $(shell echo @USERNODE@ | sed -e 's/\..*//')
NAMED_FILES = named.conf.template named_makeconf named_makerev reverse.head \
resolv.conf localhost.rev forward.head named_makeforw \
$(REVFILES) $(OURDOMAIN).db.head $(OURDOMAIN).internal.db.head \
named.conf resolv.conf.ops
named.conf resolv.conf.ops mail.access
include $(OBJDIR)/Makeconf
......@@ -72,6 +72,9 @@ $(OURDOMAIN).internal.db.head: forward.head named_makeforw
named.conf: named.conf.template named_makeconf
perl named_makeconf named.conf.template > named.conf
mail.access: mail_makeaccess
perl mail_makeaccess > mail.access
$(REVFILES): reverse.head named_makerev
perl named_makerev reverse.head
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2013 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
# This file is part of the Emulab network testbed software.
#
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
#
# }}}
#
use Getopt::Std;
use Socket;
#
# Helper script to create the email access file on ops, which will
# allow relaying from the local networks. Once created and installed
# as /etc/mail/access on ops, do this on ops:
#
# (cd /etc/mail; sudo makemap hash /etc/mail/access < /etc/mail/access)
#
# Then restart sendmail:
#
# sudo /etc/rc.d/sendmail restart
#
sub usage {
print "Usage: $0\n";
}
#
# Configure variables
#
my $TESTBED_NETWORK = "@TESTBED_NETWORK@";
my $TESTBED_NETMASK = "@TESTBED_NETMASK@";
my $CONTROL_ROUTER_IP = "@CONTROL_ROUTER_IP@";
my $CONTROL_NETWORK = "@CONTROL_NETWORK@";
my $CONTROL_NETMASK = "@CONTROL_NETMASK@";
my $VIRTNODE_NETWORK = "@VIRTNODE_NETWORK@";
my $VIRTNODE_NETMASK = "@VIRTNODE_NETMASK@";
# Testbed libraries.
use lib "@prefix@/lib";
# This is for the dotted and reverse dotted notation.
# reverse maps. This is probably all wrong ...
my ($ca, $cb, $cc, $cd) =
($CONTROL_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($cma, $cmb, $cmc, $cmd) =
($CONTROL_NETMASK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($ja, $jb, $jc, $jd) =
($VIRTNODE_NETWORK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
my ($jma, $jmb, $jmc, $kmd) =
($VIRTNODE_NETMASK =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/);
for (my $i = $jb; $i <= $jb + (255 - $jmb); $i++) {
print "${ja}.${i}\t\tRELAY\n";
}
for (my $i = $cc; $i <= $cc + (255 - $cmc); $i++) {
print "${ca}.${cb}.${i}\tRELAY\n";
}
exit(0);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment