1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-27 19:42:53 +03:00
Files
certbot/letstest/scripts/test_openssl_version.py
Brad Warren dd0e590de3 Make a test farm tests package (#8821)
Fixes https://github.com/certbot/certbot/issues/8781.

This PR makes our test farm tests into a normal package so it and its dependencies can be tracked and installed like our other packages.

Other noteworthy changes in this PR:

* Rather than continuing to place logs in your CWD, they're placed in a temporary directory that is printed to the terminal.
*  `tests/letstest/auto_targets.yaml` was deleted rather than renamed because the file is no longer used.

* make a letstest package

* remove deleted deps

* fix letstest install

* add __init__.py

* call main

* Explicitly mention activating venv

* rerename file

* fix version.py path

* clarify "this"

* Use >= instead of caret requirement
2021-05-03 17:42:30 -07:00

31 lines
1.2 KiB
Python

#!/usr/bin/env python
# Test script for OpenSSL version checking
from distutils.version import LooseVersion
import sys
def main(openssl_version, apache_version):
if not openssl_version.strip():
raise Exception("No OpenSSL version found.")
if not apache_version.strip():
raise Exception("No Apache version found.")
conf_file_location = "/etc/letsencrypt/options-ssl-apache.conf"
with open(conf_file_location) as f:
contents = f.read()
if LooseVersion(apache_version.strip()) < LooseVersion('2.4.11') or \
LooseVersion(openssl_version.strip()) < LooseVersion('1.0.2l'):
# should be old version
# assert SSLSessionTickets not in conf file
if "SSLSessionTickets" in contents:
raise Exception("Apache or OpenSSL version is too old, "
"but SSLSessionTickets is set.")
else:
# should be current version
# assert SSLSessionTickets in conf file
if "SSLSessionTickets" not in contents:
raise Exception("Apache and OpenSSL versions are sufficiently new, "
"but SSLSessionTickets is not set.")
if __name__ == '__main__':
main(*sys.argv[1:])