#! /usr/bin/perl -w
#
# 
# -------------------------------------------------------------------
#                                   X-BONE
#
#                          http://www.isi.edu/xbone
#                USC Information Sciences Institute (USC/ISI)
#                   Marina del Rey, California 90292, USA
#                          Copyright (c) 1998-2005
# 
# -------------------------------------------------------------------
#
# Copyright (c) 1998-2005 by the University of Southern California.
# All rights reserved.
#
# Permission to use, copy, modify, and distribute this software and
# its documentation in source and binary forms for non-commercial
# purposes and without fee is hereby granted, provided that the above
# copyright notice appear in all copies and that both the copyright
# notice and this permission notice appear in supporting
# documentation, and that any documentation, advertising materials,
# and other materials related to such distribution and use acknowledge
# that the software was developed by the University of Southern
# California, Information Sciences Institute.  The name of the
# University may not be used to endorse or promote products derived
# from this software without specific prior written permission.
# 
# THE UNIVERSITY OF SOUTHERN CALIFORNIA MAKES NO REPRESENTATIONS ABOUT
# THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE.  THIS SOFTWARE IS
# PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Other copyrights might apply to parts of this software and are so
# noted when applicable.
#
# -------------------------------------------------------------------
#
# Effort partly sponsored by the Defense Advanced Research Projects
# Agency (DARPA) and Air Force Research Laboratory, Air Force Materiel
# Command, USAF, under agreement numbers F30602-98-1-0200 (X-Bone) and
# F30602-01-2-0529 (DynaBone). The views and conclusions contained
# herein are those of the authors and should not be interpreted as
# necessarily representing the official policies or endorsements,
# either expressed or implied, of the Defense Advanced Research
# Projects Agency (DARPA), the Air Force Research Laboratory, or the
# U.S. Government.
#
# This work was partly supported by the NSF STI-XTEND (ANI-0230789)
# and NETFS (ANI-0129689) projects. Any opinions, findings, and
# conclusions or recommendations expressed in this material are those
# of the authors and do not necessarily reflect the views of the
# National Science Foundation.
#
# -------------------------------------------------------------------
#  $RCSfile: xb-index.pl,v $
#
# $Revision: 1.15 $
#   $Author: pingali $
#     $Date: 2005/04/06 06:39:40 $
#    $State: Exp $
# ----------------------------------------------------------------------------
#
# Primary Author: Lars Eggert

use strict;
use sigtrap;

use lib qw(../lib);

use CGI qw(:standard :html3);
use CGI::Carp qw(fatalsToBrowser);
#use XB_Defs;

sub untaint_path { 
  if ($ENV{PATH} =~ /^(\S+)$/) {
    $ENV{PATH} = $1;                     # $data now untainted
  } else {
    die "Could not untaint $ENV{PATH}";  # log this somewhere
  }
}

&untaint_path; 
my $hostname = `uname -n`; 
chomp($hostname); 

my $title = "Welcome to the X-Bone!";
print header, 
  start_html(-title => $title, 
	     -background => "/xbone/images/background_med_tan.gif",
	     -style => { -src =>"/xbone/xbone.css" }),
  h1({ -class => "secheader" }, $title),
  p("Follow the steps below to get started using the X-Bone. You need to do",
    "this on your first visit only."),
    startform(-name => "FORM",
	      -method => "POST",
	      -action => "/xb-cgi-bin/xb-index.pl"),
  table( {-width => "900" }, 
    Tr( { -height => "100" }, 
            td( { -align => "center", -class => "normalheader" },
	    submit({ 
		    -name => "submit",
                    -class => "btnheader",
	            -onClick => "document.FORM.action=".
			   "'/xb-cgi-bin/xb-get-ca-cert.pl'", 
		    -value => "Download\nCA Certificate"})),
            td( #{ -class => "normalheader" },
     dd("This will retrieve the CA's certificate and instruct your browser",
	"to install it. You should confirm the authenticity of this",
	"certificate by verifying its fingerprint. You may do so by",
	"contacting the CA by phone or authenticated e-mail.",
	i("In the future, the CA certificate will be distributed from ISI's",
	  "secure web server.")))),

    Tr({ -height => "100" }, 
      td({ -align => "center" , -class => "normalheader"}, 
  	submit(-name => "submit", 
               -class => "btnheader",
	       -onClick => "document.FORM.action=".
			   "'http://www.xbone.net/xb-cgi-bin/xb-req-user-cert.pl'", 
	       -value => "Request X-Bone User \nCertificate (*)")),
            td( #{ -class => "normalheader" },
     dd("Before you may execute any X-Bone operations, you need to obtain a",
	"user certificate. Use this form to request one. The CA will contact",
	"you to confirm your identity before issuing a certificate. " .
	u(b(" This service is provided by the X-Bone Project website." ))
	))),

    Tr({ -height => "100" }, td({ -align => "center" , -class => "normalheader"}, 
	  submit(-name => "submit", 
                 -class => "btnheader",
	       -onClick => "document.FORM.action=".
			  "'https://www.xbone.net/cgi-bin/xb-req-host-cert.pl'",
	         -value => "Request X-Bone Host\nCertificate (*)")),
            td( #{ -class => "normalheader" },
     dd("If you are installing X-Bone on new machines, you will need to" .
	" request an X-Bone host certificate for each of these machines.".
	" Use this form to request one. You must own a signed X-Bone ".
	" user certificate to do this! " . 
	u(b(" This service is provided by the X-Bone Project website.")))
	)),

    Tr({ -height => "100" }, td( { -align => "center" , -class => "normalheader"}, 
	   submit(-name => "submit", 
                 -class => "btnheader",
	          -onClick => "document.FORM.action=".
			  "'http://" . server_name . ":" . virtual_port . 
			   "/xboneconfig'", 
	         -value => "Access\nOverlay Manager")),
            td( #{ -class => "normalheader" },
     dd("Now you can access the X-Bone Overlay Manager over a secure,".
	" authenticated connection. (You should bookmark the next page" .
	" for future visits.) "
	))),
       ), # table
     end_form, 
#  dl(dt(h2( { -class => "normalheader" }, a({-href => "/xb-cgi-bin/xb-get-ca-cert.pl"},
#	  "1. Download CA Certificate (*)"))),
#     dd("This will retrieve the CA's certificate and instruct your browser",
#	"to install it. You should confirm the authenticity of this",
#	"certificate by verifying its fingerprint. You may do so by",
#	"contacting the CA by phone or authenticated e-mail.",
#	i("In the future, the CA certificate will be distributed from ISI's",
#	  "secure web server.")), p,
#
#     dt(h2( { -class => "normalheader" }, a({-href => "/xb-cgi-bin/xb-req-user-cert.pl"}, 
#	  "2. Request X-Bone User Certificate (*)"))),
#     dd("Before you may execute any X-Bone operations, you need to obtain a",
#	"user certificate. Use this form to request one. The CA will contact",
#	"you to confirm your identity before issuing a certificate."), p,
#
#     dt(h2( { -class => "normalheader" }, a({-href => "https://" . virtual_host . 
#	      "/cgi-bin/xb-req-host-cert.pl"}, 
#	  "3. Request X-Bone Host Certificates (Optional) (*)"))),
#     dd("If you are installing X-Bone on new machines, you will need to",
#	"request an X-Bone host certificate for each of these machines.",
#	"Use this form to request one. You must own a signed X-Bone user",
#	"certificate to do this!"), p,
#
#     dt(h2( { -class => "normalheader" }, a({-href => "https://" . virtual_host . "/"},
#	  "4. Access the Overlay Manager"))),
#     dd("Now you can access the X-Bone Overlay Manager over a secure,",
#	"authenticated connection. (You should bookmark the next page for",
#	"future visits.)")), p,
#
  dl(dt(h2( { -class => "normalheader" }, a("(*) Information about the X-Bone".
           " X.509 Certificates:"))),
     dd("The X-Bone project signs X.509 certificates only for collaborators ",
        "of our project. If this is an independent installation at your local",
        "site, you will need to either setup your own certification authority",
        "(see instructions in the ". a({-href => "http://www.openssl.org/"},
        "OpenSSL") . " package) or use a commercial service (e.g.",
	a({-href => "http://www.verisign.com/"}, "VeriSign"). ")."
       )), 

  dl(dt(h2( { -class => "normalheader" }, a({-href => "http://www.isi.edu/xbone/"},
          "X-Bone Project Page"))),
     dd("Project information, software download, FAQ, publications, etc.")), p,
  
  i("If you encounter any problems with these steps, ",
    a({-href => "mailto:xbone\@isi.edu"}, "please contact us.")),
  end_html;


syntax highlighted by Code2HTML, v. 0.9.1