2020-03-23 19:49:52 -04:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
# Test script for OpenSSL version checking
|
|
|
|
|
import sys
|
|
|
|
|
|
2021-11-08 18:55:32 -05:00
|
|
|
from certbot import util
|
|
|
|
|
|
2020-03-23 19:49:52 -04:00
|
|
|
|
|
|
|
|
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()
|
2021-11-08 18:55:32 -05:00
|
|
|
if util.parse_loose_version(apache_version.strip()) < util.parse_loose_version('2.4.11') or \
|
|
|
|
|
util.parse_loose_version(openssl_version.strip()) < util.parse_loose_version('1.0.2l'):
|
2020-03-23 19:49:52 -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 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:])
|