Files
bastionssh/init.sh
Eric Coissac 7f7257e422
All checks were successful
continuous-integration/drone/push Build is passing
Actualiser init.sh
2024-01-02 22:45:25 +01:00

38 lines
725 B
Bash

#!/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