summaryrefslogtreecommitdiff
path: root/data/stunnel/stunnel3
blob: ea14575371f710fe3f36181ab050608ea84849d4 (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
#!/bin/bash
exec stunnel <(
    (while getopts 'cTWfD:O:o:C:p:v:a:A:t:N:u:n:E:R:B:I:d:s:g:P:r:L:l:' OPTKEY; do
        case $OPTKEY in
            (c) echo "client = yes";;
            (T) echo "transparent = yes";;
            (W) echo "RNDoverwrite = yes";;
            (f) echo "foreground = yes";;
            (D) echo "debug = $OPTARG";;
            (O) echo "socket = $OPTARG";;
            (o) echo "output = $OPTARG";;
            (C) echo "ciphers = $OPTARG";;
            (p) echo "cert = $OPTARG";;
            (v) echo "verify = $OPTARG";;
            (a) echo "CApath = $OPTARG";;
            (A) echo "CAfile = $OPTARG";;
            (t) echo "session = $OPTARG";;
            (N) echo "service = $OPTARG";;
            (u) echo "ident = $OPTARG";;
            (n) echo "protocol = $OPTARG";;
            (E) echo "EGD = $OPTARG";;
            (R) echo "RNDfile = $OPTARG";;
            (B) echo "RNDbytes = $OPTARG";;
            (I) echo "local = $OPTARG";;

            (d)
                echo "accept = $OPTARG"
                stunnel3=
            ;;

            (s) echo "setuid = $OPTARG";;
            (g) echo "setgid = $OPTARG";;
            (P) echo "pid = $OPTARG";;
            (r) echo "connect = $OPTARG";;

            (L)
                echo "pty = yes"
                echo "exec = $OPTARG"
            ;;

            (l)
                echo "exec = $OPTARG"
            ;;
        esac
    done

    if [[ ${stunnel3+@} ]]; then
        echo "[stunnel3]"
    fi

    shift $((OPTIND - 1))
    if [[ $# -ne 0 ]]; then
        echo "execargs = $@"
    fi) | tee >(cat>&2)
)