Problem context
I am trying to implement a job orchestrator whose agent/worker programs, connect to machines via an SSH session/shell. I would like to transfer (potentially binary) files to these agents (which could be needed for any sort of task).
Obviously, if ports can be configured in any way, then nc
and a couple instructions could be executed. However, I'm trying to get something that works with the most restrictive setup.
Something I often do when working in this sort of setup (manually) is to serialize the file into Base64 or similar, and "paste" the data into the console session, something like:
echo -n "BINARY_BASE64_DATA" | base64 --decode > file_destination.file
I would like to implement something like this for the agent/worker I describe above.
Question
The crux of the question is on what tool to use to have the largest compatibility surface. Most Linux machines (even the bare-bones Docker/Vagrant images) seem to have base64
installed. However, FreeBSD does not seem to have this command pre-installed. I know I can install it with pkg
or Ports, but I would like to use something out-of-the-box as much as possible.
I looked for something more POSIX/Unix-y, and found this: https://en.wikipedia.org/wiki/List_of_Unix_commands which says:
This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems.
and has a long table of commands, of which the relevant ones would be uuencode
and uudecode
which are both listed as "mandatory".
On FreeBSD, I can see that it is installed out-of-the-box.
On my Ubuntu desktop, it is also present, although I don't know if it came out of the box or was installed as a dependency of something else I installed. However, inside an Ubuntu Vagrant box (generic/ubuntu2004
, specifically), invoking uuencode
shows the following message:
$ uuencode
Command 'uuencode' not found, but can be installed with:
apt install sharutils
Please ask your administrator.
On a Docker image I have based on Ubuntu 14.04, I get:
# uuencode
bash: uuencode: command not found
- Why does Ubuntu not include
uuencode
/uudecode
out-of-the-box in all situations? Does this make it less POSIX/Unix-compliant? - Is there another command that I am missing that provides the sort of functionality I am looking for, or should I just give up and demand that the worker/agent machine has the
base64
binary installed to work with the orchestrator?