Unverified Commit 402c7ee4 authored by Oleh's avatar Oleh

add doc and script to check certificates

parent 6e018429
# How to check when the certificates stored on sgxwallet were created
- Go to sgxwallet repository directory.
- Run `python3 scripts/grep_certificates.py PATH_TO_SGXWALLET_DB_FOLDER`. PATH_TO_SGXWALLET_DB_FOLDER - full path to the `sgx_data` directory where sgxwallet db is stored. For example, `root/sgxwallet/run_sgx/sgx_data`
- The script will output the dates when every certificate was created.
- Go to skale-node and run `cat .skale/node_data/sgx_certs/sgx.crt | grep "Not Before"`.
- Ensure that the output of the last command exists in the list from step 3 and it is the latest certificate there!
\ No newline at end of file
import os
import re
import sys
def main():
if len(sys.argv) != 2:
print("Wrong number of command line arguments: need exactly one")
exit(1)
path = sys.argv[1]
if not os.path.exists(path):
print("No such file or directory: ", path)
exit(2)
certs_path = os.path.join(path, "cert_data", "new_certs")
if len(os.listdir(certs_path)) == 0:
print("Empty certificates directory. Nothing to review.")
return
for entity in os.listdir(certs_path):
entity_path = os.path.join(certs_path, entity)
if not os.path.isfile(entity_path):
print("Not a regular file. Skipping.")
continue
_, extension = os.path.splitext(entity_path)
if extension != '.pem':
print("Not a ssl certificate file. Skipping.")
continue
with open(entity_path,"r") as file_one:
pattern = "Not Before"
for line in file_one:
if re.search(pattern, line):
print(line)
if __name__ == '__main__':
main()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment