File bacula-password-setup.sh of Package bacula
#!/bin/bash
#
# this script creates random passwords for all
# locally installed bacula configuration files,
# as long as they have the initial placeholders.
#
# attention, only call this after ALL bacula programs
# have been installed, or you will not have synchronized
# passwords in all daemons.
# of course this does not create passwords for
# daemons on other machines.
#
cd /etc/bacula;
for string in XXX_REPLACE_WITH_DIRECTOR_PASSWORD_XXX\
XXX_REPLACE_WITH_CLIENT_PASSWORD_XXX \
XXX_REPLACE_WITH_STORAGE_PASSWORD_XXX \
XXX_REPLACE_WITH_DIRECTOR_MONITOR_PASSWORD_XXX \
XXX_REPLACE_WITH_CLIENT_MONITOR_PASSWORD_XXX \
XXX_REPLACE_WITH_STORAGE_MONITOR_PASSWORD_XXX; do
pass=`openssl rand -base64 33`
for file in *.conf; do
echo "setting new password for ${string} in file ${file}"
sed -i'' "s@${string}@${pass}@g" $file
done
done