<br><br><div class="gmail_quote">On Tue, Jun 1, 2010 at 7:09 AM, Michal Trojnara <span dir="ltr"><<a href="mailto:Michal.Trojnara@mirt.net">Michal.Trojnara@mirt.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Tristan Schmelcher wrote:<br>
<br>
> stunnel-4.33-handle-minimal-ssl-libs.patch:<br>
><br>
> Add support for building against a libssl/libcrypo that has had<br>
> various non-essential features removed via the "no-<feature>"<br>
> Configure options for openssl. This requires disabling non-essential<br>
> Stunnel features at compile-time if they have dependencies on disabled<br>
> libssl/libcrypto features.<br>
><br>
> For memory-constrained embedded systems, this is a big win. With this<br>
> patch I was able to cut the memory footprint of stunnel+openssl by<br>
> about a third simply by disabling openssl features that I didn't need.<br>
<br>
Can you share the results of your tests?<br>
How much of the binary size does disabling MD4/SSLv3/SSLv2 really save?<br>
<br></blockquote><div><br></div><div>Those are just the four that required Stunnel changes in order to disable. The full set of features that I disabled in OpenSSL was:</div><div><br></div><div>no-ssl no-md2 no-md4 no-rc2 no-idea no-ripemd no-bf no-cast no-ec no-ecdsa no-krb5 no-store no-dh no-engine no-mdc2 no-camellia no-seed no-cms</div>
<div><br></div><div>Which reduced the size of my statically-linked stunnel binary from about 1.5 MB to about 1.0 MB.</div><div>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

> stunnel-4.33-separate-stderr-option.patch<br>
><br>
> This splits the stderr logging effect of the "foreground" option into<br>
> a separate option named "stderr", so that users have the freedom to<br>
> enable foreground without stderr logging, or vice versa. For backwards<br>
> compatibility though, specifying foreground = yes implies stderr = yes<br>
> unless followed in the config by stderr = no.<br>
><br>
> This is useful on embedded Linux systems that lack an implementation<br>
> of fork() (due to the processor not having an MMU), because on such<br>
> systems every daemon has to be launched in a foreground mode and<br>
> pre-daemonized with the simpler vfork() function, e.g. using "&" from<br>
> a shell. In this mode, logging to stderr does not make sense, because<br>
> in reality the process is still a daemon so the logging clutters the<br>
> terminal.<br>
><br>
> stunnel-4.33-dns-commonname-verify-support.patch:<br>
<br>
Couldn't you simply redirect stderr to a file?<br>
 � �stunnel 2>/var/log/stunnel.log<br>
<br></blockquote><div><br></div><div>Yes, but I think an option is better because it avoids dropping stderr messages from sources other than s_log--for example, libc asserts. If all of stderr is redirected then one might never know when such errors had occurred.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> I saved the best for last. ;) This adds a "verify_dns" option to check<br>
> the CommonName in peer certificates against their DNS name when<br>
> verifying, much as web browsers do.<br>
><br>
> I have seen posts from users asking for this feature in the past, so I<br>
> think it's value is self-evident.<br>
<br>
The basic purpose of SSL/TLS is to prevent network-level attacks. �Many<br>
years ago I refused to implement this option as it's inherently vulnerable<br>
to DNS spoofing and cache poisoning. �I think my point stands even more<br>
nowadays with DNS cache poisoning attacks getting more and more popular.<br>
<br>
Also stunnel, unlike web browsers, connects a predefined (static) list of<br>
servers. �It's much more secure to just download their certificates and<br>
check them with "verify = 3".<br>
<br>
I think I could add a Windows GUI option to download and save remote<br>
certificates. �What do you think?<br></blockquote><div><br></div><div>For most applications of stunnel I agree with you, DNS verification is inherently insecure and verify = 3 is better, hence why I made this an option that defaults to off. But for some applications verify = 3 isn't practical, especially embedded systems.</div>
<div><br></div><div>Let's use my company's embedded device product as an example (slightly simplified). It sits in an ISP's network and periodically connects to some TLS servers. The servers are owned by the ISP and their host names are private to the ISP's internal network, but they are located outside of the ISP's physical offices (specifically, in the offices of the ISP's customers). The number of such servers and their addresses is an option that the operator of the device must configure. However, the operator may not know anything about SSL/TLS or certificates, and after configuring the device he/she will probably forget that it exists. So the device must be designed to be as secure as possible within these constraints.</div>
<div><br></div><div>If we used verify = 3, we would first of all need the operator to download and save those remote certificates to the device. An app would help, of course, but simply the existence of this step would already present a significant barrier to configuring the device. (For example, the operator may not understand why such a step is needed, or may not know where to find the application--especially if it has been a long time since the ISP purchased the device.) A bigger issue though is that the server's certificates could be changed at a later date without the operator's knowledge--for example, because they have expired. Using verify = 3, we would no longer be able to connect to that server. Since this is an embedded device with no monitor and no normal "user", there is nobody to report the error to. Even if we did find a way to get someone to realize that there is an issue, it is not very likely that the operator who originally configured the device is still around, or that they remember anything about it.�So instead we use verify = 2 and verify_dns = yes. DNS queries are answered by the ISP's own DNS servers, so the risk of a DNS spoofing or cache poisoning attack is fairly low.</div>
<div><br></div><div>Ours is a somewhat unique case of course because DNS is much more "secure" for us than it is in most other cases, but I think verify_dns still offers (marginally) increased security for some people. Even if using verify = 3, it could still be beneficial to add verify_dns = yes, because the one-time process of manually downloading the certificates is vulnerable to a trivial man-in-the-middle attack if an attacker knows the approximate time that it will happen and has their own certificate ready to switch with the real one. If verify_dns = yes is added, the attacker has to _also_ launch a successful DNS attack in order to compromise the system. Depending on their skill and degree of access to the network that may be trivial, but it also may not be.</div>
<div><br></div><div>Another case where it would be helpful is when stunnel is being used from a script that generates a config file dynamically (e.g., with the stunnel3 wrapper) and hence the set of possible servers to connect to may not be known beforehand (so verify = 3 cannot be used). In this way stunnel may actually be being used with the exact same access patterns of a web browser by serving as an SSL tunnel for an HTTP-only browser (I have used it in a similar way in the past).�Again, DNS verification will not help against all attacks in this situation, but it will help against some.</div>
<div>�</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Best regards,<br>
 � �Mike<br>
_______________________________________________<br>
stunnel-users mailing list<br>
<a href="mailto:stunnel-users@mirt.net">stunnel-users@mirt.net</a><br>
<a href="http://stunnel.mirt.net/mailman/listinfo/stunnel-users" target="_blank">http://stunnel.mirt.net/mailman/listinfo/stunnel-users</a><br>
</blockquote></div><br>