Commit 6494727b authored by Joanne Hugé's avatar Joanne Hugé

simpleran: fix amarisoft-rf-info.jinja2.py

parent 70bed816
...@@ -28,15 +28,15 @@ md5sum = 8d6eb90fc1191c3a1b24200df2ebf4fa ...@@ -28,15 +28,15 @@ md5sum = 8d6eb90fc1191c3a1b24200df2ebf4fa
[ru_amarisoft-stats.jinja2.py] [ru_amarisoft-stats.jinja2.py]
_update_hash_filename_ = ru/amarisoft-stats.jinja2.py _update_hash_filename_ = ru/amarisoft-stats.jinja2.py
md5sum = 31b609f80a82b6efed963161c8907878 md5sum = 9075f5d5d6d453d02b4f284b7edabe41
[ru_amarisoft-rf-info.jinja2.py] [ru_amarisoft-rf-info.jinja2.py]
_update_hash_filename_ = ru/amarisoft-rf-info.jinja2.py _update_hash_filename_ = ru/amarisoft-rf-info.jinja2.py
md5sum = 93a5e07a763b619747255b4e03b50bbe md5sum = 0a3a1ecde45a898502f1c66cb26b7d91
[ru_libinstance.jinja2.cfg] [ru_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/libinstance.jinja2.cfg _update_hash_filename_ = ru/libinstance.jinja2.cfg
md5sum = f0d7d38ef486f5be44020c3d5ce2a94f md5sum = e436824a4325636fcd479b9711a94044
[ru_sdr_libinstance.jinja2.cfg] [ru_sdr_libinstance.jinja2.cfg]
_update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg _update_hash_filename_ = ru/sdr/libinstance.jinja2.cfg
......
#!{{ python_path }} #!{{ python_path }}
import json import json
import hashlib
import hmac
import logging import logging
from logging.handlers import RotatingFileHandler from logging.handlers import RotatingFileHandler
import time import time
...@@ -21,7 +23,20 @@ class enbWebSocket: ...@@ -21,7 +23,20 @@ class enbWebSocket:
if {{ testing }}: if {{ testing }}:
return return
self.ws = create_connection("{{ ws_url }}") self.ws_url = "{{ ws_url }}"
self.ws_password = "{{ ws_password }}"
self.ws = create_connection(self.ws_url)
# Password authentication
data = json.loads(self.ws.recv())
res = hmac.new(
"{}:{}:{}".format(data['type'], self.ws_password, data['name']).encode(),
msg=data['challenge'].encode(),
digestmod=hashlib.sha256
).hexdigest()
msg = {"message": "authenticate", "res": res}
self.ws.send(json.dumps(msg))
self.ws.recv()
def close(self): def close(self):
if {{ testing }}: if {{ testing }}:
......
...@@ -27,6 +27,7 @@ class enbWebSocket: ...@@ -27,6 +27,7 @@ class enbWebSocket:
self.ws_password = "{{ ws_password }}" self.ws_password = "{{ ws_password }}"
self.ws = create_connection(self.ws_url) self.ws = create_connection(self.ws_url)
# Password authentication
data = json.loads(self.ws.recv()) data = json.loads(self.ws.recv())
res = hmac.new( res = hmac.new(
"{}:{}:{}".format(data['type'], self.ws_password, data['name']).encode(), "{}:{}:{}".format(data['type'], self.ws_password, data['name']).encode(),
......
...@@ -328,6 +328,7 @@ context = ...@@ -328,6 +328,7 @@ context =
key log_file :log-output key log_file :log-output
raw stats_period {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }} raw stats_period {{ slapparameter_dict.get("enb_stats_fetch_period", 60) }}
raw testing {{ testing }} raw testing {{ testing }}
raw ws_password ${websocket-password:passwd}
raw ws_url ws://{{ slapparameter_dict.com_addr }}:{{ slapparameter_dict.com_ws_port }} raw ws_url ws://{{ slapparameter_dict.com_addr }}:{{ slapparameter_dict.com_ws_port }}
raw python_path {{ buildout_directory}}/bin/pythonwitheggs raw python_path {{ buildout_directory}}/bin/pythonwitheggs
mode = 0775 mode = 0775
......
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