blob: 595dd20481d6c7de4ca4544eeddd009f9f1c525b [file] [log] [blame]
Rajesh43076e52017-02-23 05:12:08 -05001# RIFT_IO_STANDARD_CMAKE_COPYRIGHT_HEADER(BEGIN)
2# Creation Date: 2/5/16
3# RIFT_IO_STANDARD_CMAKE_COPYRIGHT_HEADER(END)
4
5import os
6
7class BootstrapSslMissingException(Exception):
8 pass
9
10# True if the environment variable is unset, otherwise False
11USE_SSL = os.environ.get("RIFT_BOOT_WITHOUT_HTTPS", None) is None
12
13def get_bootstrap_cert_and_key():
14 '''
15 Lookup the bootstrap certificate and key and return their paths
16 '''
17
18 user_cert = os.path.join("/", "etc", "ssl", "current.cert")
19 user_key = os.path.join("/", "etc", "ssl", "current.key")
20
21 if os.path.isfile(user_cert) and os.path.isfile(user_key):
22 return USE_SSL, user_cert, user_key
23
24 rift_install = os.environ["RIFT_INSTALL"]
25 rift_cert = os.path.join(rift_install, "etc", "ssl", "current.cert")
26 rift_key = os.path.join(rift_install, "etc", "ssl", "current.key")
27
28 if os.path.isfile(rift_cert) and os.path.isfile(rift_key):
29 return USE_SSL, rift_cert, rift_key
30
31 raise BootstrapSslMissingException()
32