Username and Password are passed as plain text as environment variable while running a bash script from a existing process. using following command.
sudo -u someuser USERNAME=abc PASSWORD=xyz /path/to/script/bashscript argument1 argument2
Above bash script is user configurable script with username and password. the challenge I am facing above is, Environment variables are getting logged. like in auth.log which we don't want.
I am looking for ways to achieve one of the following:
- To prevent it from logging(into auth.log).
- encrypt username and password in exiting process(c program) and pass as environment variable and have some way to decrypt it in bash script.
I tried looking solution for this. didn't found any which fit with my use-case. Can someone please help me with this? I will also like to know any other ways to make system more secure.