diff options
Diffstat (limited to 'package/sslenv')
-rwxr-xr-x | package/sslenv | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/package/sslenv b/package/sslenv new file mode 100755 index 0000000..67cd601 --- /dev/null +++ b/package/sslenv @@ -0,0 +1,42 @@ +#!/bin/sh + +shout() { echo "${0}: $@" >&2; } +barf() { shout "fatal: $@"; exit 111; } +safe() { "$@" || barf "cannot $@"; } + +safe umask 022 +here=`env - PATH=$PATH pwd` +mypwd=${here%package} +mypwd=${mypwd%/} +home=`head -1 $mypwd/conf-home` + +nofiles=`grep auxiliar $mypwd/conf-ids | awk -F: '{print $2}'` +sqmtls=`grep TLS $mypwd/conf-ids | awk -F: '{print $2}'` + +safe mkdir -p $home/ssl +safe chown $sqmtls:$nofiles $home/ssl + +ucspi=`head -1 $mypwd/conf-ucspissl` + +if [ -d $ucspi/etc ] +then + for i in `ls $ucspi/etc` + do + shout "Copying ucspi-ssl file '$i' to $home/ssl" + safe cp "$ucspi/etc/$i" "$home/ssl/$i" + safe chown $sqmtls:$nofiles "$home/ssl/$i" + done +else + barf "Can't find ucspi-ssl dir. Check 'conf-ucspissl'." +fi + +[ -f $mypwd/service/ssl.env ] && \ +safe cat $mypwd/service/ssl.env \ + | eval sed -e 's}QMAIL}$home}g' \ + -e 's}SQMTLS}$sqmtls}g' \ + -e 's}NOFILES}$nofiles}g' \ + > $home/ssl/ssl.env + +shout "Environment for s/qmail TLS defined in $home/ssl/ssl.env" + +exit 0 |