Imported Upstream version 4.57

This commit is contained in:
Mario Fetka 2017-03-28 10:18:03 +02:00
parent ce7eba2efe
commit 74a62c14eb
49 changed files with 3268 additions and 1874 deletions

View File

@ -1,6 +1,6 @@
stunnel license (see COPYRIGHT.GPL for detailed GPL conditions)
Copyright (C) 1998-2012 Michal Trojnara
Copyright (C) 1998-2013 Michal Trojnara
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software

View File

@ -1,6 +1,80 @@
stunnel change log
Version 4.57, 2015.04.01, urgency: HIGH:
* Security bugfixes
- Added PRNG state update in fork threading (CVE-2014-0016).
Version 4.56, 2013.03.22, urgency: HIGH:
* New features
- Win32 installer automatically configures firewall exceptions.
- Win32 installer configures administrative shortcuts to invoke UAC.
- Improved Win32 GUI shutdown time.
* Bugfixes
- Fixed a regression bug introduced in version 4.55 causing random
crashes on several platforms, including Windows 7.
- Fixed startup crashes on some Win32 systems.
- Fixed incorrect "stunnel -exit" process synchronisation.
- Fixed FIPS detection with new versions of the OpenSSL library.
- Failure to open the log file at startup is no longer ignored.
Version 4.55, 2013.03.03, urgency: HIGH:
* Security bugfixes
- Buffer overflow vulnerability fixed in the NTLM authentication
of the CONNECT protocol negotiation.
See https://www.stunnel.org/CVE-2013-1762.html for details.
- OpenSSL updated to version 1.0.1e in Win32/Android builds.
* New features
- SNI wildcard matching in server mode.
- Terminal version of stunnel (tstunnel.exe) build for Win32.
* Bugfixes
- Fixed write half-close handling in the transfer() function (thx to
Dustin Lundquist).
- Fixed EAGAIN error handling in the transfer() function (thx to Jan Bee).
- Restored default signal handlers before execvp() (thx to Michael Weiser).
- Fixed memory leaks in protocol negotiation (thx to Arthur Mesh).
- Fixed a file descriptor leak during configuration file reload (thx to
Arthur Mesh).
- Closed SSL sockets were removed from the transfer() c->fds poll.
- Minor fix in handling exotic inetd-mode configurations.
- WCE compilation fixes.
- IPv6 compilation fix in protocol.c.
- Windows installer fixes.
Version 4.54, 2012.10.09, urgency: MEDIUM:
* New Win32 features
- FIPS module updated to version 2.0.
- OpenSSL DLLs updated to version 1.0.1c.
- zlib DLL updated to version 1.2.7.
- Engine DLLs added: 4758cca, aep, atalla, capi, chil, cswift, gmp, gost,
nuron, padlock, sureware, ubsec.
* Other new features
- "session" option renamed to more readable "sessionCacheTimeout".
The old name remains accepted for backward compatibility.
- New service-level "sessionCacheSize" option to control session cache size.
- New service-level option "reset" to control whether TCP RST flag is used
to indicate errors. The default value is "reset = yes".
- New service-level option "renegotiation" to disable SSL renegotiation.
This feature is based on a public-domain patch by Janusz Dziemidowicz.
- New FreeBSD socket options: IP_FREEBIND, IP_BINDANY, IPV6_BINDANY (thx
to Janusz Dziemidowicz).
- New parameters to configure TLS v1.1/v1.2 with OpenSSL version 1.0.1
or higher (thx to Henrik Riomar).
* Bugfixes
- Fixed "Application Failed to Initialize Properly (0xc0150002)" error.
- Fixed missing SSL state debug log entries.
- Fixed a race condition in libwrap code resulting in random stalls (thx
to Andrew Skalski).
- Session cache purged at configuration file reload to reduce memory leak.
Remaining leak of a few kilobytes per section is yet to be fixed.
- Fixed a regression bug in "transparent = destination" functionality (thx
to Stefan Lauterbach). This bug was introduced in stunnel 4.51.
- "transparent = destination" is now a valid endpoint in inetd mode.
- "delay = yes" fixed to work even if specified *after* "connect" option.
- Multiple "connect" targets fixed to also work with delayed resolver.
- The number of resolver retries of EAI_AGAIN error has been limited to 3
in order to prevent infinite loops.
Version 4.53, 2012.03.19, urgency: MEDIUM:
* New features
- Added client-mode "sni" option to directly control the value of
@ -94,14 +168,14 @@ Version 4.46, 2011.11.04, urgency: LOW:
- Added "verify = 4" mode to ignore CA chain and only verify peer certificate.
- Removed the limit of 16 IP addresses for a single 'connect' option.
- Removed the limit of 256 stunnel.conf sections in PTHREAD threading model.
It is still not possible have more than 63 sections on WIN32 platform.
It is still not possible have more than 63 sections on Win32 platform.
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx
* Optimizations
- Reduced per-connection memory usage.
- Performed a major refactoring of internal data structures. Extensive
internal testing was performed, but some regression bugs are expected.
* Bugfixes
- Fixed WIN32 compilation with Mingw32.
- Fixed Win32 compilation with Mingw32.
- Fixed non-blocking API emulation layer in UCONTEXT threading model.
- Fixed signal handling in UCONTEXT threading model.
@ -146,7 +220,7 @@ Version 4.43, 2011.09.07, urgency: MEDIUM:
- Major optimization of the logging subsystem.
Benchmarks indicate up to 15% stunnel performance improvement.
* Bugfixes
- Fixed WIN32 configuration file reload.
- Fixed Win32 configuration file reload.
- Fixed FORK and UCONTEXT threading models.
- Corrected INSTALL.W32 file.
@ -280,14 +354,14 @@ Version 4.34, 2010.09.19, urgency: LOW:
* Bugfixes
- Implemented fixes in user interface to enter engine PIN.
- Fixed a transfer() loop issue on socket errors.
- Fixed missing WIN32 taskbar icon while displaying a global option error.
- Fixed missing Win32 taskbar icon while displaying a global option error.
Version 4.33, 2010.04.05, urgency: MEDIUM:
* New features
- Win32 DLLs for OpenSSL 1.0.0.
This library requires to c_rehash CApath/CRLpath directories on upgrade.
- Win32 DLLs for zlib 1.2.4.
- Experimental support for local mode on WIN32 platform.
- Experimental support for local mode on Win32 platform.
Try "exec = c:\windows\system32\cmd.exe".
* Bugfixes
- Inetd mode fixed.

View File

@ -23,15 +23,17 @@ distclean-local:
rm -rf autom4te.cache
rm -f $(distdir)-installer.exe
dist-hook:
makensis -NOCD -DVERSION=${VERSION} -DSRCDIR=$(srcdir) \
-DDLLS=/usr/src/openssl-0.9.8s-fips/out32dll \
$(srcdir)/tools/stunnel.nsi
#dist-hook:
# makensis -NOCD -DVERSION=${VERSION} -DSRCDIR=$(srcdir) \
# -DOPENSSL=/usr/src/openssl-0.9.8u-fips/out32dll \
# -DZLIB=/usr/src/zlib-1.2.6-i586 \
# $(srcdir)/tools/stunnel.nsi
# cp -f $(distdir)-installer.exe ../dist
# gpg --yes --armor --detach-sign --force-v3-sigs ../dist/$(distdir)-installer.exe
sign: dist
cp -f $(distdir).tar.gz ../dist
cp -f $(distdir)-installer.exe ../dist
gpg --yes --armor --detach-sign --force-v3-sigs ../dist/$(distdir).tar.gz
gpg --yes --armor --detach-sign --force-v3-sigs ../dist/$(distdir)-installer.exe
sha256sum $(distdir).tar.gz | tee ../dist/$(distdir).tar.gz.sha256

View File

@ -515,9 +515,6 @@ distdir: $(DISTFILES)
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
@ -578,7 +575,7 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
@ -742,19 +739,19 @@ uninstall-am: uninstall-docDATA
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-generic \
distclean-libtool distclean-local distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-docDATA install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs installdirs-am \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am uninstall-docDATA
dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-libtool \
distclean-local distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-docDATA install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-docDATA
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
@ -763,16 +760,18 @@ distclean-local:
rm -rf autom4te.cache
rm -f $(distdir)-installer.exe
dist-hook:
makensis -NOCD -DVERSION=${VERSION} -DSRCDIR=$(srcdir) \
-DDLLS=/usr/src/openssl-0.9.8s-fips/out32dll \
$(srcdir)/tools/stunnel.nsi
#dist-hook:
# makensis -NOCD -DVERSION=${VERSION} -DSRCDIR=$(srcdir) \
# -DOPENSSL=/usr/src/openssl-0.9.8u-fips/out32dll \
# -DZLIB=/usr/src/zlib-1.2.6-i586 \
# $(srcdir)/tools/stunnel.nsi
# cp -f $(distdir)-installer.exe ../dist
# gpg --yes --armor --detach-sign --force-v3-sigs ../dist/$(distdir)-installer.exe
sign: dist
cp -f $(distdir).tar.gz ../dist
cp -f $(distdir)-installer.exe ../dist
gpg --yes --armor --detach-sign --force-v3-sigs ../dist/$(distdir).tar.gz
gpg --yes --armor --detach-sign --force-v3-sigs ../dist/$(distdir)-installer.exe
sha256sum $(distdir).tar.gz | tee ../dist/$(distdir).tar.gz.sha256
# Tell versions [3.59,3.63) of GNU make to not export all variables.

10
TODO
View File

@ -3,6 +3,7 @@ stunnel TODO
High priority features. They will likely be supported some day.
A sponsor could allocate my time to get them faster.
* Perform protocol negotiations after SSL negotiations if possible.
* Command-line server control interface on both Unix and Windows.
* Separate GUI process running as current user on Windows.
* Optional line-buffering of the log file.
@ -15,6 +16,7 @@ A sponsor could allocate my time to get them faster.
* Configuration file option to limit the number of concurrent connections.
* SOCKS 4 protocol support.
http://archive.socks.permeo.com/protocol/socks4.protocol
* Option to redirect instead of rejecting connections on failed authentication.
Low priority features. They will unlikely ever be supported.
* Provide 64-bit Windows builds (besides 32-bit builds).
@ -23,6 +25,7 @@ Low priority features. They will unlikely ever be supported.
* Service-level logging configuration (separate verbosity and destination).
* Key renegotiation (re-handshake) for long connections.
* Logging to NT EventLog on Windows.
* Log rotation on Windows.
* Internationalization of logged messages (i18n).
* Generic scripting engine instead or static protocol.c.
@ -32,8 +35,11 @@ Features I won't support, unless convinced otherwise by a wealthy sponsor.
This feature is less useful since PROXY protocol support is available.
- Support for adding X-Forwarded-For to SMTP email headers.
This feature is most likely to be implemented as a separate proxy.
* Additional certificate checks (including wildcard comparison) based on CN
and X509v3 Subject Alternative Name.
* Additional certificate checks (including wildcard comparison) based on:
- CN (Common Name);
- SAN (Subject Alternative Name);
- O (Organization), and
- OU (Organizational Unit).
* Set processes title that appear on the ps(1) and top(1) commands.
I could not find a portable *and* non-copyleft library for it.

View File

@ -1,6 +1,6 @@
#!/bin/sh
set -ev
VERSION=4.53
VERSION=4.57
DST=stunnel-$VERSION-android
# to build Zlib:
@ -15,11 +15,14 @@ DST=stunnel-$VERSION-android
# make
# make install
./configure --build=i686-pc-linux-gnu --host=arm-linux-androideabi --prefix=/data/local --with-ssl=/opt/androideabi/sysroot
mkdir -p bin/android
cd bin/android
../../configure --build=i686-pc-linux-gnu --host=arm-linux-androideabi --prefix=/data/local --with-ssl=/opt/androideabi/sysroot
make clean
make
cd ../..
mkdir $DST
cp src/stunnel /opt/androideabi/sysroot/bin/openssl $DST
cp bin/android/src/stunnel /opt/androideabi/sysroot/bin/openssl $DST
# arm-linux-androideabi-strip $DST/stunnel $DST/openssl
arm-linux-androideabi-strip $DST/openssl
zip -r $DST.zip $DST

728
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,10 @@
# Process this file with autoconf to produce a configure script.
AC_INIT([stunnel],[4.53])
AC_INIT([stunnel],[4.57])
AC_MSG_NOTICE([**************************************** initialization])
AC_CONFIG_AUX_DIR(auto)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(stunnel, 4.53)
AM_INIT_AUTOMAKE(stunnel, 4.57)
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_SRCDIR([src/stunnel.c])
AC_DEFINE([_GNU_SOURCE], [1], [Use GNU source])
@ -455,32 +455,27 @@ valid_CPPFLAGS="$CPPFLAGS"; CPPFLAGS="$CPPFLAGS -I$SSLDIR/include"
valid_LIBS="$LIBS"; LIBS="$LIBS -L$SSLDIR/lib64 -L$SSLDIR/lib -lssl -lcrypto"
AC_CHECK_HEADER([$SSLDIR/include/openssl/engine.h],
[AC_DEFINE([HAVE_OSSL_ENGINE_H], [1], [Define to 1 if you have <engine.h> header file.])],
[AC_DEFINE([HAVE_OSSL_ENGINE_H], [1],
[Define to 1 if you have <engine.h> header file.])],
[AC_MSG_WARN([OpenSSL engine header not found])])
AC_CHECK_HEADER([$SSLDIR/include/openssl/ocsp.h],
[AC_DEFINE([HAVE_OSSL_OCSP_H], [1], [Define to 1 if you have <ocsp.h> header file.])],
[AC_DEFINE([HAVE_OSSL_OCSP_H], [1],
[Define to 1 if you have <ocsp.h> header file.])],
[AC_MSG_WARN([OpenSSL ocsp header not found])])
AC_MSG_CHECKING([for FIPS_mode_set])
AC_CHECK_HEADER([$SSLDIR/include/openssl/fips.h],
[AC_DEFINE([HAVE_OSSL_FIPS_H], [1],
[Define to 1 if you have <fips.h> header file.])],
[AC_MSG_WARN([OpenSSL fips header not found])])
if test "$fips" = "auto"; then
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[
#include <openssl/fips.h>
],
[
FIPS_mode_set(1);
],
)],
[AC_MSG_RESULT([yes])
AC_DEFINE([USE_FIPS], [1], [Define to 1 to enable OpenSSL FIPS mode.])
], [
AC_MSG_RESULT([no])
]
)
else
AC_MSG_RESULT([test skipped])
AC_CHECK_FUNCS(FIPS_mode_set, [
AC_DEFINE([USE_FIPS], [1], [Define to 1 to enable OpenSSL FIPS mode.])
AC_MSG_NOTICE([FIPS mode detected])
], [
AC_MSG_NOTICE([FIPS mode not detected])
])
fi
CPPFLAGS="$valid_CPPFLAGS"

View File

@ -62,7 +62,7 @@
.\" ========================================================================
.\"
.IX Title "STUNNEL 8"
.TH STUNNEL 8 "2012.01.14" "4.53" "stunnel"
.TH STUNNEL 8 "2013.03.20" "4.56" "stunnel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -132,21 +132,21 @@ Don't display any message boxes
.IX Header "CONFIGURATION FILE"
Each line of the configuration file can be either:
.IP "\(bu" 4
an empty line (ignored)
An empty line (ignored).
.IP "\(bu" 4
a comment starting with ';' (ignored)
A comment starting with ';' (ignored).
.IP "\(bu" 4
an 'option_name = option_value' pair
An 'option_name = option_value' pair.
.IP "\(bu" 4
\&'[service_name]' indicating a start of a service definition
\&'[service_name]' indicating a start of a service definition.
.PP
An address parameter of an option may be either:
.IP "\(bu" 4
a port number
A port number.
.IP "\(bu" 4
a colon-separated pair of \s-1IP\s0 address (either IPv4, IPv6, or domain name) and port number
A colon-separated pair of \s-1IP\s0 address (either IPv4, IPv6, or domain name) and port number.
.IP "\(bu" 4
a Unix socket path (Unix only)
A Unix socket path (Unix only).
.SS "\s-1GLOBAL\s0 \s-1OPTIONS\s0"
.IX Subsection "GLOBAL OPTIONS"
.IP "\fBchroot\fR = directory (Unix only)" 4
@ -156,6 +156,18 @@ directory to chroot \fBstunnel\fR process
\&\fBchroot\fR keeps \fBstunnel\fR in chrooted jail. \fICApath\fR, \fICRLpath\fR, \fIpid\fR
and \fIexec\fR are located inside the jail and the patches have to be relative
to the directory specified with \fBchroot\fR.
.Sp
Several functions of the operating system also need their files to be located within chroot jail, e.g.:
.RS 4
.IP "\(bu" 4
Delayed resolver typically needs /etc/nsswitch.conf and /etc/resolv.conf.
.IP "\(bu" 4
Local time in log files needs /etc/timezone.
.IP "\(bu" 4
Some other functions may need devices, e.g. /dev/zero or /dev/null.
.RE
.RS 4
.RE
.IP "\fBcompression\fR = deflate | zlib | rle" 4
.IX Item "compression = deflate | zlib | rle"
select data compression algorithm
@ -164,10 +176,10 @@ default: no compression
.Sp
deflate is the standard compression method as described in \s-1RFC\s0 1951.
.Sp
zlib compression of OpenSSL 0.9.8 or above is not backward compatible with
OpenSSL 0.9.7.
zlib compression of \fBOpenSSL 0.9.8\fR or above is not backward compatible with
\&\fBOpenSSL 0.9.7\fR.
.Sp
rle compression is currently not implemented by the OpenSSL library.
rle compression is currently not implemented by the \fBOpenSSL\fR library.
.IP "\fBdebug\fR = [facility.]level" 4
.IX Item "debug = [facility.]level"
debugging level
@ -186,8 +198,8 @@ Case is ignored for both facilities and levels.
.IX Item "EGD = egd path (Unix only)"
path to Entropy Gathering Daemon socket
.Sp
Entropy Gathering Daemon socket to use to feed OpenSSL random number
generator. (Available only if compiled with OpenSSL 0.9.5a or higher)
Entropy Gathering Daemon socket to use to feed \fBOpenSSL\fR random number
generator. (Available only if compiled with \fBOpenSSL 0.9.5a\fR or higher)
.IP "\fBengine\fR = auto | <engine id>" 4
.IX Item "engine = auto | <engine id>"
select hardware engine
@ -220,8 +232,8 @@ engine cryptogaphic module.
.IX Item "fips = yes | no"
Enable or disable \s-1FIPS\s0 140\-2 mode.
.Sp
This option allows to disable entering \s-1FIPS\s0 mode if stunnel was compiled with
\&\s-1FIPS\s0 140\-2 support.
This option allows to disable entering \s-1FIPS\s0 mode if \fBstunnel\fR was compiled
with \s-1FIPS\s0 140\-2 support.
.Sp
default: yes
.IP "\fBforeground\fR = yes | no (Unix only)" 4
@ -249,9 +261,9 @@ If the argument is empty, then no pid file will be created.
.IX Item "RNDbytes = bytes"
bytes to read from random seed files
.Sp
Number of bytes of data read from random seed files. With \s-1SSL\s0 versions
less than 0.9.5a, also determines how many bytes of data are considered
sufficient to seed the \s-1PRNG\s0. More recent OpenSSL versions have a builtin
Number of bytes of data read from random seed files. With \s-1SSL\s0 versions less
than \fB0.9.5a\fR, also determines how many bytes of data are considered
sufficient to seed the \s-1PRNG\s0. More recent \fBOpenSSL\fR versions have a builtin
function to determine when sufficient randomness is available.
.IP "\fBRNDfile\fR = file" 4
.IX Item "RNDfile = file"
@ -335,8 +347,8 @@ the \fIverify\fR. Note that the certificates in this directory should be named
\&\s-1XXXXXXXX\s0.0 where \s-1XXXXXXXX\s0 is the hash value of the \s-1DER\s0 encoded subject of the
cert.
.Sp
The hash algorithm has been changed in OpenSSL 1.0.0. It is required to
c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.
The hash algorithm has been changed in \fBOpenSSL 1.0.0\fR. It is required to
c_rehash the directory on upgrade from \fBOpenSSL 0.x.x\fR to \fBOpenSSL 1.x.x\fR.
.Sp
\&\fICApath\fR path is relative to \fIchroot\fR directory if specified.
.IP "\fBCAfile\fR = certfile" 4
@ -383,8 +395,8 @@ This is the directory in which \fBstunnel\fR will look for CRLs when
using the \fIverify\fR. Note that the CRLs in this directory should
be named \s-1XXXXXXXX\s0.r0 where \s-1XXXXXXXX\s0 is the hash value of the \s-1CRL\s0.
.Sp
The hash algorithm has been changed in OpenSSL 1.0.0. It is required to
c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.
The hash algorithm has been changed in \fBOpenSSL 1.0.0\fR. It is required to
c_rehash the directory on upgrade from \fBOpenSSL 0.x.x\fR to \fBOpenSSL 1.x.x\fR.
.Sp
\&\fICRLpath\fR path is relative to \fIchroot\fR directory if specified.
.IP "\fBCRLfile\fR = certfile" 4
@ -408,7 +420,7 @@ default: prime256v1
delay \s-1DNS\s0 lookup for 'connect' option
.Sp
This option is useful for dynamic \s-1DNS\s0, or when \s-1DNS\s0 is not available during
stunnel startup (road warrior \s-1VPN\s0, dial-up configurations).
\&\fBstunnel\fR startup (road warrior \s-1VPN\s0, dial-up configurations).
.IP "\fBengineNum\fR = engine number" 4
.IX Item "engineNum = engine number"
select engine number to read private key
@ -461,29 +473,34 @@ default: yes
.IX Item "local = host"
\&\s-1IP\s0 of the outgoing interface is used as source for remote connections.
Use this option to bind a static local \s-1IP\s0 address, instead.
.IP "\fBsni\fR = service_name:server_name (server mode)" 4
.IX Item "sni = service_name:server_name (server mode)"
.IP "\fBsni\fR = service_name:server_name_pattern (server mode)" 4
.IX Item "sni = service_name:server_name_pattern (server mode)"
Use the service as a slave service (a name-based virtual server) for Server
Name Indication \s-1TLS\s0 extension (\s-1RFC\s0 3546).
.Sp
\&\fIservice_name\fR specifies the master service that accepts client connections
with \fIaccept\fR option. \fIserver_name\fR specifies the host name to be redirected.
with \fIaccept\fR option. \fIserver_name_pattern\fR specifies the host name to be
redirected. The pattern may start with '*' character, e.g. '*.example.com'.
Multiple slave services are normally specified for a single master service.
\&\fIsni\fR option can also be specified more than once within a single slave service.
\&\fIsni\fR option can also be specified more than once within a single slave
service.
.Sp
This service, as well as the master service, may not be configured in client
mode.
.Sp
This service, as well as the master service, may not be configured in client mode.
\&\fIconnect\fR option of the slave service is ignored when \fIprotocol\fR option is
specified, as \fIprotocol\fR connects remote host before \s-1TLS\s0 handshake.
.Sp
Libwrap checks (Unix only) are performed twice: with master service name after
\&\s-1TCP\s0 connection is accepted, and with slave service name during \s-1TLS\s0 handshake.
.Sp
Option \fIsni\fR is only available when compiled with OpenSSL 1.0.0 and later.
Option \fIsni\fR is only available when compiled with \fBOpenSSL 1.0.0\fR and later.
.IP "\fBsni\fR = server_name (client mode)" 4
.IX Item "sni = server_name (client mode)"
Use the parameter as the value of \s-1TLS\s0 Server Name Indication (\s-1RFC\s0 3546)
extension.
.Sp
Option \fIsni\fR is only available when compiled with OpenSSL 1.0.0 and later.
Option \fIsni\fR is only available when compiled with \fBOpenSSL 1.0.0\fR and later.
.IP "\fB\s-1OCSP\s0\fR = url" 4
.IX Item "OCSP = url"
select \s-1OCSP\s0 server for certificate verification
@ -497,9 +514,9 @@ currently supported flags: \s-1NOCERTS\s0, \s-1NOINTERN\s0 \s-1NOSIGS\s0, \s-1NO
\&\s-1NOEXPLICIT\s0, \s-1NOCASIGN\s0, \s-1NODELEGATED\s0, \s-1NOCHECKS\s0, \s-1TRUSTOTHER\s0, \s-1RESPID_KEY\s0, \s-1NOTIME\s0
.IP "\fBoptions\fR = SSL_options" 4
.IX Item "options = SSL_options"
OpenSSL library options
\&\fBOpenSSL\fR library options
.Sp
The parameter is the OpenSSL option name as described in the
The parameter is the \fBOpenSSL\fR option name as described in the
\&\fI\fISSL_CTX_set_options\fI\|(3ssl)\fR manual, but without \fI\s-1SSL_OP_\s0\fR prefix.
Several \fIoptions\fR can be used to specify multiple options.
.Sp
@ -511,8 +528,10 @@ the following option can be used:
.Ve
.IP "\fBprotocol\fR = proto" 4
.IX Item "protocol = proto"
application protocol to negotiate \s-1SSL\s0 (e.g. \fIstarttls\fR or \fIstls\fR)
application protocol to negotiate \s-1SSL\s0
.Sp
This option enables initial, protocol-specific negotiation of the \s-1SSL/TLS\s0
encryption.
\&\fIprotocol\fR option should not be used with \s-1SSL\s0 encryption on a separate port.
.Sp
Currently supported protocols:
@ -555,12 +574,18 @@ authentication type for protocol negotiations
.Sp
currently supported: basic, \s-1NTLM\s0
.Sp
Currently authentication type only applies to 'connect' protocol.
Currently authentication type only applies to the 'connect' protocol.
.Sp
default: basic
.IP "\fBprotocolHost\fR = host:port" 4
.IX Item "protocolHost = host:port"
destination address for protocol negotiations
.Sp
\&\fIprotocolHost\fR specifies the final \s-1SSL\s0 server to be connected by the proxy,
and not the proxy server directly connected by \fBstunnel\fR.
The proxy server should be specified with the 'connect' option.
.Sp
Currently protocol destination address only applies to 'connect' protocol.
.IP "\fBprotocolPassword\fR = password" 4
.IX Item "protocolPassword = password"
password for protocol negotiations
@ -570,14 +595,48 @@ username for protocol negotiations
.IP "\fBpty\fR = yes | no (Unix only)" 4
.IX Item "pty = yes | no (Unix only)"
allocate pseudo terminal for 'exec' option
.IP "\fBretry\fR = yes | no (Unix only)" 4
.IX Item "retry = yes | no (Unix only)"
.IP "\fBrenegotiation\fR = yes | no" 4
.IX Item "renegotiation = yes | no"
support \s-1SSL\s0 renegotiation
.Sp
Applications of the \s-1SSL\s0 renegotiation include some authentication scenarios,
or re-keying long lasting connections.
.Sp
On the other hand this feature can facilitate a trivial CPU-exhaustion
DoS attack:
.Sp
http://vincent.bernat.im/en/blog/2011\-ssl\-dos\-mitigation.html
.Sp
Please note that disabling \s-1SSL\s0 renegotiation does not fully mitigate
this issue.
.Sp
default: yes (if supported by \fBOpenSSL\fR)
.IP "\fBreset\fR = yes | no" 4
.IX Item "reset = yes | no"
attempt to use \s-1TCP\s0 \s-1RST\s0 flag to indicate an error
.Sp
This option is not supported on some platforms.
.Sp
default: yes
.IP "\fBretry\fR = yes | no" 4
.IX Item "retry = yes | no"
reconnect a connect+exec section after it's disconnected
.Sp
default: no
.IP "\fBsession\fR = timeout" 4
.IX Item "session = timeout"
.IP "\fBsessionCacheSize\fR = size" 4
.IX Item "sessionCacheSize = size"
session cache size
.Sp
\&\fIsessionCacheSize\fR specifies the maximum number of the internal session cache
entries.
.Sp
The value of 0 can be used for unlimited size. It is not recommended
for production use due to the risk of memory exhaustion DoS attack.
.IP "\fBsessionCacheTimeout\fR = timeout" 4
.IX Item "sessionCacheTimeout = timeout"
session cache timeout
.Sp
This is the number of seconds to keep cached \s-1SSL\s0 sessions.
.IP "\fBsessiond\fR = host:port" 4
.IX Item "sessiond = host:port"
address of sessiond \s-1SSL\s0 cache server
@ -585,7 +644,7 @@ address of sessiond \s-1SSL\s0 cache server
.IX Item "sslVersion = version"
select version of \s-1SSL\s0 protocol
.Sp
Allowed options: all, SSLv2, SSLv3, TLSv1
Allowed options: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2
.IP "\fBstack\fR = bytes (except for \s-1FORK\s0 model)" 4
.IX Item "stack = bytes (except for FORK model)"
thread stack size
@ -619,7 +678,7 @@ This option is currently available in:
.RS 4
.IP "Remote mode (\fIconnect\fR option) on \fILinux >=2.6.28\fR" 4
.IX Item "Remote mode (connect option) on Linux >=2.6.28"
This configuration requires stunnel to be executed as root and without
This configuration requires \fBstunnel\fR to be executed as root and without
\&\fIsetuid\fR option.
.Sp
This configuration requires the following setup for iptables and routing
@ -638,9 +697,10 @@ This configuration requires the following setup for iptables and routing
\&\fBstunnel\fR must also to be executed as root and without \fIsetuid\fR option.
.IP "Remote mode (\fIconnect\fR option) on \fILinux 2.2.x\fR" 4
.IX Item "Remote mode (connect option) on Linux 2.2.x"
This configuration requires kernel to be compiled with \fItransparent proxy\fR option.
This configuration requires kernel to be compiled with \fItransparent proxy\fR
option.
Connected service must be installed on a separate host.
Routing towards the clients has to go through the stunnel box.
Routing towards the clients has to go through the \fBstunnel\fR box.
.Sp
\&\fBstunnel\fR must also to be executed as root and without \fIsetuid\fR option.
.IP "Remote mode (\fIconnect\fR option) on \fIFreeBSD >=8.0\fR" 4
@ -697,22 +757,26 @@ This options has been renamed to \fInone\fR.
.IX Item "verify = level"
verify peer certificate
.RS 4
.IP "\fIlevel 0\fR \- request and ignore peer certificate" 4
.IX Item "level 0 - request and ignore peer certificate"
.PD 0
.IP "\fIlevel 1\fR \- verify peer certificate if present" 4
.IX Item "level 1 - verify peer certificate if present"
.IP "\fIlevel 2\fR \- verify peer certificate" 4
.IX Item "level 2 - verify peer certificate"
.IP "\fIlevel 3\fR \- verify peer with locally installed certificate" 4
.IX Item "level 3 - verify peer with locally installed certificate"
.IP "\fIlevel 4\fR \- ignore \s-1CA\s0 chain and only verify peer certificate" 4
.IX Item "level 4 - ignore CA chain and only verify peer certificate"
.IP "\fIdefault\fR \- no verify" 4
.IX Item "default - no verify"
.IP "level 0" 4
.IX Item "level 0"
Request and ignore peer certificate.
.IP "level 1" 4
.IX Item "level 1"
Verify peer certificate if present.
.IP "level 2" 4
.IX Item "level 2"
Verify peer certificate.
.IP "level 3" 4
.IX Item "level 3"
Verify peer with locally installed certificate.
.IP "level 4" 4
.IX Item "level 4"
Ignore \s-1CA\s0 chain and only verify peer certificate.
.IP "default" 4
.IX Item "default"
No verify.
.RE
.RS 4
.PD
.Sp
It is important to understand, that this option was solely designed for access
control and not for authorization. Specifically for level 2 every non-revoked
@ -725,7 +789,7 @@ for webservers. Level 3 is preferred for point-to-point connections.
\&\fBstunnel\fR returns zero on success, non-zero on error.
.SH "SIGNALS"
.IX Header "SIGNALS"
The following signals can be used to control stunnel in Unix environment:
The following signals can be used to control \fBstunnel\fR in Unix environment:
.IP "\s-1SIGHUP\s0" 4
.IX Item "SIGHUP"
Force a reload of the configuration file.
@ -745,20 +809,20 @@ setuid
.RE
.RS 4
.Sp
The use of 'setuid' option will also prevent stunnel from binding privileged
The use of 'setuid' option will also prevent \fBstunnel\fR from binding privileged
(<1024) ports during configuration reloading.
.Sp
When 'chroot' option is used, stunnel will look for all its files (including
When 'chroot' option is used, \fBstunnel\fR will look for all its files (including
configuration file, certificates, log file and pid file) within the chroot
jail.
.RE
.IP "\s-1SIGUSR1\s0" 4
.IX Item "SIGUSR1"
Close and reopen stunnel log file.
Close and reopen \fBstunnel\fR log file.
This function can be used for log rotation.
.IP "\s-1SIGTERM\s0, \s-1SIGQUIT\s0, \s-1SIGINT\s0" 4
.IX Item "SIGTERM, SIGQUIT, SIGINT"
Shut stunnel down.
Shut \fBstunnel\fR down.
.PP
The result of sending any other signals to the server is undefined.
.SH "EXAMPLES"
@ -827,7 +891,7 @@ configurations.
Each \s-1SSL\s0 enabled daemon needs to present a valid X.509 certificate
to the peer. It also needs a private key to decrypt the incoming
data. The easiest way to obtain a certificate and a key is to
generate them with the free \fIOpenSSL\fR package. You can find more
generate them with the free \fBOpenSSL\fR package. You can find more
information on certificates generation on pages listed below.
.PP
The order of contents of the \fI.pem\fR file is important. It should contain the
@ -868,10 +932,10 @@ The egd socket specified with '\-\-with\-egd\-sock' at compile time.
.IP "\(bu" 4
The /dev/urandom device.
.PP
With recent (>=OpenSSL 0.9.5a) version of \s-1SSL\s0 it will stop loading
random data automatically when sufficient entropy has been gathered.
With previous versions it will continue to gather from all the above
sources since no \s-1SSL\s0 function exists to tell when enough data is available.
With recent (\fBOpenSSL 0.9.5a\fR or later) version of \s-1SSL\s0 it will stop loading
random data automatically when sufficient entropy has been gathered. With
previous versions it will continue to gather from all the above sources since
no \s-1SSL\s0 function exists to tell when enough data is available.
.PP
Note that on Windows machines that do not have console user interaction
(mouse movements, creating windows, etc.) the screen contents are not
@ -882,14 +946,13 @@ Note that the file specified with the \fIRNDfile\fR flag should contain
random data \*(-- that means it should contain different information
each time \fBstunnel\fR is run. This is handled automatically
unless the \fIRNDoverwrite\fR flag is used. If you wish to update this file
manually, the \fIopenssl rand\fR command in recent versions of OpenSSL,
manually, the \fIopenssl rand\fR command in recent versions of \fBOpenSSL\fR,
would be useful.
.PP
One important note \*(-- if /dev/urandom is available, OpenSSL has a habit of
seeding the \s-1PRNG\s0 with it even when checking the random state, so on
systems with /dev/urandom you're likely to use it even though it's listed
at the very bottom of the list above. This isn't \fBstunnel's\fR behaviour, it's
OpenSSLs.
Important note: If /dev/urandom is available, \fBOpenSSL\fR often seeds the \s-1PRNG\s0
with it while checking the random state. On systems with /dev/urandom
\&\fBOpenSSL\fR is likely to use it even though it is listed at the very bottom of
the list above. This is the behaviour of \fBOpenSSL\fR and not \fBstunnel\fR.
.SS "\s-1DH\s0 \s-1PARAMETERS\s0"
.IX Subsection "DH PARAMETERS"
Stunnel 4.40 and later contains hardcoded 2048\-bit \s-1DH\s0 parameters.
@ -908,7 +971,7 @@ It is also possible to specify \s-1DH\s0 parameters in the certificate file:
\&\fBstunnel\fR configuration file
.SH "BUGS"
.IX Header "BUGS"
Option \fIexecargs\fR does not support quoting.
Option \fIexecargs\fR and Win32 command line does not support quoting.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
.IP "\fItcpd\fR\|(8)" 4
@ -922,7 +985,7 @@ internet 'super\-server'
\&\fBstunnel\fR homepage
.IP "\fIhttp://www.openssl.org/\fR" 4
.IX Item "http://www.openssl.org/"
OpenSSL project website
\&\fBOpenSSL\fR project website
.SH "AUTHOR"
.IX Header "AUTHOR"
.IP "Michał Trojnara" 4

View File

@ -62,7 +62,7 @@
.\" ========================================================================
.\"
.IX Title "STUNNEL.FR 8"
.TH STUNNEL.FR 8 "2012.01.12" "4.53" "stunnel"
.TH STUNNEL.FR 8 "2013.03.19" "4.56" "stunnel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l

View File

@ -156,29 +156,29 @@ Eric Young (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>)</p>
<h1><a name="configuration_file">CONFIGURATION FILE</a></h1>
<p>Each line of the configuration file can be either:</p>
<ul>
<li><strong><a name="line" class="item">an empty line (ignored)</a></strong>
<li>
<p>An empty line (ignored).</p>
</li>
<li><strong><a name="a_comment_starting_with_ignored" class="item">a comment starting with ';' (ignored)</a></strong>
<li>
<p>A comment starting with ';' (ignored).</p>
</li>
<li><strong><a name="an_option_name_option_value_pair" class="item">an 'option_name = option_value' pair</a></strong>
<li>
<p>An 'option_name = option_value' pair.</p>
</li>
<li><strong><a name="service_name_indicating_a_start_of_a_service_definition" class="item">'[service_name]' indicating a start of a service definition</a></strong>
<li>
<p>'[service_name]' indicating a start of a service definition.</p>
</li>
</ul>
<p>An address parameter of an option may be either:</p>
<ul>
<li><strong><a name="a_port_number" class="item">a port number</a></strong>
<li>
<p>A port number.</p>
</li>
<li><strong><a name="address" class="item">a colon-separated pair of IP address (either IPv4, IPv6, or domain name) and port number</a></strong>
<li>
<p>A colon-separated pair of IP address (either IPv4, IPv6, or domain name) and port number.</p>
</li>
<li><strong><a name="path" class="item">a Unix socket path (Unix only)</a></strong>
<li>
<p>A Unix socket path (Unix only).</p>
</li>
</ul>
<p>
@ -192,6 +192,18 @@ Eric Young (<a href="mailto:eay@cryptsoft.com">eay@cryptsoft.com</a>)</p>
<p><strong>chroot</strong> keeps <strong>stunnel</strong> in chrooted jail. <em>CApath</em>, <em>CRLpath</em>, <em>pid</em>
and <em>exec</em> are located inside the jail and the patches have to be relative
to the directory specified with <strong>chroot</strong>.</p>
<p>Several functions of the operating system also need their files to be located within chroot jail, e.g.:</p>
<ul>
<li>
<p>Delayed resolver typically needs /etc/nsswitch.conf and /etc/resolv.conf.</p>
</li>
<li>
<p>Local time in log files needs /etc/timezone.</p>
</li>
<li>
<p>Some other functions may need devices, e.g. /dev/zero or /dev/null.</p>
</li>
</ul>
</dd>
<dt><strong><a name="compression_deflate_zlib_rle" class="item"><strong>compression</strong> = deflate | zlib | rle</a></strong></dt>
@ -199,9 +211,9 @@ to the directory specified with <strong>chroot</strong>.</p>
<p>select data compression algorithm</p>
<p>default: no compression</p>
<p>deflate is the standard compression method as described in <a href="http://www.ietf.org/rfc/rfc1951.txt" class="rfc">RFC 1951</a>.</p>
<p>zlib compression of OpenSSL 0.9.8 or above is not backward compatible with
OpenSSL 0.9.7.</p>
<p>rle compression is currently not implemented by the OpenSSL library.</p>
<p>zlib compression of <strong>OpenSSL 0.9.8</strong> or above is not backward compatible with
<strong>OpenSSL 0.9.7</strong>.</p>
<p>rle compression is currently not implemented by the <strong>OpenSSL</strong> library.</p>
</dd>
<dt><strong><a name="debug_facility_level" class="item"><strong>debug</strong> = [facility.]level</a></strong></dt>
@ -216,12 +228,12 @@ all levels numerically less than it will be shown. Use <em>debug = debug</em> o
(Facilities are not supported on Win32.)</p>
<p>Case is ignored for both facilities and levels.</p>
</dd>
<dt><strong><strong>EGD</strong> = egd path (Unix only)</strong></dt>
<dt><strong><a name="path" class="item"><strong>EGD</strong> = egd path (Unix only)</a></strong></dt>
<dd>
<p>path to Entropy Gathering Daemon socket</p>
<p>Entropy Gathering Daemon socket to use to feed OpenSSL random number
generator. (Available only if compiled with OpenSSL 0.9.5a or higher)</p>
<p>Entropy Gathering Daemon socket to use to feed <strong>OpenSSL</strong> random number
generator. (Available only if compiled with <strong>OpenSSL 0.9.5a</strong> or higher)</p>
</dd>
<dt><strong><a name="engine_auto_engine_id" class="item"><strong>engine</strong> = auto | &lt;engine id&gt;</a></strong></dt>
@ -254,8 +266,8 @@ engine cryptogaphic module.</p>
<dd>
<p>Enable or disable FIPS 140-2 mode.</p>
<p>This option allows to disable entering FIPS mode if stunnel was compiled with
FIPS 140-2 support.</p>
<p>This option allows to disable entering FIPS mode if <strong>stunnel</strong> was compiled
with FIPS 140-2 support.</p>
<p>default: yes</p>
</dd>
<dt><strong><a name="no" class="item"><strong>foreground</strong> = yes | no (Unix only)</a></strong></dt>
@ -284,9 +296,9 @@ output (for example to log them with daemontools splogger).</p>
<dd>
<p>bytes to read from random seed files</p>
<p>Number of bytes of data read from random seed files. With SSL versions
less than 0.9.5a, also determines how many bytes of data are considered
sufficient to seed the PRNG. More recent OpenSSL versions have a builtin
<p>Number of bytes of data read from random seed files. With SSL versions less
than <strong>0.9.5a</strong>, also determines how many bytes of data are considered
sufficient to seed the PRNG. More recent <strong>OpenSSL</strong> versions have a builtin
function to determine when sufficient randomness is available.</p>
</dd>
<dt><strong><a name="rndfile_file" class="item"><strong>RNDfile</strong> = file</a></strong></dt>
@ -311,12 +323,12 @@ number generator.</p>
<dt><strong><a name="groupname" class="item"><strong>setgid</strong> = groupname (Unix only)</a></strong></dt>
<dd>
<p><a href="#setgid"><code>setgid()</code></a> to groupname in daemon mode and clears all other groups</p>
<p><code>setgid()</code> to groupname in daemon mode and clears all other groups</p>
</dd>
<dt><strong><a name="username" class="item"><strong>setuid</strong> = username (Unix only)</a></strong></dt>
<dd>
<p><a href="#setuid"><code>setuid()</code></a> to username in daemon mode</p>
<p><code>setuid()</code> to username in daemon mode</p>
</dd>
<dt><strong><a name="socket_a_l_r_option_value_value" class="item"><strong>socket</strong> = a|l|r:option=value[:value]</a></strong></dt>
@ -377,8 +389,8 @@ below.</p>
the <em>verify</em>. Note that the certificates in this directory should be named
XXXXXXXX.0 where XXXXXXXX is the hash value of the DER encoded subject of the
cert.</p>
<p>The hash algorithm has been changed in OpenSSL 1.0.0. It is required to
c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.</p>
<p>The hash algorithm has been changed in <strong>OpenSSL 1.0.0</strong>. It is required to
c_rehash the directory on upgrade from <strong>OpenSSL 0.x.x</strong> to <strong>OpenSSL 1.x.x</strong>.</p>
<p><em>CApath</em> path is relative to <em>chroot</em> directory if specified.</p>
</dd>
<dt><strong><a name="cafile_certfile" class="item"><strong>CAfile</strong> = certfile</a></strong></dt>
@ -427,8 +439,8 @@ round-robin algorithm.</p>
<p>This is the directory in which <strong>stunnel</strong> will look for CRLs when
using the <em>verify</em>. Note that the CRLs in this directory should
be named XXXXXXXX.r0 where XXXXXXXX is the hash value of the CRL.</p>
<p>The hash algorithm has been changed in OpenSSL 1.0.0. It is required to
c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.</p>
<p>The hash algorithm has been changed in <strong>OpenSSL 1.0.0</strong>. It is required to
c_rehash the directory on upgrade from <strong>OpenSSL 0.x.x</strong> to <strong>OpenSSL 1.x.x</strong>.</p>
<p><em>CRLpath</em> path is relative to <em>chroot</em> directory if specified.</p>
</dd>
<dt><strong><a name="crlfile_certfile" class="item"><strong>CRLfile</strong> = certfile</a></strong></dt>
@ -451,7 +463,7 @@ c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.</p>
<dd>
<p>delay DNS lookup for 'connect' option</p>
<p>This option is useful for dynamic DNS, or when DNS is not available during
stunnel startup (road warrior VPN, dial-up configurations).</p>
<strong>stunnel</strong> startup (road warrior VPN, dial-up configurations).</p>
</dd>
<dt><strong><a name="enginenum_engine_number" class="item"><strong>engineNum</strong> = engine number</a></strong></dt>
@ -509,28 +521,31 @@ to its owner. On Unix systems you can use the following command:</p>
<p>IP of the outgoing interface is used as source for remote connections.
Use this option to bind a static local IP address, instead.</p>
</dd>
<dt><strong><a name="server_name" class="item"><strong>sni</strong> = service_name:server_name (server mode)</a></strong></dt>
<dt><strong><a name="server_name_pattern" class="item"><strong>sni</strong> = service_name:server_name_pattern (server mode)</a></strong></dt>
<dd>
<p>Use the service as a slave service (a name-based virtual server) for Server
Name Indication TLS extension (<a href="http://www.ietf.org/rfc/rfc3546.txt" class="rfc">RFC 3546</a>).</p>
<p><em>service_name</em> specifies the master service that accepts client connections
with <em>accept</em> option. <em>server_name</em> specifies the host name to be redirected.
with <em>accept</em> option. <em>server_name_pattern</em> specifies the host name to be
redirected. The pattern may start with '*' character, e.g. '*.example.com'.
Multiple slave services are normally specified for a single master service.
<em>sni</em> option can also be specified more than once within a single slave service.</p>
<p>This service, as well as the master service, may not be configured in client mode.
<em>connect</em> option of the slave service is ignored when <em>protocol</em> option is
specified, as <em>protocol</em> connects remote host before TLS handshake.
Libwrap checks (Unix only) are performed twice: with master service name after
<em>sni</em> option can also be specified more than once within a single slave
service.</p>
<p>This service, as well as the master service, may not be configured in client
mode.</p>
<p><em>connect</em> option of the slave service is ignored when <em>protocol</em> option is
specified, as <em>protocol</em> connects remote host before TLS handshake.</p>
<p>Libwrap checks (Unix only) are performed twice: with master service name after
TCP connection is accepted, and with slave service name during TLS handshake.</p>
<p>Option <em>sni</em> is only available when compiled with OpenSSL 1.0.0 and later.</p>
<p>Option <em>sni</em> is only available when compiled with <strong>OpenSSL 1.0.0</strong> and later.</p>
</dd>
<dt><strong><strong>sni</strong> = server_name (client mode)</strong></dt>
<dt><strong><a name="server_name" class="item"><strong>sni</strong> = server_name (client mode)</a></strong></dt>
<dd>
<p>Use the parameter as the value of TLS Server Name Indication (<a href="http://www.ietf.org/rfc/rfc3546.txt" class="rfc">RFC 3546</a>)
extension.</p>
<p>Option <em>sni</em> is only available when compiled with OpenSSL 1.0.0 and later.</p>
<p>Option <em>sni</em> is only available when compiled with <strong>OpenSSL 1.0.0</strong> and later.</p>
</dd>
<dt><strong><a name="ocsp_url" class="item"><strong>OCSP</strong> = url</a></strong></dt>
@ -548,8 +563,8 @@ NOEXPLICIT, NOCASIGN, NODELEGATED, NOCHECKS, TRUSTOTHER, RESPID_KEY, NOTIME</p>
<dt><strong><a name="options_ssl_options" class="item"><strong>options</strong> = SSL_options</a></strong></dt>
<dd>
<p>OpenSSL library options</p>
<p>The parameter is the OpenSSL option name as described in the
<p><strong>OpenSSL</strong> library options</p>
<p>The parameter is the <strong>OpenSSL</strong> option name as described in the
<em>SSL_CTX_set_options(3ssl)</em> manual, but without <em>SSL_OP_</em> prefix.
Several <em>options</em> can be used to specify multiple options.</p>
<p>For example for compatibility with erroneous Eudora SSL implementation
@ -560,8 +575,10 @@ the following option can be used:</p>
<dt><strong><a name="protocol_proto" class="item"><strong>protocol</strong> = proto</a></strong></dt>
<dd>
<p>application protocol to negotiate SSL (e.g. <em>starttls</em> or <em>stls</em>)</p>
<p><em>protocol</em> option should not be used with SSL encryption on a separate port.</p>
<p>application protocol to negotiate SSL</p>
<p>This option enables initial, protocol-specific negotiation of the SSL/TLS
encryption.
<em>protocol</em> option should not be used with SSL encryption on a separate port.</p>
<p>Currently supported protocols:</p>
<dl>
<dt><strong><a name="cifs" class="item"><em>cifs</em></a></strong></dt>
@ -614,13 +631,17 @@ Support for this extension was dropped in Samba 3.0.0.</p>
<dd>
<p>authentication type for protocol negotiations</p>
<p>currently supported: basic, NTLM</p>
<p>Currently authentication type only applies to 'connect' protocol.</p>
<p>Currently authentication type only applies to the 'connect' protocol.</p>
<p>default: basic</p>
</dd>
<dt><strong><a name="protocolhost_host_port" class="item"><strong>protocolHost</strong> = host:port</a></strong></dt>
<dd>
<p>destination address for protocol negotiations</p>
<p><em>protocolHost</em> specifies the final SSL server to be connected by the proxy,
and not the proxy server directly connected by <strong>stunnel</strong>.
The proxy server should be specified with the 'connect' option.</p>
<p>Currently protocol destination address only applies to 'connect' protocol.</p>
</dd>
<dt><strong><a name="protocolpassword_password" class="item"><strong>protocolPassword</strong> = password</a></strong></dt>
@ -637,16 +658,46 @@ Support for this extension was dropped in Samba 3.0.0.</p>
<dd>
<p>allocate pseudo terminal for 'exec' option</p>
</dd>
<dt><strong><strong>retry</strong> = yes | no (Unix only)</strong></dt>
<dt><strong><a name="renegotiation_yes_no" class="item"><strong>renegotiation</strong> = yes | no</a></strong></dt>
<dd>
<p>support SSL renegotiation</p>
<p>Applications of the SSL renegotiation include some authentication scenarios,
or re-keying long lasting connections.</p>
<p>On the other hand this feature can facilitate a trivial CPU-exhaustion
DoS attack:</p>
<p><a href="http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html">http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html</a></p>
<p>Please note that disabling SSL renegotiation does not fully mitigate
this issue.</p>
<p>default: yes (if supported by <strong>OpenSSL</strong>)</p>
</dd>
<dt><strong><a name="reset_yes_no" class="item"><strong>reset</strong> = yes | no</a></strong></dt>
<dd>
<p>attempt to use TCP RST flag to indicate an error</p>
<p>This option is not supported on some platforms.</p>
<p>default: yes</p>
</dd>
<dt><strong><a name="retry_yes_no" class="item"><strong>retry</strong> = yes | no</a></strong></dt>
<dd>
<p>reconnect a connect+exec section after it's disconnected</p>
<p>default: no</p>
</dd>
<dt><strong><a name="session_timeout" class="item"><strong>session</strong> = timeout</a></strong></dt>
<dt><strong><a name="sessioncachesize_size" class="item"><strong>sessionCacheSize</strong> = size</a></strong></dt>
<dd>
<p>session cache size</p>
<p><em>sessionCacheSize</em> specifies the maximum number of the internal session cache
entries.</p>
<p>The value of 0 can be used for unlimited size. It is not recommended
for production use due to the risk of memory exhaustion DoS attack.</p>
</dd>
<dt><strong><a name="sessioncachetimeout_timeout" class="item"><strong>sessionCacheTimeout</strong> = timeout</a></strong></dt>
<dd>
<p>session cache timeout</p>
<p>This is the number of seconds to keep cached SSL sessions.</p>
</dd>
<dt><strong><a name="sessiond_host_port" class="item"><strong>sessiond</strong> = host:port</a></strong></dt>
@ -657,7 +708,7 @@ Support for this extension was dropped in Samba 3.0.0.</p>
<dd>
<p>select version of SSL protocol</p>
<p>Allowed options: all, SSLv2, SSLv3, TLSv1</p>
<p>Allowed options: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2</p>
</dd>
<dt><strong><a name="bytes" class="item"><strong>stack</strong> = bytes (except for FORK model)</a></strong></dt>
@ -705,7 +756,7 @@ from the SSL client machine instead of the machine running <strong>stunnel</stro
<dt><strong><a name="mode" class="item">Remote mode (<em>connect</em> option) on <em>Linux &gt;=2.6.28</em></a></strong></dt>
<dd>
<p>This configuration requires stunnel to be executed as root and without
<p>This configuration requires <strong>stunnel</strong> to be executed as root and without
<em>setuid</em> option.</p>
<p>This configuration requires the following setup for iptables and routing
(possibly in /etc/rc.local or equivalent file):</p>
@ -722,9 +773,10 @@ from the SSL client machine instead of the machine running <strong>stunnel</stro
<dt><strong>Remote mode (<em>connect</em> option) on <em>Linux 2.2.x</em></strong></dt>
<dd>
<p>This configuration requires kernel to be compiled with <em>transparent proxy</em> option.
<p>This configuration requires kernel to be compiled with <em>transparent proxy</em>
option.
Connected service must be installed on a separate host.
Routing towards the clients has to go through the stunnel box.</p>
Routing towards the clients has to go through the <strong>stunnel</strong> box.</p>
<p><strong>stunnel</strong> must also to be executed as root and without <em>setuid</em> option.</p>
</dd>
<dt><strong>Remote mode (<em>connect</em> option) on <em>FreeBSD &gt;=8.0</em></strong></dt>
@ -784,18 +836,36 @@ other platforms.</p>
<dd>
<p>verify peer certificate</p>
<dl>
<dt><strong><a name="level_0_request_and_ignore_peer_certificate" class="item"><em>level 0</em> - request and ignore peer certificate</a></strong></dt>
<dt><strong><a name="level_0" class="item">level 0</a></strong></dt>
<dt><strong><a name="level_1_verify_peer_certificate_if_present" class="item"><em>level 1</em> - verify peer certificate if present</a></strong></dt>
<dd>
<p>Request and ignore peer certificate.</p>
</dd>
<dt><strong><a name="level_1" class="item">level 1</a></strong></dt>
<dt><strong><a name="level_2_verify_peer_certificate" class="item"><em>level 2</em> - verify peer certificate</a></strong></dt>
<dd>
<p>Verify peer certificate if present.</p>
</dd>
<dt><strong><a name="level_2" class="item">level 2</a></strong></dt>
<dt><strong><a name="level_3_verify_peer_with_locally_installed_certificate" class="item"><em>level 3</em> - verify peer with locally installed certificate</a></strong></dt>
<dd>
<p>Verify peer certificate.</p>
</dd>
<dt><strong><a name="level_3" class="item">level 3</a></strong></dt>
<dt><strong><a name="level_4_ignore_ca_chain_and_only_verify_peer_certificate" class="item"><em>level 4</em> - ignore CA chain and only verify peer certificate</a></strong></dt>
<dd>
<p>Verify peer with locally installed certificate.</p>
</dd>
<dt><strong><a name="level_4" class="item">level 4</a></strong></dt>
<dt><strong><a name="default_no_verify" class="item"><em>default</em> - no verify</a></strong></dt>
<dd>
<p>Ignore CA chain and only verify peer certificate.</p>
</dd>
<dt><strong><a name="default" class="item">default</a></strong></dt>
<dd>
<p>No verify.</p>
</dd>
</dl>
<p>It is important to understand, that this option was solely designed for access
control and not for authorization. Specifically for level 2 every non-revoked
@ -813,7 +883,7 @@ for webservers. Level 3 is preferred for point-to-point connections.</p>
</p>
<hr />
<h1><a name="signals">SIGNALS</a></h1>
<p>The following signals can be used to control stunnel in Unix environment:</p>
<p>The following signals can be used to control <strong>stunnel</strong> in Unix environment:</p>
<dl>
<dt><strong><a name="sighup" class="item">SIGHUP</a></strong></dt>
@ -821,38 +891,38 @@ for webservers. Level 3 is preferred for point-to-point connections.</p>
<p>Force a reload of the configuration file.</p>
<p>Some global options will not be reloaded:</p>
<ul>
<li><strong><a name="chroot" class="item">chroot</a></strong>
<li>
<p>chroot</p>
</li>
<li><strong><a name="foreground" class="item">foreground</a></strong>
<li>
<p>foreground</p>
</li>
<li><strong><a name="pid" class="item">pid</a></strong>
<li>
<p>pid</p>
</li>
<li><strong><a name="setgid" class="item">setgid</a></strong>
<li>
<p>setgid</p>
</li>
<li><strong><a name="setuid" class="item">setuid</a></strong>
<li>
<p>setuid</p>
</li>
</ul>
<p>The use of 'setuid' option will also prevent stunnel from binding privileged
<p>The use of 'setuid' option will also prevent <strong>stunnel</strong> from binding privileged
(&lt;1024) ports during configuration reloading.</p>
<p>When 'chroot' option is used, stunnel will look for all its files (including
<p>When 'chroot' option is used, <strong>stunnel</strong> will look for all its files (including
configuration file, certificates, log file and pid file) within the chroot
jail.</p>
</dd>
<dt><strong><a name="sigusr1" class="item">SIGUSR1</a></strong></dt>
<dd>
<p>Close and reopen stunnel log file.
<p>Close and reopen <strong>stunnel</strong> log file.
This function can be used for log rotation.</p>
</dd>
<dt><strong><a name="sigterm_sigquit_sigint" class="item">SIGTERM, SIGQUIT, SIGINT</a></strong></dt>
<dd>
<p>Shut stunnel down.</p>
<p>Shut <strong>stunnel</strong> down.</p>
</dd>
</dl>
<p>The result of sending any other signals to the server is undefined.</p>
@ -917,7 +987,7 @@ configurations.</p>
<p>Each SSL enabled daemon needs to present a valid X.509 certificate
to the peer. It also needs a private key to decrypt the incoming
data. The easiest way to obtain a certificate and a key is to
generate them with the free <em>OpenSSL</em> package. You can find more
generate them with the free <strong>OpenSSL</strong> package. You can find more
information on certificates generation on pages listed below.</p>
<p>The order of contents of the <em>.pem</em> file is important. It should contain the
unencrypted private key first, then a signed certificate (not certificate
@ -940,35 +1010,35 @@ should be discarded. So the file should look like this:</p>
order for SSL to use good randomness. The following sources are loaded
in order until sufficient random data has been gathered:</p>
<ul>
<li><strong><a name="the_file_specified_with_the_rndfile_flag" class="item">The file specified with the <em>RNDfile</em> flag.</a></strong>
<li>
<p>The file specified with the <em>RNDfile</em> flag.</p>
</li>
<li><strong><a name="the_file_specified_by_the_randfile_environment_variable_if_set" class="item">The file specified by the RANDFILE environment variable, if set.</a></strong>
<li>
<p>The file specified by the RANDFILE environment variable, if set.</p>
</li>
<li><strong><a name="the_file_rnd_in_your_home_directory_if_randfile_not_set" class="item">The file .rnd in your home directory, if RANDFILE not set.</a></strong>
<li>
<p>The file .rnd in your home directory, if RANDFILE not set.</p>
</li>
<li><strong><a name="the_file_specified_with_with_random_at_compile_time" class="item">The file specified with '--with-random' at compile time.</a></strong>
<li>
<p>The file specified with '--with-random' at compile time.</p>
</li>
<li><strong><a name="the_contents_of_the_screen_if_running_on_windows" class="item">The contents of the screen if running on Windows.</a></strong>
<li>
<p>The contents of the screen if running on Windows.</p>
</li>
<li><strong><a name="the_egd_socket_specified_with_the_egd_flag" class="item">The egd socket specified with the <em>EGD</em> flag.</a></strong>
<li>
<p>The egd socket specified with the <em>EGD</em> flag.</p>
</li>
<li><strong><a name="the_egd_socket_specified_with_with_egd_sock_at_compile_time" class="item">The egd socket specified with '--with-egd-sock' at compile time.</a></strong>
<li>
<p>The egd socket specified with '--with-egd-sock' at compile time.</p>
</li>
<li><strong><a name="the_dev_urandom_device" class="item">The /dev/urandom device.</a></strong>
<li>
<p>The /dev/urandom device.</p>
</li>
</ul>
<p>With recent (&gt;=OpenSSL 0.9.5a) version of SSL it will stop loading
random data automatically when sufficient entropy has been gathered.
With previous versions it will continue to gather from all the above
sources since no SSL function exists to tell when enough data is available.</p>
<p>With recent (<strong>OpenSSL 0.9.5a</strong> or later) version of SSL it will stop loading
random data automatically when sufficient entropy has been gathered. With
previous versions it will continue to gather from all the above sources since
no SSL function exists to tell when enough data is available.</p>
<p>Note that on Windows machines that do not have console user interaction
(mouse movements, creating windows, etc.) the screen contents are not
variable enough to be sufficient, and you should provide a random file
@ -977,13 +1047,12 @@ for use with the <em>RNDfile</em> flag.</p>
random data -- that means it should contain different information
each time <strong>stunnel</strong> is run. This is handled automatically
unless the <em>RNDoverwrite</em> flag is used. If you wish to update this file
manually, the <em>openssl rand</em> command in recent versions of OpenSSL,
manually, the <em>openssl rand</em> command in recent versions of <strong>OpenSSL</strong>,
would be useful.</p>
<p>One important note -- if /dev/urandom is available, OpenSSL has a habit of
seeding the PRNG with it even when checking the random state, so on
systems with /dev/urandom you're likely to use it even though it's listed
at the very bottom of the list above. This isn't <strong>stunnel's</strong> behaviour, it's
OpenSSLs.</p>
<p>Important note: If /dev/urandom is available, <strong>OpenSSL</strong> often seeds the PRNG
with it while checking the random state. On systems with /dev/urandom
<strong>OpenSSL</strong> is likely to use it even though it is listed at the very bottom of
the list above. This is the behaviour of <strong>OpenSSL</strong> and not <strong>stunnel</strong>.</p>
<p>
</p>
<h2><a name="dh_parameters">DH PARAMETERS</a></h2>
@ -1007,7 +1076,7 @@ OpenSSLs.</p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>Option <em>execargs</em> does not support quoting.</p>
<p>Option <em>execargs</em> and Win32 command line does not support quoting.</p>
<p>
</p>
<hr />
@ -1031,7 +1100,7 @@ OpenSSLs.</p>
<dt><strong><a name="http_www_openssl_org" class="item"><em class="file"><a href="http://www.openssl.org/">http://www.openssl.org/</a></em></a></strong></dt>
<dd>
<p>OpenSSL project website</p>
<p><strong>OpenSSL</strong> project website</p>
</dd>
</dl>
<p>

View File

@ -62,7 +62,7 @@
.\" ========================================================================
.\"
.IX Title "STUNNEL.PL 8"
.TH STUNNEL.PL 8 "2012.01.14" "4.53" "stunnel"
.TH STUNNEL.PL 8 "2013.03.22" "4.56" "stunnel"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -158,6 +158,18 @@ Opcja określa katalog, w którym uwięziony zostanie proces programu
połączeń. Ścieżki podane w opcjach \fICApath\fR, \fICRLpath\fR, \fIpid\fR
oraz \fIexec\fR muszą być umieszczone wewnątrz katalogu podanego w opcji
\&\fIchroot\fR i określone względem tego katalogu.
.Sp
Niektóre funkcje systemu operacyjnego mogą wymagać dodatkowych plików umieszczonych w katalogu podanego w parametrze chroot:
.RS 4
.IP "\(bu" 4
opóźnione rozwinięcie adresów \s-1DNS\s0 typowo wymaga /etc/nsswitch.conf i /etc/resolv.conf
.IP "\(bu" 4
lokalizacja strefy czasowej w logach wymaga pliku /etc/timezone
.IP "\(bu" 4
niektóre inne pliki mogą potrzebować plików urządzeń, np. /dev/zero lub /dev/null
.RE
.RS 4
.RE
.IP "\fBcompression\fR = deflate | zlib | rle" 4
.IX Item "compression = deflate | zlib | rle"
wybór algorytmu kompresji przesyłanych danych
@ -166,10 +178,10 @@ domyślnie: bez kompresji
.Sp
Algorytm deflate jest standardową metodą kompresji zgodnie z \s-1RFC\s0 1951.
.Sp
Kompresja zlib zaimplementowana w OpenSSL 0.9.8 i nowszych nie jest
kompatybilna implementacją OpenSSL 0.9.7.
Kompresja zlib zaimplementowana w \fBOpenSSL 0.9.8\fR i nowszych nie jest
kompatybilna implementacją \fBOpenSSL 0.9.7\fR.
.Sp
Kompresja rle nie jest zaimplementowana w aktualnych wersjach OpenSSL.
Kompresja rle nie jest zaimplementowana w aktualnych wersjach \fBOpenSSL\fR.
.IP "\fBdebug\fR = poziom[.podsystem]" 4
.IX Item "debug = poziom[.podsystem]"
szczegółowość logowania
@ -191,7 +203,7 @@ Wielkość liter jest ignorowana zarówno dla poziomu jak podsystemu.
.Sp
Opcja pozwala określić ścieżkę do gniazda programu Entropy Gathering Daemon
używanego do zainicjalizowania generatora ciągów pseudolosowych biblioteki
OpenSSL. Opcja jest dostępna z biblioteką OpenSSL 0.9.5a lub nowszą.
\&\fBOpenSSL\fR. Opcja jest dostępna z biblioteką \fBOpenSSL 0.9.5a\fR lub nowszą.
.IP "\fBengine\fR = auto | <identyfikator urządzenia>" 4
.IX Item "engine = auto | <identyfikator urządzenia>"
wybór sprzętowego urządzenia kryptograficznego
@ -224,15 +236,15 @@ modułu kryptograficznego urządzenia.
.IX Item "fips = yes | no"
Włącz lub wyłącz tryb \s-1FIPS\s0 140\-2.
.Sp
Opcja pozwala wyłączyć wejście w tryb \s-1FIPS\s0, jeśli stunnel został skompilowany
ze wsparciem dla \s-1FIPS\s0 140\-2.
Opcja pozwala wyłączyć wejście w tryb \s-1FIPS\s0, jeśli \fBstunnel\fR został
skompilowany ze wsparciem dla \s-1FIPS\s0 140\-2.
.Sp
domyślnie: yes (pracuj w trybie \s-1FIPS\s0 140\-2)
.IP "\fBforeground\fR = yes | no (tylko Unix)" 4
.IX Item "foreground = yes | no (tylko Unix)"
tryb pierwszoplanowy
.Sp
Użycie tej opcji powoduje, że \fIstunnel\fR nie przechodzi w tło logując
Użycie tej opcji powoduje, że \fBstunnel\fR nie przechodzi w tło logując
swoje komunikaty na konsolę zamiast przez \fIsyslog\fR (o ile nie użyto
opcji \fIoutput\fR).
.IP "\fBoutput\fR = plik" 4
@ -256,7 +268,7 @@ względem tego katalogu.
.IX Item "RNDbytes = liczba_bajtów"
liczba bajtów do zainicjowania generatora pseudolosowego
.Sp
W wersjach biblioteki OpenSSL starszych niż 0.9.5a opcja ta określa
W wersjach biblioteki \fBOpenSSL\fR starszych niż \fB0.9.5a\fR opcja ta określa
również liczbę bajtów wystarczających do zainicjowania \s-1PRNG\s0.
Nowsze wersje biblioteki mają wbudowaną funkcję określającą, czy
dostarczona ilość losowości jest wystarczająca do zainicjowania generatora.
@ -264,7 +276,7 @@ dostarczona ilość losowości jest wystarczająca do zainicjowania generatora.
.IX Item "RNDfile = plik"
ścieżka do pliku zawierającego losowe dane
.Sp
Biblioteka OpenSSL użyje danych z tego pliku do zainicjowania
Biblioteka \fBOpenSSL\fR użyje danych z tego pliku do zainicjowania
generatora pseudolosowego.
.IP "\fBRNDoverwrite\fR = yes | no" 4
.IX Item "RNDoverwrite = yes | no"
@ -278,10 +290,10 @@ użyj parametru jako nazwy serwisu dla biblioteki \s-1TCP\s0 Wrapper w trybie \f
domyślnie: stunnel
.IP "\fBsetgid\fR = identyfikator_grupy (tylko Unix)" 4
.IX Item "setgid = identyfikator_grupy (tylko Unix)"
grupa z której prawami pracował będzie \fIstunnel\fR
grupa z której prawami pracował będzie \fBstunnel\fR
.IP "\fBsetuid\fR = identyfikator_użytkownika (tylko Unix)" 4
.IX Item "setuid = identyfikator_użytkownika (tylko Unix)"
użytkownik, z którego prawami pracował będzie \fIstunnel\fR
użytkownik, z którego prawami pracował będzie \fBstunnel\fR
.IP "\fBsocket\fR = a|l|r:option=value[:value]" 4
.IX Item "socket = a|l|r:option=value[:value]"
ustaw opcję na akceptującym/lokalnym/zdalnym gnieździe
@ -330,7 +342,7 @@ lub \fItcpserver\fR), należy przeczytać sekcję \fI\s-1TRYB\s0 \s-1INETD\s0\fR
.IX Item "accept = [adres:]port"
nasłuchuje na połączenia na podanym adresie i porcie
.Sp
Jeżeli nie został podany adres, \fIstunnel\fR domyślnie nasłuchuje
Jeżeli nie został podany adres, \fBstunnel\fR domyślnie nasłuchuje
na wszystkich adresach IPv4 lokalnych interfejsów.
.Sp
Aby nasłuchiwać na wszystkich adresach IPv6 należy użyć:
@ -347,8 +359,8 @@ jeżeli użyta została opcja \fIverify\fR. Pliki z certyfikatami muszą
posiadać specjalne nazwy \s-1XXXXXXXX\s0.0, gdzie \s-1XXXXXXXX\s0 jest skrótem
kryptograficznym reprezentacji \s-1DER\s0 nazwy podmiotu certyfikatu.
.Sp
Funkcja skrótu została zmieniona w wersji 1.0.0 biblioteki OpenSSL.
Należy wykonać c_rehash przy zmianie OpenSSL 0.x.x na 1.x.x.
Funkcja skrótu została zmieniona w \fBOpenSSL 1.0.0\fR.
Należy wykonać c_rehash przy zmianie \fBOpenSSL 0.x.x\fR na \fB1.x.x\fR.
.Sp
Jeżeli zdefiniowano katalog \fIchroot\fR, to ścieżka do \fICApath\fR jest określona
względem tego katalogu.
@ -381,7 +393,7 @@ domyślnie: no (tryb serwerowy)
.IX Item "connect = [adres:]port"
połącz się ze zdalnym serwerem na podany port
.Sp
Jeżeli nie został podany adres, \fIstunnel\fR domyślnie łączy się
Jeżeli nie został podany adres, \fBstunnel\fR domyślnie łączy się
z lokalnym serwerem.
.Sp
Komenda może byc użyta wielokrotnie w pojedynczej sekcji
@ -396,8 +408,8 @@ jeżeli użyta została opcja \fIverify\fR. Pliki z listami \s-1CRL\s0 muszą
posiadać specjalne nazwy \s-1XXXXXXXX\s0.r0, gdzie \s-1XXXXXXXX\s0 jest skrótem
listy \s-1CRL\s0.
.Sp
Funkcja skrótu została zmieniona w wersji 1.0.0 biblioteki OpenSSL.
Należy wykonać c_rehash przy zmianie OpenSSL 0.x.x na 1.x.x.
Funkcja skrótu została zmieniona \fBOpenSSL 1.0.0\fR.
Należy wykonać c_rehash przy zmianie \fBOpenSSL 0.x.x\fR na \fB1.x.x\fR.
.Sp
Jeżeli zdefiniowano katalog \fIchroot\fR, to ścieżka do \fICRLpath\fR jest określona
względem tego katalogu.
@ -423,7 +435,7 @@ domyślnie: prime256v1
opóźnij rozwinięcie adresu \s-1DNS\s0 podanego w opcji \fIconnect\fR
.Sp
Opcja jest przydatna przy dynamicznym \s-1DNS\s0, albo gdy usługa \s-1DNS\s0 nie jest
dostępna przy starcie programu stunnel (klient \s-1VPN\s0, połączenie wdzwaniane).
dostępna przy starcie programu \fBstunnel\fR (klient \s-1VPN\s0, połączenie wdzwaniane).
.IP "\fBengineNum\fR = <numer urządzenia>" 4
.IX Item "engineNum = <numer urządzenia>"
wybierz urządzenie do odczyta klucza prywatnego
@ -480,32 +492,36 @@ domyślnie: yes
.Sp
Domyślnie używane jest \s-1IP\s0 najbardziej zewnętrznego interfejsu w stronę
serwera, do którego nawiązywane jest połączenie.
.IP "\fBsni\fR = nazwa_usługi:nazwa_serwera (tryb serwera)" 4
.IX Item "sni = nazwa_usługi:nazwa_serwera (tryb serwera)"
.IP "\fBsni\fR = nazwa_usługi:wzorzec_nazwy_serwera (tryb serwera)" 4
.IX Item "sni = nazwa_usługi:wzorzec_nazwy_serwera (tryb serwera)"
Użyj usługi jako podrzędnej (virtualnego serwera) dla rozszerzenia \s-1TLS\s0 Server
Name Indication (\s-1RFC\s0 3546).
.Sp
\&\fInazwa_usługi\fR wskazuje usługę nadrzędną, która odbiera połączenia od klientów
przy pomocy opcji \fIaccept\fR. \fInazwa_serwera\fR wskazuje nazwę serwera
wirtualnego. Z pojedyńczą usługą nadrzędną powiązane jest zwykle wiele usług
podrzędnych. Opcja \fIsni\fR może być rownież użyta wielokrotnie w ramach jednej
usługi podrzędnej.
przy pomocy opcji \fIaccept\fR. \fIwzorzec_nazwy_serwera\fR wskazuje nazwę serwera
wirtualnego. Wzorzec może zaczynać się znakiem '*', np. '*.example.com".
Z pojedyńczą usługą nadrzędną powiązane jest zwykle wiele usług podrzędnych.
Opcja \fIsni\fR może być rownież użyta wielokrotnie w ramach jednej usługi
podrzędnej.
.Sp
Zarówno usługa nadrzędna jak i podrzędna nie może być skonfigurowana w trybie
klienckim. Opcja \fIconnect\fR usługi podrzędnej jest ignorowana w połączeniu z
opcją \fIprotocol\fR, gdyż połączenie do zdalnego serwera jest w tym wypadku
nawiązywane przed negocjacją \s-1TLS\s0. Uwierzytelnienie przy pomocy biblioteki
libwrap jest realizowane dwukrotnie: najpierw dla usługi nadrzędnej po
odebraniu połączenia \s-1TCP\s0, a następnie dla usługi podrzędnej podczas negocjacji
\&\s-1TLS\s0.
klienckim.
.Sp
Opcja \fIsni\fR jest dostępna począwszy od wersji 1.0.0 biblioteki OpenSSL.
Opcja \fIconnect\fR usługi podrzędnej jest ignorowana w połączeniu z opcją
\&\fIprotocol\fR, gdyż połączenie do zdalnego serwera jest w tym wypadku nawiązywane
przed negocjacją \s-1TLS\s0.
.Sp
Uwierzytelnienie przy pomocy biblioteki libwrap jest realizowane dwukrotnie:
najpierw dla usługi nadrzędnej po odebraniu połączenia \s-1TCP\s0, a następnie dla
usługi podrzędnej podczas negocjacji \s-1TLS\s0.
.Sp
Opcja \fIsni\fR jest dostępna począwszy od \fBOpenSSL 1.0.0\fR.
.IP "\fBsni\fR = nazwa_serwera (tryb klienta)" 4
.IX Item "sni = nazwa_serwera (tryb klienta)"
Użyj parametru jako wartości rozszerzenia \s-1TLS\s0 Server Name Indication
(\s-1RFC\s0 3546).
.Sp
Opcja \fIsni\fR jest dostępna począwszy od wersji 1.0.0 biblioteki OpenSSL.
Opcja \fIsni\fR jest dostępna począwszy od \fBOpenSSL 1.0.0\fR.
.IP "\fB\s-1OCSP\s0\fR = \s-1URL\s0" 4
.IX Item "OCSP = URL"
serwer \s-1OCSP\s0 do weryfikacji certyfikatów
@ -519,7 +535,7 @@ aktualnie wspierane flagi: \s-1NOCERTS\s0, \s-1NOINTERN\s0 \s-1NOSIGS\s0, \s-1NO
Aby wyspecyfikować kilka flag należy użyć \fIOCSPflag\fR wielokrotnie.
.IP "\fBoptions\fR = opcje_SSL" 4
.IX Item "options = opcje_SSL"
opcje biblioteki OpenSSL
opcje biblioteki \fBOpenSSL\fR
.Sp
Parametrem jest nazwa opcji zgodnie z opisem w \fI\fISSL_CTX_set_options\fI\|(3ssl)\fR,
ale bez przedrostka \fI\s-1SSL_OP_\s0\fR.
@ -533,8 +549,10 @@ w programie Eudora można użyć opcji:
.Ve
.IP "\fBprotocol\fR = protokół" 4
.IX Item "protocol = protokół"
negocjuj \s-1SSL\s0 podanym protokołem aplikacyjnym (np. \fIstarttls\fR lub \fIstls\fR)
negocjuj \s-1SSL\s0 podanym protokołem aplikacyjnym
.Sp
Opcja ta włącza wstępną negocjację szyfrowania \s-1SSL\s0 dla wybranego protokołu
aplikacyjnego.
Opcji \fIprotocol\fR nie należy używać z szyfrowaniem \s-1SSL\s0 na osobnym porcie.
.Sp
Aktualnie wspierane protokoły:
@ -583,6 +601,13 @@ domyślnie: basic
.IP "\fBprotocolHost\fR = adres:port" 4
.IX Item "protocolHost = adres:port"
adres docelowy do negocjacji protokołu
.Sp
\&\fIprotocolHost\fR określa docelowy serwer \s-1SSL\s0, do którego połączyć ma się proxy.
Nie jest to adres serwera proxy, do którego połączenie zestawia \fBstunnel\fR.
Adres serwera proxy powinien być określony przy pomocy opcji 'connect'.
.Sp
W obecnej wersji adres docelowy protokołu ma zastosowanie wyłącznie w protokole
\&'connect'.
.IP "\fBprotocolPassword\fR = hasło" 4
.IX Item "protocolPassword = hasło"
hasło do negocjacji protokołu
@ -592,14 +617,50 @@ nazwa użytkownika do negocjacji protokołu
.IP "\fBpty\fR = yes | no (tylko Unix)" 4
.IX Item "pty = yes | no (tylko Unix)"
alokuj pseudoterminal dla programu uruchamianego w opcji 'exec'
.IP "\fBretry\fR = yes | no (tylko Unix)" 4
.IX Item "retry = yes | no (tylko Unix)"
.IP "\fBrenegotiation\fR = yes | no" 4
.IX Item "renegotiation = yes | no"
pozwalaj na renegocjację \s-1SSL\s0
.Sp
Wśród zastosowań renegocjacji \s-1SSL\s0 są niektóre scenariusze uwierzytelnienia,
oraz renegocjacja kluczy dla długotrwałych połączeń.
.Sp
Z drugiej strony własność na może ułatwić trywialny atak DoS poprzez
wygenerowanie obciążenia procesora:
.Sp
http://vincent.bernat.im/en/blog/2011\-ssl\-dos\-mitigation.html
.Sp
Warto zauważyć, że zablokowanie renegocjacji \s-1SSL\s0 nie zebezpiecza w pełni
przed opisanym problemem.
.Sp
domyślnie: yes (o ile wspierane przez \fBOpenSSL\fR)
.IP "\fBreset\fR = yes | no" 4
.IX Item "reset = yes | no"
sygnalizuj wystąpienie błędu przy pomocy flagi \s-1TCP\s0 \s-1RST\s0
.Sp
Ta opcja nie jest wspierana na niektórych platformach.
.Sp
domyślnie: yes
.IP "\fBretry\fR = yes | no" 4
.IX Item "retry = yes | no"
połącz ponownie sekcję connect+exec po rozłączeniu
.Sp
domyślnie: no
.IP "\fBsession\fR = przeterminowanie_pamięci_podręcznej_sesji" 4
.IX Item "session = przeterminowanie_pamięci_podręcznej_sesji"
czas w sekundach, po którym sesja \s-1SSL\s0 zostanie usunięta z pamięci podręcznej
.IP "\fBsessionCacheSize\fR = rozmiar" 4
.IX Item "sessionCacheSize = rozmiar"
rozmiar pamięci podręcznej sesji \s-1SSL\s0
.Sp
Parametr określa maksymalną liczbę pozycji wewnętrznej pamięci podręcznej
sesji.
.Sp
Wartość 0 oznacza brak ograniczenia rozmiaru. Nie jest to zalecane dla
systemów produkcyjnych z uwagi na ryzyko ataku DoS przez wyczerpanie pamięci
\&\s-1RAM\s0.
.IP "\fBsessionCacheTimeout\fR = czas" 4
.IX Item "sessionCacheTimeout = czas"
przeterminowanie pamięci podręcznej sesji \s-1SSL\s0
.Sp
Parametr określa czas w sekundach, po którym sesja \s-1SSL\s0 zostanie usunięta z
pamięci podręcznej.
.IP "\fBsessiond\fR = adres:port" 4
.IX Item "sessiond = adres:port"
adres sessiond \- servera cache sesji \s-1SSL\s0
@ -607,7 +668,7 @@ adres sessiond \- servera cache sesji \s-1SSL\s0
.IX Item "sslVersion = wersja"
wersja protokołu \s-1SSL\s0
.Sp
Dozwolone opcje: all, SSLv2, SSLv3, TLSv1
Dozwolone opcje: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2
.IP "\fBstack\fR = liczba_bajtów (z wyjątkiem modelu \s-1FORK\s0)" 4
.IX Item "stack = liczba_bajtów (z wyjątkiem modelu FORK)"
rozmiar stosu procesora wątku
@ -635,7 +696,7 @@ Zablokuj wsparcie dla przezroczystago proxy. Jest to wartość domyślna.
.IP "\fBsource\fR" 4
.IX Item "source"
Przepisz adres, aby nawiązywane połączenie wydawało się pochodzić
bezpośrednio od klienta, a nie od programu \fIstunnel\fR.
bezpośrednio od klienta, a nie od programu \fBstunnel\fR.
.Sp
Opcja jest aktualnie obsługiwana w:
.RS 4
@ -659,7 +720,7 @@ Konfiguracja ta wymaga, aby \fBstunnel\fR był wykonywany jako root i bez opcji
.IX Item "Trybie zdalnym (opcja connect) w systemie Linux 2.2.x"
Konfiguracja ta wymaga skompilowania jądra z opcją \fItransparent proxy\fR.
Docelowa usługa musi być umieszczona na osobnej maszynie, do której routing
kierowany jest poprzez serwer stunnela.
kierowany jest poprzez serwer \fBstunnela\fR.
.Sp
Dodatkowo \fBstunnel\fR powinien być wykonywany jako root i bez opcji \fIsetuid\fR.
.IP "Trybie zdalnym (opcja \fIconnect\fR) w systemie \fIFreeBSD >=8.0\fR" 4
@ -717,23 +778,27 @@ Opcja została przemianowana na \fInone\fR.
.IX Item "verify = poziom"
weryfikuj certyfikat drugiej strony połączenia
.RS 4
.IP "\fIpoziom 0\fR \- zarządaj certyfikatu i zignoruj go" 4
.IX Item "poziom 0 - zarządaj certyfikatu i zignoruj go"
.PD 0
.IP "\fIpoziom 1\fR \- weryfikuj, jeżeli został przedstawiony" 4
.IX Item "poziom 1 - weryfikuj, jeżeli został przedstawiony"
.IP "\fIpoziom 2\fR \- weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji" 4
.IX Item "poziom 2 - weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji"
.IP "\fIpoziom 3\fR \- weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony" 4
.IX Item "poziom 3 - weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony"
.IP "\fIpoziom 4\fR \- weryfikuj z certyfikatem drugiej strony ignorując łańcuch \s-1CA\s0" 4
.IX Item "poziom 4 - weryfikuj z certyfikatem drugiej strony ignorując łańcuch CA"
.IP "\fIdomyślnie\fR \- nie weryfikuj" 4
.IX Item "domyślnie - nie weryfikuj"
.IP "\fIpoziom 0\fR" 4
.IX Item "poziom 0"
zarządaj certyfikatu i zignoruj go
.IP "\fIpoziom 1\fR" 4
.IX Item "poziom 1"
weryfikuj, jeżeli został przedstawiony
.IP "\fIpoziom 2\fR" 4
.IX Item "poziom 2"
weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji
.IP "\fIpoziom 3\fR" 4
.IX Item "poziom 3"
weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony
.IP "\fIpoziom 4\fR" 4
.IX Item "poziom 4"
weryfikuj z certyfikatem drugiej strony ignorując łańcuch \s-1CA\s0
.IP "\fIdomyślnie\fR" 4
.IX Item "domyślnie"
nie weryfikuj
.RE
.RS 4
.RE
.PD
.SH "ZWRACANA WARTOŚĆ"
.IX Header "ZWRACANA WARTOŚĆ"
\&\fBstunnel\fR zwraca zero w przypadku sukcesu, lub wartość niezerową
@ -760,17 +825,17 @@ setuid
.RE
.RS 4
.Sp
Jeżeli wykorzystywana jest opcja 'setuid' stunnel nie będzie mógł załadować
Jeżeli wykorzystywana jest opcja 'setuid' \fBstunnel\fR nie będzie mógł załadować
ponownie konfiguracji wykorzystującej uprzywilejowane (<1024) porty.
.Sp
Jeżeli wykorzystywana jest opcja 'chroot' stunnel będzie szukał wszystkich
Jeżeli wykorzystywana jest opcja 'chroot' \fBstunnel\fR będzie szukał wszystkich
potrzebnych plików (łącznie z plikiem konfiguracyjnym, certyfikatami, logiem i
plikiem pid) wewnątrz katalogu wskazanego przez 'chroot'.
.RE
.IP "\s-1SIGUSR1\s0" 4
.IX Item "SIGUSR1"
Zamknij i otwórz ponownie log.
Funkcja ta może zostać użyta w skrypcie rotującym log programu stunnel.
Funkcja ta może zostać użyta w skrypcie rotującym log programu \fBstunnel\fR.
.IP "\s-1SIGTERM\s0, \s-1SIGQUIT\s0, \s-1SIGINT\s0" 4
.IX Item "SIGTERM, SIGQUIT, SIGINT"
Zakończ działanie programu.
@ -819,7 +884,7 @@ konfiguracyjnym nie ma sekcji \fI[nazwa_usługi]\fR.
.IX Header "NOTKI"
.SS "\s-1OGRANICZENIA\s0"
.IX Subsection "OGRANICZENIA"
\&\fIstunnel\fR nie może być używany do szyfrowania protokołu \fI\s-1FTP\s0\fR,
\&\fBstunnel\fR nie może być używany do szyfrowania protokołu \fI\s-1FTP\s0\fR,
ponieważ do przesyłania poszczególnych plików używa on dodatkowych
połączeń otwieranych na portach o dynamicznie przydzielanych numerach.
Istnieją jednak specjalne wersje klientów i serwerów \s-1FTP\s0 pozwalające
@ -854,9 +919,9 @@ Protokół \s-1SSL\s0 wymaga, aby każdy serwer przedstawiał się nawiązujące
połączenie klientowi prawidłowym certyfikatem X.509.
Potwierdzenie tożsamości serwera polega na wykazaniu, że posiada on
odpowiadający certyfikatowi klucz prywatny.
Najprostszą metodą uzyskania certyfikatu jest wygenerowanie
go przy pomocy wolnego pakietu \fIOpenSSL\fR. Więcej informacji na temat
generowania certyfikatów można znaleźć na umieszczonych poniżej stronach.
Najprostszą metodą uzyskania certyfikatu jest wygenerowanie go przy pomocy
wolnego pakietu \fBOpenSSL\fR. Więcej informacji na temat generowania
certyfikatów można znaleźć na umieszczonych poniżej stronach.
.PP
Istotną kwestią jest kolejność zawartości pliku \fI.pem\fR.
W pierwszej kolejności powinien on zawierać klucz prywatny,
@ -902,11 +967,11 @@ programu.
.IP "\(bu" 4
Urządzenie /dev/urandom.
.PP
Współczesne (>=0.9.5a) wersje biblioteki \fIOpenSSL\fR automatycznie
Współczesne (\fB0.9.5a\fR lub nowsze) wersje biblioteki \fBOpenSSL\fR automatycznie
zaprzestają ładowania kolejnych danych w momencie uzyskania wystarczającej
ilości entropii. Wcześniejsze wersje biblioteki wykorzystają wszystkie
powyższe źródła, gdyż nie istnieje tam funkcja pozwalająca określić,
czy uzyskano już wystarczająco dużo danych.
powyższe źródła, gdyż nie istnieje tam funkcja pozwalająca określić, czy
uzyskano już wystarczająco dużo danych.
.PP
Warto zwrócić uwagę, że na maszynach z systemem Windows, na których
konsoli nie pracuje użytkownik, zawartość ekranu nie jest wystarczająco
@ -918,17 +983,17 @@ Plik \fIRNDfile\fR powinien zawierać dane losowe \*(-- również w tym sensie,
O ile nie użyta została opcja \fIRNDoverwrite\fR jest to robione
automatycznie. Do ręcznego uzyskania takiego pliku użyteczna
może być komenda \fIopenssl rand\fR dostarczana ze współczesnymi
wersjami pakietu \fIOpenSSL\fR.
wersjami pakietu \fBOpenSSL\fR.
.PP
Jeszcze jedna istotna informacja \*(-- jeżeli dostępne jest urządzenie
\&\fI/dev/urandom\fR biblioteka \fIOpenSSL\fR ma zwyczaj zasilania nim \s-1PRNG\s0 w trakcie
\&\fI/dev/urandom\fR biblioteka \fBOpenSSL\fR ma zwyczaj zasilania nim \s-1PRNG\s0 w trakcie
sprawdzania stanu generatora. W systemach z \fI/dev/urandom\fR urządzenie
to będzie najprawdopodobniej użyte, pomimo że znajduje się na samym końcu
powyższej listy. Jest to właściwość biblioteki \fIOpenSSL\fR, a nie programu
\&\fIstunnel\fR.
powyższej listy. Jest to właściwość biblioteki \fBOpenSSL\fR, a nie programu
\&\fBstunnel\fR.
.SS "\s-1PARAMETRY\s0 \s-1DH\s0"
.IX Subsection "PARAMETRY DH"
Począwszy od wersji 4.40 stunnel zawiera w kodzie programu 2048\-bitowe
Począwszy od wersji 4.40 \fBstunnel\fR zawiera w kodzie programu 2048\-bitowe
parametry \s-1DH\s0.
.PP
Alternatywnie parametry \s-1DH\s0 można umieścić w pliku razem z certyfikatem:
@ -945,7 +1010,7 @@ Wygenerowanie parametrów \s-1DH\s0 może zająć nawet wiele minut.
plik konfiguracyjny programu
.SH "BŁĘDY"
.IX Header "BŁĘDY"
Opcja \fIexecargs\fR nie obsługuje cytowania.
Opcja \fIexecargs\fR oraz linia komend Win32 nie obsługuje cytowania.
.SH "ZOBACZ RÓWNIEŻ"
.IX Header "ZOBACZ RÓWNIEŻ"
.IP "\fItcpd\fR\|(8)" 4
@ -956,10 +1021,10 @@ biblioteka kontroli dostępu do usług internetowych
\&'super\-serwer' internetowy
.IP "\fIhttp://www.stunnel.org/\fR" 4
.IX Item "http://www.stunnel.org/"
strona domowa programu \fIstunnel\fR
strona domowa programu \fBstunnel\fR
.IP "\fIhttp://www.openssl.org/\fR" 4
.IX Item "http://www.openssl.org/"
strona projektu \fIOpenSSL\fR
strona projektu \fBOpenSSL\fR
.SH "AUTOR"
.IX Header "AUTOR"
.IP "Michał Trojnara" 4

View File

@ -156,29 +156,29 @@ odinstalowaniu</p>
<h1><a name="plik_konfiguracyjny">PLIK KONFIGURACYJNY</a></h1>
<p>Linia w pliku konfiguracyjnym może być:</p>
<ul>
<li><strong><a name="pusta" class="item">pusta (ignorowana)</a></strong>
<li>
<p>pusta (ignorowana)</p>
</li>
<li><strong><a name="komentarzem_rozpoczynaj_cym_si_znakiem_ignorowana" class="item">komentarzem rozpoczynającym się znakiem ';' (ignorowana)</a></strong>
<li>
<p>komentarzem rozpoczynającym się znakiem ';' (ignorowana)</p>
</li>
<li><strong><a name="par_nazwa_opcji_warto_opcji" class="item">parą 'nazwa_opcji = wartość_opcji'</a></strong>
<li>
<p>parą 'nazwa_opcji = wartość_opcji'</p>
</li>
<li><strong><a name="tekstem_nazwa_us_ugi_wskazuj_cym_pocz_tek_definicji_us_ugi" class="item">tekstem '[nazwa_usługi]' wskazującym początek definicji usługi</a></strong>
<li>
<p>tekstem '[nazwa_usługi]' wskazującym początek definicji usługi</p>
</li>
</ul>
<p>Parametr adres może być:</p>
<ul>
<li><strong><a name="numerem_portu" class="item">numerem portu</a></strong>
<li>
<p>numerem portu</p>
</li>
<li><strong><a name="adresu" class="item">oddzieloną średnikiem parą adresu (IPv4, IPv6, lub nazwą domenową) i numeru portu</a></strong>
<li>
<p>oddzieloną średnikiem parą adresu (IPv4, IPv6, lub nazwą domenową) i numeru portu</p>
</li>
<li><strong>ścieżką do gniazda Unix (tylko Unix)</strong>
<li>
<p>ścieżką do gniazda Unix (tylko Unix)</p>
</li>
</ul>
<p>
@ -194,6 +194,18 @@ odinstalowaniu</p>
połączeń. Ścieżki podane w opcjach <em>CApath</em>, <em>CRLpath</em>, <em>pid</em>
oraz <em>exec</em> muszą być umieszczone wewnątrz katalogu podanego w opcji
<em>chroot</em> i określone względem tego katalogu.</p>
<p>Niektóre funkcje systemu operacyjnego mogą wymagać dodatkowych plików umieszczonych w katalogu podanego w parametrze chroot:</p>
<ul>
<li>
<p>opóźnione rozwinięcie adresów DNS typowo wymaga /etc/nsswitch.conf i /etc/resolv.conf</p>
</li>
<li>
<p>lokalizacja strefy czasowej w logach wymaga pliku /etc/timezone</p>
</li>
<li>
<p>niektóre inne pliki mogą potrzebować plików urządzeń, np. /dev/zero lub /dev/null</p>
</li>
</ul>
</dd>
<dt><strong><a name="compression_deflate_zlib_rle" class="item"><strong>compression</strong> = deflate | zlib | rle</a></strong></dt>
@ -201,9 +213,9 @@ oraz <em>exec</em> muszą być umieszczone wewnątrz katalogu podanego w opcji
<p>wybór algorytmu kompresji przesyłanych danych</p>
<p>domyślnie: bez kompresji</p>
<p>Algorytm deflate jest standardową metodą kompresji zgodnie z <a href="http://www.ietf.org/rfc/rfc1951.txt" class="rfc">RFC 1951</a>.</p>
<p>Kompresja zlib zaimplementowana w OpenSSL 0.9.8 i nowszych nie jest
kompatybilna implementacją OpenSSL 0.9.7.</p>
<p>Kompresja rle nie jest zaimplementowana w aktualnych wersjach OpenSSL.</p>
<p>Kompresja zlib zaimplementowana w <strong>OpenSSL 0.9.8</strong> i nowszych nie jest
kompatybilna implementacją <strong>OpenSSL 0.9.7</strong>.</p>
<p>Kompresja rle nie jest zaimplementowana w aktualnych wersjach <strong>OpenSSL</strong>.</p>
</dd>
<dt><strong><a name="debug_poziom_podsystem" class="item"><strong>debug</strong> = poziom[.podsystem]</a></strong></dt>
@ -225,7 +237,7 @@ Podsystemy nie są wspierane przez platformę Win32.</p>
<p>ścieżka do gniazda programu Entropy Gathering Daemon</p>
<p>Opcja pozwala określić ścieżkę do gniazda programu Entropy Gathering Daemon
używanego do zainicjalizowania generatora ciągów pseudolosowych biblioteki
OpenSSL. Opcja jest dostępna z biblioteką OpenSSL 0.9.5a lub nowszą.</p>
<strong>OpenSSL</strong>. Opcja jest dostępna z biblioteką <strong>OpenSSL 0.9.5a</strong> lub nowszą.</p>
</dd>
<dt><strong><a name="engine_auto_identyfikator_urz_dzenia" class="item"><strong>engine</strong> = auto | &lt;identyfikator urządzenia&gt;</a></strong></dt>
@ -258,15 +270,15 @@ modułu kryptograficznego urządzenia.</p>
<dd>
<p>Włącz lub wyłącz tryb FIPS 140-2.</p>
<p>Opcja pozwala wyłączyć wejście w tryb FIPS, jeśli stunnel został skompilowany
ze wsparciem dla FIPS 140-2.</p>
<p>Opcja pozwala wyłączyć wejście w tryb FIPS, jeśli <strong>stunnel</strong> został
skompilowany ze wsparciem dla FIPS 140-2.</p>
<p>domyślnie: yes (pracuj w trybie FIPS 140-2)</p>
</dd>
<dt><strong><a name="no" class="item"><strong>foreground</strong> = yes | no (tylko Unix)</a></strong></dt>
<dd>
<p>tryb pierwszoplanowy</p>
<p>Użycie tej opcji powoduje, że <em>stunnel</em> nie przechodzi w tło logując
<p>Użycie tej opcji powoduje, że <strong>stunnel</strong> nie przechodzi w tło logując
swoje komunikaty na konsolę zamiast przez <em>syslog</em> (o ile nie użyto
opcji <em>output</em>).</p>
</dd>
@ -291,7 +303,7 @@ względem tego katalogu.</p>
<dd>
<p>liczba bajtów do zainicjowania generatora pseudolosowego</p>
<p>W wersjach biblioteki OpenSSL starszych niż 0.9.5a opcja ta określa
<p>W wersjach biblioteki <strong>OpenSSL</strong> starszych niż <strong>0.9.5a</strong> opcja ta określa
również liczbę bajtów wystarczających do zainicjowania PRNG.
Nowsze wersje biblioteki mają wbudowaną funkcję określającą, czy
dostarczona ilość losowości jest wystarczająca do zainicjowania generatora.</p>
@ -300,7 +312,7 @@ dostarczona ilość losowości jest wystarczająca do zainicjowania generatora.<
<dd>
<p>ścieżka do pliku zawierającego losowe dane</p>
<p>Biblioteka OpenSSL użyje danych z tego pliku do zainicjowania
<p>Biblioteka <strong>OpenSSL</strong> użyje danych z tego pliku do zainicjowania
generatora pseudolosowego.</p>
</dd>
<dt><strong><a name="rndoverwrite_yes_no" class="item"><strong>RNDoverwrite</strong> = yes | no</a></strong></dt>
@ -318,12 +330,12 @@ generatora pseudolosowego.</p>
<dt><strong><a name="identyfikator_grupy" class="item"><strong>setgid</strong> = identyfikator_grupy (tylko Unix)</a></strong></dt>
<dd>
<p>grupa z której prawami pracował będzie <em>stunnel</em></p>
<p>grupa z której prawami pracował będzie <strong>stunnel</strong></p>
</dd>
<dt><strong><a name="ytkownika" class="item"><strong>setuid</strong> = identyfikator_użytkownika (tylko Unix)</a></strong></dt>
<dd>
<p>użytkownik, z którego prawami pracował będzie <em>stunnel</em></p>
<p>użytkownik, z którego prawami pracował będzie <strong>stunnel</strong></p>
</dd>
<dt><strong><a name="socket_a_l_r_option_value_value" class="item"><strong>socket</strong> = a|l|r:option=value[:value]</a></strong></dt>
@ -375,7 +387,7 @@ lub <em>tcpserver</em>), należy przeczytać sekcję <em>TRYB INETD</em> poniże
<dd>
<p>nasłuchuje na połączenia na podanym adresie i porcie</p>
<p>Jeżeli nie został podany adres, <em>stunnel</em> domyślnie nasłuchuje
<p>Jeżeli nie został podany adres, <strong>stunnel</strong> domyślnie nasłuchuje
na wszystkich adresach IPv4 lokalnych interfejsów.</p>
<p>Aby nasłuchiwać na wszystkich adresach IPv6 należy użyć:</p>
<pre>
@ -389,8 +401,8 @@ na wszystkich adresach IPv4 lokalnych interfejsów.</p>
jeżeli użyta została opcja <em>verify</em>. Pliki z certyfikatami muszą
posiadać specjalne nazwy XXXXXXXX.0, gdzie XXXXXXXX jest skrótem
kryptograficznym reprezentacji DER nazwy podmiotu certyfikatu.</p>
<p>Funkcja skrótu została zmieniona w wersji 1.0.0 biblioteki OpenSSL.
Należy wykonać c_rehash przy zmianie OpenSSL 0.x.x na 1.x.x.</p>
<p>Funkcja skrótu została zmieniona w <strong>OpenSSL 1.0.0</strong>.
Należy wykonać c_rehash przy zmianie <strong>OpenSSL 0.x.x</strong> na <strong>1.x.x</strong>.</p>
<p>Jeżeli zdefiniowano katalog <em>chroot</em>, to ścieżka do <em>CApath</em> jest określona
względem tego katalogu.</p>
</dd>
@ -427,7 +439,7 @@ otwieraniu nowych połączeń SSL, np.: DES-CBC3-SHA:IDEA-CBC-MD5</p>
<dd>
<p>połącz się ze zdalnym serwerem na podany port</p>
<p>Jeżeli nie został podany adres, <em>stunnel</em> domyślnie łączy się
<p>Jeżeli nie został podany adres, <strong>stunnel</strong> domyślnie łączy się
z lokalnym serwerem.</p>
<p>Komenda może byc użyta wielokrotnie w pojedynczej sekcji
celem zapewnienia wysokiej niezawodności lub rozłożenia
@ -441,8 +453,8 @@ ruchu pomiędzy wiele serwerów.</p>
jeżeli użyta została opcja <em>verify</em>. Pliki z listami CRL muszą
posiadać specjalne nazwy XXXXXXXX.r0, gdzie XXXXXXXX jest skrótem
listy CRL.</p>
<p>Funkcja skrótu została zmieniona w wersji 1.0.0 biblioteki OpenSSL.
Należy wykonać c_rehash przy zmianie OpenSSL 0.x.x na 1.x.x.</p>
<p>Funkcja skrótu została zmieniona <strong>OpenSSL 1.0.0</strong>.
Należy wykonać c_rehash przy zmianie <strong>OpenSSL 0.x.x</strong> na <strong>1.x.x</strong>.</p>
<p>Jeżeli zdefiniowano katalog <em>chroot</em>, to ścieżka do <em>CRLpath</em> jest określona
względem tego katalogu.</p>
</dd>
@ -467,7 +479,7 @@ przez opcję <em>verify</em>.</p>
<dd>
<p>opóźnij rozwinięcie adresu DNS podanego w opcji <em>connect</em></p>
<p>Opcja jest przydatna przy dynamicznym DNS, albo gdy usługa DNS nie jest
dostępna przy starcie programu stunnel (klient VPN, połączenie wdzwaniane).</p>
dostępna przy starcie programu <strong>stunnel</strong> (klient VPN, połączenie wdzwaniane).</p>
</dd>
<dt><strong><a name="enginenum_numer_urz_dzenia" class="item"><strong>engineNum</strong> = &lt;numer urządzenia&gt;</a></strong></dt>
@ -528,31 +540,33 @@ komendą:</p>
<p>Domyślnie używane jest IP najbardziej zewnętrznego interfejsu w stronę
serwera, do którego nawiązywane jest połączenie.</p>
</dd>
<dt><strong><a name="nazwa_serwera" class="item"><strong>sni</strong> = nazwa_usługi:nazwa_serwera (tryb serwera)</a></strong></dt>
<dt><strong><a name="wzorzec_nazwy_serwera" class="item"><strong>sni</strong> = nazwa_usługi:wzorzec_nazwy_serwera (tryb serwera)</a></strong></dt>
<dd>
<p>Użyj usługi jako podrzędnej (virtualnego serwera) dla rozszerzenia TLS Server
Name Indication (<a href="http://www.ietf.org/rfc/rfc3546.txt" class="rfc">RFC 3546</a>).</p>
<p><em>nazwa_usługi</em> wskazuje usługę nadrzędną, która odbiera połączenia od klientów
przy pomocy opcji <em>accept</em>. <em>nazwa_serwera</em> wskazuje nazwę serwera
wirtualnego. Z pojedyńczą usługą nadrzędną powiązane jest zwykle wiele usług
podrzędnych. Opcja <em>sni</em> może być rownież użyta wielokrotnie w ramach jednej
usługi podrzędnej.</p>
przy pomocy opcji <em>accept</em>. <em>wzorzec_nazwy_serwera</em> wskazuje nazwę serwera
wirtualnego. Wzorzec może zaczynać się znakiem '*', np. '*.example.com&quot;.
Z pojedyńczą usługą nadrzędną powiązane jest zwykle wiele usług podrzędnych.
Opcja <em>sni</em> może być rownież użyta wielokrotnie w ramach jednej usługi
podrzędnej.</p>
<p>Zarówno usługa nadrzędna jak i podrzędna nie może być skonfigurowana w trybie
klienckim. Opcja <em>connect</em> usługi podrzędnej jest ignorowana w połączeniu z
opcją <em>protocol</em>, gdyż połączenie do zdalnego serwera jest w tym wypadku
nawiązywane przed negocjacją TLS. Uwierzytelnienie przy pomocy biblioteki
libwrap jest realizowane dwukrotnie: najpierw dla usługi nadrzędnej po
odebraniu połączenia TCP, a następnie dla usługi podrzędnej podczas negocjacji
TLS.</p>
<p>Opcja <em>sni</em> jest dostępna począwszy od wersji 1.0.0 biblioteki OpenSSL.</p>
klienckim.</p>
<p>Opcja <em>connect</em> usługi podrzędnej jest ignorowana w połączeniu z opcją
<em>protocol</em>, gdyż połączenie do zdalnego serwera jest w tym wypadku nawiązywane
przed negocjacją TLS.</p>
<p>Uwierzytelnienie przy pomocy biblioteki libwrap jest realizowane dwukrotnie:
najpierw dla usługi nadrzędnej po odebraniu połączenia TCP, a następnie dla
usługi podrzędnej podczas negocjacji TLS.</p>
<p>Opcja <em>sni</em> jest dostępna począwszy od <strong>OpenSSL 1.0.0</strong>.</p>
</dd>
<dt><strong><strong>sni</strong> = nazwa_serwera (tryb klienta)</strong></dt>
<dt><strong><a name="nazwa_serwera" class="item"><strong>sni</strong> = nazwa_serwera (tryb klienta)</a></strong></dt>
<dd>
<p>Użyj parametru jako wartości rozszerzenia TLS Server Name Indication
(<a href="http://www.ietf.org/rfc/rfc3546.txt" class="rfc">RFC 3546</a>).</p>
<p>Opcja <em>sni</em> jest dostępna począwszy od wersji 1.0.0 biblioteki OpenSSL.</p>
<p>Opcja <em>sni</em> jest dostępna począwszy od <strong>OpenSSL 1.0.0</strong>.</p>
</dd>
<dt><strong><a name="ocsp_url" class="item"><strong>OCSP</strong> = URL</a></strong></dt>
@ -570,7 +584,7 @@ NOEXPLICIT, NOCASIGN, NODELEGATED, NOCHECKS, TRUSTOTHER, RESPID_KEY, NOTIME</p>
<dt><strong><a name="options_opcje_ssl" class="item"><strong>options</strong> = opcje_SSL</a></strong></dt>
<dd>
<p>opcje biblioteki OpenSSL</p>
<p>opcje biblioteki <strong>OpenSSL</strong></p>
<p>Parametrem jest nazwa opcji zgodnie z opisem w <em>SSL_CTX_set_options(3ssl)</em>,
ale bez przedrostka <em>SSL_OP_</em>.
Aby wyspecyfikować kilka opcji należy użyć <em>options</em> wielokrotnie.</p>
@ -582,8 +596,10 @@ w programie Eudora można użyć opcji:</p>
<dt><strong><a name="protocol_protok" class="item"><strong>protocol</strong> = protokół</a></strong></dt>
<dd>
<p>negocjuj SSL podanym protokołem aplikacyjnym (np. <em>starttls</em> lub <em>stls</em>)</p>
<p>Opcji <em>protocol</em> nie należy używać z szyfrowaniem SSL na osobnym porcie.</p>
<p>negocjuj SSL podanym protokołem aplikacyjnym</p>
<p>Opcja ta włącza wstępną negocjację szyfrowania SSL dla wybranego protokołu
aplikacyjnego.
Opcji <em>protocol</em> nie należy używać z szyfrowaniem SSL na osobnym porcie.</p>
<p>Aktualnie wspierane protokoły:</p>
<dl>
<dt><strong><a name="cifs" class="item"><em>cifs</em></a></strong></dt>
@ -643,6 +659,11 @@ Wsparcie dla tego rozrzeczenia zostało zarzucone w wersji 3.0.0 serwera Samba.<
<dd>
<p>adres docelowy do negocjacji protokołu</p>
<p><em>protocolHost</em> określa docelowy serwer SSL, do którego połączyć ma się proxy.
Nie jest to adres serwera proxy, do którego połączenie zestawia <strong>stunnel</strong>.
Adres serwera proxy powinien być określony przy pomocy opcji 'connect'.</p>
<p>W obecnej wersji adres docelowy protokołu ma zastosowanie wyłącznie w protokole
'connect'.</p>
</dd>
<dt><strong><a name="protocolpassword_has_o" class="item"><strong>protocolPassword</strong> = hasło</a></strong></dt>
@ -659,16 +680,48 @@ Wsparcie dla tego rozrzeczenia zostało zarzucone w wersji 3.0.0 serwera Samba.<
<dd>
<p>alokuj pseudoterminal dla programu uruchamianego w opcji 'exec'</p>
</dd>
<dt><strong><strong>retry</strong> = yes | no (tylko Unix)</strong></dt>
<dt><strong><a name="renegotiation_yes_no" class="item"><strong>renegotiation</strong> = yes | no</a></strong></dt>
<dd>
<p>pozwalaj na renegocjację SSL</p>
<p>Wśród zastosowań renegocjacji SSL są niektóre scenariusze uwierzytelnienia,
oraz renegocjacja kluczy dla długotrwałych połączeń.</p>
<p>Z drugiej strony własność na może ułatwić trywialny atak DoS poprzez
wygenerowanie obciążenia procesora:</p>
<p><a href="http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html">http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html</a></p>
<p>Warto zauważyć, że zablokowanie renegocjacji SSL nie zebezpiecza w pełni
przed opisanym problemem.</p>
<p>domyślnie: yes (o ile wspierane przez <strong>OpenSSL</strong>)</p>
</dd>
<dt><strong><a name="reset_yes_no" class="item"><strong>reset</strong> = yes | no</a></strong></dt>
<dd>
<p>sygnalizuj wystąpienie błędu przy pomocy flagi TCP RST</p>
<p>Ta opcja nie jest wspierana na niektórych platformach.</p>
<p>domyślnie: yes</p>
</dd>
<dt><strong><a name="retry_yes_no" class="item"><strong>retry</strong> = yes | no</a></strong></dt>
<dd>
<p>połącz ponownie sekcję connect+exec po rozłączeniu</p>
<p>domyślnie: no</p>
</dd>
<dt><strong><a name="session_przeterminowanie_pami_ci_podr_cznej_sesji" class="item"><strong>session</strong> = przeterminowanie_pamięci_podręcznej_sesji</a></strong></dt>
<dt><strong><a name="sessioncachesize_rozmiar" class="item"><strong>sessionCacheSize</strong> = rozmiar</a></strong></dt>
<dd>
<p>czas w sekundach, po którym sesja SSL zostanie usunięta z pamięci podręcznej</p>
<p>rozmiar pamięci podręcznej sesji SSL</p>
<p>Parametr określa maksymalną liczbę pozycji wewnętrznej pamięci podręcznej
sesji.</p>
<p>Wartość 0 oznacza brak ograniczenia rozmiaru. Nie jest to zalecane dla
systemów produkcyjnych z uwagi na ryzyko ataku DoS przez wyczerpanie pamięci
RAM.</p>
</dd>
<dt><strong><a name="sessioncachetimeout_czas" class="item"><strong>sessionCacheTimeout</strong> = czas</a></strong></dt>
<dd>
<p>przeterminowanie pamięci podręcznej sesji SSL</p>
<p>Parametr określa czas w sekundach, po którym sesja SSL zostanie usunięta z
pamięci podręcznej.</p>
</dd>
<dt><strong><a name="sessiond_adres_port" class="item"><strong>sessiond</strong> = adres:port</a></strong></dt>
@ -679,7 +732,7 @@ Wsparcie dla tego rozrzeczenia zostało zarzucone w wersji 3.0.0 serwera Samba.<
<dd>
<p>wersja protokołu SSL</p>
<p>Dozwolone opcje: all, SSLv2, SSLv3, TLSv1</p>
<p>Dozwolone opcje: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2</p>
</dd>
<dt><strong><a name="w" class="item"><strong>stack</strong> = liczba_bajtów (z wyjątkiem modelu FORK)</a></strong></dt>
@ -721,7 +774,7 @@ Wsparcie dla tego rozrzeczenia zostało zarzucone w wersji 3.0.0 serwera Samba.<
<dd>
<p>Przepisz adres, aby nawiązywane połączenie wydawało się pochodzić
bezpośrednio od klienta, a nie od programu <em>stunnel</em>.</p>
bezpośrednio od klienta, a nie od programu <strong>stunnel</strong>.</p>
<p>Opcja jest aktualnie obsługiwana w:</p>
<dl>
<dt><strong><a name="zdalnym" class="item">Trybie zdalnym (opcja <em>connect</em>) w systemie <em>Linux &gt;=2.6.28</em></a></strong></dt>
@ -744,7 +797,7 @@ bezpośrednio od klienta, a nie od programu <em>stunnel</em>.</p>
<dd>
<p>Konfiguracja ta wymaga skompilowania jądra z opcją <em>transparent proxy</em>.
Docelowa usługa musi być umieszczona na osobnej maszynie, do której routing
kierowany jest poprzez serwer stunnela.</p>
kierowany jest poprzez serwer <strong>stunnela</strong>.</p>
<p>Dodatkowo <strong>stunnel</strong> powinien być wykonywany jako root i bez opcji <em>setuid</em>.</p>
</dd>
<dt><strong>Trybie zdalnym (opcja <em>connect</em>) w systemie <em>FreeBSD &gt;=8.0</em></strong></dt>
@ -805,18 +858,36 @@ dodatkowe opcje:</p>
<dd>
<p>weryfikuj certyfikat drugiej strony połączenia</p>
<dl>
<dt><strong><a name="poziom_0_zarz_daj_certyfikatu_i_zignoruj_go" class="item"><em>poziom 0</em> - zarządaj certyfikatu i zignoruj go</a></strong></dt>
<dt><strong><a name="poziom_0" class="item"><em>poziom 0</em></a></strong></dt>
<dt><strong><a name="poziom_1_weryfikuj_je_eli_zosta_przedstawiony" class="item"><em>poziom 1</em> - weryfikuj, jeżeli został przedstawiony</a></strong></dt>
<dd>
<p>zarządaj certyfikatu i zignoruj go</p>
</dd>
<dt><strong><a name="poziom_1" class="item"><em>poziom 1</em></a></strong></dt>
<dt><strong><a name="poziom_2_weryfikuj_z_zainstalowanym_certyfikatem_centrum_certyfikacji" class="item"><em>poziom 2</em> - weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji</a></strong></dt>
<dd>
<p>weryfikuj, jeżeli został przedstawiony</p>
</dd>
<dt><strong><a name="poziom_2" class="item"><em>poziom 2</em></a></strong></dt>
<dt><strong><a name="poziom_3_weryfikuj_z_lokalnie_zainstalowanym_certyfikatem_drugiej_strony" class="item"><em>poziom 3</em> - weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony</a></strong></dt>
<dd>
<p>weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji</p>
</dd>
<dt><strong><a name="poziom_3" class="item"><em>poziom 3</em></a></strong></dt>
<dt><strong><a name="poziom_4_weryfikuj_z_certyfikatem_drugiej_strony_ignoruj_c_a_cuch_ca" class="item"><em>poziom 4</em> - weryfikuj z certyfikatem drugiej strony ignorując łańcuch CA</a></strong></dt>
<dd>
<p>weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony</p>
</dd>
<dt><strong><a name="poziom_4" class="item"><em>poziom 4</em></a></strong></dt>
<dt><strong><a name="domy_lnie_nie_weryfikuj" class="item"><em>domyślnie</em> - nie weryfikuj</a></strong></dt>
<dd>
<p>weryfikuj z certyfikatem drugiej strony ignorując łańcuch CA</p>
</dd>
<dt><strong><a name="domy_lnie" class="item"><em>domyślnie</em></a></strong></dt>
<dd>
<p>nie weryfikuj</p>
</dd>
</dl>
</dd>
</dl>
@ -838,25 +909,25 @@ w przypadku błędu.</p>
<p>Załaduj ponownie plik konfiguracyjny.</p>
<p>Niektóre globalne opcje nie będą przeładowane:</p>
<ul>
<li><strong><a name="chroot" class="item">chroot</a></strong>
<li>
<p>chroot</p>
</li>
<li><strong><a name="foreground" class="item">foreground</a></strong>
<li>
<p>foreground</p>
</li>
<li><strong><a name="pid" class="item">pid</a></strong>
<li>
<p>pid</p>
</li>
<li><strong><a name="setgid" class="item">setgid</a></strong>
<li>
<p>setgid</p>
</li>
<li><strong><a name="setuid" class="item">setuid</a></strong>
<li>
<p>setuid</p>
</li>
</ul>
<p>Jeżeli wykorzystywana jest opcja 'setuid' stunnel nie będzie mógł załadować
<p>Jeżeli wykorzystywana jest opcja 'setuid' <strong>stunnel</strong> nie będzie mógł załadować
ponownie konfiguracji wykorzystującej uprzywilejowane (&lt;1024) porty.</p>
<p>Jeżeli wykorzystywana jest opcja 'chroot' stunnel będzie szukał wszystkich
<p>Jeżeli wykorzystywana jest opcja 'chroot' <strong>stunnel</strong> będzie szukał wszystkich
potrzebnych plików (łącznie z plikiem konfiguracyjnym, certyfikatami, logiem i
plikiem pid) wewnątrz katalogu wskazanego przez 'chroot'.</p>
</dd>
@ -864,7 +935,7 @@ plikiem pid) wewnątrz katalogu wskazanego przez 'chroot'.</p>
<dd>
<p>Zamknij i otwórz ponownie log.
Funkcja ta może zostać użyta w skrypcie rotującym log programu stunnel.</p>
Funkcja ta może zostać użyta w skrypcie rotującym log programu <strong>stunnel</strong>.</p>
</dd>
<dt><strong><a name="sigterm_sigquit_sigint" class="item">SIGTERM, SIGQUIT, SIGINT</a></strong></dt>
@ -910,7 +981,7 @@ konfiguracyjnym nie ma sekcji <em>[nazwa_usługi]</em>.</p>
<p>
</p>
<h2><a name="ograniczenia">OGRANICZENIA</a></h2>
<p><em>stunnel</em> nie może być używany do szyfrowania protokołu <em>FTP</em>,
<p><strong>stunnel</strong> nie może być używany do szyfrowania protokołu <em>FTP</em>,
ponieważ do przesyłania poszczególnych plików używa on dodatkowych
połączeń otwieranych na portach o dynamicznie przydzielanych numerach.
Istnieją jednak specjalne wersje klientów i serwerów FTP pozwalające
@ -943,9 +1014,9 @@ globalnymi. Przykład takiej konfiguracji znajduje się w sekcji
połączenie klientowi prawidłowym certyfikatem X.509.
Potwierdzenie tożsamości serwera polega na wykazaniu, że posiada on
odpowiadający certyfikatowi klucz prywatny.
Najprostszą metodą uzyskania certyfikatu jest wygenerowanie
go przy pomocy wolnego pakietu <em>OpenSSL</em>. Więcej informacji na temat
generowania certyfikatów można znaleźć na umieszczonych poniżej stronach.</p>
Najprostszą metodą uzyskania certyfikatu jest wygenerowanie go przy pomocy
wolnego pakietu <strong>OpenSSL</strong>. Więcej informacji na temat generowania
certyfikatów można znaleźć na umieszczonych poniżej stronach.</p>
<p>Istotną kwestią jest kolejność zawartości pliku <em>.pem</em>.
W pierwszej kolejności powinien on zawierać klucz prywatny,
a dopiero za nim podpisany certyfikat (nie żądanie certyfikatu).
@ -970,39 +1041,39 @@ gdyż protokół SSL wymaga do bezpieczeństwa kryptograficznego źródła
dobrej losowości. Następujące źródła są kolejno odczytywane aż do
uzyskania wystarczającej ilości entropii:</p>
<ul>
<li><strong><a name="zawarto_pliku_podanego_w_opcji_rndfile" class="item">Zawartość pliku podanego w opcji <em>RNDfile</em>.</a></strong>
<li>
<p>Zawartość pliku podanego w opcji <em>RNDfile</em>.</p>
</li>
<li><strong><a name="zawarto_pliku_o_nazwie_okre_lonej_przez_zmienn_rodowiskow_randfile_o_ile_jest_ona_ustawiona" class="item">Zawartość pliku o nazwie określonej przez zmienną środowiskową
RANDFILE, o ile jest ona ustawiona.</a></strong>
<li>
<p>Zawartość pliku o nazwie określonej przez zmienną środowiskową
RANDFILE, o ile jest ona ustawiona.</p>
</li>
<li><strong><a name="plik_rnd_umieszczony_w_katalogu_domowym_u_ytkownika_je_eli_zmienna_randfile_nie_jest_ustawiona" class="item">Plik .rnd umieszczony w katalogu domowym użytkownika,
jeżeli zmienna RANDFILE nie jest ustawiona.</a></strong>
<li>
<p>Plik .rnd umieszczony w katalogu domowym użytkownika,
jeżeli zmienna RANDFILE nie jest ustawiona.</p>
</li>
<li><strong><a name="plik_podany_w_opcji_with_random_w_czasie_konfiguracji_programu" class="item">Plik podany w opcji '--with-random' w czasie konfiguracji programu.</a></strong>
<li>
<p>Plik podany w opcji '--with-random' w czasie konfiguracji programu.</p>
</li>
<li><strong><a name="zawarto_ekranu_w_systemie_windows" class="item">Zawartość ekranu w systemie Windows.</a></strong>
<li>
<p>Zawartość ekranu w systemie Windows.</p>
</li>
<li><strong><a name="gniazdo_egd_je_eli_u_yta_zosta_a_opcja_egd" class="item">Gniazdo egd, jeżeli użyta została opcja <em>EGD</em>.</a></strong>
<li>
<p>Gniazdo egd, jeżeli użyta została opcja <em>EGD</em>.</p>
</li>
<li><strong><a name="gniazdo_egd_podane_w_opcji_with_egd_socket_w_czasie_konfiguracji_programu" class="item">Gniazdo egd podane w opcji '--with-egd-socket' w czasie konfiguracji
programu.</a></strong>
<li>
<p>Gniazdo egd podane w opcji '--with-egd-socket' w czasie konfiguracji
programu.</p>
</li>
<li><strong><a name="urz_dzenie_dev_urandom" class="item">Urządzenie /dev/urandom.</a></strong>
<li>
<p>Urządzenie /dev/urandom.</p>
</li>
</ul>
<p>Współczesne (&gt;=0.9.5a) wersje biblioteki <em>OpenSSL</em> automatycznie
<p>Współczesne (<strong>0.9.5a</strong> lub nowsze) wersje biblioteki <strong>OpenSSL</strong> automatycznie
zaprzestają ładowania kolejnych danych w momencie uzyskania wystarczającej
ilości entropii. Wcześniejsze wersje biblioteki wykorzystają wszystkie
powyższe źródła, gdyż nie istnieje tam funkcja pozwalająca określić,
czy uzyskano już wystarczająco dużo danych.</p>
powyższe źródła, gdyż nie istnieje tam funkcja pozwalająca określić, czy
uzyskano już wystarczająco dużo danych.</p>
<p>Warto zwrócić uwagę, że na maszynach z systemem Windows, na których
konsoli nie pracuje użytkownik, zawartość ekranu nie jest wystarczająco
zmienna, aby zainicjować PRNG. W takim przypadku do zainicjowania
@ -1012,17 +1083,17 @@ generatora należy użyć opcji <em>RNDfile</em>.</p>
O ile nie użyta została opcja <em>RNDoverwrite</em> jest to robione
automatycznie. Do ręcznego uzyskania takiego pliku użyteczna
może być komenda <em>openssl rand</em> dostarczana ze współczesnymi
wersjami pakietu <em>OpenSSL</em>.</p>
wersjami pakietu <strong>OpenSSL</strong>.</p>
<p>Jeszcze jedna istotna informacja -- jeżeli dostępne jest urządzenie
<em>/dev/urandom</em> biblioteka <em>OpenSSL</em> ma zwyczaj zasilania nim PRNG w trakcie
<em>/dev/urandom</em> biblioteka <strong>OpenSSL</strong> ma zwyczaj zasilania nim PRNG w trakcie
sprawdzania stanu generatora. W systemach z <em>/dev/urandom</em> urządzenie
to będzie najprawdopodobniej użyte, pomimo że znajduje się na samym końcu
powyższej listy. Jest to właściwość biblioteki <em>OpenSSL</em>, a nie programu
<em>stunnel</em>.</p>
powyższej listy. Jest to właściwość biblioteki <strong>OpenSSL</strong>, a nie programu
<strong>stunnel</strong>.</p>
<p>
</p>
<h2><a name="parametry_dh">PARAMETRY DH</a></h2>
<p>Począwszy od wersji 4.40 stunnel zawiera w kodzie programu 2048-bitowe
<p>Począwszy od wersji 4.40 <strong>stunnel</strong> zawiera w kodzie programu 2048-bitowe
parametry DH.</p>
<p>Alternatywnie parametry DH można umieścić w pliku razem z certyfikatem:</p>
<pre>
@ -1043,7 +1114,7 @@ parametry DH.</p>
</p>
<hr />
<h1><a name="b____dy">BŁĘDY</a></h1>
<p>Opcja <em>execargs</em> nie obsługuje cytowania.</p>
<p>Opcja <em>execargs</em> oraz linia komend Win32 nie obsługuje cytowania.</p>
<p>
</p>
<hr />
@ -1062,12 +1133,12 @@ parametry DH.</p>
<dt><strong><a name="http_www_stunnel_org" class="item"><em class="file"><a href="http://www.stunnel.org/">http://www.stunnel.org/</a></em></a></strong></dt>
<dd>
<p>strona domowa programu <em>stunnel</em></p>
<p>strona domowa programu <strong>stunnel</strong></p>
</dd>
<dt><strong><a name="http_www_openssl_org" class="item"><em class="file"><a href="http://www.openssl.org/">http://www.openssl.org/</a></em></a></strong></dt>
<dd>
<p>strona projektu <em>OpenSSL</em></p>
<p>strona projektu <strong>OpenSSL</strong></p>
</dd>
</dl>
<p>

View File

@ -94,13 +94,21 @@ Linia w pliku konfiguracyjnym może być:
=over 4
=item * pusta (ignorowana)
=item *
=item * komentarzem rozpoczynającym się znakiem ';' (ignorowana)
pusta (ignorowana)
=item * parą 'nazwa_opcji = wartość_opcji'
=item *
=item * tekstem '[nazwa_usługi]' wskazującym początek definicji usługi
komentarzem rozpoczynającym się znakiem ';' (ignorowana)
=item *
parą 'nazwa_opcji = wartość_opcji'
=item *
tekstem '[nazwa_usługi]' wskazującym początek definicji usługi
=back
@ -108,11 +116,17 @@ Parametr adres może być:
=over 4
=item * numerem portu
=item *
=item * oddzieloną średnikiem parą adresu (IPv4, IPv6, lub nazwą domenową) i numeru portu
numerem portu
=item * ścieżką do gniazda Unix (tylko Unix)
=item *
oddzieloną średnikiem parą adresu (IPv4, IPv6, lub nazwą domenową) i numeru portu
=item *
ścieżką do gniazda Unix (tylko Unix)
=back
@ -130,6 +144,24 @@ połączeń. Ścieżki podane w opcjach I<CApath>, I<CRLpath>, I<pid>
oraz I<exec> muszą być umieszczone wewnątrz katalogu podanego w opcji
I<chroot> i określone względem tego katalogu.
Niektóre funkcje systemu operacyjnego mogą wymagać dodatkowych plików umieszczonych w katalogu podanego w parametrze chroot:
=over 4
=item *
opóźnione rozwinięcie adresów DNS typowo wymaga /etc/nsswitch.conf i /etc/resolv.conf
=item *
lokalizacja strefy czasowej w logach wymaga pliku /etc/timezone
=item *
niektóre inne pliki mogą potrzebować plików urządzeń, np. /dev/zero lub /dev/null
=back
=item B<compression> = deflate | zlib | rle
wybór algorytmu kompresji przesyłanych danych
@ -138,10 +170,10 @@ domyślnie: bez kompresji
Algorytm deflate jest standardową metodą kompresji zgodnie z RFC 1951.
Kompresja zlib zaimplementowana w OpenSSL 0.9.8 i nowszych nie jest
kompatybilna implementacją OpenSSL 0.9.7.
Kompresja zlib zaimplementowana w B<OpenSSL 0.9.8> i nowszych nie jest
kompatybilna implementacją B<OpenSSL 0.9.7>.
Kompresja rle nie jest zaimplementowana w aktualnych wersjach OpenSSL.
Kompresja rle nie jest zaimplementowana w aktualnych wersjach B<OpenSSL>.
=item B<debug> = poziom[.podsystem]
@ -165,7 +197,7 @@ Wielkość liter jest ignorowana zarówno dla poziomu jak podsystemu.
Opcja pozwala określić ścieżkę do gniazda programu Entropy Gathering Daemon
używanego do zainicjalizowania generatora ciągów pseudolosowych biblioteki
OpenSSL. Opcja jest dostępna z biblioteką OpenSSL 0.9.5a lub nowszą.
B<OpenSSL>. Opcja jest dostępna z biblioteką B<OpenSSL 0.9.5a> lub nowszą.
=item B<engine> = auto | <identyfikator urządzenia>
@ -199,8 +231,8 @@ modułu kryptograficznego urządzenia.
Włącz lub wyłącz tryb FIPS 140-2.
Opcja pozwala wyłączyć wejście w tryb FIPS, jeśli stunnel został skompilowany
ze wsparciem dla FIPS 140-2.
Opcja pozwala wyłączyć wejście w tryb FIPS, jeśli B<stunnel> został
skompilowany ze wsparciem dla FIPS 140-2.
domyślnie: yes (pracuj w trybie FIPS 140-2)
@ -208,7 +240,7 @@ domyślnie: yes (pracuj w trybie FIPS 140-2)
tryb pierwszoplanowy
Użycie tej opcji powoduje, że I<stunnel> nie przechodzi w tło logując
Użycie tej opcji powoduje, że B<stunnel> nie przechodzi w tło logując
swoje komunikaty na konsolę zamiast przez I<syslog> (o ile nie użyto
opcji I<output>).
@ -235,7 +267,7 @@ względem tego katalogu.
liczba bajtów do zainicjowania generatora pseudolosowego
W wersjach biblioteki OpenSSL starszych niż 0.9.5a opcja ta określa
W wersjach biblioteki B<OpenSSL> starszych niż B<0.9.5a> opcja ta określa
również liczbę bajtów wystarczających do zainicjowania PRNG.
Nowsze wersje biblioteki mają wbudowaną funkcję określającą, czy
dostarczona ilość losowości jest wystarczająca do zainicjowania generatora.
@ -244,7 +276,7 @@ dostarczona ilość losowości jest wystarczająca do zainicjowania generatora.
ścieżka do pliku zawierającego losowe dane
Biblioteka OpenSSL użyje danych z tego pliku do zainicjowania
Biblioteka B<OpenSSL> użyje danych z tego pliku do zainicjowania
generatora pseudolosowego.
=item B<RNDoverwrite> = yes | no
@ -261,11 +293,11 @@ domyślnie: stunnel
=item B<setgid> = identyfikator_grupy (tylko Unix)
grupa z której prawami pracował będzie I<stunnel>
grupa z której prawami pracował będzie B<stunnel>
=item B<setuid> = identyfikator_użytkownika (tylko Unix)
użytkownik, z którego prawami pracował będzie I<stunnel>
użytkownik, z którego prawami pracował będzie B<stunnel>
=item B<socket> = a|l|r:option=value[:value]
@ -322,7 +354,7 @@ lub I<tcpserver>), należy przeczytać sekcję I<TRYB INETD> poniżej.
nasłuchuje na połączenia na podanym adresie i porcie
Jeżeli nie został podany adres, I<stunnel> domyślnie nasłuchuje
Jeżeli nie został podany adres, B<stunnel> domyślnie nasłuchuje
na wszystkich adresach IPv4 lokalnych interfejsów.
Aby nasłuchiwać na wszystkich adresach IPv6 należy użyć:
@ -338,8 +370,8 @@ jeżeli użyta została opcja I<verify>. Pliki z certyfikatami muszą
posiadać specjalne nazwy XXXXXXXX.0, gdzie XXXXXXXX jest skrótem
kryptograficznym reprezentacji DER nazwy podmiotu certyfikatu.
Funkcja skrótu została zmieniona w wersji 1.0.0 biblioteki OpenSSL.
Należy wykonać c_rehash przy zmianie OpenSSL 0.x.x na 1.x.x.
Funkcja skrótu została zmieniona w B<OpenSSL 1.0.0>.
Należy wykonać c_rehash przy zmianie B<OpenSSL 0.x.x> na B<1.x.x>.
Jeżeli zdefiniowano katalog I<chroot>, to ścieżka do I<CApath> jest określona
względem tego katalogu.
@ -377,7 +409,7 @@ domyślnie: no (tryb serwerowy)
połącz się ze zdalnym serwerem na podany port
Jeżeli nie został podany adres, I<stunnel> domyślnie łączy się
Jeżeli nie został podany adres, B<stunnel> domyślnie łączy się
z lokalnym serwerem.
Komenda może byc użyta wielokrotnie w pojedynczej sekcji
@ -393,8 +425,8 @@ jeżeli użyta została opcja I<verify>. Pliki z listami CRL muszą
posiadać specjalne nazwy XXXXXXXX.r0, gdzie XXXXXXXX jest skrótem
listy CRL.
Funkcja skrótu została zmieniona w wersji 1.0.0 biblioteki OpenSSL.
Należy wykonać c_rehash przy zmianie OpenSSL 0.x.x na 1.x.x.
Funkcja skrótu została zmieniona B<OpenSSL 1.0.0>.
Należy wykonać c_rehash przy zmianie B<OpenSSL 0.x.x> na B<1.x.x>.
Jeżeli zdefiniowano katalog I<chroot>, to ścieżka do I<CRLpath> jest określona
względem tego katalogu.
@ -421,7 +453,7 @@ domyślnie: prime256v1
opóźnij rozwinięcie adresu DNS podanego w opcji I<connect>
Opcja jest przydatna przy dynamicznym DNS, albo gdy usługa DNS nie jest
dostępna przy starcie programu stunnel (klient VPN, połączenie wdzwaniane).
dostępna przy starcie programu B<stunnel> (klient VPN, połączenie wdzwaniane).
=item B<engineNum> = <numer urządzenia>
@ -482,33 +514,37 @@ IP źródła do nawiązywania zdalnych połączeń
Domyślnie używane jest IP najbardziej zewnętrznego interfejsu w stronę
serwera, do którego nawiązywane jest połączenie.
=item B<sni> = nazwa_usługi:nazwa_serwera (tryb serwera)
=item B<sni> = nazwa_usługi:wzorzec_nazwy_serwera (tryb serwera)
Użyj usługi jako podrzędnej (virtualnego serwera) dla rozszerzenia TLS Server
Name Indication (RFC 3546).
I<nazwa_usługi> wskazuje usługę nadrzędną, która odbiera połączenia od klientów
przy pomocy opcji I<accept>. I<nazwa_serwera> wskazuje nazwę serwera
wirtualnego. Z pojedyńczą usługą nadrzędną powiązane jest zwykle wiele usług
podrzędnych. Opcja I<sni> może być rownież użyta wielokrotnie w ramach jednej
usługi podrzędnej.
przy pomocy opcji I<accept>. I<wzorzec_nazwy_serwera> wskazuje nazwę serwera
wirtualnego. Wzorzec może zaczynać się znakiem '*', np. '*.example.com".
Z pojedyńczą usługą nadrzędną powiązane jest zwykle wiele usług podrzędnych.
Opcja I<sni> może być rownież użyta wielokrotnie w ramach jednej usługi
podrzędnej.
Zarówno usługa nadrzędna jak i podrzędna nie może być skonfigurowana w trybie
klienckim. Opcja I<connect> usługi podrzędnej jest ignorowana w połączeniu z
opcją I<protocol>, gdyż połączenie do zdalnego serwera jest w tym wypadku
nawiązywane przed negocjacją TLS. Uwierzytelnienie przy pomocy biblioteki
libwrap jest realizowane dwukrotnie: najpierw dla usługi nadrzędnej po
odebraniu połączenia TCP, a następnie dla usługi podrzędnej podczas negocjacji
TLS.
klienckim.
Opcja I<sni> jest dostępna począwszy od wersji 1.0.0 biblioteki OpenSSL.
Opcja I<connect> usługi podrzędnej jest ignorowana w połączeniu z opcją
I<protocol>, gdyż połączenie do zdalnego serwera jest w tym wypadku nawiązywane
przed negocjacją TLS.
Uwierzytelnienie przy pomocy biblioteki libwrap jest realizowane dwukrotnie:
najpierw dla usługi nadrzędnej po odebraniu połączenia TCP, a następnie dla
usługi podrzędnej podczas negocjacji TLS.
Opcja I<sni> jest dostępna począwszy od B<OpenSSL 1.0.0>.
=item B<sni> = nazwa_serwera (tryb klienta)
Użyj parametru jako wartości rozszerzenia TLS Server Name Indication
(RFC 3546).
Opcja I<sni> jest dostępna począwszy od wersji 1.0.0 biblioteki OpenSSL.
Opcja I<sni> jest dostępna począwszy od B<OpenSSL 1.0.0>.
=item B<OCSP> = URL
@ -525,7 +561,7 @@ Aby wyspecyfikować kilka flag należy użyć I<OCSPflag> wielokrotnie.
=item B<options> = opcje_SSL
opcje biblioteki OpenSSL
opcje biblioteki B<OpenSSL>
Parametrem jest nazwa opcji zgodnie z opisem w I<SSL_CTX_set_options(3ssl)>,
ale bez przedrostka I<SSL_OP_>.
@ -538,8 +574,10 @@ w programie Eudora można użyć opcji:
=item B<protocol> = protokół
negocjuj SSL podanym protokołem aplikacyjnym (np. I<starttls> lub I<stls>)
negocjuj SSL podanym protokołem aplikacyjnym
Opcja ta włącza wstępną negocjację szyfrowania SSL dla wybranego protokołu
aplikacyjnego.
Opcji I<protocol> nie należy używać z szyfrowaniem SSL na osobnym porcie.
Aktualnie wspierane protokoły:
@ -599,6 +637,13 @@ domyślnie: basic
adres docelowy do negocjacji protokołu
I<protocolHost> określa docelowy serwer SSL, do którego połączyć ma się proxy.
Nie jest to adres serwera proxy, do którego połączenie zestawia B<stunnel>.
Adres serwera proxy powinien być określony przy pomocy opcji 'connect'.
W obecnej wersji adres docelowy protokołu ma zastosowanie wyłącznie w protokole
'connect'.
=item B<protocolPassword> = hasło
hasło do negocjacji protokołu
@ -611,15 +656,54 @@ nazwa użytkownika do negocjacji protokołu
alokuj pseudoterminal dla programu uruchamianego w opcji 'exec'
=item B<retry> = yes | no (tylko Unix)
=item B<renegotiation> = yes | no
pozwalaj na renegocjację SSL
Wśród zastosowań renegocjacji SSL są niektóre scenariusze uwierzytelnienia,
oraz renegocjacja kluczy dla długotrwałych połączeń.
Z drugiej strony własność na może ułatwić trywialny atak DoS poprzez
wygenerowanie obciążenia procesora:
http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html
Warto zauważyć, że zablokowanie renegocjacji SSL nie zebezpiecza w pełni
przed opisanym problemem.
domyślnie: yes (o ile wspierane przez B<OpenSSL>)
=item B<reset> = yes | no
sygnalizuj wystąpienie błędu przy pomocy flagi TCP RST
Ta opcja nie jest wspierana na niektórych platformach.
domyślnie: yes
=item B<retry> = yes | no
połącz ponownie sekcję connect+exec po rozłączeniu
domyślnie: no
=item B<session> = przeterminowanie_pamięci_podręcznej_sesji
=item B<sessionCacheSize> = rozmiar
czas w sekundach, po którym sesja SSL zostanie usunięta z pamięci podręcznej
rozmiar pamięci podręcznej sesji SSL
Parametr określa maksymalną liczbę pozycji wewnętrznej pamięci podręcznej
sesji.
Wartość 0 oznacza brak ograniczenia rozmiaru. Nie jest to zalecane dla
systemów produkcyjnych z uwagi na ryzyko ataku DoS przez wyczerpanie pamięci
RAM.
=item B<sessionCacheTimeout> = czas
przeterminowanie pamięci podręcznej sesji SSL
Parametr określa czas w sekundach, po którym sesja SSL zostanie usunięta z
pamięci podręcznej.
=item B<sessiond> = adres:port
@ -629,7 +713,7 @@ adres sessiond - servera cache sesji SSL
wersja protokołu SSL
Dozwolone opcje: all, SSLv2, SSLv3, TLSv1
Dozwolone opcje: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2
=item B<stack> = liczba_bajtów (z wyjątkiem modelu FORK)
@ -666,7 +750,7 @@ Zablokuj wsparcie dla przezroczystago proxy. Jest to wartość domyślna.
=item B<source>
Przepisz adres, aby nawiązywane połączenie wydawało się pochodzić
bezpośrednio od klienta, a nie od programu I<stunnel>.
bezpośrednio od klienta, a nie od programu B<stunnel>.
Opcja jest aktualnie obsługiwana w:
@ -691,7 +775,7 @@ Konfiguracja ta wymaga, aby B<stunnel> był wykonywany jako root i bez opcji I<s
Konfiguracja ta wymaga skompilowania jądra z opcją I<transparent proxy>.
Docelowa usługa musi być umieszczona na osobnej maszynie, do której routing
kierowany jest poprzez serwer stunnela.
kierowany jest poprzez serwer B<stunnela>.
Dodatkowo B<stunnel> powinien być wykonywany jako root i bez opcji I<setuid>.
@ -754,17 +838,29 @@ weryfikuj certyfikat drugiej strony połączenia
=over 4
=item I<poziom 0> - zarządaj certyfikatu i zignoruj go
=item I<poziom 0>
=item I<poziom 1> - weryfikuj, jeżeli został przedstawiony
zarządaj certyfikatu i zignoruj go
=item I<poziom 2> - weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji
=item I<poziom 1>
=item I<poziom 3> - weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony
weryfikuj, jeżeli został przedstawiony
=item I<poziom 4> - weryfikuj z certyfikatem drugiej strony ignorując łańcuch CA
=item I<poziom 2>
=item I<domyślnie> - nie weryfikuj
weryfikuj z zainstalowanym certyfikatem Centrum Certyfikacji
=item I<poziom 3>
weryfikuj z lokalnie zainstalowanym certyfikatem drugiej strony
=item I<poziom 4>
weryfikuj z certyfikatem drugiej strony ignorując łańcuch CA
=item I<domyślnie>
nie weryfikuj
=back
@ -791,29 +887,39 @@ Niektóre globalne opcje nie będą przeładowane:
=over 4
=item * chroot
=item *
=item * foreground
chroot
=item * pid
=item *
=item * setgid
foreground
=item * setuid
=item *
pid
=item *
setgid
=item *
setuid
=back
Jeżeli wykorzystywana jest opcja 'setuid' stunnel nie będzie mógł załadować
Jeżeli wykorzystywana jest opcja 'setuid' B<stunnel> nie będzie mógł załadować
ponownie konfiguracji wykorzystującej uprzywilejowane (<1024) porty.
Jeżeli wykorzystywana jest opcja 'chroot' stunnel będzie szukał wszystkich
Jeżeli wykorzystywana jest opcja 'chroot' B<stunnel> będzie szukał wszystkich
potrzebnych plików (łącznie z plikiem konfiguracyjnym, certyfikatami, logiem i
plikiem pid) wewnątrz katalogu wskazanego przez 'chroot'.
=item SIGUSR1
Zamknij i otwórz ponownie log.
Funkcja ta może zostać użyta w skrypcie rotującym log programu stunnel.
Funkcja ta może zostać użyta w skrypcie rotującym log programu B<stunnel>.
=item SIGTERM, SIGQUIT, SIGINT
@ -861,7 +967,7 @@ konfiguracyjnym nie ma sekcji I<[nazwa_usługi]>.
=head2 OGRANICZENIA
I<stunnel> nie może być używany do szyfrowania protokołu I<FTP>,
B<stunnel> nie może być używany do szyfrowania protokołu I<FTP>,
ponieważ do przesyłania poszczególnych plików używa on dodatkowych
połączeń otwieranych na portach o dynamicznie przydzielanych numerach.
Istnieją jednak specjalne wersje klientów i serwerów FTP pozwalające
@ -896,9 +1002,9 @@ Protokół SSL wymaga, aby każdy serwer przedstawiał się nawiązującemu
połączenie klientowi prawidłowym certyfikatem X.509.
Potwierdzenie tożsamości serwera polega na wykazaniu, że posiada on
odpowiadający certyfikatowi klucz prywatny.
Najprostszą metodą uzyskania certyfikatu jest wygenerowanie
go przy pomocy wolnego pakietu I<OpenSSL>. Więcej informacji na temat
generowania certyfikatów można znaleźć na umieszczonych poniżej stronach.
Najprostszą metodą uzyskania certyfikatu jest wygenerowanie go przy pomocy
wolnego pakietu B<OpenSSL>. Więcej informacji na temat generowania
certyfikatów można znaleźć na umieszczonych poniżej stronach.
Istotną kwestią jest kolejność zawartości pliku I<.pem>.
W pierwszej kolejności powinien on zawierać klucz prywatny,
@ -926,32 +1032,48 @@ uzyskania wystarczającej ilości entropii:
=over 4
=item * Zawartość pliku podanego w opcji I<RNDfile>.
=item *
=item * Zawartość pliku o nazwie określonej przez zmienną środowiskową
Zawartość pliku podanego w opcji I<RNDfile>.
=item *
Zawartość pliku o nazwie określonej przez zmienną środowiskową
RANDFILE, o ile jest ona ustawiona.
=item * Plik .rnd umieszczony w katalogu domowym użytkownika,
=item *
Plik .rnd umieszczony w katalogu domowym użytkownika,
jeżeli zmienna RANDFILE nie jest ustawiona.
=item * Plik podany w opcji '--with-random' w czasie konfiguracji programu.
=item *
=item * Zawartość ekranu w systemie Windows.
Plik podany w opcji '--with-random' w czasie konfiguracji programu.
=item * Gniazdo egd, jeżeli użyta została opcja I<EGD>.
=item *
=item * Gniazdo egd podane w opcji '--with-egd-socket' w czasie konfiguracji
Zawartość ekranu w systemie Windows.
=item *
Gniazdo egd, jeżeli użyta została opcja I<EGD>.
=item *
Gniazdo egd podane w opcji '--with-egd-socket' w czasie konfiguracji
programu.
=item * Urządzenie /dev/urandom.
=item *
Urządzenie /dev/urandom.
=back
Współczesne (>=0.9.5a) wersje biblioteki I<OpenSSL> automatycznie
Współczesne (B<0.9.5a> lub nowsze) wersje biblioteki B<OpenSSL> automatycznie
zaprzestają ładowania kolejnych danych w momencie uzyskania wystarczającej
ilości entropii. Wcześniejsze wersje biblioteki wykorzystają wszystkie
powyższe źródła, gdyż nie istnieje tam funkcja pozwalająca określić,
czy uzyskano już wystarczająco dużo danych.
powyższe źródła, gdyż nie istnieje tam funkcja pozwalająca określić, czy
uzyskano już wystarczająco dużo danych.
Warto zwrócić uwagę, że na maszynach z systemem Windows, na których
konsoli nie pracuje użytkownik, zawartość ekranu nie jest wystarczająco
@ -963,18 +1085,18 @@ Plik I<RNDfile> powinien zawierać dane losowe -- również w tym sensie,
O ile nie użyta została opcja I<RNDoverwrite> jest to robione
automatycznie. Do ręcznego uzyskania takiego pliku użyteczna
może być komenda I<openssl rand> dostarczana ze współczesnymi
wersjami pakietu I<OpenSSL>.
wersjami pakietu B<OpenSSL>.
Jeszcze jedna istotna informacja -- jeżeli dostępne jest urządzenie
I</dev/urandom> biblioteka I<OpenSSL> ma zwyczaj zasilania nim PRNG w trakcie
I</dev/urandom> biblioteka B<OpenSSL> ma zwyczaj zasilania nim PRNG w trakcie
sprawdzania stanu generatora. W systemach z I</dev/urandom> urządzenie
to będzie najprawdopodobniej użyte, pomimo że znajduje się na samym końcu
powyższej listy. Jest to właściwość biblioteki I<OpenSSL>, a nie programu
I<stunnel>.
powyższej listy. Jest to właściwość biblioteki B<OpenSSL>, a nie programu
B<stunnel>.
=head2 PARAMETRY DH
Począwszy od wersji 4.40 stunnel zawiera w kodzie programu 2048-bitowe
Począwszy od wersji 4.40 B<stunnel> zawiera w kodzie programu 2048-bitowe
parametry DH.
Alternatywnie parametry DH można umieścić w pliku razem z certyfikatem:
@ -997,7 +1119,7 @@ plik konfiguracyjny programu
=head1 BŁĘDY
Opcja I<execargs> nie obsługuje cytowania.
Opcja I<execargs> oraz linia komend Win32 nie obsługuje cytowania.
=head1 ZOBACZ RÓWNIEŻ
@ -1014,11 +1136,11 @@ biblioteka kontroli dostępu do usług internetowych
=item F<http://www.stunnel.org/>
strona domowa programu I<stunnel>
strona domowa programu B<stunnel>
=item F<http://www.openssl.org/>
strona projektu I<OpenSSL>
strona projektu B<OpenSSL>
=back

View File

@ -95,13 +95,21 @@ Each line of the configuration file can be either:
=over 4
=item * an empty line (ignored)
=item *
=item * a comment starting with ';' (ignored)
An empty line (ignored).
=item * an 'option_name = option_value' pair
=item *
=item * '[service_name]' indicating a start of a service definition
A comment starting with ';' (ignored).
=item *
An 'option_name = option_value' pair.
=item *
'[service_name]' indicating a start of a service definition.
=back
@ -109,11 +117,17 @@ An address parameter of an option may be either:
=over 4
=item * a port number
=item *
=item * a colon-separated pair of IP address (either IPv4, IPv6, or domain name) and port number
A port number.
=item * a Unix socket path (Unix only)
=item *
A colon-separated pair of IP address (either IPv4, IPv6, or domain name) and port number.
=item *
A Unix socket path (Unix only).
=back
@ -129,6 +143,24 @@ B<chroot> keeps B<stunnel> in chrooted jail. I<CApath>, I<CRLpath>, I<pid>
and I<exec> are located inside the jail and the patches have to be relative
to the directory specified with B<chroot>.
Several functions of the operating system also need their files to be located within chroot jail, e.g.:
=over 4
=item *
Delayed resolver typically needs /etc/nsswitch.conf and /etc/resolv.conf.
=item *
Local time in log files needs /etc/timezone.
=item *
Some other functions may need devices, e.g. /dev/zero or /dev/null.
=back
=item B<compression> = deflate | zlib | rle
select data compression algorithm
@ -137,10 +169,10 @@ default: no compression
deflate is the standard compression method as described in RFC 1951.
zlib compression of OpenSSL 0.9.8 or above is not backward compatible with
OpenSSL 0.9.7.
zlib compression of B<OpenSSL 0.9.8> or above is not backward compatible with
B<OpenSSL 0.9.7>.
rle compression is currently not implemented by the OpenSSL library.
rle compression is currently not implemented by the B<OpenSSL> library.
=item B<debug> = [facility.]level
@ -161,8 +193,8 @@ Case is ignored for both facilities and levels.
path to Entropy Gathering Daemon socket
Entropy Gathering Daemon socket to use to feed OpenSSL random number
generator. (Available only if compiled with OpenSSL 0.9.5a or higher)
Entropy Gathering Daemon socket to use to feed B<OpenSSL> random number
generator. (Available only if compiled with B<OpenSSL 0.9.5a> or higher)
=item B<engine> = auto | <engine id>
@ -196,8 +228,8 @@ engine cryptogaphic module.
Enable or disable FIPS 140-2 mode.
This option allows to disable entering FIPS mode if stunnel was compiled with
FIPS 140-2 support.
This option allows to disable entering FIPS mode if B<stunnel> was compiled
with FIPS 140-2 support.
default: yes
@ -229,9 +261,9 @@ I<pid> path is relative to I<chroot> directory if specified.
bytes to read from random seed files
Number of bytes of data read from random seed files. With SSL versions
less than 0.9.5a, also determines how many bytes of data are considered
sufficient to seed the PRNG. More recent OpenSSL versions have a builtin
Number of bytes of data read from random seed files. With SSL versions less
than B<0.9.5a>, also determines how many bytes of data are considered
sufficient to seed the PRNG. More recent B<OpenSSL> versions have a builtin
function to determine when sufficient randomness is available.
=item B<RNDfile> = file
@ -328,8 +360,8 @@ the I<verify>. Note that the certificates in this directory should be named
XXXXXXXX.0 where XXXXXXXX is the hash value of the DER encoded subject of the
cert.
The hash algorithm has been changed in OpenSSL 1.0.0. It is required to
c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.
The hash algorithm has been changed in B<OpenSSL 1.0.0>. It is required to
c_rehash the directory on upgrade from B<OpenSSL 0.x.x> to B<OpenSSL 1.x.x>.
I<CApath> path is relative to I<chroot> directory if specified.
@ -382,8 +414,8 @@ This is the directory in which B<stunnel> will look for CRLs when
using the I<verify>. Note that the CRLs in this directory should
be named XXXXXXXX.r0 where XXXXXXXX is the hash value of the CRL.
The hash algorithm has been changed in OpenSSL 1.0.0. It is required to
c_rehash the directory on upgrade from OpenSSL 0.x.x to OpenSSL 1.x.x.
The hash algorithm has been changed in B<OpenSSL 1.0.0>. It is required to
c_rehash the directory on upgrade from B<OpenSSL 0.x.x> to B<OpenSSL 1.x.x>.
I<CRLpath> path is relative to I<chroot> directory if specified.
@ -408,7 +440,7 @@ default: prime256v1
delay DNS lookup for 'connect' option
This option is useful for dynamic DNS, or when DNS is not available during
stunnel startup (road warrior VPN, dial-up configurations).
B<stunnel> startup (road warrior VPN, dial-up configurations).
=item B<engineNum> = engine number
@ -465,30 +497,35 @@ default: yes
IP of the outgoing interface is used as source for remote connections.
Use this option to bind a static local IP address, instead.
=item B<sni> = service_name:server_name (server mode)
=item B<sni> = service_name:server_name_pattern (server mode)
Use the service as a slave service (a name-based virtual server) for Server
Name Indication TLS extension (RFC 3546).
I<service_name> specifies the master service that accepts client connections
with I<accept> option. I<server_name> specifies the host name to be redirected.
with I<accept> option. I<server_name_pattern> specifies the host name to be
redirected. The pattern may start with '*' character, e.g. '*.example.com'.
Multiple slave services are normally specified for a single master service.
I<sni> option can also be specified more than once within a single slave service.
I<sni> option can also be specified more than once within a single slave
service.
This service, as well as the master service, may not be configured in client
mode.
This service, as well as the master service, may not be configured in client mode.
I<connect> option of the slave service is ignored when I<protocol> option is
specified, as I<protocol> connects remote host before TLS handshake.
Libwrap checks (Unix only) are performed twice: with master service name after
TCP connection is accepted, and with slave service name during TLS handshake.
Option I<sni> is only available when compiled with OpenSSL 1.0.0 and later.
Option I<sni> is only available when compiled with B<OpenSSL 1.0.0> and later.
=item B<sni> = server_name (client mode)
Use the parameter as the value of TLS Server Name Indication (RFC 3546)
extension.
Option I<sni> is only available when compiled with OpenSSL 1.0.0 and later.
Option I<sni> is only available when compiled with B<OpenSSL 1.0.0> and later.
=item B<OCSP> = url
@ -505,9 +542,9 @@ NOEXPLICIT, NOCASIGN, NODELEGATED, NOCHECKS, TRUSTOTHER, RESPID_KEY, NOTIME
=item B<options> = SSL_options
OpenSSL library options
B<OpenSSL> library options
The parameter is the OpenSSL option name as described in the
The parameter is the B<OpenSSL> option name as described in the
I<SSL_CTX_set_options(3ssl)> manual, but without I<SSL_OP_> prefix.
Several I<options> can be used to specify multiple options.
@ -518,8 +555,10 @@ the following option can be used:
=item B<protocol> = proto
application protocol to negotiate SSL (e.g. I<starttls> or I<stls>)
application protocol to negotiate SSL
This option enables initial, protocol-specific negotiation of the SSL/TLS
encryption.
I<protocol> option should not be used with SSL encryption on a separate port.
Currently supported protocols:
@ -571,7 +610,7 @@ authentication type for protocol negotiations
currently supported: basic, NTLM
Currently authentication type only applies to 'connect' protocol.
Currently authentication type only applies to the 'connect' protocol.
default: basic
@ -579,6 +618,12 @@ default: basic
destination address for protocol negotiations
I<protocolHost> specifies the final SSL server to be connected by the proxy,
and not the proxy server directly connected by B<stunnel>.
The proxy server should be specified with the 'connect' option.
Currently protocol destination address only applies to 'connect' protocol.
=item B<protocolPassword> = password
password for protocol negotiations
@ -591,16 +636,53 @@ username for protocol negotiations
allocate pseudo terminal for 'exec' option
=item B<retry> = yes | no (Unix only)
=item B<renegotiation> = yes | no
support SSL renegotiation
Applications of the SSL renegotiation include some authentication scenarios,
or re-keying long lasting connections.
On the other hand this feature can facilitate a trivial CPU-exhaustion
DoS attack:
http://vincent.bernat.im/en/blog/2011-ssl-dos-mitigation.html
Please note that disabling SSL renegotiation does not fully mitigate
this issue.
default: yes (if supported by B<OpenSSL>)
=item B<reset> = yes | no
attempt to use TCP RST flag to indicate an error
This option is not supported on some platforms.
default: yes
=item B<retry> = yes | no
reconnect a connect+exec section after it's disconnected
default: no
=item B<session> = timeout
=item B<sessionCacheSize> = size
session cache size
I<sessionCacheSize> specifies the maximum number of the internal session cache
entries.
The value of 0 can be used for unlimited size. It is not recommended
for production use due to the risk of memory exhaustion DoS attack.
=item B<sessionCacheTimeout> = timeout
session cache timeout
This is the number of seconds to keep cached SSL sessions.
=item B<sessiond> = host:port
address of sessiond SSL cache server
@ -609,7 +691,7 @@ address of sessiond SSL cache server
select version of SSL protocol
Allowed options: all, SSLv2, SSLv3, TLSv1
Allowed options: all, SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2
=item B<stack> = bytes (except for FORK model)
@ -654,7 +736,7 @@ This option is currently available in:
=item Remote mode (I<connect> option) on I<Linux E<gt>=2.6.28>
This configuration requires stunnel to be executed as root and without
This configuration requires B<stunnel> to be executed as root and without
I<setuid> option.
This configuration requires the following setup for iptables and routing
@ -672,9 +754,10 @@ B<stunnel> must also to be executed as root and without I<setuid> option.
=item Remote mode (I<connect> option) on I<Linux 2.2.x>
This configuration requires kernel to be compiled with I<transparent proxy> option.
This configuration requires kernel to be compiled with I<transparent proxy>
option.
Connected service must be installed on a separate host.
Routing towards the clients has to go through the stunnel box.
Routing towards the clients has to go through the B<stunnel> box.
B<stunnel> must also to be executed as root and without I<setuid> option.
@ -737,17 +820,29 @@ verify peer certificate
=over 4
=item I<level 0> - request and ignore peer certificate
=item level 0
=item I<level 1> - verify peer certificate if present
Request and ignore peer certificate.
=item I<level 2> - verify peer certificate
=item level 1
=item I<level 3> - verify peer with locally installed certificate
Verify peer certificate if present.
=item I<level 4> - ignore CA chain and only verify peer certificate
=item level 2
=item I<default> - no verify
Verify peer certificate.
=item level 3
Verify peer with locally installed certificate.
=item level 4
Ignore CA chain and only verify peer certificate.
=item default
No verify.
=back
@ -767,7 +862,7 @@ B<stunnel> returns zero on success, non-zero on error.
=head1 SIGNALS
The following signals can be used to control stunnel in Unix environment:
The following signals can be used to control B<stunnel> in Unix environment:
=over 4
@ -779,33 +874,43 @@ Some global options will not be reloaded:
=over 4
=item * chroot
=item *
=item * foreground
chroot
=item * pid
=item *
=item * setgid
foreground
=item * setuid
=item *
pid
=item *
setgid
=item *
setuid
=back
The use of 'setuid' option will also prevent stunnel from binding privileged
The use of 'setuid' option will also prevent B<stunnel> from binding privileged
(<1024) ports during configuration reloading.
When 'chroot' option is used, stunnel will look for all its files (including
When 'chroot' option is used, B<stunnel> will look for all its files (including
configuration file, certificates, log file and pid file) within the chroot
jail.
=item SIGUSR1
Close and reopen stunnel log file.
Close and reopen B<stunnel> log file.
This function can be used for log rotation.
=item SIGTERM, SIGQUIT, SIGINT
Shut stunnel down.
Shut B<stunnel> down.
=back
@ -875,7 +980,7 @@ configurations.
Each SSL enabled daemon needs to present a valid X.509 certificate
to the peer. It also needs a private key to decrypt the incoming
data. The easiest way to obtain a certificate and a key is to
generate them with the free I<OpenSSL> package. You can find more
generate them with the free B<OpenSSL> package. You can find more
information on certificates generation on pages listed below.
The order of contents of the I<.pem> file is important. It should contain the
@ -901,28 +1006,44 @@ in order until sufficient random data has been gathered:
=over 4
=item * The file specified with the I<RNDfile> flag.
=item *
=item * The file specified by the RANDFILE environment variable, if set.
The file specified with the I<RNDfile> flag.
=item * The file .rnd in your home directory, if RANDFILE not set.
=item *
=item * The file specified with '--with-random' at compile time.
The file specified by the RANDFILE environment variable, if set.
=item * The contents of the screen if running on Windows.
=item *
=item * The egd socket specified with the I<EGD> flag.
The file .rnd in your home directory, if RANDFILE not set.
=item * The egd socket specified with '--with-egd-sock' at compile time.
=item *
=item * The /dev/urandom device.
The file specified with '--with-random' at compile time.
=item *
The contents of the screen if running on Windows.
=item *
The egd socket specified with the I<EGD> flag.
=item *
The egd socket specified with '--with-egd-sock' at compile time.
=item *
The /dev/urandom device.
=back
With recent (>=OpenSSL 0.9.5a) version of SSL it will stop loading
random data automatically when sufficient entropy has been gathered.
With previous versions it will continue to gather from all the above
sources since no SSL function exists to tell when enough data is available.
With recent (B<OpenSSL 0.9.5a> or later) version of SSL it will stop loading
random data automatically when sufficient entropy has been gathered. With
previous versions it will continue to gather from all the above sources since
no SSL function exists to tell when enough data is available.
Note that on Windows machines that do not have console user interaction
(mouse movements, creating windows, etc.) the screen contents are not
@ -933,14 +1054,13 @@ Note that the file specified with the I<RNDfile> flag should contain
random data -- that means it should contain different information
each time B<stunnel> is run. This is handled automatically
unless the I<RNDoverwrite> flag is used. If you wish to update this file
manually, the I<openssl rand> command in recent versions of OpenSSL,
manually, the I<openssl rand> command in recent versions of B<OpenSSL>,
would be useful.
One important note -- if /dev/urandom is available, OpenSSL has a habit of
seeding the PRNG with it even when checking the random state, so on
systems with /dev/urandom you're likely to use it even though it's listed
at the very bottom of the list above. This isn't B<stunnel's> behaviour, it's
OpenSSLs.
Important note: If /dev/urandom is available, B<OpenSSL> often seeds the PRNG
with it while checking the random state. On systems with /dev/urandom
B<OpenSSL> is likely to use it even though it is listed at the very bottom of
the list above. This is the behaviour of B<OpenSSL> and not B<stunnel>.
=head2 DH PARAMETERS
@ -966,7 +1086,7 @@ B<stunnel> configuration file
=head1 BUGS
Option I<execargs> does not support quoting.
Option I<execargs> and Win32 command line does not support quoting.
=head1 SEE ALSO
@ -987,7 +1107,7 @@ B<stunnel> homepage
=item F<http://www.openssl.org/>
OpenSSL project website
B<OpenSSL> project website
=back

View File

@ -31,36 +31,42 @@ stunnel_CPPFLAGS += -DPIDFILE='"$(localstatedir)/run/stunnel/stunnel.pid"'
stunnel_LDFLAGS = -L$(SSLDIR)/lib64 -L$(SSLDIR)/lib -lssl -lcrypto
# Win32 executable
EXTRA_DIST = nogui.c make.bat makece.bat makew32.bat
EXTRA_DIST = make.bat makece.bat makew32.bat
EXTRA_DIST += mingw.mak evc.mak vc.mak os2.mak
EXTRA_PROGRAMS = stunnel.exe
EXTRA_PROGRAMS = stunnel.exe tstunnel.exe
stunnel_exe_SOURCES = $(common_headers) $(common_sources) $(win32_sources)
tstunnel_exe_SOURCES = $(common_headers) $(common_sources) nogui.c
OPENSSLDIR = /usr/src/openssl-0.9.8s-fips
WINCPPFLAGS = -I$(OPENSSLDIR)/inc32
# OPENSSLDIR = /usr/src/openssl-1.0.0f-i586
# WINCPPFLAGS = -I$(OPENSSLDIR)/include
# OPENSSLDIR = /usr/src/openssl-0.9.8u-fips
# WINCPPFLAGS = -I$(OPENSSLDIR)/inc32
OPENSSLDIR = /usr/src/openssl-1.0.2a-i686
WINCPPFLAGS = -I$(OPENSSLDIR)/include
WINCFLAGS = -mthreads -fstack-protector -O2 -Wall -Wextra -Wno-long-long -pedantic
WINLDFLAGS = -mthreads -fstack-protector -mwindows -s
WINLDFLAGS = -mthreads -fstack-protector -s
WINLIBS = -L$(OPENSSLDIR) -lcrypto -lssl -lpsapi -lws2_32 -lgdi32
# WINLIBS = -L$(OPENSSLDIR) -lzdll -lcrypto.dll -lssl.dll -lpsapi -lws2_32 -lgdi32
# WINLIBS = -L$(OPENSSLDIR) -lzdll -lcrypto -lssl -lpsapi -lws2_32 -lgdi32
WINOBJ = str.obj file.obj client.obj log.obj options.obj protocol.obj
WINOBJ += network.obj resolver.obj ssl.obj ctx.obj verify.obj sthreads.obj
WINOBJ += fd.obj stunnel.obj gui.obj resources.obj
WINPREFIX = i586-mingw32msvc-
WINOBJ += fd.obj stunnel.obj
WINGUIOBJ = $(WINOBJ) gui.obj resources.obj
WINNOGUIOBJ = $(WINOBJ) nogui.obj
WINPREFIX = i686-w64-mingw32-
WINGCC = $(WINPREFIX)gcc
WINDRES = $(WINPREFIX)windres
dist-hook: stunnel.exe
dist-hook: stunnel.exe tstunnel.exe
distclean-local:
rm -f stunnel.exe
rm -f stunnel.exe tstunnel.exe
# SUFFIXES = .c .rc .obj
stunnel.exe: $(WINOBJ)
$(WINGCC) $(WINLDFLAGS) -o stunnel.exe $(WINOBJ) $(WINLIBS)
stunnel.exe: $(WINGUIOBJ)
$(WINGCC) -mwindows $(WINLDFLAGS) -o stunnel.exe $(WINGUIOBJ) $(WINLIBS)
tstunnel.exe: $(WINNOGUIOBJ)
$(WINGCC) $(WINLDFLAGS) -o tstunnel.exe $(WINNOGUIOBJ) $(WINLIBS)
%.obj: %.c $(common_headers)
$(WINGCC) -c $(WINCPPFLAGS) $(WINCFLAGS) -o $@ $<

View File

@ -37,7 +37,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = stunnel$(EXEEXT)
EXTRA_PROGRAMS = stunnel.exe$(EXEEXT)
EXTRA_PROGRAMS = stunnel.exe$(EXEEXT) tstunnel.exe$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(srcdir)/stunnel3.in
@ -110,6 +110,10 @@ am_stunnel_exe_OBJECTS = $(am__objects_2) $(am__objects_5) \
$(am__objects_6)
stunnel_exe_OBJECTS = $(am_stunnel_exe_OBJECTS)
stunnel_exe_LDADD = $(LDADD)
am_tstunnel_exe_OBJECTS = $(am__objects_2) $(am__objects_5) \
nogui.$(OBJEXT)
tstunnel_exe_OBJECTS = $(am_tstunnel_exe_OBJECTS)
tstunnel_exe_LDADD = $(LDADD)
SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/auto/depcomp
@ -125,9 +129,9 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libstunnel_la_SOURCES) $(stunnel_SOURCES) \
$(stunnel_exe_SOURCES)
$(stunnel_exe_SOURCES) $(tstunnel_exe_SOURCES)
DIST_SOURCES = $(libstunnel_la_SOURCES) $(stunnel_SOURCES) \
$(stunnel_exe_SOURCES)
$(stunnel_exe_SOURCES) $(tstunnel_exe_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -276,22 +280,26 @@ stunnel_CPPFLAGS = -I/usr/kerberos/include -I$(SSLDIR)/include \
-DPIDFILE='"$(localstatedir)/run/stunnel/stunnel.pid"'
# Win32 executable
EXTRA_DIST = nogui.c make.bat makece.bat makew32.bat mingw.mak evc.mak \
vc.mak os2.mak
EXTRA_DIST = make.bat makece.bat makew32.bat mingw.mak evc.mak vc.mak \
os2.mak
stunnel_exe_SOURCES = $(common_headers) $(common_sources) $(win32_sources)
OPENSSLDIR = /usr/src/openssl-0.9.8s-fips
WINCPPFLAGS = -I$(OPENSSLDIR)/inc32
# OPENSSLDIR = /usr/src/openssl-1.0.0f-i586
# WINCPPFLAGS = -I$(OPENSSLDIR)/include
tstunnel_exe_SOURCES = $(common_headers) $(common_sources) nogui.c
# OPENSSLDIR = /usr/src/openssl-0.9.8u-fips
# WINCPPFLAGS = -I$(OPENSSLDIR)/inc32
OPENSSLDIR = /usr/src/openssl-1.0.1e-i586
WINCPPFLAGS = -I$(OPENSSLDIR)/include
WINCFLAGS = -mthreads -fstack-protector -O2 -Wall -Wextra -Wno-long-long -pedantic
WINLDFLAGS = -mthreads -fstack-protector -mwindows -s
WINLDFLAGS = -mthreads -fstack-protector -s
WINLIBS = -L$(OPENSSLDIR) -lcrypto -lssl -lpsapi -lws2_32 -lgdi32
# WINLIBS = -L$(OPENSSLDIR) -lzdll -lcrypto.dll -lssl.dll -lpsapi -lws2_32 -lgdi32
# WINLIBS = -L$(OPENSSLDIR) -lzdll -lcrypto -lssl -lpsapi -lws2_32 -lgdi32
WINOBJ = str.obj file.obj client.obj log.obj options.obj protocol.obj \
network.obj resolver.obj ssl.obj ctx.obj verify.obj \
sthreads.obj fd.obj stunnel.obj gui.obj resources.obj
WINPREFIX = i586-mingw32msvc-
sthreads.obj fd.obj stunnel.obj
WINGUIOBJ = $(WINOBJ) gui.obj resources.obj
WINNOGUIOBJ = $(WINOBJ) nogui.obj
WINPREFIX = i686-w64-mingw32-
WINGCC = $(WINPREFIX)gcc
WINDRES = $(WINPREFIX)windres
all: config.h
@ -476,6 +484,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nogui.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resolver.Po@am__quote@
@ -962,15 +971,18 @@ uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
uninstall-pkglibLTLIBRARIES
dist-hook: stunnel.exe
dist-hook: stunnel.exe tstunnel.exe
distclean-local:
rm -f stunnel.exe
rm -f stunnel.exe tstunnel.exe
# SUFFIXES = .c .rc .obj
stunnel.exe: $(WINOBJ)
$(WINGCC) $(WINLDFLAGS) -o stunnel.exe $(WINOBJ) $(WINLIBS)
stunnel.exe: $(WINGUIOBJ)
$(WINGCC) -mwindows $(WINLDFLAGS) -o stunnel.exe $(WINGUIOBJ) $(WINLIBS)
tstunnel.exe: $(WINNOGUIOBJ)
$(WINGCC) $(WINLDFLAGS) -o tstunnel.exe $(WINNOGUIOBJ) $(WINLIBS)
%.obj: %.c $(common_headers)
$(WINGCC) -c $(WINCPPFLAGS) $(WINCFLAGS) -o $@ $<

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -54,7 +54,7 @@ static void init_local(CLI *);
static void init_remote(CLI *);
static void init_ssl(CLI *);
#ifdef USE_WIN32
static void win_new_chain(CLI *);
static void new_chain(CLI *);
#endif
static void transfer(CLI *);
static int parse_socket_error(CLI *, const char *);
@ -129,7 +129,7 @@ void client_main(CLI *c) {
}
static void client_run(CLI *c) {
int error;
int err, rst;
#ifndef USE_FORK
enter_critical_section(CRIT_CLIENTS); /* for multi-cpu machines */
@ -145,13 +145,13 @@ static void client_run(CLI *c) {
c->connect_addr.num=0;
c->connect_addr.addr=NULL;
error=setjmp(c->err);
if(!error)
err=setjmp(c->err);
if(!err)
client_try(c);
rst=err==1 && c->opt->option.reset;
s_log(LOG_NOTICE,
"Connection %s: %d byte(s) sent to SSL, %d byte(s) sent to socket",
error==1 ? "reset" : "closed", c->ssl_bytes, c->sock_bytes);
rst ? "reset" : "closed", c->ssl_bytes, c->sock_bytes);
/* cleanup temporary (e.g. IDENT) socket */
if(c->fd>=0)
@ -168,7 +168,7 @@ static void client_run(CLI *c) {
/* cleanup remote socket */
if(c->remote_fd.fd>=0) { /* remote socket initialized */
if(error==1 && c->remote_fd.is_socket) /* reset */
if(rst && c->remote_fd.is_socket) /* reset */
reset(c->remote_fd.fd, "linger (remote)");
closesocket(c->remote_fd.fd);
s_log(LOG_DEBUG, "Remote socket (FD=%d) closed", c->remote_fd.fd);
@ -178,14 +178,14 @@ static void client_run(CLI *c) {
/* cleanup local socket */
if(c->local_rfd.fd>=0) { /* local socket initialized */
if(c->local_rfd.fd==c->local_wfd.fd) {
if(error==1 && c->local_rfd.is_socket)
if(rst && c->local_rfd.is_socket)
reset(c->local_rfd.fd, "linger (local)");
closesocket(c->local_rfd.fd);
s_log(LOG_DEBUG, "Local socket (FD=%d) closed", c->local_rfd.fd);
} else { /* stdin/stdout */
if(error==1 && c->local_rfd.is_socket)
if(rst && c->local_rfd.is_socket)
reset(c->local_rfd.fd, "linger (local_rfd)");
if(error==1 && c->local_wfd.is_socket)
if(rst && c->local_wfd.is_socket)
reset(c->local_wfd.fd, "linger (local_wfd)");
}
c->local_rfd.fd=c->local_wfd.fd=-1;
@ -217,7 +217,7 @@ static void client_try(CLI *c) {
/* server mode and no protocol negotiation needed */
init_ssl(c);
init_remote(c);
} else {
} else { /* client mode or protocol negotiation enabled */
protocol(c, PROTOCOL_PRE_CONNECT);
init_remote(c);
protocol(c, PROTOCOL_PRE_SSL);
@ -269,7 +269,7 @@ static void init_local(CLI *c) {
}
/* neither of local descriptors is a socket */
if(!c->local_rfd.is_socket && !c->local_rfd.is_socket) {
if(!c->local_rfd.is_socket && !c->local_wfd.is_socket) {
#ifndef USE_WIN32
if(c->opt->option.transparent_src) {
s_log(LOG_ERR, "Transparent source needs a socket");
@ -303,7 +303,12 @@ static void init_remote(CLI *c) {
c->bind_addr=NULL; /* don't bind */
/* setup c->remote_fd, now */
if(c->opt->option.remote) { /* try remote first for exec+connect targets */
if(c->opt->option.remote
#ifndef USE_WIN32
|| c->opt->option.transparent_dst
#endif
) {
/* try remote first for exec+connect targets */
c->remote_fd.fd=connect_remote(c);
} else if(c->opt->option.program) { /* exec+connect uses local fd */
c->remote_fd.fd=connect_local(c);
@ -332,7 +337,7 @@ static void init_ssl(CLI *c) {
if(c->opt->option.client) {
#ifndef OPENSSL_NO_TLSEXT
if(c->opt->sni) {
s_log(LOG_DEBUG, "SNI: host name: %s", c->opt->sni);
s_log(LOG_DEBUG, "SNI: sending servername: %s", c->opt->sni);
if(!SSL_set_tlsext_host_name(c->ssl, c->opt->sni)) {
sslerror("SSL_set_tlsext_host_name");
longjmp(c->err, 1);
@ -432,7 +437,7 @@ static void init_ssl(CLI *c) {
c->opt->option.client ? "connected" : "accepted");
} else { /* a new session was negotiated */
#ifdef USE_WIN32
win_new_chain(c);
new_chain(c);
#endif
if(c->opt->option.client) {
s_log(LOG_INFO, "SSL connected: new session negotiated");
@ -449,7 +454,7 @@ static void init_ssl(CLI *c) {
}
#ifdef USE_WIN32
static void win_new_chain(CLI *c) {
static void new_chain(CLI *c) {
BIO *bio;
int i, len;
X509 *peer=NULL;
@ -491,7 +496,7 @@ static void win_new_chain(CLI *c) {
BIO_free(bio);
str_detach(chain); /* to prevent automatic deallocation of cached value */
c->opt->chain=chain; /* this race condition is safe to ignore */
PostMessage(hwnd, WM_NEW_CHAIN, c->opt->section_number, 0);
win_new_chain(c->opt->section_number);
s_log(LOG_DEBUG, "Peer certificate was cached (%d bytes)", len);
}
#endif
@ -522,15 +527,18 @@ static void transfer(CLI *c) {
s_poll_init(c->fds); /* initialize the structure */
/* for plain socket open data strem = open file descriptor */
/* make sure to add each open socket to receive exceptions! */
if(sock_open_rd)
if(sock_open_rd) /* only poll if the read file descriptor is open */
s_poll_add(c->fds, c->sock_rfd->fd, c->sock_ptr<BUFFSIZE, 0);
if(sock_open_wr)
if(sock_open_wr) /* only poll if the write file descriptor is open */
s_poll_add(c->fds, c->sock_wfd->fd, 0, c->ssl_ptr);
/* for SSL assume that sockets are open if there any pending requests */
if(read_wants_read || write_wants_read || shutdown_wants_read)
s_poll_add(c->fds, c->ssl_rfd->fd, 1, 0);
if(read_wants_write || write_wants_write || shutdown_wants_write)
s_poll_add(c->fds, c->ssl_wfd->fd, 0, 1);
/* poll SSL file descriptors unless SSL shutdown was completed */
if(SSL_get_shutdown(c->ssl)!=
(SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN)) {
s_poll_add(c->fds, c->ssl_rfd->fd,
read_wants_read || write_wants_read || shutdown_wants_read, 0);
s_poll_add(c->fds, c->ssl_wfd->fd, 0,
read_wants_write || write_wants_write || shutdown_wants_write);
}
/****************************** wait for an event */
err=s_poll_wait(c->fds,
@ -558,39 +566,64 @@ static void transfer(CLI *c) {
}
/****************************** check for errors on sockets */
err=s_poll_error(c->fds, c->sock_rfd);
if(err) {
s_log(LOG_NOTICE,
"Error detected on socket (read) file descriptor: %s (%d)",
err=s_poll_error(c->fds, c->sock_rfd->fd);
if(err && err!=S_EWOULDBLOCK && err!=S_EAGAIN) {
s_log(LOG_NOTICE, "Read socket error: %s (%d)",
s_strerror(err), err);
longjmp(c->err, 1);
}
if(c->sock_wfd->fd != c->sock_rfd->fd) { /* performance optimization */
err=s_poll_error(c->fds, c->sock_wfd);
if(err) {
s_log(LOG_NOTICE,
"Error detected on socket write file descriptor: %s (%d)",
if(c->sock_wfd->fd!=c->sock_rfd->fd) { /* performance optimization */
err=s_poll_error(c->fds, c->sock_wfd->fd);
if(err && err!=S_EWOULDBLOCK && err!=S_EAGAIN) {
s_log(LOG_NOTICE, "Write socket error: %s (%d)",
s_strerror(err), err);
longjmp(c->err, 1);
}
}
err=s_poll_error(c->fds, c->ssl_rfd);
if(err) {
s_log(LOG_NOTICE,
"Error detected on SSL (read) file descriptor: %s (%d)",
err=s_poll_error(c->fds, c->ssl_rfd->fd);
if(err && err!=S_EWOULDBLOCK && err!=S_EAGAIN) {
s_log(LOG_NOTICE, "SSL socket error: %s (%d)",
s_strerror(err), err);
longjmp(c->err, 1);
}
if(c->ssl_wfd->fd != c->ssl_rfd->fd) { /* performance optimization */
err=s_poll_error(c->fds, c->ssl_wfd);
if(err) {
s_log(LOG_NOTICE,
"Error detected on SSL write file descriptor: %s (%d)",
if(c->ssl_wfd->fd!=c->ssl_rfd->fd) { /* performance optimization */
err=s_poll_error(c->fds, c->ssl_wfd->fd);
if(err && err!=S_EWOULDBLOCK && err!=S_EAGAIN) {
s_log(LOG_NOTICE, "SSL socket error: %s (%d)",
s_strerror(err), err);
longjmp(c->err, 1);
}
}
/****************************** check for hangup conditions */
if(s_poll_hup(c->fds, c->sock_rfd->fd)) {
s_log(LOG_INFO, "Read socket closed (hangup)");
sock_open_rd=0;
}
if(s_poll_hup(c->fds, c->sock_wfd->fd)) {
if(c->ssl_ptr) {
s_log(LOG_ERR,
"Write socket closed (hangup) with %d unsent byte(s)",
c->ssl_ptr);
longjmp(c->err, 1); /* reset the socket */
}
s_log(LOG_INFO, "Write socket closed (hangup)");
sock_open_wr=0;
}
if(s_poll_hup(c->fds, c->ssl_rfd->fd) ||
s_poll_hup(c->fds, c->ssl_wfd->fd)) {
/* hangup -> buggy (e.g. Microsoft) peer:
* SSL socket closed without close_notify alert */
if(c->sock_ptr) {
s_log(LOG_ERR,
"SSL socket closed (hangup) with %d unsent byte(s)",
c->sock_ptr);
longjmp(c->err, 1); /* reset the socket */
}
s_log(LOG_INFO, "SSL socket closed (hangup)");
SSL_set_shutdown(c->ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
}
/****************************** retrieve results from c->fds */
sock_can_rd=s_poll_canread(c->fds, c->sock_rfd->fd);
sock_can_wr=s_poll_canwrite(c->fds, c->sock_wfd->fd);
@ -605,6 +638,11 @@ static void transfer(CLI *c) {
longjmp(c->err, 1);
}
if(c->reneg_state==RENEG_DETECTED && !c->opt->option.renegotiation) {
s_log(LOG_ERR, "Aborting due to renegotiation request");
longjmp(c->err, 1);
}
/****************************** send SSL close_notify alert */
if(shutdown_wants_read || shutdown_wants_write) {
num=SSL_shutdown(c->ssl); /* send close_notify alert */
@ -650,8 +688,10 @@ static void transfer(CLI *c) {
case -1:
if(parse_socket_error(c, "readsocket"))
break; /* a non-critical error: retry */
sock_open_rd=sock_open_wr=0;
break;
case 0: /* close */
s_log(LOG_DEBUG, "Socket closed on read");
s_log(LOG_INFO, "Read socket closed (readsocket)");
sock_open_rd=0;
break;
default:
@ -667,8 +707,6 @@ static void transfer(CLI *c) {
case -1: /* error */
if(parse_socket_error(c, "writesocket"))
break; /* a non-critical error: retry */
case 0:
s_log(LOG_DEBUG, "Socket closed on write");
sock_open_rd=sock_open_wr=0;
break;
default:
@ -717,15 +755,15 @@ static void transfer(CLI *c) {
* SSL socket closed without close_notify alert */
if(c->sock_ptr) {
s_log(LOG_ERR,
"SSL socket closed on SSL_read with %d unsent byte(s)",
"SSL socket closed (SSL_read) with %d unsent byte(s)",
c->sock_ptr);
longjmp(c->err, 1); /* reset the socket */
}
s_log(LOG_DEBUG, "SSL socket closed on SSL_read");
s_log(LOG_INFO, "SSL socket closed (SSL_read)");
SSL_set_shutdown(c->ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
break;
case SSL_ERROR_ZERO_RETURN: /* close_notify alert received */
s_log(LOG_DEBUG, "SSL closed on SSL_read");
s_log(LOG_INFO, "SSL closed (SSL_read)");
if(SSL_version(c->ssl)==SSL2_VERSION)
SSL_set_shutdown(c->ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
break;
@ -769,15 +807,15 @@ static void transfer(CLI *c) {
* SSL socket closed without close_notify alert */
if(c->sock_ptr) {
s_log(LOG_ERR,
"SSL socket closed on SSL_write with %d unsent byte(s)",
"SSL socket closed (SSL_write) with %d unsent byte(s)",
c->sock_ptr);
longjmp(c->err, 1); /* reset the socket */
}
s_log(LOG_DEBUG, "SSL socket closed on SSL_write");
s_log(LOG_INFO, "SSL socket closed (SSL_write)");
SSL_set_shutdown(c->ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
break;
case SSL_ERROR_ZERO_RETURN: /* close_notify alert received */
s_log(LOG_DEBUG, "SSL closed on SSL_write");
s_log(LOG_INFO, "SSL closed (SSL_write)");
if(SSL_version(c->ssl)==SSL2_VERSION)
SSL_set_shutdown(c->ssl, SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN);
break;
@ -794,7 +832,7 @@ static void transfer(CLI *c) {
if(sock_open_wr && SSL_get_shutdown(c->ssl)&SSL_RECEIVED_SHUTDOWN && !c->ssl_ptr) {
sock_open_wr=0; /* no further write allowed */
if(!c->sock_wfd->is_socket) {
s_log(LOG_DEBUG, "Closing the socket file descriptor");
s_log(LOG_DEBUG, "Closing the file descriptor");
sock_open_rd=0; /* file descriptor is ready to be closed */
} else if(!shutdown(c->sock_wfd->fd, SHUT_WR)) { /* send TCP FIN */
s_log(LOG_DEBUG, "Sent socket write shutdown");
@ -1084,8 +1122,15 @@ static int connect_local(CLI *c) { /* spawn local process */
sigemptyset(&newmask);
sigprocmask(SIG_SETMASK, &newmask, NULL);
#endif
signal(SIGCHLD, SIG_DFL);
signal(SIGHUP, SIG_DFL);
signal(SIGUSR1, SIG_DFL);
signal(SIGPIPE, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGINT, SIG_DFL);
execvp(c->opt->execname, c->opt->execargs);
ioerror(c->opt->execname); /* execv failed */
ioerror(c->opt->execname); /* execvp failed */
_exit(1);
default: /* parent */
s_log(LOG_INFO, "Local mode child started (PID=%lu)", c->pid);
@ -1159,8 +1204,8 @@ static SOCKADDR_LIST *dynamic_remote_addr(CLI *c) {
#endif /* SO_ORIGINAL_DST */
if(c->opt->option.delayed_lookup) {
if(!name2addrlist(&c->connect_addr,
c->opt->connect_name, DEFAULT_LOOPBACK)) {
if(!namelist2addrlist(&c->connect_addr,
c->opt->connect_list, DEFAULT_LOOPBACK)) {
s_log(LOG_ERR, "No host resolved");
longjmp(c->err, 1);
}

View File

@ -1,6 +1,6 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -431,10 +431,10 @@ extern char *sys_errlist[];
#include <openssl/ocsp.h>
#endif /* HAVE_OSSL_OCSP_H */
#ifdef USE_FIPS
#ifdef HAVE_OSSL_FIPS_H
#include <openssl/fips.h>
#include <openssl/fips_rand.h>
#endif /* USE_FIPS */
#endif /* HAVE_OSSL_FIPS_H */
#if OPENSSL_VERSION_NUMBER<0x0090800fL
#define OPENSSL_NO_ECDH

View File

@ -27,6 +27,9 @@
/* Define to 1 if you have the `endhostent' function. */
#undef HAVE_ENDHOSTENT
/* Define to 1 if you have the `FIPS_mode_set' function. */
#undef HAVE_FIPS_MODE_SET
/* Define to 1 if you have 'getaddrinfo' function. */
#undef HAVE_GETADDRINFO
@ -78,6 +81,9 @@
/* Define to 1 if you have <engine.h> header file. */
#undef HAVE_OSSL_ENGINE_H
/* Define to 1 if you have <fips.h> header file. */
#undef HAVE_OSSL_FIPS_H
/* Define to 1 if you have <ocsp.h> header file. */
#undef HAVE_OSSL_OCSP_H

View File

@ -1,6 +1,6 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -43,6 +43,7 @@
/* SNI */
#ifndef OPENSSL_NO_TLSEXT
static int servername_cb(SSL *, int *, void *);
static int matches_wildcard(char *, char *);
#endif
/* DH/ECDH initialization */
@ -126,6 +127,7 @@ int context_init(SERVICE_OPTIONS *section) { /* init SSL context */
}
}
SSL_CTX_set_session_cache_mode(section->ctx, SSL_SESS_CACHE_BOTH);
SSL_CTX_sess_set_cache_size(section->ctx, section->session_size);
SSL_CTX_set_timeout(section->ctx, section->session_timeout);
if(section->option.sessiond) {
SSL_CTX_sess_set_new_cb(section->ctx, sess_new_cb);
@ -134,8 +136,7 @@ int context_init(SERVICE_OPTIONS *section) { /* init SSL context */
}
/* set info callback */
if(global_options.debug_level==LOG_DEBUG) /* performance optimization */
SSL_CTX_set_info_callback(section->ctx, info_callback);
SSL_CTX_set_info_callback(section->ctx, info_callback);
/* ciphers, options, mode */
if(section->cipher_list)
@ -173,20 +174,25 @@ static int servername_cb(SSL *ssl, int *ad, void *arg) {
/* leave the alert type at SSL_AD_UNRECOGNIZED_NAME */
(void)ad; /* skip warning about unused parameter */
if(!section->servername_list_head) /* no virtual services defined */
if(!section->servername_list_head) { /* no virtual services defined */
s_log(LOG_DEBUG, "SNI: no virtual services defined");
return SSL_TLSEXT_ERR_OK;
if(!servername) /* no SNI extension received from the client */
}
if(!servername) { /* no SNI extension received from the client */
s_log(LOG_NOTICE, "SNI: extension not received from the client");
return SSL_TLSEXT_ERR_NOACK;
}
s_log(LOG_DEBUG, "SNI: searching service for servername: %s", servername);
for(list=section->servername_list_head; list; list=list->next)
if(!strcasecmp(servername, list->servername)) {
if(matches_wildcard((char *)servername, list->servername)) {
s_log(LOG_DEBUG, "SNI: matched pattern: %s", list->servername);
c=SSL_get_ex_data(ssl, cli_index);
c->opt=list->opt;
SSL_set_SSL_CTX(ssl, c->opt->ctx);
SSL_set_verify(ssl, SSL_CTX_get_verify_mode(c->opt->ctx),
SSL_CTX_get_verify_callback(c->opt->ctx));
s_log(LOG_NOTICE, "SNI: switched to section %s",
c->opt->servname);
s_log(LOG_INFO, "SNI: switched to service [%s]", c->opt->servname);
#ifdef USE_LIBWRAP
accepted_address=s_ntop(&c->peer_addr, c->peer_addr_len);
libwrap_auth(c, accepted_address); /* retry on a service switch */
@ -194,7 +200,7 @@ static int servername_cb(SSL *ssl, int *ad, void *arg) {
#endif /* USE_LIBWRAP */
return SSL_TLSEXT_ERR_OK;
}
s_log(LOG_ERR, "SNI: no service defined for server %s", servername);
s_log(LOG_ERR, "SNI: no pattern matched servername: %s", servername);
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
/* TLSEXT callback return codes:
@ -203,6 +209,20 @@ static int servername_cb(SSL *ssl, int *ad, void *arg) {
* - SSL_TLSEXT_ERR_ALERT_FATAL
* - SSL_TLSEXT_ERR_NOACK */
static int matches_wildcard(char *servername, char *pattern) {
int diff;
if(!servername || !pattern)
return 0;
if(*pattern=='*') { /* wildcard comparison */
diff=strlen(servername)-strlen(++pattern);
if(diff<0) /* pattern longer than servername */
return 0;
servername+=diff;
}
return !strcasecmp(servername, pattern);
}
#endif /* OPENSSL_NO_TLSEXT */
/**************************************** DH initialization */
@ -300,7 +320,8 @@ static int init_ecdh(SERVICE_OPTIONS *section) {
ecdh=EC_KEY_new_by_curve_name(section->curve);
if(!ecdh) {
s_log(LOG_ERR, "Unable to create curve %s",
sslerror("EC_KEY_new_by_curve_name");
s_log(LOG_ERR, "Cannot create curve %s",
OBJ_nid2ln(section->curve));
return 1; /* FAILED */
}
@ -615,6 +636,31 @@ static void info_callback(
const
#endif
SSL *ssl, int where, int ret) {
CLI *c;
c=SSL_get_ex_data(ssl, cli_index);
if(c) {
if((where&SSL_CB_HANDSHAKE_DONE)
&& c->reneg_state==RENEG_INIT) {
/* first (initial) handshake was completed, remember this,
* so that further renegotiation attempts can be detected */
c->reneg_state=RENEG_ESTABLISHED;
} else if((where&SSL_CB_ACCEPT_LOOP)
&& c->reneg_state==RENEG_ESTABLISHED) {
int state=SSL_get_state(ssl);
if(state==SSL3_ST_SR_CLNT_HELLO_A
|| state==SSL23_ST_SR_CLNT_HELLO_A) {
/* client hello received after initial handshake,
* this means renegotiation -> mark it */
c->reneg_state=RENEG_DETECTED;
}
}
}
if(global_options.debug_level<LOG_DEBUG)
return; /* performance optimization */
if(where & SSL_CB_LOOP) {
s_log(LOG_DEBUG, "SSL state (%s): %s",
where & SSL_ST_CONNECT ? "connect" :

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission

View File

@ -65,7 +65,7 @@ SDKDIR=$(SDKROOT)\$(OSVERSION)\$(PLATFORM)
INCLUDES=-I$(SSLDIR)\inc32 -I$(COMPATDIR)\include -I"$(SDKDIR)\include\$(TARGETCPU)"
# for X86 and other it appears that /MC or /ML flags are absurd,
# we always have to override runtime lib list to coredll and corelibc
LIBS=/NODEFAULTLIB coredll.lib corelibc.lib winsock.lib wcecompatex.lib libeay32.lib ssleay32.lib
LIBS=/NODEFAULTLIB winsock.lib wcecompatex.lib libeay32.lib ssleay32.lib coredll.lib corelibc.lib
DEFINES=/DHOST=\"$(TARGETCPU)-WCE-eVC-$(WCEVER)\"
# /O1 /Oi more correct vs MS doc

View File

@ -1,6 +1,6 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -50,11 +50,9 @@ DISK_FILE *file_open(char *name, int wr) {
fh=CreateFile(tstr, wr ? GENERIC_WRITE : GENERIC_READ,
FILE_SHARE_READ, NULL, wr ? OPEN_ALWAYS : OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);
str_free(tstr);
if(fh==INVALID_HANDLE_VALUE) {
ioerror(name);
str_free(tstr); /* str_free() overwrites GetLastError() value */
if(fh==INVALID_HANDLE_VALUE)
return NULL;
}
if(wr) /* append */
SetFilePointer(fh, 0, NULL, FILE_END);
@ -92,10 +90,8 @@ DISK_FILE *file_open(char *name, int wr) {
flags|=O_CLOEXEC;
#endif /* O_CLOEXEC */
fd=open(name, flags, 0640);
if(fd<0) {
ioerror(name);
if(fd<0)
return NULL;
}
/* setup df structure */
df=str_alloc(sizeof df);

119
src/gui.c
View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -79,7 +79,6 @@ static void invalid_config(void);
static void update_peer_menu(void);
static void update_tray_icon(void);
static void error_box(const LPSTR);
static void message_box(const LPSTR, const UINT);
static void edit_config(HWND);
static BOOL is_admin(void);
@ -109,13 +108,15 @@ static HMENU tray_menu_handle=NULL;
#ifndef _WIN32_WCE
static HMENU main_menu_handle=NULL;
#endif
HWND hwnd=NULL; /* main window handle */
static HWND hwnd=NULL; /* main window handle */
#ifdef _WIN32_WCE
static HWND command_bar_handle; /* command bar handle */
#endif
static HANDLE small_icon; /* 16x16 icon */
static TCHAR *win32_name;
static HANDLE daemon_handle=NULL;
/* win32_name is needed for any error_box(), message_box(),
* and the initial main window title */
static TCHAR *win32_name=TEXT("stunnel ") TEXT(STUNNEL_VERSION)
TEXT(" on ") TEXT(STUNNEL_PLATFORM) TEXT(" (not configured)");
#ifndef _WIN32_WCE
static SERVICE_STATUS serviceStatus;
@ -129,15 +130,9 @@ static LONG new_logs=0;
static UI_DATA *ui_data=NULL;
#ifndef _WIN32_WCE
GETADDRINFO s_getaddrinfo;
FREEADDRINFO s_freeaddrinfo;
GETNAMEINFO s_getnameinfo;
#endif
static struct {
char *config_file;
unsigned int install:1, uninstall:1, start:1, stop:1, service:1,
unsigned int service:1, install:1, uninstall:1, start:1, stop:1,
quiet:1, exit:1;
} cmdline;
@ -167,18 +162,18 @@ int WINAPI WinMain(HINSTANCE this_instance, HINSTANCE prev_instance,
command_line=lpCmdLine;
#endif
/* win32_name is needed for any error_box(), message_box(),
* and the initial main window title */
win32_name=TEXT("stunnel ") TEXT(STUNNEL_VERSION) TEXT(" on ")
TEXT(STUNNEL_PLATFORM) TEXT(" (not configured)");
parse_cmdline(command_line); /* setup global cmdline structure */
#ifndef _WIN32_WCE
GetModuleFileName(0, stunnel_exe_path, MAX_PATH);
/* find previous instances of the same executable */
EnumWindows(enum_windows, (LPARAM)stunnel_exe_path);
if(!cmdline.service && !cmdline.install && !cmdline.uninstall &&
!cmdline.start && !cmdline.stop) {
EnumWindows(enum_windows, (LPARAM)stunnel_exe_path);
if(cmdline.exit)
return 0; /* in case EnumWindows didn't find a previous instance */
}
/* change current working directory */
c=strrchr(stunnel_exe_path, '\\'); /* last backslash */
@ -190,16 +185,13 @@ int WINAPI WinMain(HINSTANCE this_instance, HINSTANCE prev_instance,
str_free(errmsg);
return 1;
}
if(cmdline.exit)
return 0; /* in case EnumWindows didn't find a previous instance */
#endif
if(initialize_winsock())
return 1;
#ifndef _WIN32_WCE
if(cmdline.service) /* it must be checked before "-install" */
if(cmdline.service) /* "-service" must be processed before "-install" */
return service_initialize();
if(cmdline.install)
return service_install(command_line);
@ -216,7 +208,7 @@ int WINAPI WinMain(HINSTANCE this_instance, HINSTANCE prev_instance,
#ifndef _WIN32_WCE
static BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
DWORD pid;
DWORD pid, exit_code;
HINSTANCE hInstance;
char window_exe_path[MAX_PATH];
HANDLE process_handle;
@ -226,9 +218,14 @@ static BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
return TRUE;
hInstance=(HINSTANCE)GetWindowLong(other_window_handle, GWL_HINSTANCE);
GetWindowThreadProcessId(other_window_handle, &pid);
process_handle=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,
process_handle=OpenProcess(SYNCHRONIZE /* WaitForSingleObject() */ |
PROCESS_TERMINATE /* TerminateProcess() */ |
PROCESS_QUERY_INFORMATION|PROCESS_VM_READ /* GetModuleFileNameEx() */,
FALSE, pid);
if(!GetModuleFileNameEx(process_handle, hInstance, window_exe_path, MAX_PATH)) {
if(!process_handle)
return TRUE;
if(!GetModuleFileNameEx(process_handle,
hInstance, window_exe_path, MAX_PATH)) {
CloseHandle(process_handle);
return TRUE;
}
@ -237,8 +234,11 @@ static BOOL CALLBACK enum_windows(HWND other_window_handle, LPARAM lParam) {
return TRUE;
}
if(cmdline.exit) {
SendMessage(other_window_handle, WM_COMMAND, IDM_EXIT, 0);
WaitForSingleObject(process_handle, 3000);
PostMessage(other_window_handle, WM_COMMAND, IDM_EXIT, 0);
if(WaitForSingleObject(process_handle, 3000)==WAIT_TIMEOUT) {
TerminateProcess(process_handle, 0);
WaitForSingleObject(process_handle, 3000);
}
} else {
ShowWindow(other_window_handle, SW_SHOWNORMAL); /* show window */
SetForegroundWindow(other_window_handle); /* bring on top */
@ -289,37 +289,12 @@ static void parse_cmdline(LPSTR command_line) {
/* try to load winsock2 resolver functions from a specified dll name */
static int initialize_winsock() {
static struct WSAData wsa_state;
#ifndef _WIN32_WCE
HINSTANCE handle;
#endif
if(WSAStartup(MAKEWORD( 2, 2 ), &wsa_state)) {
message_box("Failed to initialize winsock", MB_ICONERROR);
return 1; /* error */
}
#ifndef _WIN32_WCE
handle=LoadLibrary("ws2_32.dll"); /* IPv6 in Windows XP or higher */
if(handle) {
s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
s_getnameinfo=(GETNAMEINFO)GetProcAddress(handle, "getnameinfo");
if(s_getaddrinfo && s_freeaddrinfo && s_getnameinfo)
return 0; /* IPv6 detected -> OK */
FreeLibrary(handle);
}
handle=LoadLibrary("wship6.dll"); /* experimental IPv6 for Windows 2000 */
if(handle) {
s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
s_getnameinfo=(GETNAMEINFO)GetProcAddress(handle, "getnameinfo");
if(s_getaddrinfo && s_freeaddrinfo && s_getnameinfo)
return 0; /* IPv6 detected -> OK */
FreeLibrary(handle);
}
s_getaddrinfo=NULL;
s_freeaddrinfo=NULL;
s_getnameinfo=NULL;
#endif
resolver_init();
return 0; /* IPv4 detected -> OK */
}
@ -379,7 +354,7 @@ static int gui_loop() {
#endif
/* auto-reset, non-signaled */
config_ready=CreateEvent(NULL, FALSE, FALSE, NULL);
daemon_handle=(HANDLE)_beginthread(daemon_thread, DEFAULT_STACK_SIZE, NULL);
_beginthread(daemon_thread, DEFAULT_STACK_SIZE, NULL);
while(GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
@ -517,10 +492,8 @@ static LRESULT CALLBACK window_proc(HWND main_window_handle,
ShowWindow(main_window_handle, SW_HIDE); /* hide window */
break;
case IDM_EXIT:
if(!error_mode) { /* signal_pipe is active */
if(!error_mode) /* signal_pipe is active */
signal_post(SIGNAL_TERMINATE);
WaitForSingleObject(daemon_handle, 3000);
}
DestroyWindow(main_window_handle);
break;
case IDM_SAVE_LOG:
@ -937,11 +910,13 @@ static void update_peer_menu(void) {
section->file=str2tstr(str);
str_free(str);
/* setup section->help */
/* setup LPTSTR section->file */
str=str_printf("peer-%s.pem", section->servname);
section->file=str2tstr(str);
str_free(str);
str=str_printf(
/* setup (char *) section->help */
section->help=str_printf(
"Peer certificate chain has been saved.\n"
"Add the following lines to section [%s]:\n"
"\tCAfile = peer-%s.pem\n"
@ -949,8 +924,6 @@ static void update_peer_menu(void) {
"to enable cryptographic authentication.\n"
"Then reload stunnel configuration file.",
section->servname, section->servname);
section->help=str2tstr(str);
str_free(str);
/* setup section->chain */
section->chain=NULL;
@ -1021,7 +994,7 @@ static void error_box(const LPSTR text) {
str_free(fullmsg);
}
static void message_box(const LPSTR text, const UINT type) {
void message_box(const LPSTR text, const UINT type) {
LPTSTR tstr;
if(cmdline.quiet)
@ -1031,6 +1004,18 @@ static void message_box(const LPSTR text, const UINT type) {
str_free(tstr);
}
void win_new_chain(int section_number) {
PostMessage(hwnd, WM_NEW_CHAIN, section_number, 0);
}
void win_new_log(char *line) {
SendMessage(hwnd, WM_LOG, (WPARAM)line, 0);
}
void win_new_config(void) {
PostMessage(hwnd, WM_VALID_CONFIG, 0, 0);
}
static void edit_config(HWND main_window_handle) {
char cwd[MAX_PATH], *conf_path;

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -168,13 +168,11 @@ void libwrap_auth(CLI *c, char *accepted_address) {
}
busy[my_process]=0; /* mark the child process as free */
--num_busy; /* the child process has been released */
if(num_busy==num_processes-1) { /* need to wake up a thread */
retval=pthread_cond_signal(&cond); /* signal waiting threads */
if(retval) {
errno=retval;
ioerror("pthread_cond_signal");
longjmp(c->err, 1);
}
retval=pthread_cond_signal(&cond); /* signal a waiting thread */
if(retval) {
errno=retval;
ioerror("pthread_cond_signal");
longjmp(c->err, 1);
}
retval=pthread_mutex_unlock(&mutex);
if(retval) {

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -73,14 +73,17 @@ void syslog_close(void) {
#endif /* !defined(USE_WIN32) && !defined(__vms) */
void log_open(void) {
int log_open(void) {
if(global_options.output_file) { /* 'output' option specified */
outfile=file_open(global_options.output_file, 1);
if(!outfile)
s_log(LOG_ERR, "Unable to open output file: %s",
if(!outfile) {
s_log(LOG_ERR, "Cannot open log file: %s",
global_options.output_file);
return 1;
}
}
log_flush(LOG_MODE_CONFIGURED);
return 0;
}
void log_close(void) {
@ -198,15 +201,7 @@ static void log_raw(const int level, const char *stamp,
if(mode==LOG_MODE_ERROR || /* always log to the GUI window */
(mode==LOG_MODE_INFO && level<LOG_DEBUG) ||
level<=global_options.debug_level)
SendMessage(hwnd, WM_LOG, (WPARAM)line, 0);
#if 0
/* logging to Windows console for nogui.c */
LPTSTR tstr;
tstr=str2tstr(line);
RETAILMSG(TRUE, (TEXT("%s\r\n"), tstr));
str_free(tstr);
#endif
win_new_log(line);
#else /* Unix */
if(mode==LOG_MODE_ERROR || /* always log LOG_MODE_ERROR to stderr */
(mode==LOG_MODE_INFO && level<LOG_DEBUG) ||
@ -251,12 +246,7 @@ void fatal_debug(char *error, char *file, int line) {
#endif /* USE_WIN32, __vms */
#ifdef USE_WIN32
#ifdef _WIN32_WCE
MessageBox(hwnd, TEXT("INTERNAL ERROR"),
TEXT("stunnel"), MB_ICONERROR);
#else /* _WIN32_WCE */
MessageBox(hwnd, text, "stunnel", MB_ICONERROR);
#endif /* _WIN32_WCE */
message_box(text, MB_ICONERROR);
#endif /* USE_WIN32 */
abort();

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -40,6 +40,8 @@
/* #define DEBUG_UCONTEXT */
static int get_socket_error(const int);
/**************************************** s_poll functions */
#ifdef USE_POLL
@ -88,8 +90,8 @@ int s_poll_canread(s_poll_set *fds, int fd) {
for(i=0; i<fds->nfds; i++)
if(fds->ufds[i].fd==fd)
return fds->ufds[i].revents&(POLLIN|POLLHUP); /* read or closed */
return 0;
return fds->ufds[i].revents&POLLIN;
return 0; /* not listed in fds */
}
int s_poll_canwrite(s_poll_set *fds, int fd) {
@ -97,20 +99,27 @@ int s_poll_canwrite(s_poll_set *fds, int fd) {
for(i=0; i<fds->nfds; i++)
if(fds->ufds[i].fd==fd)
return fds->ufds[i].revents&POLLOUT; /* it is possible to write */
return 0;
return fds->ufds[i].revents&POLLOUT;
return 0; /* not listed in fds */
}
int s_poll_error(s_poll_set *fds, FD *s) {
int s_poll_hup(s_poll_set *fds, int fd) {
unsigned int i;
if(!s->is_socket)
return 0;
for(i=0; i<fds->nfds; i++)
if(fds->ufds[i].fd==s->fd)
if(fds->ufds[i].fd==fd)
return fds->ufds[i].revents&POLLHUP;
return 0; /* not listed in fds */
}
int s_poll_error(s_poll_set *fds, int fd) {
unsigned int i;
for(i=0; i<fds->nfds; i++)
if(fds->ufds[i].fd==fd)
return fds->ufds[i].revents&(POLLERR|POLLNVAL) ?
get_socket_error(s->fd) : 0;
return 0;
get_socket_error(fd) : 0;
return 0; /* not listed in fds */
}
#ifdef USE_UCONTEXT
@ -321,14 +330,18 @@ int s_poll_canwrite(s_poll_set *fds, int fd) {
return FD_ISSET(fd, &fds->owfds);
}
int s_poll_error(s_poll_set *fds, FD *s) {
if(!s->is_socket)
return 0; /* getsockopt is only available on sockets */
int s_poll_hup(s_poll_set *fds, int fd) {
(void)fds; /* skip warning about unused parameter */
(void)fd; /* skip warning about unused parameter */
return 0; /* FIXME: how to detect HUP condition with select()? */
}
int s_poll_error(s_poll_set *fds, int fd) {
/* error conditions are signaled as read, but apparently *not* in Winsock:
* http://msdn.microsoft.com/en-us/library/windows/desktop/ms737625%28v=vs.85%29.aspx */
if(!(FD_ISSET(s->fd, &fds->orfds) || FD_ISSET(s->fd, &fds->oxfds)))
if(!FD_ISSET(fd, &fds->orfds) && !FD_ISSET(fd, &fds->oxfds))
return 0;
return get_socket_error(s->fd); /* check if it's really an error */
return get_socket_error(fd); /* check if it's really an error */
}
int s_poll_wait(s_poll_set *fds, int sec, int msec) {
@ -400,13 +413,13 @@ int set_socket_options(int s, int type) {
return retval; /* returns 0 when all options succeeded */
}
int get_socket_error(const int fd) {
static int get_socket_error(const int fd) {
int err;
socklen_t optlen=sizeof err;
if(getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &optlen))
err=get_last_socket_error(); /* failed -> ask why */
return err;
return err==S_ENOTSOCK ? 0 : err;
}
/**************************************** simulate blocking I/O */
@ -550,9 +563,10 @@ void fd_putline(CLI *c, int fd, const char *line) {
}
char *fd_getline(CLI *c, int fd) {
char *line=NULL, *tmpline;
int ptr=0;
char *line, *tmpline;
int ptr=0, allocated=32;
line=str_alloc(allocated);
for(;;) {
s_poll_init(c->fds);
s_poll_add(c->fds, fd, 1, 0); /* read */
@ -573,7 +587,10 @@ char *fd_getline(CLI *c, int fd) {
str_free(line);
longjmp(c->err, 1); /* error */
}
line=str_realloc(line, ptr+1);
if(allocated<ptr+1) {
allocated*=2;
line=str_realloc(line, allocated);
}
switch(readsocket(fd, line+ptr, 1)) {
case -1: /* error */
sockerror("fd_getline: readsocket");

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -41,21 +41,59 @@
int main(int argc, char *argv[]) {
static struct WSAData wsa_state;
str_init(); /* initialize per-thread string management */
if(WSAStartup(MAKEWORD(1, 1), &wsa_state))
return 1;
resolver_init();
main_initialize();
if(main_configure(argc>1 ? argv[1] : NULL, argc>2 ? argv[2] : NULL))
return 1;
main_execute();
if(!main_configure(argc>1 ? argv[1] : NULL, argc>2 ? argv[2] : NULL))
daemon_loop();
unbind_ports();
log_flush(LOG_MODE_ERROR);
return 0;
}
void message_box(const LPSTR text, const UINT type) {
LPTSTR tstr;
tstr=str2tstr(text);
MessageBox(NULL, tstr, TEXT("stunnel"), type);
str_free(tstr);
}
void win_new_chain(int section_number) {
(void)section_number; /* skip warning about unused parameter */
}
void win_new_log(char *line) {
#ifdef _WIN32_WCE
/* log to Windows CE debug output stream */
LPTSTR tstr;
tstr=str2tstr(line);
RETAILMSG(TRUE, (TEXT("%s\r\n"), tstr));
str_free(tstr);
#else
printf("%s\n", line);
#endif
}
void win_new_config(void) {
/* no action */
}
int passwd_cb(char *buf, int size, int rwflag, void *userdata) {
(void)buf; /* skip warning about unused parameter */
(void)size; /* skip warning about unused parameter */
(void)rwflag; /* skip warning about unused parameter */
(void)userdata; /* skip warning about unused parameter */
return 0; /* not implemented */
}
#ifdef HAVE_OSSL_ENGINE_H
int pin_cb(UI *ui, UI_STRING *uis) {
(void)ui; /* skip warning about unused parameter */
(void)uis; /* skip warning about unused parameter */
return 0; /* not implemented */
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
prefix=.
DEFS = -DPACKAGE_NAME=\"stunnel\" \
-DPACKAGE_TARNAME=\"stunnel\" \
-DPACKAGE_VERSION=\"4.53\" \
-DPACKAGE_STRING=\"stunnel\ 4.53\" \
-DPACKAGE_VERSION=\"4.57\" \
-DPACKAGE_STRING=\"stunnel\ 4.57\" \
-DPACKAGE_BUGREPORT=\"\" \
-DPACKAGE=\"stunnel\" \
-DVERSION=\"4.53\" \
-DVERSION=\"4.57\" \
-DSTDC_HEADERS=1 \
-DHAVE_SYS_TYPES_H=1 \
-DHAVE_SYS_STAT_H=1 \

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -38,7 +38,7 @@
#include "common.h"
#include "prototypes.h"
#define isprefix(a, b) (strncasecmp((a), (b), strlen(b))==0)
#define is_prefix(a, b) (strncasecmp((a), (b), strlen(b))==0)
/* protocol-specific function prototypes */
static void proxy_server(CLI *c);
@ -71,7 +71,7 @@ typedef void (*FUNCTION)(CLI *);
static const struct {
char *name;
struct {
PROTOCOL_TYPE type;
PROTOCOL_PHASE type;
FUNCTION func;
} handlers[2];
} protocols[]={
@ -95,7 +95,7 @@ int find_protocol_id(const char *name) {
return -1;
}
void protocol(CLI *c, const PROTOCOL_TYPE type) {
void protocol(CLI *c, const PROTOCOL_PHASE type) {
const int id=c->opt->protocol, mode=(unsigned int)c->opt->option.client;
if(id<0 || type!=protocols[id].handlers[mode].type ||
@ -112,7 +112,7 @@ void protocol(CLI *c, const PROTOCOL_TYPE type) {
/*
* PROXY protocol: http://haproxy.1wt.eu/download/1.5/doc/proxy-protocol.txt
* this is a protocol client support for stunnel acting as an SSL server
* this is a protocol client support for stunnel acting as an SSL server
* I don't think anything else is useful, but feel free to discuss on the
* stunnel-users mailing list if you disagree
*/
@ -157,9 +157,11 @@ static void proxy_server(CLI *c) {
case AF_INET:
proto="TCP4";
break;
#ifdef USE_IPv6
case AF_INET6:
proto="TCP6";
break;
#endif
default: /* AF_UNIX */
proto="UNKNOWN";
}
@ -203,7 +205,7 @@ static void cifs_server(CLI *c) {
longjmp(c->err, 1);
}
read_blocking(c, c->local_rfd.fd, buffer+4, len);
if(buffer[0]!=0x81){ /* NB_SSN_REQUEST */
if(buffer[0]!=0x81) { /* NB_SSN_REQUEST */
s_log(LOG_ERR, "Client did not send session setup");
write_blocking(c, c->local_wfd.fd, response_access_denied, 5);
longjmp(c->err, 1);
@ -246,28 +248,35 @@ static void pgsql_server(CLI *c) {
static void smtp_client(CLI *c) {
char *line;
line=str_dup("");
do { /* copy multiline greeting */
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
fd_putline(c, c->local_wfd.fd, line);
} while(isprefix(line, "220-"));
} while(is_prefix(line, "220-"));
fd_putline(c, c->remote_fd.fd, "EHLO localhost");
do { /* skip multiline reply */
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
} while(isprefix(line, "250-"));
if(!isprefix(line, "250 ")) { /* error */
} while(is_prefix(line, "250-"));
if(!is_prefix(line, "250 ")) { /* error */
s_log(LOG_ERR, "Remote server is not RFC 1425 compliant");
str_free(line);
longjmp(c->err, 1);
}
fd_putline(c, c->remote_fd.fd, "STARTTLS");
do { /* skip multiline reply */
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
} while(isprefix(line, "220-"));
if(!isprefix(line, "220 ")) { /* error */
} while(is_prefix(line, "220-"));
if(!is_prefix(line, "220 ")) { /* error */
s_log(LOG_ERR, "Remote server is not RFC 2487 compliant");
str_free(line);
longjmp(c->err, 1);
}
str_free(line);
}
static void smtp_server(CLI *c) {
@ -288,24 +297,30 @@ static void smtp_server(CLI *c) {
}
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "220")) {
if(!is_prefix(line, "220")) {
s_log(LOG_ERR, "Unknown server welcome");
str_free(line);
longjmp(c->err, 1);
}
fd_printf(c, c->local_wfd.fd, "%s + stunnel", line);
str_free(line);
line=fd_getline(c, c->local_rfd.fd);
if(!isprefix(line, "EHLO ")) {
if(!is_prefix(line, "EHLO ")) {
s_log(LOG_ERR, "Unknown client EHLO");
str_free(line);
longjmp(c->err, 1);
}
fd_printf(c, c->local_wfd.fd, "250-%s Welcome", line);
fd_putline(c, c->local_wfd.fd, "250 STARTTLS");
str_free(line);
line=fd_getline(c, c->local_rfd.fd);
if(!isprefix(line, "STARTTLS")) {
if(!is_prefix(line, "STARTTLS")) {
s_log(LOG_ERR, "STARTTLS expected");
str_free(line);
longjmp(c->err, 1);
}
fd_putline(c, c->local_wfd.fd, "220 Go ahead");
str_free(line);
}
/**************************************** pop3 */
@ -314,17 +329,21 @@ static void pop3_client(CLI *c) {
char *line;
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "+OK ")) {
if(!is_prefix(line, "+OK ")) {
s_log(LOG_ERR, "Unknown server welcome");
str_free(line);
longjmp(c->err, 1);
}
fd_putline(c, c->local_wfd.fd, line);
fd_putline(c, c->remote_fd.fd, "STLS");
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "+OK ")) {
if(!is_prefix(line, "+OK ")) {
s_log(LOG_ERR, "Server does not support TLS");
str_free(line);
longjmp(c->err, 1);
}
str_free(line);
}
static void pop3_server(CLI *c) {
@ -332,17 +351,21 @@ static void pop3_server(CLI *c) {
line=fd_getline(c, c->remote_fd.fd);
fd_printf(c, c->local_wfd.fd, "%s + stunnel", line);
str_free(line);
line=fd_getline(c, c->local_rfd.fd);
if(isprefix(line, "CAPA")) { /* client wants RFC 2449 extensions */
if(is_prefix(line, "CAPA")) { /* client wants RFC 2449 extensions */
fd_putline(c, c->local_wfd.fd, "+OK Stunnel capability list follows");
fd_putline(c, c->local_wfd.fd, "STLS");
fd_putline(c, c->local_wfd.fd, ".");
str_free(line);
line=fd_getline(c, c->local_rfd.fd);
}
if(!isprefix(line, "STLS")) {
if(!is_prefix(line, "STLS")) {
s_log(LOG_ERR, "Client does not want TLS");
str_free(line);
longjmp(c->err, 1);
}
str_free(line);
fd_putline(c, c->local_wfd.fd, "+OK Stunnel starts TLS negotiation");
}
@ -352,24 +375,28 @@ static void imap_client(CLI *c) {
char *line;
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "* OK")) {
if(!is_prefix(line, "* OK")) {
s_log(LOG_ERR, "Unknown server welcome");
str_free(line);
longjmp(c->err, 1);
}
fd_putline(c, c->local_wfd.fd, line);
fd_putline(c, c->remote_fd.fd, "stunnel STARTTLS");
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "stunnel OK")) {
if(!is_prefix(line, "stunnel OK")) {
fd_putline(c, c->local_wfd.fd,
"* BYE stunnel: Server does not support TLS");
s_log(LOG_ERR, "Server does not support TLS");
str_free(line);
longjmp(c->err, 2); /* don't reset */
}
str_free(line);
}
static void imap_server(CLI *c) {
char *line, *id, *tail, *capa;
s_poll_init(c->fds);
s_poll_add(c->fds, c->local_rfd.fd, 1, 0);
switch(s_poll_wait(c->fds, 0, 200)) {
@ -386,8 +413,9 @@ static void imap_server(CLI *c) {
/* process server welcome and send it to client */
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "* OK")) {
if(!is_prefix(line, "* OK")) {
s_log(LOG_ERR, "Unknown server welcome");
str_free(line);
longjmp(c->err, 1);
}
capa=strstr(line, "CAPABILITY");
@ -397,41 +425,48 @@ static void imap_server(CLI *c) {
*capa='K'; /* disable CAPABILITY within greeting */
fd_printf(c, c->local_wfd.fd, "%s (stunnel)", line);
id=str_dup("");
while(1) { /* process client commands */
str_free(line);
line=fd_getline(c, c->local_rfd.fd);
/* split line into id and tail */
str_free(id);
id=str_dup(line);
tail=strchr(id, ' ');
if(!tail)
break;
*tail++='\0';
if(isprefix(tail, "STARTTLS")) {
if(is_prefix(tail, "STARTTLS")) {
fd_printf(c, c->local_wfd.fd,
"%s OK Begin TLS negotiation now", id);
str_free(line);
str_free(id);
return; /* success */
} else if(isprefix(tail, "CAPABILITY")) {
} else if(is_prefix(tail, "CAPABILITY")) {
fd_putline(c, c->remote_fd.fd, line); /* send it to server */
str_free(line);
line=fd_getline(c, c->remote_fd.fd); /* get the capabilites */
if(*line=='*') {
/*
/*
* append STARTTLS
* should also add LOGINDISABLED, but can't because
* of Mozilla bug #324138/#312009
* LOGIN would fail as "unexpected command", anyway
*/
fd_printf(c, c->local_wfd.fd, "%s STARTTLS", line);
str_free(line);
line=fd_getline(c, c->remote_fd.fd); /* next line */
}
fd_putline(c, c->local_wfd.fd, line); /* forward to the client */
tail=strchr(line, ' ');
if(!tail || !isprefix(tail+1, "OK")) { /* not OK? */
if(!tail || !is_prefix(tail+1, "OK")) { /* not OK? */
fd_putline(c, c->local_wfd.fd,
"* BYE unexpected server response");
s_log(LOG_ERR, "Unexpected server response: %s", line);
break;
}
} else if(isprefix(tail, "LOGOUT")) {
} else if(is_prefix(tail, "LOGOUT")) {
fd_putline(c, c->local_wfd.fd, "* BYE server terminating");
fd_printf(c, c->local_wfd.fd, "%s OK LOGOUT completed", id);
break;
@ -441,12 +476,17 @@ static void imap_server(CLI *c) {
s_log(LOG_ERR, "Unexpected client command %s", tail);
break;
}
}
}
/* clean server shutdown */
str_free(id);
fd_putline(c, c->remote_fd.fd, "stunnel LOGOUT");
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
if(*line=='*')
if(*line=='*') {
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
}
str_free(line);
longjmp(c->err, 2); /* don't reset */
}
@ -456,49 +496,61 @@ static void nntp_client(CLI *c) {
char *line;
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "200 ") && !isprefix(line, "201 ")) {
if(!is_prefix(line, "200 ") && !is_prefix(line, "201 ")) {
s_log(LOG_ERR, "Unknown server welcome");
str_free(line);
longjmp(c->err, 1);
}
fd_putline(c, c->local_wfd.fd, line);
fd_putline(c, c->remote_fd.fd, "STARTTLS");
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
if(!isprefix(line, "382 ")) {
if(!is_prefix(line, "382 ")) {
s_log(LOG_ERR, "Server does not support TLS");
str_free(line);
longjmp(c->err, 1);
}
str_free(line);
}
/**************************************** connect */
static void connect_server(CLI *c) {
char *request, *proto, *header;
int not_empty;
NAME_LIST host_list;
request=fd_getline(c, c->local_rfd.fd);
if(!isprefix(request, "CONNECT ")) {
if(!is_prefix(request, "CONNECT ")) {
fd_putline(c, c->local_wfd.fd, "HTTP/1.0 400 Bad Request Method");
fd_putline(c, c->local_wfd.fd, "Server: stunnel/" STUNNEL_VERSION);
fd_putline(c, c->local_wfd.fd, "");
str_free(request);
longjmp(c->err, 1);
}
proto=strchr(request+8, ' ');
if(!proto || !isprefix(proto, " HTTP/")) {
if(!proto || !is_prefix(proto, " HTTP/")) {
fd_putline(c, c->local_wfd.fd, "HTTP/1.0 400 Bad Request Protocol");
fd_putline(c, c->local_wfd.fd, "Server: stunnel/" STUNNEL_VERSION);
fd_putline(c, c->local_wfd.fd, "");
str_free(request);
longjmp(c->err, 1);
}
*proto='\0';
do { /* ignore any headers*/
header=fd_getline(c, c->local_rfd.fd);
not_empty=*header;
header=str_dup("");
do { /* ignore any headers */
str_free(header);
} while(not_empty);
if(!name2addrlist(&c->connect_addr, request+8, DEFAULT_LOOPBACK)) {
header=fd_getline(c, c->local_rfd.fd);
} while(*header); /* not empty */
str_free(header);
host_list.name=request+8;
host_list.next=NULL;
if(!namelist2addrlist(&c->connect_addr, &host_list, DEFAULT_LOOPBACK)) {
fd_putline(c, c->local_wfd.fd, "HTTP/1.0 404 Not Found");
fd_putline(c, c->local_wfd.fd, "Server: stunnel/" STUNNEL_VERSION);
fd_putline(c, c->local_wfd.fd, "");
str_free(request);
longjmp(c->err, 1);
}
str_free(request);
@ -541,23 +593,27 @@ static void connect_client(CLI *c) {
}
fd_putline(c, c->remote_fd.fd, ""); /* empty line */
line=fd_getline(c, c->remote_fd.fd);
if(strlen(line)<12 || line[9]!='2') {
/* not "HTTP/1.0 200 Connection established" */
if(!is_prefix(line, "HTTP/1.0 2") && !is_prefix(line, "HTTP/1.1 2")) {
/* not "HTTP/1.x 2xx Connection established" */
s_log(LOG_ERR, "CONNECT request rejected");
do { /* read all headers */
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
} while(*line);
str_free(line);
longjmp(c->err, 1);
}
s_log(LOG_INFO, "CONNECT request accepted");
do {
str_free(line);
line=fd_getline(c, c->remote_fd.fd); /* read all headers */
} while(*line);
str_free(line);
}
#if !defined(OPENSSL_NO_MD4) && OPENSSL_VERSION_NUMBER>=0x0090700fL
/*
/*
* NTLM code is based on the following documentation:
* http://davenport.sourceforge.net/ntlm.html
* http://www.innovation.ch/personal/ronald/ntlm.html
@ -566,7 +622,7 @@ static void connect_client(CLI *c) {
#define s_min(a, b) ((a)>(b)?(b):(a))
static void ntlm(CLI *c) {
char *line, buf[BUFSIZ], *ntlm1_txt, *ntlm2_txt, *ntlm3_txt;
char *line, buf[BUFSIZ], *ntlm1_txt, *ntlm2_txt, *ntlm3_txt, *tmpstr;
long content_length=0; /* no HTTP content */
/* send Proxy-Authorization (phase 1) */
@ -582,28 +638,38 @@ static void ntlm(CLI *c) {
line=fd_getline(c, c->remote_fd.fd);
/* receive Proxy-Authenticate (phase 2) */
if(line[9]!='4' || line[10]!='0' || line[11]!='7') { /* code 407 */
s_log(LOG_ERR, "NTLM authorization request rejected");
if(!is_prefix(line, "HTTP/1.0 407") && !is_prefix(line, "HTTP/1.1 407")) {
s_log(LOG_ERR, "Proxy-Authenticate: NTLM authorization request rejected");
do { /* read all headers */
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
} while(*line);
str_free(line);
longjmp(c->err, 1);
}
ntlm2_txt=NULL;
do { /* read all headers */
str_free(line);
line=fd_getline(c, c->remote_fd.fd);
if(isprefix(line, "Proxy-Authenticate: NTLM "))
if(is_prefix(line, "Proxy-Authenticate: NTLM "))
ntlm2_txt=str_dup(line+25);
else if(isprefix(line, "Content-Length: "))
content_length=atol(line+16);
else if(is_prefix(line, "Content-Length: ")) {
content_length=strtol(line+16, &tmpstr, 10);
if(tmpstr==line+16 || *tmpstr || content_length<0) {
s_log(LOG_ERR, "Proxy-Authenticate: Invalid Content-Length");
str_free(line);
longjmp(c->err, 1);
}
}
} while(*line);
if(!ntlm2_txt) { /* no Proxy-Authenticate: NTLM header */
s_log(LOG_ERR, "Proxy-Authenticate: NTLM header not found");
str_free(line);
longjmp(c->err, 1);
}
/* read and ignore HTTP content (if any) */
while(content_length) {
while(content_length>0) {
read_blocking(c, c->remote_fd.fd, buf, s_min(content_length, BUFSIZ));
content_length-=s_min(content_length, BUFSIZ);
}

View File

@ -1,6 +1,6 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -60,6 +60,11 @@ typedef union sockaddr_union {
#endif
} SOCKADDR_UNION;
typedef struct name_list_struct {
char *name;
struct name_list_struct *next;
} NAME_LIST;
typedef struct sockaddr_list { /* list of addresses */
SOCKADDR_UNION *addr; /* the list of addresses */
u16 cur; /* current address for round-robin */
@ -146,7 +151,7 @@ typedef struct service_options_struct {
char *cipher_list;
char *cert; /* cert filename */
char *key; /* pem (priv key/cert) filename */
long session_timeout;
long session_size, session_timeout;
long ssl_options;
SSL_METHOD *client_method, *server_method;
SOCKADDR_UNION sessiond_addr;
@ -173,7 +178,7 @@ typedef struct service_options_struct {
SOCKADDR_UNION local_addr, source_addr;
SOCKADDR_LIST connect_addr;
char *username;
char *connect_name;
NAME_LIST *connect_list;
int timeout_busy; /* maximum waiting for data time */
int timeout_close; /* maximum close_notify time */
int timeout_connect; /* maximum connect() time */
@ -190,8 +195,8 @@ typedef struct service_options_struct {
/* service-specific data for gui.c */
#ifdef USE_WIN32
int section_number;
LPTSTR file, help;
char *chain;
LPTSTR file;
char *help, *chain;
#endif
/* on/off switches */
@ -218,6 +223,8 @@ typedef struct service_options_struct {
#ifdef HAVE_OSSL_OCSP_H
unsigned int ocsp:1;
#endif
unsigned int reset:1; /* reset sockets on error */
unsigned int renegotiation:1;
} option;
} SERVICE_OPTIONS;
@ -322,7 +329,7 @@ void set_nonblock(int, unsigned long);
void syslog_open(void);
void syslog_close(void);
#endif
void log_open(void);
int log_open(void);
void log_close(void);
void log_flush(LOG_MODE);
void s_log(int, const char *, ...)
@ -377,7 +384,8 @@ void s_poll_init(s_poll_set *);
void s_poll_add(s_poll_set *, int, int, int);
int s_poll_canread(s_poll_set *, int);
int s_poll_canwrite(s_poll_set *, int);
int s_poll_error(s_poll_set *, FD *);
int s_poll_hup(s_poll_set *, int);
int s_poll_error(s_poll_set *, int);
int s_poll_wait(s_poll_set *, int, int);
#ifdef USE_WIN32
@ -391,11 +399,16 @@ int s_poll_wait(s_poll_set *, int, int);
#endif
int set_socket_options(int, int);
int get_socket_error(const int);
int make_sockets(int [2]);
/**************************************** prototypes for client.c */
typedef enum {
RENEG_INIT, /* initial state */
RENEG_ESTABLISHED, /* initial handshake completed */
RENEG_DETECTED /* renegotiation detected */
} RENEG_STATE;
typedef struct {
jmp_buf err; /* exception handler needs to be 16-byte aligned on Itanium */
SSL *ssl; /* SSL connnection */
@ -410,6 +423,7 @@ typedef struct {
/* IP for explicit local bind or transparent proxy */
unsigned long pid; /* PID of the local process */
int fd; /* temporary file descriptor */
RENEG_STATE reneg_state; /* used to track renegotiation attempts */
/* data for transfer() function */
char sock_buff[BUFFSIZE]; /* socket read buffer */
@ -447,17 +461,17 @@ typedef enum {
PROTOCOL_PRE_CONNECT,
PROTOCOL_PRE_SSL,
PROTOCOL_POST_SSL
} PROTOCOL_TYPE;
} PROTOCOL_PHASE;
int find_protocol_id(const char *);
void protocol(CLI *, const PROTOCOL_TYPE);
void protocol(CLI *, const PROTOCOL_PHASE);
/**************************************** prototypes for resolver.c */
void resolver_init();
int name2addr(SOCKADDR_UNION *, char *, char *);
int hostport2addr(SOCKADDR_UNION *, char *, char *);
int name2addrlist(SOCKADDR_LIST *, char *, char *);
int hostport2addrlist(SOCKADDR_LIST *, char *, char *);
int namelist2addrlist(SOCKADDR_LIST *, NAME_LIST *, char *);
char *s_ntop(SOCKADDR_UNION *, socklen_t);
socklen_t addr_len(const SOCKADDR_UNION *);
const char *s_gai_strerror(int);
@ -472,9 +486,22 @@ const char *s_gai_strerror(int);
#endif
#ifdef USE_WIN32
/* rename some locally shadowed declarations */
#define getnameinfo local_getnameinfo
#endif /* defined USE_WIN32 */
#ifndef _WIN32_WCE
typedef int (CALLBACK * GETADDRINFO) (const char *,
const char *, const struct addrinfo *, struct addrinfo **);
typedef void (CALLBACK * FREEADDRINFO) (struct addrinfo FAR *);
typedef int (CALLBACK * GETNAMEINFO) (const struct sockaddr *, socklen_t,
char *, size_t, char *, size_t, int);
extern GETADDRINFO s_getaddrinfo;
extern FREEADDRINFO s_freeaddrinfo;
extern GETNAMEINFO s_getnameinfo;
#endif /* ! _WIN32_WCE */
#endif /* USE_WIN32 */
int getnameinfo(const struct sockaddr *, int, char *, int, char *, int, int);
@ -523,23 +550,14 @@ void stack_info(int);
/**************************************** prototypes for gui.c */
#ifdef USE_WIN32
extern HWND hwnd;
void message_box(const LPSTR, const UINT);
void win_new_chain(int);
void win_new_log(char *);
void win_new_config(void);
int passwd_cb(char *, int, int, void *);
#ifdef HAVE_OSSL_ENGINE_H
int pin_cb(UI *, UI_STRING *);
#endif
#ifndef _WIN32_WCE
typedef int (CALLBACK * GETADDRINFO) (const char *,
const char *, const struct addrinfo *, struct addrinfo **);
typedef void (CALLBACK * FREEADDRINFO) (struct addrinfo FAR *);
typedef int (CALLBACK * GETNAMEINFO) (const struct sockaddr *, socklen_t,
char *, size_t, char *, size_t, int);
extern GETADDRINFO s_getaddrinfo;
extern FREEADDRINFO s_freeaddrinfo;
extern GETNAMEINFO s_getnameinfo;
#endif /* ! _WIN32_WCE */
#endif /* USE_WIN32 */
/**************************************** prototypes for file.c */

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -40,6 +40,9 @@
/**************************************** prototypes */
static int name2addrlist(SOCKADDR_LIST *, char *, char *);
static int hostport2addrlist(SOCKADDR_LIST *, char *, char *);
#ifndef HAVE_GETADDRINFO
#ifndef EAI_MEMORY
@ -77,6 +80,42 @@ static void freeaddrinfo(struct addrinfo *);
#endif /* !defined HAVE_GETADDRINFO */
/**************************************** resolver initialization */
#if defined(USE_WIN32) && !defined(_WIN32_WCE)
GETADDRINFO s_getaddrinfo;
FREEADDRINFO s_freeaddrinfo;
GETNAMEINFO s_getnameinfo;
#endif
void resolver_init() {
#if defined(USE_WIN32) && !defined(_WIN32_WCE)
HINSTANCE handle;
handle=LoadLibrary("ws2_32.dll"); /* IPv6 in Windows XP or higher */
if(handle) {
s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
s_getnameinfo=(GETNAMEINFO)GetProcAddress(handle, "getnameinfo");
if(s_getaddrinfo && s_freeaddrinfo && s_getnameinfo)
return; /* IPv6 detected -> OK */
FreeLibrary(handle);
}
handle=LoadLibrary("wship6.dll"); /* experimental IPv6 for Windows 2000 */
if(handle) {
s_getaddrinfo=(GETADDRINFO)GetProcAddress(handle, "getaddrinfo");
s_freeaddrinfo=(FREEADDRINFO)GetProcAddress(handle, "freeaddrinfo");
s_getnameinfo=(GETNAMEINFO)GetProcAddress(handle, "getnameinfo");
if(s_getaddrinfo && s_freeaddrinfo && s_getnameinfo)
return; /* IPv6 detected -> OK */
FreeLibrary(handle);
}
s_getaddrinfo=NULL;
s_freeaddrinfo=NULL;
s_getnameinfo=NULL;
#endif
}
/**************************************** stunnel resolver API */
int name2addr(SOCKADDR_UNION *addr, char *name, char *default_host) {
@ -107,7 +146,15 @@ int hostport2addr(SOCKADDR_UNION *addr, char *hostname, char *portname) {
return retval;
}
int name2addrlist(SOCKADDR_LIST *addr_list, char *name, char *default_host) {
int namelist2addrlist(SOCKADDR_LIST *addr_list, NAME_LIST *name_list, char *default_host) {
/* recursive implementation to reverse the list */
if(!name_list)
return 0;
return namelist2addrlist(addr_list, name_list->next, default_host) +
name2addrlist(addr_list, name_list->name, default_host);
}
static int name2addrlist(SOCKADDR_LIST *addr_list, char *name, char *default_host) {
char *tmp, *hostname, *portname;
int retval;
@ -146,10 +193,10 @@ int name2addrlist(SOCKADDR_LIST *addr_list, char *name, char *default_host) {
return retval;
}
int hostport2addrlist(SOCKADDR_LIST *addr_list,
static int hostport2addrlist(SOCKADDR_LIST *addr_list,
char *hostname, char *portname) {
struct addrinfo hints, *res=NULL, *cur;
int err;
int err, retries=0;
memset(&hints, 0, sizeof hints);
#if defined(USE_IPv6) || defined(USE_WIN32)
@ -159,15 +206,15 @@ int hostport2addrlist(SOCKADDR_LIST *addr_list,
#endif
hints.ai_socktype=SOCK_STREAM;
hints.ai_protocol=IPPROTO_TCP;
do {
for(;;) {
err=getaddrinfo(hostname, portname, &hints, &res);
if(err && res)
freeaddrinfo(res);
if(err==EAI_AGAIN) {
s_log(LOG_DEBUG, "getaddrinfo: EAI_AGAIN received: retrying");
sleep(1);
}
} while(err==EAI_AGAIN);
if(err!=EAI_AGAIN || ++retries>=3)
break;
s_log(LOG_DEBUG, "getaddrinfo: EAI_AGAIN received: retrying");
sleep(1);
}
switch(err) {
case 0:
break; /* success */

View File

@ -19,7 +19,7 @@ BEGIN
VALUE "FileDescription", "stunnel - multiplatform SSL tunneling proxy"
VALUE "FileVersion", STUNNEL_VERSION
VALUE "InternalName", "stunnel"
VALUE "LegalCopyright", "© by Michal Trojnara, 1998-2012"
VALUE "LegalCopyright", "© by Michal Trojnara, 1998-2013"
VALUE "OriginalFilename", "stunnel.exe"
VALUE "ProductName", STUNNEL_PRODUCTNAME
VALUE "ProductVersion", STUNNEL_VERSION
@ -90,7 +90,7 @@ BEGIN
ICON IDI_MYICON, -1, 9, 8, 18, 20
LTEXT "stunnel version", -1, 30, 4, 52, 8
LTEXT STUNNEL_VERSION, -1, 82, 4, 54, 8
LTEXT "© by Michal Trojnara, 1998-2012", -1, 30, 12, 106, 8
LTEXT "© by Michal Trojnara, 1998-2013", -1, 30, 12, 106, 8
LTEXT "All Rights Reserved", -1, 30, 20, 106, 8
LTEXT "Licensed under the GNU GPL version 2", -1, 4, 28, 132, 8
LTEXT "with a special exception for OpenSSL", -1, 4, 36, 132, 8

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -225,15 +225,15 @@ static int add_rand_file(GLOBAL_OPTIONS *global, const char *filename) {
struct stat sb;
if(stat(filename, &sb))
return 0; /* could not stat() file -> return 0 bytes */
return 0; /* could not stat() file --> return 0 bytes */
if((readbytes=RAND_load_file(filename, global->random_bytes)))
s_log(LOG_DEBUG, "Snagged %d random bytes from %s",
readbytes, filename);
else
s_log(LOG_INFO, "Unable to retrieve any random data from %s",
s_log(LOG_INFO, "Cannot retrieve any random data from %s",
filename);
/* write new random data for future seeding if it's a regular file */
if(global->option.rand_write && (sb.st_mode & S_IFREG)){
if(global->option.rand_write && (sb.st_mode & S_IFREG)) {
writebytes=RAND_write_file(filename);
if(writebytes==-1)
s_log(LOG_WARNING, "Failed to write strong random data to %s - "

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -112,7 +112,7 @@ static CONTEXT *new_context(void) {
int sthreads_init(void) {
/* create the first (listening) context and put it in the running queue */
if(!new_context()) {
s_log(LOG_ERR, "Unable create the listening context");
s_log(LOG_ERR, "Cannot create the listening context");
return 1;
}
/* no need to initialize ucontext_t structure here
@ -124,7 +124,7 @@ int create_client(int ls, int s, CLI *arg, void *(*cli)(void *)) {
CONTEXT *context;
(void)ls; /* this parameter is only used with USE_FORK */
s_log(LOG_DEBUG, "Creating a new context");
context=new_context();
if(!context) {

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -172,7 +172,7 @@ static ALLOC_TLS *get_alloc_tls() {
#ifdef USE_WIN32
static DWORD tls_index;
static DWORD tls_index;
void str_init() {
tls_index=TlsAlloc();

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -44,7 +44,11 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-pedantic"
#endif /* __GNUC__ */
#ifdef __GNUC__
#include <../ms/applink.c>
#else /* __GNUC__ */
#include <openssl/applink.c>
#endif /* __GNUC__ */
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif /* __GNUC__ */
@ -119,12 +123,16 @@ static int main_unix(int argc, char* argv[]) {
fatal("Could not open /dev/null");
#endif /* standard Unix */
main_initialize();
if(main_configure(argc>1 ? argv[1] : NULL, argc>2 ? argv[2] : NULL))
if(main_configure(argc>1 ? argv[1] : NULL, argc>2 ? argv[2] : NULL)) {
close(fd);
return 1;
}
if(service_options.next) { /* there are service sections -> daemon mode */
#if !defined(__vms) && !defined(USE_OS2)
if(daemonize(fd))
if(daemonize(fd)) {
close(fd);
return 1;
}
close(fd);
/* create_pid() must be called after drop_privileges()
* or it won't be possible to remove the file on exit */
@ -202,7 +210,8 @@ int main_configure(char *arg1, char *arg2) {
* or logfile rotation won't be possible */
/* log_open() must be be called before daemonize()
* since daemonize() invalidates stderr */
log_open();
if(log_open())
return 1;
return 0;
}
@ -269,7 +278,9 @@ static int accept_connection(SERVICE_OPTIONS *opt) {
s_log(LOG_DEBUG, "Service [%s] accepted (FD=%d) from %s",
opt->servname, s, from_address);
str_free(from_address);
#ifndef USE_FORK
#ifdef USE_FORK
RAND_add("", 1, 0.0); /* each child needs a unique entropy pool */
#else
if(max_clients && num_clients>=max_clients) {
s_log(LOG_WARNING, "Connection rejected: too many clients (>=%d)",
max_clients);
@ -298,7 +309,8 @@ void unbind_ports(void) {
s_poll_init(fds);
s_poll_add(fds, signal_pipe[0], 1, 0);
for(opt=service_options.next; opt; opt=opt->next)
for(opt=service_options.next; opt; opt=opt->next) {
s_log(LOG_DEBUG, "Closing service [%s]", opt->servname);
if(opt->option.accept && opt->fd>=0) {
closesocket(opt->fd);
s_log(LOG_DEBUG, "Service [%s] closed (FD=%d)",
@ -318,7 +330,22 @@ void unbind_ports(void) {
opt->local_addr.un.sun_path);
}
#endif
} else if(opt->option.program && opt->option.remote) {
/* create exec+connect services */
/* FIXME: this is just a crude workaround */
/* is it better to kill the service? */
opt->option.retry=0;
}
if(opt->ctx) {
s_log(LOG_DEBUG, "Sessions cached before flush: %ld",
SSL_CTX_sess_number(opt->ctx));
SSL_CTX_flush_sessions(opt->ctx,
(long)time(NULL)+opt->session_timeout+1);
s_log(LOG_DEBUG, "Sessions cached after flush: %ld",
SSL_CTX_sess_number(opt->ctx));
}
s_log(LOG_DEBUG, "Service [%s] closed", opt->servname);
}
}
/* open new ports, update fds */
@ -375,6 +402,7 @@ int bind_ports(void) {
str_free(local_address);
} else if(opt->option.program && opt->option.remote) {
/* create exec+connect services */
/* FIXME: needs to be delayed on reload with opt->option.retry set */
create_client(-1, -1,
alloc_client_session(opt, -1, -1), client_thread);
}
@ -659,7 +687,7 @@ static void signal_handler(int sig) {
#endif /* !defined(USE_WIN32) && !defined(USE_OS2) */
/**************************************** log messages to identify build */
/**************************************** log build details */
void stunnel_info(int level) {
s_log(level, "stunnel " STUNNEL_VERSION " on " HOST " platform");
@ -671,6 +699,7 @@ void stunnel_info(int level) {
s_log(level, "Update OpenSSL shared libraries or rebuild stunnel");
}
s_log(level,
"Threading:"
#ifdef USE_UCONTEXT
"UCONTEXT"
@ -685,35 +714,37 @@ void stunnel_info(int level) {
"FORK"
#endif
" SSL:"
#if defined HAVE_OSSL_ENGINE_H || defined HAVE_OSSL_OCSP_H || defined USE_FIPS
#ifdef HAVE_OSSL_ENGINE_H
"+ENGINE"
#endif
#ifdef HAVE_OSSL_OCSP_H
"+OCSP"
#endif
#ifdef USE_FIPS
"+FIPS"
#endif
#else
"none"
#endif
" Auth:"
#ifdef USE_LIBWRAP
"LIBWRAP"
#else
"none"
#endif
" Sockets:"
#ifdef USE_POLL
"POLL"
#else /* defined(USE_POLL) */
"SELECT"
#endif /* defined(USE_POLL) */
"+IPv%c",
",IPv%c"
#if defined HAVE_OSSL_ENGINE_H || defined HAVE_OSSL_OCSP_H || defined USE_FIPS
" SSL:"
#define ITEM_SEPARATOR ""
#ifdef HAVE_OSSL_ENGINE_H
"ENGINE"
#undef ITEM_SEPARATOR
#define ITEM_SEPARATOR ","
#endif /* defined(HAVE_OSSL_ENGINE_H) */
#ifdef HAVE_OSSL_OCSP_H
ITEM_SEPARATOR "OCSP"
#undef ITEM_SEPARATOR
#define ITEM_SEPARATOR ","
#endif /* HAVE_OSSL_OCSP_H */
#ifdef USE_FIPS
ITEM_SEPARATOR "FIPS"
#endif /* USE_FIPS */
#endif /* an SSL optional feature enabled */
#ifdef USE_LIBWRAP
" Auth:LIBWRAP"
#endif
, /* supported IP version parameter */
#if defined(USE_WIN32) && !defined(_WIN32_WCE)
s_getaddrinfo ? '6' : '4'
#else /* defined(USE_WIN32) */

View File

@ -1,4 +1,4 @@
# vc.mak by Michal Trojnara 1998-2012
# vc.mak by Michal Trojnara 1998-2013
# with help of David Gillingham <dgillingham@gmail.com>
# with help of Pierre Delaage <delaage.pierre@free.fr>
@ -11,13 +11,20 @@
# modify this to point to your OpenSSL directory
# either install a precompiled version (*not* the "Light" one) from
# http://www.slproweb.com/products/Win32OpenSSL.html
SSLDIR=C:\OpenSSL-Win32
INCDIR=$(SSLDIR)\include
LIBDIR=$(SSLDIR)\lib
#SSLDIR=C:\OpenSSL-Win32
#INCDIR=$(SSLDIR)\include
#FIPSDIR=$(SSLDIR)\include
#LIBDIR=$(SSLDIR)\lib
# or compile one yourself
#SSLDIR=..\..\openssl-1.0.0f
#SSLDIR=..\..\openssl-1.0.1e
#INCDIR=$(SSLDIR)\inc32
#FIPSDIR=$(SSLDIR)\inc32
#LIBDIR=$(SSLDIR)\out32dll
# or simply install with "nmake -f ms\ntdll.mak install"
SSLDIR=\usr\local\ssl
INCDIR=$(SSLDIR)\include
FIPSDIR=$(SSLDIR)\fips-2.0\include
LIBDIR=$(SSLDIR)\lib
TARGETCPU=W32
SRC=..\src
@ -26,21 +33,25 @@ OBJ=$(OBJROOT)\$(TARGETCPU)
BINROOT=..\bin
BIN=$(BINROOT)\$(TARGETCPU)
OBJS=$(OBJ)\stunnel.obj $(OBJ)\ssl.obj $(OBJ)\ctx.obj \
SHAREDOBJS=$(OBJ)\stunnel.obj $(OBJ)\ssl.obj $(OBJ)\ctx.obj \
$(OBJ)\verify.obj $(OBJ)\file.obj $(OBJ)\client.obj \
$(OBJ)\protocol.obj $(OBJ)\sthreads.obj $(OBJ)\log.obj \
$(OBJ)\options.obj $(OBJ)\network.obj $(OBJ)\resolver.obj \
$(OBJ)\gui.obj $(OBJ)\resources.res $(OBJ)\str.obj $(OBJ)/fd.obj
$(OBJ)\str.obj $(OBJ)/fd.obj
GUIOBJS=$(OBJ)\gui.obj $(OBJ)\resources.res
NOGUIOBJS=$(OBJ)\nogui.obj
CC=cl
LINK=link
CFLAGS=/MD /W3 /O2 /nologo /I"$(INCDIR)"
CFLAGS=/MD /W3 /O2 /nologo /I"$(INCDIR)" /I"$(FIPSDIR)"
LDFLAGS=/NOLOGO
LIBS=advapi32.lib comdlg32.lib crypt32.lib gdi32.lib \
psapi.lib shell32.lib user32.lib ws2_32.lib \
/LIBPATH:"$(LIBDIR)" libeay32.lib ssleay32.lib
SHAREDLIBS=ws2_32.lib user32.lib
GUILIBS=advapi32.lib comdlg32.lib crypt32.lib gdi32.lib \
psapi.lib shell32.lib
NOGUILIBS=
SSLLIBS=/LIBPATH:"$(LIBDIR)" libeay32.lib ssleay32.lib
# static linking:
# /LIBPATH:"$(LIBDIR)\VC\static" libeay32MD.lib ssleay32MD.lib
@ -50,15 +61,19 @@ LIBS=advapi32.lib comdlg32.lib crypt32.lib gdi32.lib \
{$(SRC)\}.rc{$(OBJ)\}.res:
$(RC) -fo$@ -r $<
all: makedirs $(BIN)\stunnel.exe
all: makedirs $(BIN)\stunnel.exe $(BIN)\tstunnel.exe
clean:
-@ del $(OBJS) >NUL 2>&1
-@ del $(SHAREDOBJS) >NUL 2>&1
-@ del $(GUIBJS) >NUL 2>&1
-@ del $(NOGUIBJS) >NUL 2>&1
# -@ del *.manifest >NUL 2>&1
-@ del $(BIN)\stunnel.exe >NUL 2>&1
-@ del $(BIN)\stunnel.exe.manifest >NUL 2>&1
-@ rmdir $(OBJ) >NUL 2>&1
-@ rmdir $(BIN) >NUL 2>&1
-@ del $(BIN)\tstunnel.exe >NUL 2>&1
-@ del $(BIN)\tstunnel.exe.manifest >NUL 2>&1
-@ rmdir $(OBJ) >NUL 2>&1
-@ rmdir $(BIN) >NUL 2>&1
makedirs:
-@ IF NOT EXIST $(OBJROOT) mkdir $(OBJROOT) >NUL 2>&1
@ -66,10 +81,17 @@ makedirs:
-@ IF NOT EXIST $(BINROOT) mkdir $(BINROOT) >NUL 2>&1
-@ IF NOT EXIST $(BIN) mkdir $(BIN) >NUL 2>&1
$(OBJS): *.h vc.mak
$(SHAREDOBJS): *.h vc.mak
$(GUIOBJS): *.h vc.mak
$(NOGUIOBJS): *.h vc.mak
$(BIN)\stunnel.exe: $(OBJS)
$(LINK) $(LDFLAGS) $(LIBS) /OUT:$@ $**
$(BIN)\stunnel.exe: $(SHAREDOBJS) $(GUIOBJS)
$(LINK) $(LDFLAGS) $(SHAREDLIBS) $(GUILIBS) $(SSLLIBS) /OUT:$@ $**
IF EXIST $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
$(BIN)\tstunnel.exe: $(SHAREDOBJS) $(NOGUIOBJS)
$(LINK) $(LDFLAGS) $(SHAREDLIBS) $(NOGUILIBS) $(SSLLIBS) /OUT:$@ $**
IF EXIST $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1

View File

@ -1,24 +1,24 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <http://www.gnu.org/licenses>.
*
*
* Linking stunnel statically or dynamically with other modules is making
* a combined work based on stunnel. Thus, the terms and conditions of
* the GNU General Public License cover the whole combination.
*
*
* In addition, as a special exception, the copyright holder of stunnel
* gives you permission to combine stunnel with free software programs or
* libraries that are released under the GNU LGPL and with code included
@ -26,7 +26,7 @@
* modified versions of such code, with unchanged license). You may copy
* and distribute such a system following the terms of the GNU GPL for
* stunnel and the licenses of the other code concerned.
*
*
* Note that people who make modified versions of stunnel are not obligated
* to grant this special exception for their modified versions; it is their
* choice whether to do so. The GNU General Public License gives permission
@ -225,7 +225,7 @@ static int cert_check(CLI *c, X509_STORE_CTX *callback_ctx, int preverify_ok) {
if(c->opt->verify_level>=4 && depth>0) {
s_log(LOG_INFO, "CERT: Invalid CA certificate ignored");
return 1; /* accept connection */
} else {
} else {
s_log(LOG_WARNING, "CERT: Verification error: %s",
X509_verify_cert_error_string(
X509_STORE_CTX_get_error(callback_ctx)));

View File

@ -1,6 +1,6 @@
/*
* stunnel Universal SSL tunnel
* Copyright (C) 1998-2012 Michal Trojnara <Michal.Trojnara@mirt.net>
* Copyright (C) 1998-2013 Michal Trojnara <Michal.Trojnara@mirt.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -58,7 +58,7 @@
/* START CUSTOMIZE */
#define VERSION_MAJOR 4
#define VERSION_MINOR 53
#define VERSION_MINOR 57
/* END CUSTOMIZE */
/* all the following macros are ABSOLUTELY NECESSARY to have proper string

View File

@ -1,5 +1,5 @@
# OpenSSL configuration file to create a server certificate
# by Michal Trojnara 1998-2012
# by Michal Trojnara 1998-2013
[ req ]
# the default key length is secure and quite fast - do not change it

View File

@ -1,4 +1,4 @@
; Sample stunnel configuration file for Unix by Michal Trojnara 2002-2012
; Sample stunnel configuration file for Unix by Michal Trojnara 2002-2013
; Some options used here may be inadequate for your particular configuration
; This sample file does *not* represent stunnel.conf defaults
; Please consult the manual for detailed description of available options

View File

@ -1,4 +1,4 @@
Copyright (C) 1998-2012 Michal Trojnara
Copyright (C) 1998-2013 Michal Trojnara
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

View File

@ -1,182 +1,289 @@
# NSIS stunnel installer by Michal Trojnara 1998-2012
!include "Sections.nsh"
Name "stunnel ${VERSION}"
OutFile "stunnel-${VERSION}-installer.exe"
InstallDir "$PROGRAMFILES\stunnel"
BrandingText "Author: Michal Trojnara"
LicenseData "${SRCDIR}/tools/stunnel.license"
SetCompressor /SOLID LZMA
InstallDirRegKey HKLM "Software\NSIS_stunnel" "Install_Dir"
RequestExecutionLevel admin
Page license
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
Section "Stunnel Core Files (required)"
SectionIn RO
SetOutPath "$INSTDIR"
# stop the service, exit stunnel
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors skip_service_stop
ExecWait '"$INSTDIR\stunnel.exe" -stop -quiet'
skip_service_stop:
# skip if the previously installed stunnel version is older than 4.40
GetDLLVersion "$INSTDIR\stunnel.exe" $R0 $R1
IfErrors skip_process_exit
ExecWait '"$INSTDIR\stunnel.exe" -exit -quiet'
skip_process_exit:
# write files
SetOverwrite off
File "${SRCDIR}/tools/stunnel.conf"
SetOverwrite on
#File "${DLLS}/*eay32.dll"
File "${DLLS}/libeay32.dll"
File "${DLLS}/ssleay32.dll"
File "${DLLS}/zlib1.dll"
File "${DLLS}/msvcr90.dll"
File "${DLLS}/Microsoft.VC90.CRT.manifest"
File "src/stunnel.exe"
File "${SRCDIR}/doc/stunnel.html"
WriteUninstaller "uninstall.exe"
# add uninstaller registry entries
WriteRegStr HKLM "Software\NSIS_stunnel" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"DisplayName" "stunnel"
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"NoModify" 1
WriteRegDWORD HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"NoRepair" 1
SectionEnd
Section "Self-signed Certificate Tools" sectionCA
SetOutPath "$INSTDIR"
# write files
File "${DLLS}/openssl.exe"
File "${SRCDIR}/tools/stunnel.cnf"
IfSilent lbl_skip_new_pem
IfFileExists "$INSTDIR\stunnel.pem" lbl_skip_new_pem
ExecWait '"$INSTDIR\openssl.exe" req -new -x509 -days 365 -config stunnel.cnf -out stunnel.pem -keyout stunnel.pem'
lbl_skip_new_pem:
SectionEnd
Section "Start Menu Shortcuts"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\stunnel"
# remove old links
Delete "$SMPROGRAMS\stunnel\*.lnk"
Delete "$SMPROGRAMS\stunnel\*.url"
# main link
CreateShortCut "$SMPROGRAMS\stunnel\Run stunnel.lnk" \
"$INSTDIR\stunnel.exe" "" "$INSTDIR\stunnel.exe" 0
CreateShortCut "$SMPROGRAMS\stunnel\Exit stunnel.lnk" \
"$INSTDIR\stunnel.exe" "-exit" "$INSTDIR\stunnel.exe" 0
# NT service
ClearErrors
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors skip_service_links
CreateShortCut "$SMPROGRAMS\stunnel\Service install.lnk" \
"$INSTDIR\stunnel.exe" "-install" "$INSTDIR\stunnel.exe" 0
CreateShortCut "$SMPROGRAMS\stunnel\Service uninstall.lnk" \
"$INSTDIR\stunnel.exe" "-uninstall" "$INSTDIR\stunnel.exe" 0
CreateShortCut "$SMPROGRAMS\stunnel\Service start.lnk" \
"$INSTDIR\stunnel.exe" "-start" "$INSTDIR\stunnel.exe" 0
CreateShortCut "$SMPROGRAMS\stunnel\Service stop.lnk" \
"$INSTDIR\stunnel.exe" "-stop" "$INSTDIR\stunnel.exe" 0
skip_service_links:
# edit config file
CreateShortCut "$SMPROGRAMS\stunnel\Edit stunnel.conf.lnk" \
"notepad.exe" "stunnel.conf" "notepad.exe" 0
# OpenSSL shell
CreateShortCut "$SMPROGRAMS\stunnel\OpenSSL Shell.lnk" \
"$INSTDIR\openssl.exe" "" "$INSTDIR\openssl.exe" 0
# make stunnel.pem
SectionGetFlags sectionCA $0
IntOp $0 $0 & SF_SELECTED
IntCmp $0 0 lbl_noCA
CreateShortCut "$SMPROGRAMS\stunnel\Build Self-signed stunnel.pem.lnk" \
"$INSTDIR\openssl.exe" \
"req -new -x509 -days 365 -config stunnel.cnf -out stunnel.pem -keyout stunnel.pem"
lbl_noCA:
# help/uninstall
WriteINIStr "$SMPROGRAMS\stunnel\Manual.url" "InternetShortcut" \
"URL" "file://$INSTDIR/stunnel.html"
CreateShortCut "$SMPROGRAMS\stunnel\Uninstall stunnel.lnk" \
"$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
SectionEnd
Section "Desktop Shortcut"
SetShellVarContext all
Delete "$DESKTOP\stunnel.lnk"
CreateShortCut "$DESKTOP\stunnel.lnk" \
"$INSTDIR\stunnel.exe" "" "$INSTDIR\stunnel.exe" 0
SectionEnd
Section "Uninstall"
ClearErrors
# stop and remove the service, exit stunnel
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors skip_service_uninstall
ExecWait '"$INSTDIR\stunnel.exe" -stop -quiet'
ExecWait '"$INSTDIR\stunnel.exe" -uninstall -quiet'
skip_service_uninstall:
ExecWait '"$INSTDIR\stunnel.exe" -exit -quiet'
# remove stunnel folder
Delete "$INSTDIR\stunnel.conf"
Delete "$INSTDIR\stunnel.pem"
Delete "$INSTDIR\stunnel.exe"
Delete "$INSTDIR\stunnel.cnf"
Delete "$INSTDIR\openssl.exe"
#Delete "$INSTDIR\*eay32.dll"
Delete "$INSTDIR\libeay32.dll"
Delete "$INSTDIR\ssleay32.dll"
Delete "$INSTDIR\zlib1.dll"
Delete "$INSTDIR\msvcr90.dll"
Delete "$INSTDIR\Microsoft.VC90.CRT.manifest"
Delete "$INSTDIR\stunnel.html"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
# remove menu shortcuts
SetShellVarContext all
Delete "$DESKTOP\stunnel.lnk"
Delete "$SMPROGRAMS\stunnel\*.lnk"
Delete "$SMPROGRAMS\stunnel\*.url"
RMDir "$SMPROGRAMS\stunnel"
# remove uninstaller registry entires
DeleteRegKey HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel"
DeleteRegKey HKLM "Software\NSIS_stunnel"
SectionEnd
# end of stunnel.nsi
# NSIS stunnel installer by Michal Trojnara 1998-2013
!include "Sections.nsh"
!ifndef VERSION
!define VERSION 4.57
!endif
!ifndef ZLIBDIR
!define ZLIBDIR zlib-1.2.7
!endif
!ifndef OPENSSLDIR
!define OPENSSLDIR openssl-1.0.1e
!endif
!addplugindir "plugins/SimpleFC"
!addplugindir "plugins/ShellLink/Plugins"
Name "stunnel ${VERSION}"
OutFile "stunnel-${VERSION}-installer.exe"
InstallDir "$PROGRAMFILES\stunnel"
BrandingText "Author: Michal Trojnara"
LicenseData "stunnel.license"
SetCompressor /SOLID LZMA
InstallDirRegKey HKLM "Software\NSIS_stunnel" "Install_Dir"
RequestExecutionLevel admin
Page license
Page components
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
Section "Stunnel Core Files (required)"
SectionIn RO
SetOutPath "$INSTDIR"
# stop the service, exit stunnel
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors skip_service_stop
ExecWait '"$INSTDIR\stunnel.exe" -stop -quiet'
skip_service_stop:
ExecWait '"$INSTDIR\stunnel.exe" -exit -quiet'
# write files
SetOverwrite off
File "stunnel.conf"
SetOverwrite on
!cd ".."
!cd "doc"
File "stunnel.html"
!cd ".."
!cd "bin"
!cd "W32"
File "stunnel.exe"
File "stunnel.exe.manifest"
!cd ".."
!cd ".."
!cd ".."
!cd "${ZLIBDIR}"
File "zlib1.dll"
File "zlib1.dll.manifest"
!cd ".."
!cd "${OPENSSLDIR}"
!cd "out32dll"
File "*.dll"
File "*.dll.manifest"
!cd ".."
!cd ".."
!cd "redist"
File "msvcr90.dll"
File "Microsoft.VC90.CRT.manifest"
!cd ".."
!cd "stunnel"
!cd "tools"
# add firewall rule
SimpleFC::AddApplication "stunnel (GUI Version)" \
"$INSTDIR\stunnel.exe" 0 2 "" 1
Pop $0 # returns error(1)/success(0)
DetailPrint "SimpleFC::AddApplication: $0"
# write uninstaller and its registry entries
WriteUninstaller "uninstall.exe"
WriteRegStr HKLM "Software\NSIS_stunnel" "Install_Dir" "$INSTDIR"
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"DisplayName" "stunnel"
WriteRegStr HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"NoModify" 1
WriteRegDWORD HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel" \
"NoRepair" 1
SectionEnd
Section "Self-signed Certificate Tools" sectionCA
SetOutPath "$INSTDIR"
!cd ".."
!cd ".."
!cd "${OPENSSLDIR}"
!cd "out32dll"
File "openssl.exe"
File "openssl.exe.manifest"
!cd ".."
!cd ".."
!cd "stunnel"
!cd "tools"
File "stunnel.cnf"
IfSilent lbl_skip_new_pem
IfFileExists "$INSTDIR\stunnel.pem" lbl_skip_new_pem
ExecWait '"$INSTDIR\openssl.exe" req -new -x509 -days 365 -config stunnel.cnf -out stunnel.pem -keyout stunnel.pem'
lbl_skip_new_pem:
SectionEnd
Section "Terminal Version of stunnel" sectionTERM
SetOutPath "$INSTDIR"
!cd ".."
!cd "bin"
!cd "W32"
File "tstunnel.exe"
File "tstunnel.exe.manifest"
!cd ".."
!cd ".."
!cd "tools"
# add firewall rule
SimpleFC::AddApplication "stunnel (Terminal Version)" \
"$INSTDIR\tstunnel.exe" 0 2 "" 1
Pop $0 # returns error(1)/success(0)
DetailPrint "SimpleFC::AddApplication: $0"
SectionEnd
Section "Start Menu Shortcuts"
SetShellVarContext all
CreateDirectory "$SMPROGRAMS\stunnel"
# remove old links
Delete "$SMPROGRAMS\stunnel\*.lnk"
Delete "$SMPROGRAMS\stunnel\*.url"
# main link
CreateShortCut "$SMPROGRAMS\stunnel\stunnel GUI Start.lnk" \
"$INSTDIR\stunnel.exe" "" "$INSTDIR\stunnel.exe" 0
CreateShortCut "$SMPROGRAMS\stunnel\stunnel GUI Stop.lnk" \
"$INSTDIR\stunnel.exe" "-exit" "$INSTDIR\stunnel.exe" 0
# tstunnel
SectionGetFlags ${sectionTERM} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 0 lbl_noTERM
CreateShortCut "$SMPROGRAMS\stunnel\stunnel Terminal Start.lnk" \
"$INSTDIR\tstunnel.exe" "" "$INSTDIR\tstunnel.exe" 0
lbl_noTERM:
# NT service
ClearErrors
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors skip_service_links
CreateShortCut "$SMPROGRAMS\stunnel\stunnel Service Install.lnk" \
"$INSTDIR\stunnel.exe" "-install" "$INSTDIR\stunnel.exe" 0
ShellLink::SetRunAsAdministrator \
"$SMPROGRAMS\stunnel\stunnel Service Install.lnk"
Pop $0 # returns error(-1)/success(0)
DetailPrint "ShellLink::SetRunAsAdministrator: $0"
CreateShortCut "$SMPROGRAMS\stunnel\stunnel Service Uninstall.lnk" \
"$INSTDIR\stunnel.exe" "-uninstall" "$INSTDIR\stunnel.exe" 0
ShellLink::SetRunAsAdministrator \
"$SMPROGRAMS\stunnel\stunnel Service Uninstall.lnk"
Pop $0 # returns error(-1)/success(0)
DetailPrint "ShellLink::SetRunAsAdministrator: $0"
CreateShortCut "$SMPROGRAMS\stunnel\stunnel Service Start.lnk" \
"$INSTDIR\stunnel.exe" "-start" "$INSTDIR\stunnel.exe" 0
ShellLink::SetRunAsAdministrator \
"$SMPROGRAMS\stunnel\stunnel Service Start.lnk"
Pop $0 # returns error(-1)/success(0)
DetailPrint "ShellLink::SetRunAsAdministrator: $0"
CreateShortCut "$SMPROGRAMS\stunnel\stunnel Service Stop.lnk" \
"$INSTDIR\stunnel.exe" "-stop" "$INSTDIR\stunnel.exe" 0
ShellLink::SetRunAsAdministrator \
"$SMPROGRAMS\stunnel\stunnel Service Stop.lnk"
Pop $0 # returns error(-1)/success(0)
DetailPrint "ShellLink::SetRunAsAdministrator: $0"
skip_service_links:
# edit config file
CreateShortCut "$SMPROGRAMS\stunnel\Edit stunnel.conf.lnk" \
"notepad.exe" "$INSTDIR\stunnel.conf" "notepad.exe" 0
ShellLink::SetRunAsAdministrator \
"$SMPROGRAMS\stunnel\Edit stunnel.conf.lnk"
Pop $0 # returns error(-1)/success(0)
DetailPrint "ShellLink::SetRunAsAdministrator: $0"
SectionGetFlags ${sectionCA} $0
IntOp $0 $0 & ${SF_SELECTED}
IntCmp $0 0 lbl_noCA
# OpenSSL shell
CreateShortCut "$SMPROGRAMS\stunnel\OpenSSL Shell.lnk" \
"$INSTDIR\openssl.exe" "" "$INSTDIR\openssl.exe" 0
# make stunnel.pem
CreateShortCut "$SMPROGRAMS\stunnel\Build Self-signed stunnel.pem.lnk" \
"$INSTDIR\openssl.exe" \
"req -new -x509 -days 365 -config stunnel.cnf -out stunnel.pem -keyout stunnel.pem"
ShellLink::SetRunAsAdministrator \
"$SMPROGRAMS\stunnel\\Build Self-signed stunnel.pem.lnk"
Pop $0 # returns error(-1)/success(0)
DetailPrint "ShellLink::SetRunAsAdministrator: $0"
lbl_noCA:
# help/uninstall
WriteINIStr "$SMPROGRAMS\stunnel\Manual.url" "InternetShortcut" \
"URL" "file://$INSTDIR/stunnel.html"
CreateShortCut "$SMPROGRAMS\stunnel\Uninstall stunnel.lnk" \
"$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
SectionEnd
Section "Desktop Shortcut"
SetShellVarContext all
Delete "$DESKTOP\stunnel.lnk"
CreateShortCut "$DESKTOP\stunnel.lnk" \
"$INSTDIR\stunnel.exe" "" "$INSTDIR\stunnel.exe" 0
SectionEnd
Section "Uninstall"
ClearErrors
# stop and remove the service, exit stunnel
ReadRegStr $R0 HKLM \
"Software\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors skip_service_uninstall
ExecWait '"$INSTDIR\stunnel.exe" -stop -quiet'
ExecWait '"$INSTDIR\stunnel.exe" -uninstall -quiet'
skip_service_uninstall:
ExecWait '"$INSTDIR\stunnel.exe" -exit -quiet'
# remove stunnel folder
Delete "$INSTDIR\stunnel.conf"
Delete "$INSTDIR\stunnel.pem"
Delete "$INSTDIR\stunnel.exe"
Delete "$INSTDIR\stunnel.exe.manifest"
Delete "$INSTDIR\tstunnel.exe"
Delete "$INSTDIR\tstunnel.exe.manifest"
Delete "$INSTDIR\stunnel.cnf"
Delete "$INSTDIR\openssl.exe"
Delete "$INSTDIR\openssl.exe.manifest"
Delete "$INSTDIR\*.dll"
Delete "$INSTDIR\*.dll.manifest"
Delete "$INSTDIR\Microsoft.VC90.CRT.manifest"
Delete "$INSTDIR\stunnel.html"
Delete "$INSTDIR\uninstall.exe"
RMDir "$INSTDIR"
# remove menu shortcuts
SetShellVarContext all
Delete "$DESKTOP\stunnel.lnk"
Delete "$SMPROGRAMS\stunnel\*.lnk"
Delete "$SMPROGRAMS\stunnel\*.url"
RMDir "$SMPROGRAMS\stunnel"
# remove firewall rules
SimpleFC::RemoveApplication "$INSTDIR\stunnel.exe"
Pop $0 # returns error(1)/success(0)
DetailPrint "SimpleFC::RemoveApplication: $0"
SimpleFC::RemoveApplication "$INSTDIR\tstunnel.exe"
Pop $0 # returns error(1)/success(0)
DetailPrint "SimpleFC::RemoveApplication: $0"
# remove uninstaller registry entires
DeleteRegKey HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\stunnel"
DeleteRegKey HKLM "Software\NSIS_stunnel"
SectionEnd
# end of stunnel.nsi

View File

@ -3,7 +3,7 @@
Summary: Program that wraps normal socket connections with SSL/TLS
Name: stunnel
Version: 4.53
Version: 4.57
Release: 1
Copyright: GPL
Group: Applications/Networking