Skip to main content
Solved

Script usage : how to hide credentials

  • March 30, 2022
  • 4 replies
  • 523 views

pierre1
Forum|alt.badge.img+9

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 !

Best answer by omercier

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>

 

4 replies

sduret
Centreonian
Forum|alt.badge.img+13
  • Centreonian
  • April 1, 2022

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.


pierre1
Forum|alt.badge.img+9
  • Author
  • April 1, 2022

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

 

Thanks,


omercier
Centreonian
Forum|alt.badge.img+13
  • Centreonian
  • Answer
  • April 1, 2022

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>

 


pierre1
Forum|alt.badge.img+9
  • Author
  • April 4, 2022

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.