
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
= TLSPretense --- SSL/TLS Client Testing Framework
A test framework for testing SSL/TLS client certificate validation.
== Description
Note: TLSPretense is still undergoing a lot of polishing. It is currently usable, but features may change and documentation may be missing. As such, please bear with us over next few months as we find time to work on the tools, and feel free to file a bug with details.
TLSPretense provides a test framework for testing SSL certificate validation. It generates a set of certificates containing specific flaws, and it presents the certificates to a client that has been configured to trust a CA used by TLSPretense. The test framework then configures its system's firewall to redirect and intercept network traffic so that the test runner can present its certificate to the client. To speed up testing, the test runner starts the next test as soon as the current test finishes.
The test framework must be run on a Unix-like OS that contains a supported firewall, but the program being tested can run on any device whose network traffic can be routed through the system hosting the test framework. Currently, it supports netfilter (Linux), ipfw (Mac OS X 10.6, *BSD), and PF on Mac OS X Lion.
It also has an implementation for a newer version of PF, although this is untested.
== Links
== How It Works
TLSPretense requires the TLS client software to be configured to trust a CA that TLPretense controls. That way "good" certificates created by TLSPretense will be accepted by the client.
Once the system hosting the test runner has been configured to be a gateway for the network traffic of thest client being tested, it will add a firewall rule to redirect network traffic to a test listener. The test listener checks to see whether the client is trying to connect to a predefined host. If the client is connecting to the desired host, then the test listener presents a test certificate chain to the client. The test runner then determines whether the test passes or fails based on whether the client completes the TLS handshake or not.
The test harness was designed to anticipate working with a client that may connect to more than one host. The config.yml file specifies a hostname that should be used for the actual test --- all other intercepted SSL connections are essentially ignored (although they currently have their certificate re-signed by the goodca in order to make interception easier).
== Requirements
A Unix-like system that uses a supported firewall/routing implementation. TLSPretense currently supports:
Ruby 1.9.x (Developed with 1.9.3). Check your version with:
ruby --version
Some systems will install Ruby 1.9.x with a suffix, like ruby1.9
. Ruby must
also be built against a version of OpenSSL that supports the SNI TLS
extension. You can check for this if you run the following Ruby script (on
some systems, Ruby 1.9.x will be installed as ruby1.9, and commands like gem
will also have the 1.9 suffix):
ruby -ropenssl -e 'puts OpenSSL::SSL::SSLSocket.public_instance_methods.include? :hostname='
Ruby 1.8.7 will mostly work, but Ruby 1.8's OpenSSL wrapper library does not support the ability for clients to use the SNI TLS extension, which is needed to grab the correct remote certificate for proxying miscellaneous connections. Use Ruby 1.8.x at your own risk.
The SSL client/HTTPS user agent has to trust the CA used by TLSPretense. You can either generate a new goodca and install it in the client's trust store, or you can use an existing test CA with TLSPretense to generate the test certificates.
== Quick Start
Install with rubygems:
umask 0022 ; sudo gem install tlspretense
Create a new project:
tlspretense init myproject
cd myproject
And edit config.yml to suit your needs. If you want to create a new test CA (not necessary if you want to use the default or your own):
tlspretense ca
Generate certificates for the test cases:
tlspretense certs
You will also need to setup the host's networking stack and firewall to support TLSPretense. More details can be found in {TLSPretense Setup}[rdoc-ref:general_setup] and in the system-specific guides.
Finally, run all of the configured test cases:
sudo tlspretense run
Or just certain tests (in the order specified):
sudo tlspretense run unknownca wrongcname
== Limitations
The Server Name Indication (SNI) TLS extension does not have full support in Ruby 1.8.7.
Protocols that explicitly call STARTTLS to enable SSL/TLS (eg, SMTP and IMAP) are not yet supported. They would require protocol-specific support. The version of these protocols where they are wrapped in SSL should be testable though.
It currently uses the goodca to re-sign certificates from hostnames that do not match the configured test hostname, instead of silently forwarding the connection.
The existing PFDivert rule implementation does not work on Mac OS X 10.7 or 10.8 (use PFRdr instead). OpenBSD newer than 4.3 and FreeBSD 9 can make use of the newer PF syntax and functionality though.
== TODO
Convert SSLClient's initial connection to use a non-blocking connect.
Change the pre-flight in SSLSmartProxy to disable the accepted server socket until the pre-flight finishes. (the SSLClient within SSLTransparentProxy probably also should do this until the client connects)
Add wildcard tests (need a hostname that has domain.domain.domain.publicsuffix for all tests)
Decide how to deal with a wildcard cert at the original destination. If we are testing foo.somehost.com, and the client connects to other hostnames like bar.somehost.com, and they all use a *.somehost.com certificate, then TLSPretense gets confused.
Advanced: Add name constraints tests.
Document how to run SSLTest from MacOSX
Document how to run SSLTest from a Linux VM on Windows (eg, with VMWare)
Document how to deal with certificate pinning and other things that may make testing certificate validation logic difficult.
Command line option to specify where to write the results to
Add more result output formats
truly unique serial numbers for a given CA. Alternatively, we could use the first cert's serial as a starting point and increment from there.
Build certs and chains of certs for each test so that something like s_server could use them.
Make initialization interactive. It should prompt the user to choose or confirm configuration details like the interception/firewalling method to use, the network device to listen on, the default hostname, etc. It could then auto-generate the necessary certificates as well.
Config file validator
Add an API for interacting with an external test controller. This could be a little web service, although that lacks real-time responses. A TCP/unix socket interface that sends/receives JSON messages (or something simpler) might be better. The client would tell TLSPretense which test to start, and then TLSPretense would reply with a result when it completes.
== Contributing to TLSPretense
== Authors
== Copyright
Copyright (c) 2012-2013 iSEC Partners
See LICENSE.txt for further details.
FAQs
Unknown package
We found that tlspretense demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.