#!/bin/bash # usage: file_env VAR # ie: file_env TOTO__FILE file_env() { local fileVar="$1" local var="${fileVar/__FILE/}" if [ "${!fileVar:-}" ]; then val="$(< "${!fileVar}")" export "$var"="$val" unset "$fileVar" fi } for e in $(env); do echo $e >&2 var=$(cut -d " " -f 1 <<< "${e}") if [[ "$var" == *__file ]] ; then echo "Processing secret : ${var}" >&2 file_env "$var" fi done #echo -e "BASE ${LDAP_BASE}\nURI ${LDAP_SERVER}" > /etc/nslcd.conf #for item in passwd shadow group; do # sed -i "s/^${item}:.*/${item}: files ldap/g" /etc/nsswitch.conf #done #/usr/sbin/nslcd #/usr/sbin/rsyslogd /usr/sbin/sshd touch /var/log/auth.log tail -F /var/log/auth.log