summaryrefslogtreecommitdiff
path: root/package/sslenv
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-03 15:48:04 +0200
commit89b7b67a13ebb7965cc7f13ad0595e2194a2d34c (patch)
tree25efd77a90ae87236e6730d8ea3846bbe0fd126f /package/sslenv
add sqmail-4.2.29asqmail-4.2
Diffstat (limited to 'package/sslenv')
-rwxr-xr-xpackage/sslenv42
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