<span class="gmail_quote"></span>Attached is a patch which extends the "connect=" and "CApath=" options to allow these parameters to be obtained dynamically at connect-time via a URL lookup, rather than statically from the stunnel configuration file.  It is a generalization of an earlier patch to 
4.04 submitted by Jan Piet-Mens which does something similar using LDAP lookups.  Feedback is appreciated!<br><br>Here is a summary of the functionality, along with some notes:<br><ol><li>The patch was written to allow stunnel to dynamically route and authenticate incoming connections based on parameters found in the client's certificate.
</li><li>Routing and authentication information is obtained by issuing a URL lookup, so the information can be obtained from a variety of local or remote sources.<br></li><li>It is particularly useful in high-volume, load-balancing scenarios where many copies of stunnel are running on multiple front-end servers.  It allows the destination socket and client certificate verification info to be obtained on-the-fly from a centralized database.
<br></li><li>Although primarily intended for use with HTTP, this patch uses the libcurl URL library and should work with all of its supported protocols: HTTP, HTTPS, FTP, FTPS, TFTP, DICT, TELNET, LDAP or FILE.</li></ol>
As a brief example, an end-user might configure their stunnel as follows:
<br><br><div style="margin-left: 40px;">cert = id.pem<br>verify = 2<br>CApath = ca_dir<br><span style="font-weight: bold;">CAlookup = <a href="http://database.stunnel.org/map_client.php?hash=%25h" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://database.stunnel.org/map_client.php?hash=%h
</a></span><br><br>[dynamic]<br>accept = 50000<br>connect = <span style="font-weight: bold;">@<a href="http://database.stunnel.org/map_client.php?common_name=%25n" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://database.stunnel.org/map_client.php?common_name=%n</a>
</span><br></div><br>In this scenario, an incoming stunnel connection would obtain it's connect info from <a href="http://database.stunnel.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">database.stunnel.org
</a> by sending an HTTP request and passing the common name found in the client certificate.  Similarly, the client's certificate would be verified using CA certificates obtained via HTTP lookup to the same host.
<br><br>Comments are appreciated.<br><br>Thanks,<br><span class="sg"><br>Dan Jakubiec<br>

</span><br clear="all">