Commit c895a3cd authored by Leigh B Stoller's avatar Leigh B Stoller

Install phase for shellinabox support.

parent 5cf5823a
#
# Install shellinabox. This does not install shellinabox on ops,
# currently need to do that by hand. Get the code from Utah at
#
# git clone http://git-public.flux.utah.edu/git/shellinabox.git
#
# Then (on ops) cd into the top directory:
#
# ops> ./configure
# ops> make
# ops> sudo make install
#
use strict;
use libinstall;
use installvars;
my $SHAREDKEY = "$PREFIX/etc/sshauth.key";
my $LOGFILE = "$PREFIX/log/shellinabox.log";
sub Install($$$)
{
my ($server, $isupdate, $impotent) = @_;
# Replace if this script does an update for ip/domain.
return 0
if ($isupdate);
Phase "shellinabox", "Adding ShellInABox Support", sub {
Phase "syslog", "Setting up syslog on ops", sub {
if (ExecQuiet("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" grep -q -s shellinabox $SYSLOG_CONF")) {
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'echo \"\\\!shellinabox\" >> $SYSLOG_CONF'");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'echo \"*.*\t\t $LOGFILE\" >> $SYSLOG_CONF'");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'echo \"$LOGFILE\t\t640 7 1000 * Z\" ".
" >> $NEWSYSLOG_CONF'");
}
};
#
# Need a secret shared key for signing.
#
Phase "createkey", "Creating shared key", sub {
DoneIfExists($SHAREDKEY);
ExecQuietFatal("/bin/dd if=/dev/urandom count=128 bs=1 | ".
" /sbin/md5 -q > $SHAREDKEY");
};
Phase "copykey", "Copying shared key to users", sub {
ExecQuietFatal("$SCP -p $SHAREDKEY ${USERNODE}:${SHAREDKEY}");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'chmod 600 $SHAREDKEY'");
};
Phase "httpdconf", "Copying new httpd.conf to ops", sub {
ExecQuietFatal("$GMAKE -C $TOP_OBJDIR/apache all");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" '/bin/cp -fp ${INSTALL_APACHE_CONFIG}/httpd.conf ".
" ${INSTALL_APACHE_CONFIG}/httpd.conf.$$'");
ExecQuietFatal("$SCP -p $TOP_OBJDIR/apache/httpd.conf-ops ".
" ${USERNODE}:${INSTALL_APACHE_CONFIG}/httpd.conf");
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" $APACHE_START_COMMAND restart");
};
Phase "logfile", "Creating logfile on ops", sub {
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'touch $LOGFILE; chmod 640 $LOGFILE'");
};
Phase "json", "Installing json port on ops", sub {
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'cd /usr/ports/converters/p5-JSON; make install'");
};
Phase "hmac", "Installing hmac digest port on ops", sub {
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'cd /usr/ports/secret/p5-Digest-HMAC; make install'");
};
Phase "sha1", "Installing sha1 digest port on ops", sub {
ExecQuietFatal("$SSH -o 'BatchMode=yes' root\@${USERNODE} ".
" 'cd /usr/ports/secret/p5-digest-SHA1; make install'");
};
};
return 0;
}
# Local Variables:
# mode:perl
# End:
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