From e8477204a3ebf5c80e1fa51101a31617af6ea5a0 Mon Sep 17 00:00:00 2001 From: Robert Hafner Date: Thu, 5 Dec 2013 15:29:04 -0800 Subject: [PATCH] Making another attempt to deal with the ssl issue --- tests/SetupEnvironment.sh | 6 +----- tests/resources/Scripts/SSL.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 tests/resources/Scripts/SSL.sh diff --git a/tests/SetupEnvironment.sh b/tests/SetupEnvironment.sh index 8825946..07559f3 100755 --- a/tests/SetupEnvironment.sh +++ b/tests/SetupEnvironment.sh @@ -5,11 +5,7 @@ if [ -n "$TRAVIS" ]; then echo 'Travis config not yet written' sudo cp -Rp $TRAVIS_BUILD_DIR/tests/resources /resources sudo /bin/bash /resources/Scripts/Provision.sh - sudo stop dovecot - sudo cp -p /resources/dovecot.pem /etc/ssl/private/ - sudo chgrp dovecot /etc/ssl/private/dovecot.pem - sudo start dovecot - + sudo /bin/bash /resources/Scripts/SSL.sh else diff --git a/tests/resources/Scripts/SSL.sh b/tests/resources/Scripts/SSL.sh new file mode 100644 index 0000000..56e40a3 --- /dev/null +++ b/tests/resources/Scripts/SSL.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +stop dovecot + +STARTPATH=`pwd` + +SSL_CERT=/etc/ssl/certs/dovecot.pem +SSL_KEY=/etc/ssl/private/dovecot.pem + +echo "Creating generic self-signed certificate: $SSL_CERT" +cd /etc/ssl/certs +PATH=$PATH:/usr/bin/ssl +FQDN=`hostname -f` +MAILNAME=`cat /etc/mailname 2> /dev/null || hostname -f` +(openssl req -new -x509 -days 365 -nodes -out $SSL_CERT -keyout $SSL_KEY > /dev/null 2>&1 <<+ +. +. +. +Dovecot mail server +$FQDN +$FQDN +root@$MAILNAME ++ +) || echo "Warning : Bad SSL config, can't generate certificate." + + +chown root $SSL_CERT || true +chgrp dovecot $SSL_CERT || true +chmod 0644 $SSL_CERT || true +chown root $SSL_KEY || true +chgrp dovecot $SSL_KEY || true +chmod 0600 $SSL_KEY || true + +start dovecot \ No newline at end of file