Any ideas for transporting variables in chroot bash script?
Hello, iam in the making of artix install script. I start with setting variables in dialog like bootloader="refind" and etc. but when i do artix-chroot into chroot.sh script variables are gone.
Preferably, put the variables into a temp file (e.g. using mktemp) and bind-mount that file somewhere into the chroot directory, so you can source it from within that environment.
That way the critical information, like the passwords, at least only gets to live in volatile memory and won't stick around on the host system after the reboot. That limits the exposure somewhat.
Pack it into a json or CSV oneline string and shove it in a CLI password manager you can access in a scriptable way from both users. (I use the linux tool, 'pass' for this).
Alternatively, save it to a dropfile that only both users can access.
Passing them as arguments can be even worse - depending on the configuration, process arguments of running processes can be seen by everything running on the machine.
But I suppose u are working in live environment loaded from iso ,so u should be already comporissed then if some process can read ur files. What's ur threat model
It would be more secure if the credentials are in an in memory SQLite Database but that would require you to use something other than the shell. You would need to do a hardware key or have the user do a bootstrap password or have an API that uses a public key to authenticate the remote process passing the credentials