Welcome to mirror list, hosted at ThFree Co, Russian Federation.

hackish-apache-test « apache-conf-files « tests - github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c4df319ed7fdc16ad304860e78d754cc64017d8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

# A hackish script to see if the client is behaving as expected 
# with each of the "passing" conf files.

# TODO presently this requires interaction and human judgement to 
# assess, but it should be automated
export EA=/etc/apache2/ 
TESTDIR="`dirname $0`"
LEROOT="`realpath \"$TESTDIR/../../\"`"
cd $TESTDIR/passing
LETSENCRYPT="${LETSENCRYPT:-$LEROOT/venv/bin/letsencrypt}"

function CleanupExit() {
    echo control c, exiting tests...
    if [ "$f" != "" ] ; then
        sudo rm /etc/apache2/sites-{enabled,available}/"$f"
    fi
    exit 1
}

FAILS=0
trap CleanupExit INT
for f in *.conf ; do 
    echo -n  testing "$f"...
    sudo cp "$f" "$EA"/sites-available/
    sudo ln -s "$EA/sites-available/$f" "$EA/sites-enabled/$f"
    RESULT=`echo c | sudo "$LETSENCRYPT" --staging --apache --register-unsafely-without-email --agree-tos certonly -t 2>&1`
    if echo $RESULT | grep -Eq \("Please specify --domains"\|"mod_macro is not yet"\) ; then
        echo passed
    else
        echo failed
        echo $RESULT
        echo
        echo
        FAILS=`expr $FAILS + 1`
    fi
    sudo rm /etc/apache2/sites-{enabled,available}/"$f"
done
if [ "$FAILS" -ne 0 ] ; then
    exit 1
fi
exit 0