guacamole-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul A <p...@thissolution.com>
Subject Sending private-key in json (using API to open session)
Date Fri, 26 Apr 2019 06:58:06 GMT
Hi



We have been using the API for a while to automatically open up a remote
session (VNC/RDP) with success.



We have started to use it for ssh, and with using a username/password – its
pretty successful. Here is what a json that is supplied to the API looks
like:



{

    "username" : "user",

    "expires" : "",

    "connections" : {

        "paul" : {

            "protocol" : "ssh",

            "parameters" : {

                "hostname" : "rca",

                "username" : "paul",

                "port" : "10004",

                "password" : "hello"

            }

        }

    }

}



I use the encrypt-json.sh script and get the output, can go direct to the
URL to test and it works.



Issue is using a private key, how are we supposed to put that into the
json? IWe have tried like this:



{

    "username" : "user",

    "expires" : "",

    "connections" : {

        "paul" : {

            "protocol" : "ssh",

            "parameters" : {

                "hostname" : "rca",

                "username" : "paul",

                "port" : "10004",

                "private-key" : "-----BEGIN DSA PRIVATE KEY-----

MIIBuwIBAAKBgQDppeXMVXvli6AG1ndhH1hvyTCekMzeiqvPGKKqcWfUKWIzvyJ+

<SNIP>

En4Ima6HUc54HT3ybLzaPGuDnISsi3p+8LL3wO8xV145fG+Wme9NigIVAJOAY4mD

A1cmHO6ihlFARJ89tOch

-----END DSA PRIVATE KEY-----"

            }

        }

    }

}



But when we use encrypt-json.sh and create the token, and pass the token to
the website, we get this message in the logs and get a connection error
message in the website:



ERROR o.g.g.auth.json.user.UserDataService - Received JSON is invalid:
Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using
backslash to be included in string value

at [Source: java.io.StringReader@662d76c; line: 11, column: 66]



When we escape out the json required characters the json looks like this:

{

    "username" : "user",

    "expires" : "",

    "connections" : {

        "paul" : {

            "protocol" : "ssh",

            "parameters" : {

                "hostname" : "rca",

                "username" : "paul",

                "port" : "10004",

                "private-key" : "-----BEGIN DSA PRIVATE
KEY-----\r\nMIIBuwIBAAKBgQDppeXMVXvli6AG1ndhH1hvyTCekMzeiqvPGKKqcWfUKWIzvyJ+\r\n
<SNIP>
En4Ima6HUc54HT3ybLzaPGuDnISsi3p+8LL3wO8xV145fG+Wme9NigIVAJOAY4mD\r\nA1cmHO6ihlFARJ89tOch\r\n-----END
DSA PRIVATE KEY-----"

            }

        }

    }

}





But now connecting I get this:



ERROR o.g.g.auth.json.user.UserDataService - Received JSON is invalid:
Unexpected character ('-' (code 45)) in numeric value: expected digit (0-9)
to follow minus sign, for valid numeric value

at [Source: java.io.StringReader@32408e9d; line: 1, column: 3]



Anyone able to provide any pointers?



Thanks

Mime
View raw message