2020-03-17 20:21:35 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# Test script for OpenSSL version checking
|
|
|
|
|
from distutils.version import LooseVersion
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(openssl_version, apache_version):
|
2020-03-20 18:13:47 -04:00
|
|
|
if not openssl_version.strip():
|
|
|
|
|
raise Exception("No OpenSSL version found.")
|
|
|
|
|
if not apache_version.strip():
|
|
|
|
|
raise Exception("No Apache version found.")
|
2020-03-17 20:21:35 -04:00
|
|
|
conf_file_location = "/etc/letsencrypt/options-ssl-apache.conf"
|
|
|
|
|
with open(conf_file_location) as f:
|
|
|
|
|
contents = f.read()
|
2020-03-19 22:03:36 -04:00
|
|
|
if LooseVersion(apache_version.strip()) < LooseVersion('2.4.11') or \
|
2020-03-19 21:35:37 -04:00
|
|
|
LooseVersion(openssl_version.strip()) < LooseVersion('1.0.2l'):
|
2020-03-17 20:21:35 -04:00
|
|
|
# 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 enabled.")
|
|
|
|
|
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 enabled.")
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
main(*sys.argv[1:])
|