Skip to content

Commit

Permalink
nassh: add option to select different ssh client plugin versions
Browse files Browse the repository at this point in the history
Add support for shipping multiple versions of the pnacl plugin.  This
can be helpful for people when upgrading in case there is a regression
in the plugin.  For example, when doing a version upgrade in OpenSSH or
libraries it uses.  It's not intended to support multiple versions for
a long time, just long enough to iron out regressions.

It can also be used to ship new versions for longer testing purposes,
like a WebAssembly implementation.

Change-Id: I9b3f65da7a15bdc7c2b0644213fca065d60e22a6
Reviewed-on: https://chromium-review.googlesource.com/771010
Reviewed-by: Brandon Gilmore <[email protected]>
Tested-by: Mike Frysinger <[email protected]>
  • Loading branch information
vapier committed Nov 20, 2017
1 parent 20ddaf6 commit 783a001
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
10 changes: 10 additions & 0 deletions nassh/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@
"description": "Generic message displayed when we encounter an unexpected error.",
"message": "An unexpected error occurred, please check the JavaScript console for more details."
},
"UNKNOWN_SSH_CLIENT_VERSION": {
"description": "Displayed when the version requested by the user is not supported.",
"message": "Unknown SSH version: $VER$",
"placeholders": {
"ver": {
"content": "$1",
"example": "pnacl-openssh-7.4p1"
}
}
},
"UNMOUNT_BUTTON_LABEL": {
"description": "The label for the unmount button. Used to access (mount) remote directories over SSH.",
"message": "Unmount SFTP"
Expand Down
15 changes: 15 additions & 0 deletions nassh/doc/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,18 @@ manage keys or certificates or anything else an ssh agent can.
Here's a list of known agents:

* [gnubbyd beknehfpfkghjoafdifaflglpjkojoco](https://chrome.google.com/webstore/detail/beknehfpfkghjoafdifaflglpjkojoco)

## `--ssh-client-version=<version>`

The version of the ssh client to use. Intended for mitigating regressions with
newer versions of the plugin and quick version comparison.

Support for older versions is not permanent and there is no guarantee that newer
releases will continue to bundle them. If you encounter problems with the
default version and selecting a previous version makes things work, you need to
[report a bug](https://goo.gl/vb94JY).

Here are some versions that might be available:

* `pnacl`: The default OpenSSH version built for NaCl most people should use.
* `pnacl-openssh-7.5p1`: An older OpenSSH release.
2 changes: 1 addition & 1 deletion nassh/html/nassh_connect_dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<x-hbox>
<input x-box id='field-relay-options' x-flex='1' type='text'
i18n='{"aria-label": "$id", "title": "=aria-label", "placeholder": "$id"}'
pattern='^\s*(--(no-)?(config|proxy-host|proxy-port|relay-prefix-field|relay-protocol|report-ack-latency|report-connect-attempts|ssh-agent|use-ssl|use-xhr)(=[^\s]+)?(\s+|$))*$'>
pattern='^\s*(--(no-)?(config|proxy-host|proxy-port|relay-prefix-field|relay-protocol|report-ack-latency|report-connect-attempts|ssh-client-version|ssh-agent|use-ssl|use-xhr)(=[^\s]+)?(\s+|$))*$'>
</x-hbox>
<br>
<x-hbox x-align='baseline'>
Expand Down
15 changes: 14 additions & 1 deletion nassh/js/nassh_command_instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ nassh.CommandInstance = function(argv) {
// An HTML5 DirectoryEntry for /.ssh/.
this.sshDirectoryEntry_ = null;

// The version of the ssh client to load.
this.sshClientVersion_ = 'pnacl';

// Application ID of auth agent.
this.authAgentAppID_ = null;

Expand Down Expand Up @@ -753,6 +756,16 @@ nassh.CommandInstance.prototype.connectTo = function(params) {
if (relay.options['--ssh-agent'])
params.authAgentAppID = relay.options['--ssh-agent'];
params.authAgentForward = relay.options['auth-agent-forward'];

if (relay.options['--ssh-client-version'])
this.sshClientVersion_ = relay.options['--ssh-client-version'];
}

if (!this.sshClientVersion_.match(/^[a-zA-Z0-9.-]+$/)) {
this.io.println(nassh.msg('UNKNOWN_SSH_CLIENT_VERSION',
[this.sshClientVersion_]));
this.exit(127);
return false;
}

this.authAgentAppID_ = params.authAgentAppID;
Expand Down Expand Up @@ -863,7 +876,7 @@ nassh.CommandInstance.prototype.initPlugin_ = function(onComplete) {
'width: 0;' +
'height: 0;');

var pluginURL = '../plugin/pnacl/ssh_client.nmf';
const pluginURL = `../plugin/${this.sshClientVersion_}/ssh_client.nmf`;

this.plugin_.setAttribute('src', pluginURL);
this.plugin_.setAttribute('type', 'application/x-nacl');
Expand Down
1 change: 1 addition & 0 deletions nassh/js/nassh_google_relay.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ nassh.GoogleRelay.parseOptionString.validOptions_ = [
'report-ack-latency',
'report-connect-attempts',
'ssh-agent',
'ssh-client-version',
'use-ssl',
'use-xhr',
];
Expand Down

0 comments on commit 783a001

Please sign in to comment.