3
# stunnel3 Perl wrapper to use stunnel 3.x syntax in stunnel >=4.05
4
# Copyright (c) 2004-2005 Michal Trojnara <Michal.Trojnara@mirt.net>
9
# Author: Michal Trojnara <Michal.Trojnara@mirt.net>
11
# This program is free software; you can redistribute it and/or modify
12
# it under the terms of the GNU General Public License as published by
13
# the Free Software Foundation; either version 2 of the License, or
14
# (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU General Public License for more details.
21
# You should have received a copy of the GNU General Public License
22
# along with this program; if not, write to the Free Software
23
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29
# Configuration - path to stunnel (version >=4.05)
30
$stunnel_bin='@prefix@/sbin/stunnel4';
32
# stunnel3 script body begins here
33
($read_fd, $write_fd)=POSIX::pipe();
35
die "Can't fork" unless defined $pid;
37
POSIX::close($write_fd);
38
exec "$stunnel_bin -fd $read_fd";
39
die "$stunnel_bin exec failed";
42
POSIX::close($read_fd);
43
open(STUNNEL, ">&$write_fd");
44
# comment out the next line to see the config file
47
getopts('cTWfD:O:o:C:p:v:a:A:t:N:u:n:E:R:B:I:d:s:g:P:r:L:l:');
49
print("client = yes\n") if defined $opt_c;
50
print("transparent = yes\n") if defined $opt_T;
51
print("RNDoverwrite = yes\n") if defined $opt_W;
52
print("foreground = yes\n") if defined $opt_f;
53
print("debug = $opt_D\n") if defined $opt_D;
54
print("socket = $opt_O\n") if defined $opt_O;
55
print("output = $opt_o\n") if defined $opt_o;
56
print("ciphers = $opt_C\n") if defined $opt_C;
57
print("cert = $opt_p\n") if defined $opt_p;
58
print("verify = $opt_v\n") if defined $opt_v;
59
print("CApath = $opt_a\n") if defined $opt_a;
60
print("CAfile = $opt_A\n") if defined $opt_A;
61
print("session = $opt_t\n") if defined $opt_t;
62
print("service = $opt_N\n") if defined $opt_N;
63
print("ident = $opt_u\n") if defined $opt_u;
64
print("protocol = $opt_n\n") if defined $opt_n;
65
print("EGD = $opt_E\n") if defined $opt_E;
66
print("RNDfile = $opt_R\n") if defined $opt_R;
67
print("RNDbytes = $opt_B\n") if defined $opt_B;
68
print("local = $opt_I\n") if defined $opt_I;
69
print("accept = $opt_d\n") if defined $opt_d;
70
print("setuid = $opt_s\n") if defined $opt_s;
71
print("setgid = $opt_g\n") if defined $opt_g;
72
print("pid = $opt_P\n") if defined $opt_P;
73
print("connect = $opt_r\n") if defined $opt_r;
74
print("pty = yes\n"), $opt_l=$opt_L if defined $opt_L;
75
print("exec = $opt_l\n") if defined $opt_l;
76
print("execargs = " . join(' ', @ARGV) . "\n") if @ARGV;
77
print("[stunnel3]\n") if defined $opt_d;
81
# stunnel3 script body ends here