Commit a3083d60 authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Flack 17.19 -- Various bugfixes. egre-tunnel support. New Flack unified loader

parent 383092cc
\z\work\flex\bin\mxmlc -load-config config-duerig.xml src\flack.mxml
This diff is collapsed.
/*
Eliminate any default margins/padding and set the height of the
html element and the body element to 100%, because Firefox, or any
Gecko based browser, interprets percentage as the percentage of the
height of its parent container, which has to be set explicitly.
Initially, don't display flashContent div so it won't show if
JavaScript disabled.
*/
html, body
{
height: 100%;
}
body
{
margin:0;
padding:0;
overflow:auto;
text-align:center;
background-color: #d2e1f0;
}
object:focus
{
outline:none;
}
#flashContent
{
display:none;
}
#socketPool
{
visibility:hidden;
}
......@@ -4,318 +4,21 @@
<title>Flack</title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Initially,
don't display flashContent div so it won't show if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: #d2e1f0; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section -->
<!-- <link rel="stylesheet" type="text/css" href="history/history.css" /> -->
<!-- <script type="text/javascript" src="history/history.js"></script> -->
<!-- END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#d2e1f0";
params.allowscriptaccess = "always";
params.allowfullscreen = "true";
params.fullScreenOnSelection = "true";
var attributes = {};
attributes.id = "flack";
attributes.name = "flack";
attributes.align = "middle";
swfobject.embedSWF(
"flack.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
<link rel="stylesheet" style="text/css" href="flack.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="forge/debug.js"></script>
<script type="text/javascript" src="forge/util.js"></script>
<script type="text/javascript" src="forge/log.js"></script>
<script type="text/javascript" src="forge/socket.js"></script>
<script type="text/javascript" src="forge/md5.js"></script>
<script type="text/javascript" src="forge/sha1.js"></script>
<script type="text/javascript" src="forge/hmac.js"></script>
<script type="text/javascript" src="forge/aes.js"></script>
<script type="text/javascript" src="forge/asn1.js"></script>
<script type="text/javascript" src="forge/jsbn.js"></script>
<script type="text/javascript" src="forge/prng.js"></script>
<script type="text/javascript" src="forge/random.js"></script>
<script type="text/javascript" src="forge/oids.js"></script>
<script type="text/javascript" src="forge/rsa.js"></script>
<script type="text/javascript" src="forge/pki.js"></script>
<script type="text/javascript" src="forge/tls.js"></script>
<script type="text/javascript" src="forge/tlssocket.js"></script>
<script type="text/javascript" src="forge/http.js"></script>
<script type="text/javascript">
//<![CDATA[
// logging category
var cat = 'forge.tests.tls';
swfobject.embedSWF(
'forge/SocketPool.swf', 'socketPool', '0', '0', '9.0.0',
false, {}, {allowscriptaccess: 'always'}, {});
// CA certificate for test server
var serverCerts = [];
var clientCert = '';
var clientKey = '';
var flash_id = "";
function getSWF()
{
if (navigator.appName.indexOf("Microsoft") != -1)
{
return window[flash_id];
}
else
{
return document[flash_id];
}
}
var sp;
function init(new_flash_id)
{
try {
flash_id = new_flash_id;
sp = net.createSocketPool({
flashId: 'socketPool',
policyPort: 843,
msie: false
});
} catch(ex) {
forge.log.error(cat, ex);
}
}
// local aliases
var net = window.forge.net;
var tls = window.forge.tls;
var http = window.forge.http;
var util = window.forge.util;
var clients = new Object();
function make_request(instance, host, path, sendData)
{
try {
var newClient = client_init(host);
if (clients[instance] == null)
{
clients[instance] = newClient;
client_send(newClient, path, sendData, instance);
}
} catch(ex) {
forge.log.error(cat, ex);
}
}
function cancel_request(instance)
{
try {
var client = clients[instance];
if (client != null)
{
client_cleanup(client);
delete client[instance];
if (client[instance] != null)
{
forge.log.debug(cat, "instance not really deleted", "");
}
}
} catch(ex) {
forge.log.error(cat, ex);
}
return false;
}
function setServerCert(newCert)
{
try {
serverCerts = [];
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
serverCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
} catch(ex) {
forge.log.error(cat, ex);
}
}
function addServerCert(newCert)
{
try {
var list = newCert.split("-----END CERTIFICATE-----");
for (var i = 0; i < list.length - 1; ++i)
{
serverCerts.push(list[i] + "-----END CERTIFICATE-----\n");
}
} catch(ex) {
forge.log.error(cat, ex);
}
}
function setClientCert(newCert)
{
try {
clientCert = newCert;
} catch(ex) {
forge.log.error(cat, ex);
}
}
function setClientKey(newKey)
{
try {
clientKey = newKey;
} catch(ex) {
forge.log.error(cat, ex);
}
}
function client_init(host)
{
var result = null;
try
{
var arg = {
url: host,
socketPool: sp,
connections: 1,
// optional cipher suites in order of preference
caCerts : serverCerts,
cipherSuites: [
tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA,
tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA],
verify: function(c, verified, depth, certs)
{
/*
forge.log.debug(cat,
'TLS certificate ' + depth + ' subject: ' + certs[depth].subject.getField('CN').value + " issuer: " + certs[depth].issuer.getField('CN').value, verified);
// Note: change to always true to test verifying without cert
//return verified;
// FIXME: temporarily accept any cert to allow hitting any bpe
if(verified !== true)
{
forge.log.warning(cat,
'Certificate NOT verified. Ignored for test.');
}
return true;
*/
return verified;
},
primeTlsSockets: false
};
if (clientCert != "")
{
arg.getCertificate = function(c, request) { return clientCert; };
arg.getPrivateKey = function(c, cert) { return clientKey; };
}
result = http.createClient(arg);
}
catch(ex)
{
forge.log.error(cat, ex);
}
return result;
}
function client_cleanup(client)
{
client.destroy();
}
function client_send(client, path, data, instance)
{
var requestArg = {
path: path,
method: 'GET' };
if (data != "")
{
requestArg.method = 'POST';
requestArg.headers = [{'Content-Type': 'text/xml'}];
requestArg.body = data;
}
var request = http.createRequest(requestArg);
client.send({
request: request,
connected: function(e)
{
// forge.log.debug(cat, 'connected', e);
},
headerReady: function(e)
{
// forge.log.debug(cat, 'header ready', e);
},
bodyReady: function(e)
{
// forge.log.debug(cat, 'body ready called', e);
var response = e.response.body;
e.socket.close();
getSWF().flash_onbody(instance, response);
},
error: function(e)
{
var response = e.type + ": " + e.message;
if (e.cause != null)
{
// response += ": " + String(e.cause);
}
e.socket.close();
getSWF().flash_onerror(instance, response);
}
});
return false;
}
//]]>
</script>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
11.1.0 or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
<a href='http://www.adobe.com/go/getflashplayer'>
<img src='https://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' />
</a>
</div>
<div id="socketPool">
......@@ -326,5 +29,14 @@
<p>Flack requires that JavaScript be turned on~</p>
</noscript>
<script type="text/javascript" src="https://www.emulab.net/protogeni/flack-stable/loader.js"></script>
<script type="text/plain" id="sa-url-parameter">https://ch.geni.net/PGCH</script>
<script type="text/plain" id="sa-urn-parameter">urn:publicid:IDN+geni:gpo:portal+authority+sa</script>
<script type="text/plain" id="ch-url-parameter">https://ch.geni.net/PGCH</script>
<script type="text/plain" id="slice-urn-parameter"></script>
<script type="text/plain" id="client-key-parameter"></script>
<script type="text/plain" id="client-cert-parameter"></script>
<script type="text/plain" id="server-cert-parameter"></script>
</body>
</html>
This diff is collapsed.
......@@ -282,6 +282,11 @@
}
function logToConsole(message)
{
console.log('--- ' + message);
}
// setServerCert(tlsval);
// tlsval = "KEY";
// setClientKey(tlsval);
......@@ -302,7 +307,7 @@
flashvars.saurl = "https%3A%2F%2Fch.geni.net%3A8443%2F";
flashvars.saurn = "urn%3Apublicid%3AIDN%2Bgeni%3Agpo%3Aportal%2Bauthority%2Bsa";
flashvars.churl = "https%3A%2F%2Fch.geni.net%3A8443%2F";
flashvars.sliceurn = "urn%3Apublicid%3AIDN%2Bch.geni.net%3Apgeni-testing%2Bslice%2Bjon-test";
flashvars.sliceurn = "urn%3Apublicid%3AIDN%2Bch.geni.net%3Apgeni-testing%2Bslice%2Bimage-test";
var params = {};
params.quality = "high";
params.bgcolor = "#d2e1f0";
......@@ -892,7 +897,6 @@ IwePprDrd6V9CigMKsrniEghHjtblA70pTRj75CO5TUIPNpsL3d8+juPPNou+wwX
DU13v1h/AbAioWbTOCd8fRPq3vKiKLNUWtTrENl1cfxLYy6H6s7ETlQwXxcoEEDz
SBkIDe0qTE3zSWjZm1zfOEkCWzrbQFhkSrryQpa7MkrPxi1Q
-----END CERTIFICATE-----
----
-----BEGIN CERTIFICATE-----
MIIESzCCAzOgAwIBAgIJAPzyDLVtbM9vMA0GCSqGSIb3DQEBBQUAMIG7MQswCQYD
VQQGEwItLTESMBAGA1UECAwJU29tZVN0YXRlMREwDwYDVQQHDAhTb21lQ2l0eTEZ
......
var isPortal = false;
var basePath = '';
(function () {
var importList = [
'forge/debug.js',
'forge/util.js',
'forge/log.js',
'forge/socket.js',
'forge/md5.js',
'forge/sha1.js',
'forge/hmac.js',
'forge/aes.js',
'forge/asn1.js',
'forge/jsbn.js',
'forge/prng.js',
'forge/random.js',
'forge/oids.js',
'forge/rsa.js',
'forge/pki.js',
'forge/tls.js',
'forge/tlssocket.js',
'forge/http.js',
'main.js'
];
var sourceOptionList = ['local', 'devel', 'stable', 'none'];
var sourceOptions = {
'local': 'http://localhost:8080/',
'devel': 'https://www.emulab.net/protogeni/flack-devel/',
'stable': 'https://www.emulab.net/protogeni/flack-stable/',
'none': ''
};
function getQueryParams(qs) {
qs = qs.split('+').join(' ');
var params = {};
var re = /[?&]?([^=]+)=([^&]*)/g;
var tokens = re.exec(qs);
while (tokens) {
params[decodeURIComponent(tokens[1])]
= decodeURIComponent(tokens[2]);
tokens = re.exec(qs);
}
return params;
}
var params = getQueryParams(window.location.search);
if (params['portal'] && params['portal'] === '1')
{
isPortal = true;
}
var sourceName = params['source'];
var basePath = sourceOptions['stable'];
if (sourceOptionList.indexOf(sourceName) !== -1)
{
basePath = sourceOptions[sourceName];
}
var body = document.getElementsByTagName('body')[0];
var i = 0;
for (i = 0; i < importList.length; i += 1)
{
var script = document.createElement('script');
script.src = basePath + importList[i];
script.type = 'application/javascript';
script.async = false;
script.defer = false;
body.appendChild(script);
}
}());
</
(function ()
{
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
if (isPortal)
{
flashvars.skipstartup = '1';
flashvars.bundlepreset = '1';
flashvars.keycertpreset = '1';
flashvars.loadallmanagerswithoutasking = '1';
flashvars.saurl = encodeURIComponent(document.getElementById('sa-url-parameter').innerText);
flashvars.saurn = encodeURIComponent(document.getElementById('sa-urn-parameter').innerText);
flashvars.churl = encodeURIComponent(document.getElementById('ch-url-parameter').innerText);
flashvars.sliceurn = encodeURIComponent(document.getElementById('slice-urn-parameter').innerText);
}
var params = {};
params.quality = "high";
params.bgcolor = "#d2e1f0";
params.allowscriptaccess = "always";
params.allowfullscreen = "true";
params.fullScreenOnSelection = "true";
var attributes = {};
attributes.id = "flack";
attributes.name = "flack";
attributes.align = "middle";
swfobject.embedSWF(
basePath + "flack.swf", "flashContent",
"100%", "100%",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
swfobject.embedSWF(
basePath + 'forge/SocketPool.swf', 'socketPool',
'0', '0',
'9.0.0', false,
{}, {allowscriptaccess: 'always'}, {});
swfobject.createCSS("#socketPool", "visibility:visible;");
}());
// CA certificate for test server
var serverCerts = [];
var clientCerts = [];
var clientKey = '';
var flash_id = "";
function getSWF()
{
if (navigator.appName.indexOf("Microsoft") != -1)
{
return window[flash_id];
}
else
{
return document[flash_id];
}
}
var sp;
function init(new_flash_id)
{
try
{
if (isPortal)
{
setServerCert(document.getElementById('server-cert-parameter').innerHTML);
setClientKey(document.getElementById('client-key-parameter').innerHTML);
setClientCert(document.getElementById('client-cert-parameter').innerHTML);
}
flash_id = new_flash_id;
sp = forge.net.createSocketPool({
flashId: 'socketPool',
policyPort: 843,
msie: false
});
}
catch(ex)
{
console.log('ERROR init:');
console.dir(ex);
}
}
// local aliases
var tls = window.forge.tls;
var http = window.forge.http;
var util = window.forge.util;
var clients = new Object();
function make_request(instance, host, path, sendData)
{
try
{
var newClient = client_init(host);
if (clients[instance] == null)
{
clients[instance] = newClient;
client_send(newClient, path, sendData, instance);
}
}
catch(ex)
{