. # # }}} # $APTHOST = "$WWWHOST"; $APTBASE = "$TBBASE/apt"; # # Global flag to disable accounts. We do this on some pages which # should not display login/account info. # $disable_accounts = 0; # # So, we could be coming in on the alternate APT address (virtual server) # which causes cookie problems. I need to look into avoiding this problem # but for now, just change the global value of the TBAUTHDOMAIN when we do. # The downside is that users will have to log in twice if they switch back # and forth. # if ($TBMAINSITE && $_SERVER["SERVER_NAME"] == "www.aptlab.net") { $TBAUTHDOMAIN = ".aptlab.net"; $APTHOST = "www.aptlab.net"; $WWWHOST = "www.aptlab.net"; $APTBASE = "https://www.aptlab.net"; } # # Redefine this so APT errors are styled properly. # $PAGEERROR_HANDLER = function($msg, $status_code = 0) { global $drewheader; if (! $drewheader) { SPITHEADER(); } echo $msg; echo "\n"; SPITFOOTER(); die(""); }; function SPITHEADER($thinheader = 0) { global $TBMAINSITE; global $login_user, $login_status; global $disable_accounts, $page_title, $drewheader; $title = "AptLab"; if (isset($page_title)) { $title .= " - $page_title"; } $height = ($thinheader ? 150 : 250); $drewheader = 1; # # Figure out who is logged in, if anyone. # if (($login_user = CheckLogin($status)) != null) { $login_status = $status; $login_uid = $login_user->uid(); } echo " $title \n"; if ($TBMAINSITE && file_exists("../google-analytics.php")) { readfile("../google-analytics.php"); } echo "
\n"; SpitLoginModal("quickvm_login_modal"); echo "
\n"; } function SPITFOOTER() { echo "
\n"; echo "
\n"; } function SPITUSERERROR($msg) { PAGEERROR($msg, 0); } # # Does not return; page exits. # function SPITAJAX_RESPONSE($value) { $results = array( 'code' => 0, 'value' => $value ); echo json_encode($results); } function SPITAJAX_ERROR($code, $msg) { $results = array( 'code' => code, 'value' => $msg ); echo json_encode($results); } function SPITNULLREQUIRE() { echo "\n"; } # # Spit out an info tooltip. # function SpitToolTip($info) { echo " ". " ". "\n"; } # # Spit out the verify modal. We are not using real password authentication # like the rest of the Emulab website. Assumed to be inside of a form # that handles a create button. # function SpitVerifyModal($id, $label) { echo " \n"; } # # Spit out the login modal. # function SpitLoginModal($id) { ?> \n"; } # # Generate an authentication object to pass to the browser that # is passed to the web server on boss. This is used to grant # permission to the user to invoke ssh to a local node using their # emulab generated (no passphrase) key. This is basically a clone # of what GateOne does, but that code was a mess. # function SSHAuthObject($uid, $nodeid) { global $USERNODE; $file = "/usr/testbed/etc/sshauth.key"; # # We need the secret that is shared with ops. # $fp = fopen($file, "r"); if (! $fp) { TBERROR("Error opening $file", 0); return null; } $key = fread($fp, 128); fclose($fp); if (!$key) { TBERROR("Could not get key from $file", 0); return null; } $key = chop($key); $stuff = GENHASH(); $now = time(); $authobj = array('uid' => $uid, 'stuff' => $stuff, 'nodeid' => $nodeid, 'timestamp' => $now, 'baseurl' => "https://${USERNODE}", 'signature_method' => 'HMAC-SHA1', 'api_version' => '1.0', 'signature' => hash_hmac('sha1', $uid . $stuff . $nodeid . $now, $key), ); return json_encode($authobj); } # # This is a little odd; since we are using our local CM to create # the experiment, we can just ask for the graphic directly. # function GetTopoMap($uid, $pid, $eid) { global $TBSUEXEC_PATH; $xmlstuff = ""; if ($fp = popen("$TBSUEXEC_PATH nobody nobody webvistopology ". "-x -s $uid $pid $eid", "r")) { while (!feof($fp) && connection_status() == 0) { $string = fgets($fp); if ($string) { $xmlstuff .= $string; } } return $xmlstuff; } else { return ""; } } # # Redirect request to https # function RedirectSecure() { global $APTHOST; if (!isset($_SERVER["SSL_PROTOCOL"])) { header("Location: https://$APTHOST". $_SERVER['REQUEST_URI']); exit(); } } # # Redirect to the login page() # function RedirectLoginPage() { # HTTP_REFERER will not work reliably when redirecting so # pass in the URI for this page as an argument header("Location: login.php?referrer=". urlencode($_SERVER['REQUEST_URI'])); } function SpitAboutApt() { ?>
What is Apt?

Apt is a testbed facility built around profiles. A profile describes an experiment; when you instantiate a profile, that specification is realized on the Apt cluster using virtual or physical machines. The creator of a profile may put code, data, and other resources into it, and the profile may consist of a single machine or may describe an entire network.

Apt is a platform for sharing research; it is open to all researchers, educators, and students. Basic access to public profiles on Apt is provided without the need to register for an account - this keeps the barriers to accessing research results low. If you find the limited resources that are provided to unregistered users valuable, we recommend signing up for a (free) account to get access to more resources and to create profiles of your own.

Apt is built on Emulab and GENI technologies. It is built and operated by the Flux Research Group, part of the University of Utah's School of Computing. Apt is funded by the National Science Foundation under award CNS-1338155 and by the University of Utah.

For help, bug reports, or other questions, come join the Discussion Forum