tlscanary


Nametlscanary JSON
Version 4.0.2 PyPI version JSON
download
home_pagehttps://github.com/mozilla/tls-canary
SummaryTLS/SSL Test Suite for Mozilla Firefox
upload_time2022-12-16 22:22:27
maintainer
docs_urlNone
authorChristiane Ruetten
requires_python
licenseMPL2
keywords mozilla firefox tls regression-testing testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TLS Canary

## Status : Archived

This project is no longer maintained and has been archived. No further work will
be done on it including security fixes. Feel free to fork the project if you'd
like to extend it.

## Description
TLS Canary was a [TLS/SSL](https://en.wikipedia.org/wiki/Transport_Layer_Security) testing framework for the
[Mozilla Firefox](https://www.mozilla.org/firefox) web browser. It was used by developers to run regression and
performance tests against a large number of HTTPS-enabled hosts on the Internet.

[![License](https://img.shields.io/badge/license-MPL2-blue.svg)](https://raw.githubusercontent.com/mozilla/tls-canary/master/LICENSE.txt)
[![PyPI Package version](https://badge.fury.io/py/tlscanary.svg)](https://pypi.python.org/pypi/tlscanary)

## This project

 
* Downloads a test build and a base build of Firefox for comparison.
* Automatically queries thousands of secure sites with those builds.
* Diffs the results and presents potential regressions in an report for further diagnosis.
* Does performance regression testing.
* Extracts SSL state information.
* Can also use local Firefox build trees or package files for testing.
* Can maintain an updated list of HTTPS-enabled top sites.
* Requires a highly reliable network link. **WiFi will give unstable results.**

## Requirements
* Python 3.6+
* 7zip
* Go 1.7 or later
* Rust 1.39 or later
* OpenSSL-dev
* libffi-dev

### Dependencies for Debian and Ubuntu users
Assuming that you run TLS Canary on a regular graphical desktop machine, these are the packages it requires:
```
sudo apt-get install python3 python3-dev gcc golang-1.9-go p7zip-full libssl-dev libffi-dev libx11-xcb-dev
```

In addition, you'll need to install the Rust Cargo toolchain:
```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

The script [linux_bootstrap.sh](bootstrap/linux_bootstrap.sh) provides bootstrapping for a headless Ubuntu-based EC2
instance which requires installation of a few standard GUI libraries for running Firefox.
The script may or may not work for your other favourite Debian-based distribution.

### Dependencies for Mac users
Assuming that your're using [Homebrew](https://brew.sh/) for package management, this should set you up:
```
brew install openssl libffi python p7zip go
```

The script [osx_bootstrap.sh](bootstrap/osx_bootstrap.sh) provides bootstrapping for Travis CI's Mac OS X instances
using homebrew for package management. It may work for your OS X desktop environment as well.

### Dependencies for Windows users
Windows support targets **PowerShell 5.1** on **Windows 10**. Windows 7 and 8 are generally able to run TLS Canary,
but expect minor unicode encoding issues in terminal logging output.

First, [install Chocolatey](https://chocolatey.org/install), then run the following command in an admin PowerShell
to install the dependencies:
```
choco install 7zip.commandline git golang openssh python3
```

## For end users
TLS Canary can be installed as a stable package from PyPI and as experimental package directly from GitHub.
The following command will install the latest stable release of TLS Canary to your current Python environment:
```
pip3 install [--user] --upgrade tlscanary
```

Whether or not you require the `--user` flag depends on how your Python environment is set up. Most Linux distributions
require it when not installing Python packages as root.

Once it finishes the `tlscanary` binary is available in your Python environment:
```
tlscanary --help
tlscanary regression --help
tlscanary log --help
```

## Usage examples
```bash
# Run a quick regression test against the first 50000 hosts in the default `top` database
tlscanary regression -l 50000

# Compile a fresh 'top 1000' host database called `mini`
tlscanary srcupdate -s mini -l 1000 -x1

# Show a list of available host databases
tlscanary srcupdate -s list

# Use your fresh `mini` database for a quick regession test and see lots of things happening
tlscanary --debug regression -s mini
```

Please refer to the complete argument and mode references below.

### Run log and reporting
TLS Canary collects all run log data in `~/.tlscanary/log`. The format is somewhat JSONny, but heavily compressed
to save disk space. Canary logs can get very big very fast when a run returns many results.

Here are some usage examples how to interact with TLS Canary's run log database:
```bash
# List all logs in database, including incomplete ones marked with (*)
tlscanary log

# List and then delete incomplete logs
tlscanary log -i incomplete
tlscanary log -i incomplete -a delete  # just a dry-run
tlscanary log -i incomplete -a delete --really

# Print complete regression logs as JSON array to terminal
tlscanary log -i regression -e incomplete -a json

# Print JSON report of the last two runs to terminal
tlscanary log -i 2 -a json

# Create an HTML report in /tmp/report for completed regression runs
tlscanary log -i regression -e incomplete -a htmlreport -o /tmp/report
```

### Canary run modes
Run modes are specified via the mandatory positional `mode` parameter. See `tlscanary <mode> --help` for mode-specific
arguments.

Mode | Description
-----|-----
log | Performs various actions on run logs collected by performance, regression, and scan runs. See `tlscanary log --help`.
performance | Runs a performance analysis against the hosts in the test set. Use `--scans` to specify how often each host is tested.
regression | Runs a TLS regression test, comparing the 'test' candidate against the 'baseline' candidate. Only reports errors that are new to the test candidate. No error generated by baseline can make it to the report.
scan | This mode only collects connection state information for every host in the test set.
srcupdate | Compile a fresh set of TLS-enabled 'top' sites from the *Umbrella Top 1M* list. Use `-l` to override the default target size of 500k hosts. Use `-x` to adjust the number of passes for errors. Use `-x1` for a factor two speed improvement with slightly less stable results. Use `-b` to change the Firefox version used for filtering. You can use `-s` to create a new database, but you can't make it the default. Databases are written to `~/.tlscanary/sources/`.

### Command line arguments for test runs
The run modes `performance`, `regression`, and `scan` share a common set command line arguments:

Argument | Choices / **default** | Description
----------|----------|----------
-b --base | **release**, nightly, beta, aurora, esr, *build tree*, *package file* | Baseline test candidate to test against. Only used by comparative test modes.
-c --cache | false | Enable content caching in profiles
-d --debug | | Enable verbose debug logging to the terminal
-f --filter | 0, **1** | The default filter level 1 removes network timeouts from reports which may appear spuriously. Filter level 0 applies no filtering.
-h --help | | Longer usage information
-j --parallel | 4 | Number of parallel firefox worker instances the host set will be distributed among
-l --limit | 100000 | The number of hosts in the test set is limited to the given number. Default is 100000 hosts. You can increase the limit, but such runs will require LOTS of memory (90 GBytes and more) and can cause instability.
-m --timeout | 10 | Request timeout in seconds. Running more requests in parallel increases network latency and results in more timeouts.
-n --requestsperworker | 50 | Chunk size of hosts that a worker will query in parallel.
-o --onecrl | **production**, stage, custom | OneCRL revocation list to install to the test profiles. `custom` uses a pre-configured, static list.
-s --source | **top**, list, ... | Set of hosts to run the test against. Pass `list` to get info on available test sets.
-t --test | release, **nightly**, beta, aurora, esr, *build tree*, *package file* | Specify the main test candidate. Used by every run mode.
-u --max_timeout | 20 | Maximum request timeout in seconds. Each scan increases the timeout, up to this value
-w --workdir | **~/.tlscanary** | Directory where cached files and other state is stored
-x --scans | 3 | Number of scans to run against each host during performance or regression mode.
MODE | performance, regression, scan, srcupdate | Test mode to run, given as positional parameter. This is a mandatory argument.

## For developers
For development you will additionally need to install:

* git
* virtualenv (highly recommended)

*git* can be installed with your favourite package manager. *virtualenv* comes with a simple
`pip install [--user] virtualenv`.

### Developing on Linux or Mac
These are the commands that set you up for TLS Canary development work:
```
git clone https://github.com/mozilla/tls-canary
cd tls-canary
virtualenv -p python3 venv
source venv/bin/activate
pip install -e .[dev]
```

The latter command should be used regularly to install new Python dependencies that a TLS Canary update might require.

### Developing on Windows
Developing TLS Canary on Windows is not something we practice regularly. If you encounter quirks along the way,
please do not hesitate to open an issue here on GitHub. The following commands, executed in a PowerShell session
with user privileges, should set you up for TLS Canary development:
```
git clone https://github.com/mozilla/tls-canary
cd tls-canary
virtualenv -p c:\python36\python.exe venv
venv\Scripts\activate
pip install -e .[dev]
```

### Building and running tls-canary

```
python setup.py build
python setup.py install
```

### Running tests
There are two ways to run the test suite:
```
python setup.py test
nosetests -v
```

They are largely equivalent, but the former takes care of missing test dependencies, while running `nosetests`
directly offers more control. To get test coverage, for example, use

```
nosetests -v --with-coverage --cover-erase --cover-package=tlscanary
```

### Installing the pre-commit hook for git
There's a pre-commit hook for git that you can use for automated [PEP 8](https://www.python.org/dev/peps/pep-0008/)
violations checking. You can install it by running
```
ln -sf ../../hooks/pre-commit .git/hooks/
```
in the top-level project directory. By using a symbolic link, you will automatically get updates once the hook
in the repo changes. This is highly recommended. You can also copy the script manually, but then you have to
take care of updates yourself.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mozilla/tls-canary",
    "name": "tlscanary",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "mozilla,firefox,tls,regression-testing,testing",
    "author": "Christiane Ruetten",
    "author_email": "cr@mozilla.com",
    "download_url": "https://files.pythonhosted.org/packages/d3/bc/ee6c09d45a8eb74ead55e4e8b00dd36142dea4b35c052f76eb58a7fd9fdf/tlscanary-4.0.2.tar.gz",
    "platform": null,
    "description": "# TLS Canary\n\n## Status : Archived\n\nThis project is no longer maintained and has been archived. No further work will\nbe done on it including security fixes. Feel free to fork the project if you'd\nlike to extend it.\n\n## Description\nTLS Canary was a [TLS/SSL](https://en.wikipedia.org/wiki/Transport_Layer_Security) testing framework for the\n[Mozilla Firefox](https://www.mozilla.org/firefox) web browser. It was used by developers to run regression and\nperformance tests against a large number of HTTPS-enabled hosts on the Internet.\n\n[![License](https://img.shields.io/badge/license-MPL2-blue.svg)](https://raw.githubusercontent.com/mozilla/tls-canary/master/LICENSE.txt)\n[![PyPI Package version](https://badge.fury.io/py/tlscanary.svg)](https://pypi.python.org/pypi/tlscanary)\n\n## This project\n\n \n* Downloads a test build and a base build of Firefox for comparison.\n* Automatically queries thousands of secure sites with those builds.\n* Diffs the results and presents potential regressions in an report for further diagnosis.\n* Does performance regression testing.\n* Extracts SSL state information.\n* Can also use local Firefox build trees or package files for testing.\n* Can maintain an updated list of HTTPS-enabled top sites.\n* Requires a highly reliable network link. **WiFi will give unstable results.**\n\n## Requirements\n* Python 3.6+\n* 7zip\n* Go 1.7 or later\n* Rust 1.39 or later\n* OpenSSL-dev\n* libffi-dev\n\n### Dependencies for Debian and Ubuntu users\nAssuming that you run TLS Canary on a regular graphical desktop machine, these are the packages it requires:\n```\nsudo apt-get install python3 python3-dev gcc golang-1.9-go p7zip-full libssl-dev libffi-dev libx11-xcb-dev\n```\n\nIn addition, you'll need to install the Rust Cargo toolchain:\n```\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\nThe script [linux_bootstrap.sh](bootstrap/linux_bootstrap.sh) provides bootstrapping for a headless Ubuntu-based EC2\ninstance which requires installation of a few standard GUI libraries for running Firefox.\nThe script may or may not work for your other favourite Debian-based distribution.\n\n### Dependencies for Mac users\nAssuming that your're using [Homebrew](https://brew.sh/) for package management, this should set you up:\n```\nbrew install openssl libffi python p7zip go\n```\n\nThe script [osx_bootstrap.sh](bootstrap/osx_bootstrap.sh) provides bootstrapping for Travis CI's Mac OS X instances\nusing homebrew for package management. It may work for your OS X desktop environment as well.\n\n### Dependencies for Windows users\nWindows support targets **PowerShell 5.1** on **Windows 10**. Windows 7 and 8 are generally able to run TLS Canary,\nbut expect minor unicode encoding issues in terminal logging output.\n\nFirst, [install Chocolatey](https://chocolatey.org/install), then run the following command in an admin PowerShell\nto install the dependencies:\n```\nchoco install 7zip.commandline git golang openssh python3\n```\n\n## For end users\nTLS Canary can be installed as a stable package from PyPI and as experimental package directly from GitHub.\nThe following command will install the latest stable release of TLS Canary to your current Python environment:\n```\npip3 install [--user] --upgrade tlscanary\n```\n\nWhether or not you require the `--user` flag depends on how your Python environment is set up. Most Linux distributions\nrequire it when not installing Python packages as root.\n\nOnce it finishes the `tlscanary` binary is available in your Python environment:\n```\ntlscanary --help\ntlscanary regression --help\ntlscanary log --help\n```\n\n## Usage examples\n```bash\n# Run a quick regression test against the first 50000 hosts in the default `top` database\ntlscanary regression -l 50000\n\n# Compile a fresh 'top 1000' host database called `mini`\ntlscanary srcupdate -s mini -l 1000 -x1\n\n# Show a list of available host databases\ntlscanary srcupdate -s list\n\n# Use your fresh `mini` database for a quick regession test and see lots of things happening\ntlscanary --debug regression -s mini\n```\n\nPlease refer to the complete argument and mode references below.\n\n### Run log and reporting\nTLS Canary collects all run log data in `~/.tlscanary/log`. The format is somewhat JSONny, but heavily compressed\nto save disk space. Canary logs can get very big very fast when a run returns many results.\n\nHere are some usage examples how to interact with TLS Canary's run log database:\n```bash\n# List all logs in database, including incomplete ones marked with (*)\ntlscanary log\n\n# List and then delete incomplete logs\ntlscanary log -i incomplete\ntlscanary log -i incomplete -a delete  # just a dry-run\ntlscanary log -i incomplete -a delete --really\n\n# Print complete regression logs as JSON array to terminal\ntlscanary log -i regression -e incomplete -a json\n\n# Print JSON report of the last two runs to terminal\ntlscanary log -i 2 -a json\n\n# Create an HTML report in /tmp/report for completed regression runs\ntlscanary log -i regression -e incomplete -a htmlreport -o /tmp/report\n```\n\n### Canary run modes\nRun modes are specified via the mandatory positional `mode` parameter. See `tlscanary <mode> --help` for mode-specific\narguments.\n\nMode | Description\n-----|-----\nlog | Performs various actions on run logs collected by performance, regression, and scan runs. See `tlscanary log --help`.\nperformance | Runs a performance analysis against the hosts in the test set. Use `--scans` to specify how often each host is tested.\nregression | Runs a TLS regression test, comparing the 'test' candidate against the 'baseline' candidate. Only reports errors that are new to the test candidate. No error generated by baseline can make it to the report.\nscan | This mode only collects connection state information for every host in the test set.\nsrcupdate | Compile a fresh set of TLS-enabled 'top' sites from the *Umbrella Top 1M* list. Use `-l` to override the default target size of 500k hosts. Use `-x` to adjust the number of passes for errors. Use `-x1` for a factor two speed improvement with slightly less stable results. Use `-b` to change the Firefox version used for filtering. You can use `-s` to create a new database, but you can't make it the default. Databases are written to `~/.tlscanary/sources/`.\n\n### Command line arguments for test runs\nThe run modes `performance`, `regression`, and `scan` share a common set command line arguments:\n\nArgument | Choices / **default** | Description\n----------|----------|----------\n-b --base | **release**, nightly, beta, aurora, esr, *build tree*, *package file* | Baseline test candidate to test against. Only used by comparative test modes.\n-c --cache | false | Enable content caching in profiles\n-d --debug | | Enable verbose debug logging to the terminal\n-f --filter | 0, **1** | The default filter level 1 removes network timeouts from reports which may appear spuriously. Filter level 0 applies no filtering.\n-h --help | | Longer usage information\n-j --parallel | 4 | Number of parallel firefox worker instances the host set will be distributed among\n-l --limit | 100000 | The number of hosts in the test set is limited to the given number. Default is 100000 hosts. You can increase the limit, but such runs will require LOTS of memory (90 GBytes and more) and can cause instability.\n-m --timeout | 10 | Request timeout in seconds. Running more requests in parallel increases network latency and results in more timeouts.\n-n --requestsperworker | 50 | Chunk size of hosts that a worker will query in parallel.\n-o --onecrl | **production**, stage, custom | OneCRL revocation list to install to the test profiles. `custom` uses a pre-configured, static list.\n-s --source | **top**, list, ... | Set of hosts to run the test against. Pass `list` to get info on available test sets.\n-t --test | release, **nightly**, beta, aurora, esr, *build tree*, *package file* | Specify the main test candidate. Used by every run mode.\n-u --max_timeout | 20 | Maximum request timeout in seconds. Each scan increases the timeout, up to this value\n-w --workdir | **~/.tlscanary** | Directory where cached files and other state is stored\n-x --scans | 3 | Number of scans to run against each host during performance or regression mode.\nMODE | performance, regression, scan, srcupdate | Test mode to run, given as positional parameter. This is a mandatory argument.\n\n## For developers\nFor development you will additionally need to install:\n\n* git\n* virtualenv (highly recommended)\n\n*git* can be installed with your favourite package manager. *virtualenv* comes with a simple\n`pip install [--user] virtualenv`.\n\n### Developing on Linux or Mac\nThese are the commands that set you up for TLS Canary development work:\n```\ngit clone https://github.com/mozilla/tls-canary\ncd tls-canary\nvirtualenv -p python3 venv\nsource venv/bin/activate\npip install -e .[dev]\n```\n\nThe latter command should be used regularly to install new Python dependencies that a TLS Canary update might require.\n\n### Developing on Windows\nDeveloping TLS Canary on Windows is not something we practice regularly. If you encounter quirks along the way,\nplease do not hesitate to open an issue here on GitHub. The following commands, executed in a PowerShell session\nwith user privileges, should set you up for TLS Canary development:\n```\ngit clone https://github.com/mozilla/tls-canary\ncd tls-canary\nvirtualenv -p c:\\python36\\python.exe venv\nvenv\\Scripts\\activate\npip install -e .[dev]\n```\n\n### Building and running tls-canary\n\n```\npython setup.py build\npython setup.py install\n```\n\n### Running tests\nThere are two ways to run the test suite:\n```\npython setup.py test\nnosetests -v\n```\n\nThey are largely equivalent, but the former takes care of missing test dependencies, while running `nosetests`\ndirectly offers more control. To get test coverage, for example, use\n\n```\nnosetests -v --with-coverage --cover-erase --cover-package=tlscanary\n```\n\n### Installing the pre-commit hook for git\nThere's a pre-commit hook for git that you can use for automated [PEP 8](https://www.python.org/dev/peps/pep-0008/)\nviolations checking. You can install it by running\n```\nln -sf ../../hooks/pre-commit .git/hooks/\n```\nin the top-level project directory. By using a symbolic link, you will automatically get updates once the hook\nin the repo changes. This is highly recommended. You can also copy the script manually, but then you have to\ntake care of updates yourself.\n",
    "bugtrack_url": null,
    "license": "MPL2",
    "summary": "TLS/SSL Test Suite for Mozilla Firefox",
    "version": "4.0.2",
    "split_keywords": [
        "mozilla",
        "firefox",
        "tls",
        "regression-testing",
        "testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "96d18a4f112d858b2244a1d035929dfa",
                "sha256": "14c3d58fd6d39179748d5a66b472674416d38340a862150833db1a33e78fe283"
            },
            "downloads": -1,
            "filename": "tlscanary-4.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "96d18a4f112d858b2244a1d035929dfa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 6452610,
            "upload_time": "2022-12-16T22:22:25",
            "upload_time_iso_8601": "2022-12-16T22:22:25.845710Z",
            "url": "https://files.pythonhosted.org/packages/92/6d/763f46bf6d236c78d3e005399cd4ffe387cfc8251234d3647478763afa26/tlscanary-4.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "4274814315f83624f8b632d45666714f",
                "sha256": "8f58f965f7e9eebcd65ffaf95022bfe91cc8cb48b1094d25cbcbe40bfe8d2298"
            },
            "downloads": -1,
            "filename": "tlscanary-4.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4274814315f83624f8b632d45666714f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6431663,
            "upload_time": "2022-12-16T22:22:27",
            "upload_time_iso_8601": "2022-12-16T22:22:27.838936Z",
            "url": "https://files.pythonhosted.org/packages/d3/bc/ee6c09d45a8eb74ead55e4e8b00dd36142dea4b35c052f76eb58a7fd9fdf/tlscanary-4.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-16 22:22:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "mozilla",
    "github_project": "tls-canary",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tlscanary"
}
        
Elapsed time: 0.02031s