Commit 38452552 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Remove old setipod script, which has been replaced by new rc.ipod

which Mike added.
parent 759f2431
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Enable ICMP ping-of-death
# Support both the old style (host only) and the new style (host+mask+key)
#
use English;
use Socket;
#
# This is in its own file cause its a pain on the MFS, which does not
# have all the that perl library stuff that Socket needs.
#
#
# Untaint path
#
$ENV{'PATH'} = "/bin:/sbin:/usr/bin:/usr/local/bin";
$ENV{'PATH'} .= ":/usr/local/etc/emulab:/etc/testbed";
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Handle old style
#
if (system("sysctl -w net.inet.icmp.ipod_enabled=0 >/dev/null 2>&1") == 0) {
my ($bname, $bip) = split(/ /, `tmcc bossinfo`);
if (!defined($bip)) {
warn "*** WARNING: could not determine boss node, IPOD not enabled\n";
exit -1;
}
my $ipuint = unpack("N", inet_aton($bip));
# XXX arg to sysctl must be a signed 32-bit int, so we must "cast"
my $sysctlcmd = sprintf("sysctl -w net.inet.icmp.ipod_host=%d", $ipuint);
if (system($sysctlcmd . ">/dev/null")) {
warn "*** WARNING: could not set IPOD host to $bip ($ipuint)\n";
exit -1;
}
if (system("sysctl -w net.inet.icmp.ipod_enabled=1 >/dev/null")) {
warn "*** WARNING: could not enable IPOD\n";
exit -1;
} else {
print STDOUT "IPOD enabled from $bip\n";
}
exit 0;
}
#
# New style
#
if (system("sysctl -w net.inet.icmp.ipod.enabled=0 >/dev/null 2>&1")) {
warn "*** WARNING: IPOD sysctls not supported, not enabled\n";
exit -1;
}
my $pat = q(HOST=([0-9.]*) MASK=([0-9.]*) HASH=([0-9a-f]*));
if (`tmcc ipodinfo` =~ /$pat/) {
my $ipaddr = $1;
my $ipmask = $2;
my $hash = $3;
#
# Note the use of sprintf below.
# We need this to "cast" the arg to a signed 32-bit int for sysctl.
#
my $ipuint = unpack("N", inet_aton($ipaddr));
my $sysctlcmd = sprintf("sysctl -w net.inet.icmp.ipod.host=%d", $ipuint);
if (system($sysctlcmd . ">/dev/null")) {
warn "*** WARNING: could not set IPOD host to $ipaddr ($ipuint)\n";
exit -1;
}
$ipuint = unpack("N", inet_aton($ipmask));
$sysctlcmd = sprintf("sysctl -w net.inet.icmp.ipod.mask=%d", $ipuint);
if (system($sysctlcmd . ">/dev/null")) {
warn "*** WARNING: could not set IPOD mask to $ipmask ($ipuint)\n";
exit -1;
}
$sysctlcmd = sprintf("sysctl -w net.inet.icmp.ipod.hash=%.32s", $hash);
if (system($sysctlcmd . ">/dev/null")) {
warn "*** WARNING: could not set IPOD hash\n";
exit -1;
}
if (system("sysctl -w net.inet.icmp.ipod.enabled=1 >/dev/null")) {
warn "*** WARNING: could not enable IPOD\n";
exit -1;
} else {
print STDOUT "Authenticated IPOD enabled from $ipaddr/$ipmask\n";
}
} else {
warn "*** WARNING: no IPOD info, not enabled\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