Open rupertbg opened 2 years ago
I've tested the code and it works fine with the above documentation. @bertrandmartel Can you please merge this PR?
I've tested the code and it works fine with the above documentation. @bertrandmartel Can you please merge this PR?
@ToshipSo , I tried here and the 'slice' function seems not working from my side. Is there any tip how to solve it?
I've tested the code and it works fine with the above documentation. @bertrandmartel Can you please merge this PR?
@ToshipSo , I tried here and the 'slice' function seems not working from my side. Is there any tip how to solve it? ce.
. I can confirm the code still works like a charm! About my problem with slice:
`export function transformBlobIntoUInt8Array (blob) { const arr1 = []
for (let i = 0; i < size; i += 1) {
arr1.push(blob[i])
}
return new Uint8Array(arr1)
}` I did by my own a code to conver a blob into a Uint8Array and it worked.
Hey @sergiosilvajr - yes decryptExecText(ciphertext)
expects the ciphertext to be the payload
from the decode
function of this library (aws-ssm-session), when the payloadType === 1
.
In most implementations you will still need to check the handshake request (5) for the KMSEncryption
field to ensure the server is requesting an encrypted session, and fallback to plaintext communication if it's missing if that's desired.
Also the binaryType
of the underlying WebSocket is set to "arraybuffer"
Hey @sergiosilvajr - yes
decryptExecText(ciphertext)
expects the ciphertext to be thepayload
from thedecode
function of this library (aws-ssm-session), when thepayloadType === 1
.In most implementations you will still need to check the handshake request (5) for the
KMSEncryption
field to ensure the server is requesting an encrypted session, and fallback to plaintext communication if it's missing if that's desired.Also the
binaryType
of the underlying WebSocket is set to"arraybuffer"
Hi, @rupertbg , I am using the KMSEncryption described on this pr and it worked. At this moment I am doing some tests with the websocket using KMSEncryption but the handshaking fails when I have 2 or more users trying to use the interface with websockets to a ssm node at the same time. Any tips on how solve it?
@sergiosilvajr I'm not entirely sure off the top of my head but it sounds like potentially an issue with the messageSequenceNumber
?
does anybody know what happened w @bertrandmartel ?
does anybody know what happened w @bertrandmartel ?
Not sure, but you could always use my fork or make a new fork if you want to fix a bug or add new features.
This adds support for handling the handshake that runs when using SSM Session Manager or ECS Exec with KMS Encryption enabled.
Handling the encryption / decryption I've left out of scope but it looks something like this:
Handle RequestedClientActions where the KMSKeyId to use is supplied and respond to the handshake
You will need credentials for AWS KMS at this stage, so you can generate a data key
SSM requires you to request a 512 bit key from KMS, provide the ciphertext to the Agent via the handshake response, and then split the key into two 256 bit keys and use one for encrypt and one for decrypt (the agent at the other end does the same but in reverse.)
Handle the KMS challenge request payload by decrypting and re-encrypting a challenge value that is sent from the agent.
And don't forget to decrypt / encrypt data that you send and receive after that
Decrypt:
Encrypt: