Notes on how to transfer files to airgapped systems.
Requirements:
- ECS Exec enabled on your container
- container need to have installed
lrzsz(to provide aYMODEMreceiver)
Then to transfer files fom your workstation to the container, you can run:
socat EXEC:'sx --ymodem -b -k /path/to/file/one /path/to/file/two ...',pipes EXEC:"aws --profile $PROFILE ecs execute-command --cluster $CLUSTER --container $CONTAINER --interactive --task $TASK --command \'/usr/bin/rx --ymodem -b\'",nofork
- observed roughly transfer speeds above 40kiB/s
- ZMODEM initially stalls for about 30 seconds
- handshake from
rxlooks to be chopped (smells like line buffering) after the\r, which on thesxside appears in the following read when the next handshake attempt is made, so they end up overlapping - tired setting raw mode (
stty rawas well as other combinations) and could not find something that worked - XMODEM/YMODEM work fine though
- handshake from
- SSM gets upset if you send larger than 1kB packets (so we use
-k) - we pass
pipestosocatotherwise at the end of the transfer we get a died withSIGPIPE
socat EXEC:'sx --zmodem -b --start-8k /path/to/file/one /path/to/file/two ...',pipes EXEC:"kubectl -n $NAMESPACE exec -i $CONTAINER -- /usr/bin/rx --ymodem -b",nofork
- observed roughly transfer speeds around 6MiB/s for AWS EKS
- ...of course you could alternatively use
kubectl cp ...