瀏覽代碼

Print VTN fingerprint on server startup

Stan Janssen 4 年之前
父節點
當前提交
0cd077cb7f
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      openleadr/server.py

+ 7 - 0
openleadr/server.py

@@ -17,6 +17,7 @@
 from aiohttp import web
 from openleadr.service import EventService, PollService, RegistrationService, ReportService, OptService, VTNService
 from openleadr.messaging import create_message, parse_message
+from openleadr.utils import certificate_fingerprint
 from functools import partial
 
 class OpenADRServer:
@@ -60,6 +61,12 @@ class OpenADRServer:
                 cert = file.read()
             with open(key, "rb") as file:
                 key = file.read()
+            print("*" * 80)
+            print("Your VTN Certificate Fingerprint is", certificate_fingerprint(cert))
+            print("Please deliver this fingerprint to the VTN you are connecting to.")
+            print("You do not need to keep this a secret.")
+            print("*" * 80)
+
         VTNService._create_message = partial(create_message, cert=cert, key=key, passphrase=passphrase)
         VTNService._parse_message = partial(parse_message, fingerprint_lookup=fingerprint_lookup)