#!/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 var=$(cut -d "=" -f 1 <<< "${e}") echo "$e, $var" >&2 if [[ "$var" =~ __FILE$ ]] ; then echo "Processing secret : ${var}" >&2 file_env "$var" fi done envsubst < /etc/sssd/sssd.conf.orig > /etc/sssd/sssd.conf systemctl start sssd.service pam-auth-update --enable mkhomedir #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