1.0.3 • Published 1 year ago

@tpaul/csign v1.0.3

Weekly downloads
-
License
BSD-2-Clause
Repository
-
Last release
1 year ago

CSign

A Cloud API URL signing utility.

Usage:

Create a signed URL for a Triton Cloud API PATH
Usage:
  csign sign PATH
Options:
    -m METHODS, --method=METHODS  Comma separated list of HTTP methods (default:
                                  HEAD,GET).
    -P, --prefix                  Don't prefix PATH with authenticating user
                                  (Default: true).
    -p ARG, --profile=ARG         Load the specified profile from
                                  ~/.triton/profiles.d.
    -u ARG, --user=ARG            Set the Cloud API user (overrides value in
                                  profile, if any).
    -k ARG, --key=ARG             Set the SSH Key ID (overrides value in
                                  profile, if any).
    -H ARG, --host=ARG            Set the Cloud API Host (overrides value in
                                  profile, if any).
    -v, --verbose                 Verbose output.
    -n ARG, --novnc=ARG           Output provided link with noVNC URL parameters
                                  appended (Useful for the ConnectMachineVNC
                                  endpoint).

Example:

This example creates a signed URL for use with (a slightly modified¹) noVNC in the browser:

$ open "$(./csign sign -n https://us-central.manta.mnx.io/tpaul/public/test/noVNC/vnc_lite.html /machines/97440717-0646-4fde-a173-e3ecc195d4a9/vnc)"

Example listing packages:

$ curl -s "$(./csign sign -p local packages)" | jq
[
  {
    "default": false,
    "description": "g1.micro",
    "disk": 10240,
    "group": "General",
    "id": "58d53657-6690-e40c-bb20-d0d280817f44",
    "lwps": 4096,
    "memory": 1024,
    "name": "g1.micro",
    "swap": 2048,
    "vcpus": 1,
    "version": "1.0.0"
  },
  {
    "brand": "joyent",
    "default": false,
    "description": "",
    "disk": 32768,
    "group": "",
    "id": "33c926a9-ba99-4c58-a386-5db59ef74c27",
    "lwps": 4000,
    "memory": 4096,
    "name": "build-zone",
    "swap": 8192,
    "vcpus": 4,
    "version": "1.0.0"
  },
  {
    "brand": "kvm",
    "default": false,
    "description": "",
    "disk": 40960,
    "group": "",
    "id": "b39caf66-cfaf-43a9-aff9-a426d17d5880",
    "lwps": 4096,
    "memory": 2048,
    "name": "kvm.1",
    "swap": 4096,
    "vcpus": 2,
    "version": "1.0.0"
  }

¹: noVNC's vnc_lite.html prefixes the path with / which is undesirable here.

diff --git a/vnc_lite.html b/vnc_lite.html
index e725a2d..f72115f 100644
--- a/vnc_lite.html
+++ b/vnc_lite.html
@@ -157,7 +157,7 @@
         if(port) {
             url += ':' + port;
         }
-        url += '/' + path;
+        url += path;

         // Creating a new RFB object will start a new connection
         rfb = new RFB(document.getElementById('screen'), url,
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago