summaryrefslogtreecommitdiffstats
path: root/test/createinstance.sh
blob: 05380905f8a2db2b9d72f068f166ec23221ebb47 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh
#
# Make a temporary Apache instance for testing.

function create_content_dirs {
    local dir=$1

    mkdir $1

    # Create the content
    mkdir $dir/rc4_cipher
    mkdir $dir/openssl_rc4_cipher
    mkdir $dir/openssl_aes_cipher
    mkdir $dir/dhe_cipher
    mkdir $dir/acl
    mkdir $dir/protocolssl2
    mkdir $dir/protocolssl3
    mkdir $dir/protocoltls1
    mkdir $dir/protocoltls11
    mkdir $dir/protocoltls12
    mkdir $dir/proxydata

    cat > $dir/index.html << EOF
    <html>
    Basic index page for $dir
    </html
EOF

    cp $dir/index.html $dir/acl/aclS01.html
    cp $dir/index.html $dir/acl/aclS02.html
    cp $dir/index.html $dir/acl/aclS03.html
    cp $dir/index.html $dir/secret-test.html
    cp $dir/index.html $dir/protocolssl2/index.html
    cp $dir/index.html $dir/protocolssl3/index.html
    cp $dir/index.html $dir/protocoltls1/index.html
    cp $dir/index.html $dir/protocoltls11/index.html
    cp $dir/index.html $dir/protocoltls12/index.html
    cp $dir/index.html $dir/proxydata/index.html
}

target=$1

echo "Creating instance in $target"
mkdir -p $target

# Make the default server root
cd $target
mkdir alias
mkdir bin
mkdir conf
mkdir conf.d
mkdir logs
mkdir run
mkdir cgi-bin
mkdir lib

if [ -e /usr/lib64/libnssckbi.so ]; then
    cd alias
    ln -s /usr/lib64/libnssckbi.so  .
    cd ..
elif [ -e /usr/lib/libnssckbi.so ]; then
    cd alias
    ln -s /usr/lib/libnssckbi.so  .
    cd ..
fi

touch conf.d/empty.conf

# Create the content directories
create_content_dirs content
count=1
while test $count -lt 26 ; do
    create_content_dirs "sni${count}"
    count=`expr $count + 1`
done

ln -s /etc/httpd/modules modules

dn="E=alpha@`hostname`,CN=Frank Alpha,UID=alpha,OU=People,O=example.com,C=US"
cat > conf/htpasswd << EOF
/${dn}:xxj31ZMTZzkVA
EOF

# Create start/stop scripts

cat << EOF >  start
#!/bin/sh
MALLOC_CHECK_=3
MALLOC_PERTURB=9
HTTPD=/usr/sbin/httpd
#valgrind --leak-check=full --log-file=valgrind.out.%p --trace-children=yes --track-origins=yes \$HTTPD -X -k start -d . -f ./conf/httpd.conf
\$HTTPD -k start -d . -f ./conf/httpd.conf
EOF

cat << EOF > stop
#!/bin/sh
HTTPD=/usr/sbin/httpd
\$HTTPD -k stop -d . -f ./conf/httpd.conf
EOF

chmod 0755 start stop