We have hybrid environments (Windows + Ubuntu) and multiple scripts to monitor the systems via Zabbix.
All the scripts work well in Windows + Ubuntu via powershell but I´m facing the following issue and I don´t have clear even if it´s possible to solve.
Some Scripts needs some credentials to work properly.The credentials are stored (AsSecure Strings) in another file. The script calls this file when need it.
Of course, for windows this is the way to do it, I guess. But what could be the alternative to Ubuntu?
How we do it for windows: First get the Secure String and assign it to a variable.
In a standard powershell console: Read-Host 'Enter password' -AsSecureString | ConvertFrom-SecureString
$PWD_secure = "xxxxxxxxxxxxxxxxxxxxx"
Then I have this line that saves user/pass into a global variable used by X scripts who needs it.
$global:credentials= New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList Username, (ConvertTo-SecureString -String $PWD_secure)
Of course tried same principle with linux. I get a SecureString (no error given) but the Script is never able to login. Is there a similar alternative to hide the passwords without storing a file into disk?