Skip to content

Instantly share code, notes, and snippets.

@jimdigriz
Last active April 21, 2024 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimdigriz/3746f55602630bd44b41206f39dcc5a9 to your computer and use it in GitHub Desktop.
Save jimdigriz/3746f55602630bd44b41206f39dcc5a9 to your computer and use it in GitHub Desktop.
Airgapped File Transfers

Notes on how to transfer files to airgapped systems.

AWS

ECS

Requirements:

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

Findings

  • observed roughly transfer speeds above 40kiB/s
  • ZMODEM initially stalls for about 30 seconds
    • handshake from rx looks to be chopped (smells like line buffering) after the \r, which on the sx side appears in the following read when the next handshake attempt is made, so they end up overlapping
    • tired setting raw mode (stty raw as well as other combinations) and could not find something that worked
    • XMODEM/YMODEM work fine though
  • SSM gets upset if you send larger than 1kB packets (so we use -k)
  • we pass pipes to socat otherwise at the end of the transfer we get a died with SIGPIPE

Kubenetes

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

Findings

  • observed roughly transfer speeds around 6MiB/s for AWS EKS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment