Solved

Script usage : how to hide credentials

  • 30 March 2022
  • 4 replies
  • 373 views

Userlevel 1
Badge +7

Hello the community !

Recently you helped me on the ‘Massive import’ topic, by the usage of a script to execute many changes on one action. I’ve used this solution and it works fine.

I would like to improve the last line :

/usr/share/centreon/script/delete_device_from_hostgroup.sh <user> <password> <hostgroup> <file>

My objective is to hide <password>, for obvious security reasons. I’ve tried to use .bashrc file with an alias, but it didn’t work.

Do you have an idea to improve this ?

Thanks !

icon

Best answer by omercier 1 April 2022, 17:12

View original

4 replies

Userlevel 4
Badge +13

Hello Pierre


Is it the same contact/user you’re using each time you execute the script?

If yes, is it possible for you to do it directly into the script and not in the parameters.

Userlevel 1
Badge +7

Hello sduret, yes it’s the same user. It’s a good idea, I’ll test it next monday.

 

Thanks,

Userlevel 4
Badge +12

My way of handling it with a script that is launched manually:

read -s PASSWORD
<type your password + ENTER (it won't be displayed)>
/usr/share/centreon/script/delete_device_from_hostgroup.sh <user> "$PASSWORD" <hostgroup> <file>

 

Userlevel 1
Badge +7

Thanks omercier, yes it works fine, the password is hidden, and I don’t have to add it on each script.

I’ll apply this solution.

Reply